| 288 | 288 | originalModels = data; // Store the original data for search |
| 289 | 289 | featherlessModels = data; |
| 290 | 290 | |
| 291 | + if (!data.find(x => x.id === textgen_settings.featherless_model)) { |
| 292 | + textgen_settings.featherless_model = data[0]?.id || ''; |
| 293 | + } |
| 294 | + |
| 291 | 295 | // Populate class select options with unique classes |
| 292 | 296 | populateClassSelection(data); |
| 293 | 297 | |
| 294 | 298 | // Retrieve the stored number of items per page or default to 510 |
| 295 | 299 | const perPage = Number(localStorage.getItem(storageKey)) || 10; |
| 296 | 300 | |
| 297 | 301 | // Initialize pagination with the full set of models |
| 298 | 302 | const selectedModelPagecurrentModelIndex = (data.findIndex(x => x.id === textgen_settings.featherless_model) / perPage) + 1; |
| 299 | 303 | featherlessCurrentPage = selectedModelPagecurrentModelIndex >= 0 ? selectedModelPage(currentModelIndex / perPage) + 1 : 1; |
| 300 | 304 | setupPagination(originalModels, perPage); |
| 301 | 305 | |
| 302 | 306 | // Function to set up pagination (also used for filtered results) |