added new filter and css fix
| @@ -34,6 +34,7 @@ | ||
| 34 | 34 | "rate-limiter-flexible": "^5.0.0", |
| 35 | 35 | "response-time": "^2.3.2", |
| 36 | 36 | "sanitize-filename": "^1.6.3", |
| 37 | + "sillytavern": "file:", | |
| 37 | 38 | "sillytavern-transformers": "2.14.6", |
| 38 | 39 | "simple-git": "^3.19.1", |
| 39 | 40 | "tiktoken": "^1.0.16", |
| @@ -412,13 +412,18 @@ export async function loadFeatherlessModels(data) { | ||
| 412 | 412 | const selectedSortOrder = sortOrderSelect.value; |
| 413 | 413 | const selectedClass = classSelect.value; |
| 414 | 414 | const selectedCategory = categoriesSelect.value; |
| 415 | + | |
| 415 | 416 | const featherlessTop = await fetchFeatherlessStats(); |
| 416 | 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 | 422 | let filteredModels = originalModels.filter(model => { |
| 419 | 423 | const matchesSearch = model.id.toLowerCase().includes(searchQuery); |
| 420 | 424 | const matchesClass = selectedClass ? model.model_class === selectedClass : true; |
| 421 | 425 | const matchesTop = featherlessIds.includes(model.id); |
| 426 | + const matchesNew = featherlessNewIds.includes(model.id); | |
| 422 | 427 | |
| 423 | 428 | if (selectedCategory === 'All') { |
| 424 | 429 | return matchesSearch && matchesClass; |
| @@ -426,8 +431,12 @@ export async function loadFeatherlessModels(data) { | ||
| 426 | 431 | else if (selectedCategory === 'Top') { |
| 427 | 432 | return matchesSearch && matchesClass && matchesTop; |
| 428 | 433 | } |
| 429 | - | |
| 434 | + else if (selectedCategory === 'New') { | |
| 430 | 435 | return matchesSearch && matchesClass && matchesNew; |
| 436 | + } | |
| 437 | + else { | |
| 438 | + return null; | |
| 439 | + } | |
| 431 | 440 | }); |
| 432 | 441 | |
| 433 | 442 | // Sort the filtered models based on selected sort order (A-Z or Z-A) |
| @@ -448,8 +457,14 @@ async function fetchFeatherlessStats() { | ||
| 448 | 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 | 466 | function onFeatherlessModelSelect(modelId) { |
| 452 | - // Find the selected model and set the settings | |
| 467 | + | |
| 453 | 468 | const model = featherlessModels.find(x => x.id === modelId); |
| 454 | 469 | selectedModelId = modelId; |
| 455 | 470 | textgen_settings.featherless_model = modelId; |
| @@ -5564,12 +5564,14 @@ body:not(.movingUI) .drawer-content.maximized { | ||
| 5564 | 5564 | #model_search_bar { |
| 5565 | 5565 | flex-grow: 1; |
| 5566 | 5566 | min-width: 10ch; |
| 5567 | + align-self: center; | |
| 5567 | 5568 | } |
| 5568 | 5569 | |
| 5569 | 5570 | /* Sort dropdown should be auto-sized based on its content */ |
| 5570 | 5571 | #model_sort_order { |
| 5571 | - width: auto; /* Set the width of the dropdown to its content size */ | |
| 5572 | + width: auto; | |
| 5572 | 5573 | flex-shrink: 0; /* Prevent it from shrinking */ |
| 5574 | + align-self: center; | |
| 5573 | 5575 | } |
| 5574 | 5576 | |
| 5575 | 5577 | /* Grid toggle button */ |
| @@ -5579,13 +5581,30 @@ body:not(.movingUI) .drawer-content.maximized { | ||
| 5579 | 5581 | cursor: pointer; |
| 5580 | 5582 | } |
| 5581 | 5583 | |
| 5582 | 5584 | #category_selection, |
| 5583 | -{ | |
| 5585 | +#class_selection { | |
| 5584 | 5586 | display: flex; |
| 5585 | 5587 | width: auto; |
| 5588 | + align-self: center; | |
| 5589 | +} | |
| 5590 | + | |
| 5591 | +/* Media query for mobile devices */ | |
| 5592 | +@media (max-width: 768px) { | |
| 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 */ | |
| 5586 | 5609 | } |
| 5587 | -#class_selection | |
| 5588 | -{ | |
| 5589 | - display: flex; | |
| 5590 | - width: auto; | |
| 5591 | 5610 | } |