added new filter and css fix
| @@ -34,6 +34,7 @@ | |||
| 34 | "rate-limiter-flexible": "^5.0.0", | 34 | "rate-limiter-flexible": "^5.0.0", |
| 35 | "response-time": "^2.3.2", | 35 | "response-time": "^2.3.2", |
| 36 | "sanitize-filename": "^1.6.3", | 36 | "sanitize-filename": "^1.6.3", |
| 37 | "sillytavern": "file:", | ||
| 37 | "sillytavern-transformers": "2.14.6", | 38 | "sillytavern-transformers": "2.14.6", |
| 38 | "simple-git": "^3.19.1", | 39 | "simple-git": "^3.19.1", |
| 39 | "tiktoken": "^1.0.16", | 40 | "tiktoken": "^1.0.16", |
| @@ -412,13 +412,18 @@ export async function loadFeatherlessModels(data) { | |||
| 412 | const selectedSortOrder = sortOrderSelect.value; | 412 | const selectedSortOrder = sortOrderSelect.value; |
| 413 | const selectedClass = classSelect.value; | 413 | const selectedClass = classSelect.value; |
| 414 | const selectedCategory = categoriesSelect.value; | 414 | const selectedCategory = categoriesSelect.value; |
| 415 | |||
| 415 | const featherlessTop = await fetchFeatherlessStats(); | 416 | const featherlessTop = await fetchFeatherlessStats(); |
| 416 | const featherlessIds = featherlessTop.map(stat => stat.id); | 417 | const featherlessIds = featherlessTop.map(stat => stat.id); |
| 417 | // Filter the models based on the search query and selected class | 418 | |
| 419 | const featherlessNew = await fetchFeatherlessNew(); | ||
| 420 | const featherlessNewIds = featherlessNew.map(stat => stat.id); | ||
| 421 | |||
| 418 | let filteredModels = originalModels.filter(model => { | 422 | let filteredModels = originalModels.filter(model => { |
| 419 | const matchesSearch = model.id.toLowerCase().includes(searchQuery); | 423 | const matchesSearch = model.id.toLowerCase().includes(searchQuery); |
| 420 | const matchesClass = selectedClass ? model.model_class === selectedClass : true; | 424 | const matchesClass = selectedClass ? model.model_class === selectedClass : true; |
| 421 | const matchesTop = featherlessIds.includes(model.id); | 425 | const matchesTop = featherlessIds.includes(model.id); |
| 426 | const matchesNew = featherlessNewIds.includes(model.id); | ||
| 422 | 427 | ||
| 423 | if (selectedCategory === 'All') { | 428 | if (selectedCategory === 'All') { |
| 424 | return matchesSearch && matchesClass; | 429 | return matchesSearch && matchesClass; |
| @@ -426,8 +431,12 @@ export async function loadFeatherlessModels(data) { | |||
| 426 | else if (selectedCategory === 'Top') { | 431 | else if (selectedCategory === 'Top') { |
| 427 | return matchesSearch && matchesClass && matchesTop; | 432 | return matchesSearch && matchesClass && matchesTop; |
| 428 | } | 433 | } |
| 429 | 434 | else if (selectedCategory === 'New') { | |
| 430 | return matchesSearch && matchesClass; | 435 | return matchesSearch && matchesClass && matchesNew; |
| 436 | } | ||
| 437 | else { | ||
| 438 | return null; | ||
| 439 | } | ||
| 431 | }); | 440 | }); |
| 432 | 441 | ||
| 433 | // Sort the filtered models based on selected sort order (A-Z or Z-A) | 442 | // Sort the filtered models based on selected sort order (A-Z or Z-A) |
| @@ -448,8 +457,14 @@ async function fetchFeatherlessStats() { | |||
| 448 | return data.popular; | 457 | return data.popular; |
| 449 | } | 458 | } |
| 450 | 459 | ||
| 460 | async function fetchFeatherlessNew() { | ||
| 461 | const response = await fetch('https://api.featherless.ai/feather/models?sort=-created_at&perPage=10'); | ||
| 462 | const data = await response.json(); | ||
| 463 | return data.items; | ||
| 464 | } | ||
| 465 | |||
| 451 | function onFeatherlessModelSelect(modelId) { | 466 | function onFeatherlessModelSelect(modelId) { |
| 452 | // Find the selected model and set the settings | 467 | |
| 453 | const model = featherlessModels.find(x => x.id === modelId); | 468 | const model = featherlessModels.find(x => x.id === modelId); |
| 454 | selectedModelId = modelId; | 469 | selectedModelId = modelId; |
| 455 | textgen_settings.featherless_model = modelId; | 470 | textgen_settings.featherless_model = modelId; |
| @@ -5564,12 +5564,14 @@ body:not(.movingUI) .drawer-content.maximized { | |||
| 5564 | #model_search_bar { | 5564 | #model_search_bar { |
| 5565 | flex-grow: 1; | 5565 | flex-grow: 1; |
| 5566 | min-width: 10ch; | 5566 | min-width: 10ch; |
| 5567 | align-self: center; | ||
| 5567 | } | 5568 | } |
| 5568 | 5569 | ||
| 5569 | /* Sort dropdown should be auto-sized based on its content */ | 5570 | /* Sort dropdown should be auto-sized based on its content */ |
| 5570 | #model_sort_order { | 5571 | #model_sort_order { |
| 5571 | width: auto; /* Set the width of the dropdown to its content size */ | 5572 | width: auto; |
| 5572 | flex-shrink: 0; /* Prevent it from shrinking */ | 5573 | flex-shrink: 0; |
| 5574 | align-self: center; | ||
| 5573 | } | 5575 | } |
| 5574 | 5576 | ||
| 5575 | /* Grid toggle button */ | 5577 | /* Grid toggle button */ |
| @@ -5579,13 +5581,30 @@ body:not(.movingUI) .drawer-content.maximized { | |||
| 5579 | cursor: pointer; | 5581 | cursor: pointer; |
| 5580 | } | 5582 | } |
| 5581 | 5583 | ||
| 5582 | #category_selection | 5584 | #category_selection, |
| 5583 | { | 5585 | #class_selection { |
| 5584 | display: flex; | 5586 | display: flex; |
| 5585 | width: auto; | 5587 | width: auto; |
| 5588 | align-self: center; | ||
| 5586 | } | 5589 | } |
| 5587 | #class_selection | 5590 | |
| 5588 | { | 5591 | /* Media query for mobile devices */ |
| 5589 | display: flex; | 5592 | @media (max-width: 768px) { |
| 5590 | width: auto; | 5593 | .model-card { |
| 5594 | flex-direction: column; /* Stack content vertically on small screens */ | ||
| 5595 | align-items: stretch; /* Stretch items to take full width */ | ||
| 5596 | } | ||
| 5597 | |||
| 5598 | .model-info, .model-details { | ||
| 5599 | width: 100%; /* Take full width */ | ||
| 5600 | text-align: left; /* Left-align text */ | ||
| 5601 | } | ||
| 5602 | |||
| 5603 | #model_search_bar { | ||
| 5604 | width: 100%; /* Take full width on small screens */ | ||
| 5605 | } | ||
| 5606 | |||
| 5607 | #model_sort_order, #model_grid_toggle { | ||
| 5608 | margin-top: 10px; /* Add some space above these elements */ | ||
| 5609 | } | ||
| 5591 | } | 5610 | } |