Featherless: Fix model pagination init
This commit is contained in:
parent
9c379125be
commit
f61c2403d6
|
@ -288,15 +288,19 @@ export async function loadFeatherlessModels(data) {
|
||||||
originalModels = data; // Store the original data for search
|
originalModels = data; // Store the original data for search
|
||||||
featherlessModels = data;
|
featherlessModels = data;
|
||||||
|
|
||||||
|
if (!data.find(x => x.id === textgen_settings.featherless_model)) {
|
||||||
|
textgen_settings.featherless_model = data[0]?.id || '';
|
||||||
|
}
|
||||||
|
|
||||||
// Populate class select options with unique classes
|
// Populate class select options with unique classes
|
||||||
populateClassSelection(data);
|
populateClassSelection(data);
|
||||||
|
|
||||||
// Retrieve the stored number of items per page or default to 5
|
// Retrieve the stored number of items per page or default to 10
|
||||||
const perPage = Number(localStorage.getItem(storageKey)) || 10;
|
const perPage = Number(localStorage.getItem(storageKey)) || 10;
|
||||||
|
|
||||||
// Initialize pagination with the full set of models
|
// Initialize pagination with the full set of models
|
||||||
const selectedModelPage = (data.findIndex(x => x.id === textgen_settings.featherless_model) / perPage) + 1;
|
const currentModelIndex = data.findIndex(x => x.id === textgen_settings.featherless_model);
|
||||||
featherlessCurrentPage = selectedModelPage > 0 ? selectedModelPage : 1;
|
featherlessCurrentPage = currentModelIndex >= 0 ? (currentModelIndex / perPage) + 1 : 1;
|
||||||
setupPagination(originalModels, perPage);
|
setupPagination(originalModels, perPage);
|
||||||
|
|
||||||
// Function to set up pagination (also used for filtered results)
|
// Function to set up pagination (also used for filtered results)
|
||||||
|
|
Loading…
Reference in New Issue