mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-04 05:08:26 +01:00
added new filter and css fix
This commit is contained in:
parent
409d83e6ea
commit
aea985d78c
@ -34,6 +34,7 @@
|
|||||||
"rate-limiter-flexible": "^5.0.0",
|
"rate-limiter-flexible": "^5.0.0",
|
||||||
"response-time": "^2.3.2",
|
"response-time": "^2.3.2",
|
||||||
"sanitize-filename": "^1.6.3",
|
"sanitize-filename": "^1.6.3",
|
||||||
|
"sillytavern": "file:",
|
||||||
"sillytavern-transformers": "2.14.6",
|
"sillytavern-transformers": "2.14.6",
|
||||||
"simple-git": "^3.19.1",
|
"simple-git": "^3.19.1",
|
||||||
"tiktoken": "^1.0.16",
|
"tiktoken": "^1.0.16",
|
||||||
|
@ -412,13 +412,18 @@ export async function loadFeatherlessModels(data) {
|
|||||||
const selectedSortOrder = sortOrderSelect.value;
|
const selectedSortOrder = sortOrderSelect.value;
|
||||||
const selectedClass = classSelect.value;
|
const selectedClass = classSelect.value;
|
||||||
const selectedCategory = categoriesSelect.value;
|
const selectedCategory = categoriesSelect.value;
|
||||||
|
|
||||||
const featherlessTop = await fetchFeatherlessStats();
|
const featherlessTop = await fetchFeatherlessStats();
|
||||||
const featherlessIds = featherlessTop.map(stat => stat.id);
|
const featherlessIds = featherlessTop.map(stat => stat.id);
|
||||||
// Filter the models based on the search query and selected class
|
|
||||||
|
const featherlessNew = await fetchFeatherlessNew();
|
||||||
|
const featherlessNewIds = featherlessNew.map(stat => stat.id);
|
||||||
|
|
||||||
let filteredModels = originalModels.filter(model => {
|
let filteredModels = originalModels.filter(model => {
|
||||||
const matchesSearch = model.id.toLowerCase().includes(searchQuery);
|
const matchesSearch = model.id.toLowerCase().includes(searchQuery);
|
||||||
const matchesClass = selectedClass ? model.model_class === selectedClass : true;
|
const matchesClass = selectedClass ? model.model_class === selectedClass : true;
|
||||||
const matchesTop = featherlessIds.includes(model.id);
|
const matchesTop = featherlessIds.includes(model.id);
|
||||||
|
const matchesNew = featherlessNewIds.includes(model.id);
|
||||||
|
|
||||||
if (selectedCategory === 'All') {
|
if (selectedCategory === 'All') {
|
||||||
return matchesSearch && matchesClass;
|
return matchesSearch && matchesClass;
|
||||||
@ -426,8 +431,12 @@ export async function loadFeatherlessModels(data) {
|
|||||||
else if (selectedCategory === 'Top') {
|
else if (selectedCategory === 'Top') {
|
||||||
return matchesSearch && matchesClass && matchesTop;
|
return matchesSearch && matchesClass && matchesTop;
|
||||||
}
|
}
|
||||||
|
else if (selectedCategory === 'New') {
|
||||||
return matchesSearch && matchesClass;
|
return matchesSearch && matchesClass && matchesNew;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Sort the filtered models based on selected sort order (A-Z or Z-A)
|
// Sort the filtered models based on selected sort order (A-Z or Z-A)
|
||||||
@ -448,8 +457,14 @@ async function fetchFeatherlessStats() {
|
|||||||
return data.popular;
|
return data.popular;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function fetchFeatherlessNew() {
|
||||||
|
const response = await fetch('https://api.featherless.ai/feather/models?sort=-created_at&perPage=10');
|
||||||
|
const data = await response.json();
|
||||||
|
return data.items;
|
||||||
|
}
|
||||||
|
|
||||||
function onFeatherlessModelSelect(modelId) {
|
function onFeatherlessModelSelect(modelId) {
|
||||||
// Find the selected model and set the settings
|
|
||||||
const model = featherlessModels.find(x => x.id === modelId);
|
const model = featherlessModels.find(x => x.id === modelId);
|
||||||
selectedModelId = modelId;
|
selectedModelId = modelId;
|
||||||
textgen_settings.featherless_model = modelId;
|
textgen_settings.featherless_model = modelId;
|
||||||
|
@ -5564,12 +5564,14 @@ body:not(.movingUI) .drawer-content.maximized {
|
|||||||
#model_search_bar {
|
#model_search_bar {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
min-width: 10ch;
|
min-width: 10ch;
|
||||||
|
align-self: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sort dropdown should be auto-sized based on its content */
|
/* Sort dropdown should be auto-sized based on its content */
|
||||||
#model_sort_order {
|
#model_sort_order {
|
||||||
width: auto; /* Set the width of the dropdown to its content size */
|
width: auto;
|
||||||
flex-shrink: 0; /* Prevent it from shrinking */
|
flex-shrink: 0;
|
||||||
|
align-self: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Grid toggle button */
|
/* Grid toggle button */
|
||||||
@ -5579,13 +5581,30 @@ body:not(.movingUI) .drawer-content.maximized {
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
#category_selection
|
#category_selection,
|
||||||
{
|
#class_selection {
|
||||||
display: flex;
|
display: flex;
|
||||||
width: auto;
|
width: auto;
|
||||||
|
align-self: center;
|
||||||
}
|
}
|
||||||
#class_selection
|
|
||||||
{
|
/* Media query for mobile devices */
|
||||||
display: flex;
|
@media (max-width: 768px) {
|
||||||
width: auto;
|
.model-card {
|
||||||
|
flex-direction: column; /* Stack content vertically on small screens */
|
||||||
|
align-items: stretch; /* Stretch items to take full width */
|
||||||
|
}
|
||||||
|
|
||||||
|
.model-info, .model-details {
|
||||||
|
width: 100%; /* Take full width */
|
||||||
|
text-align: left; /* Left-align text */
|
||||||
|
}
|
||||||
|
|
||||||
|
#model_search_bar {
|
||||||
|
width: 100%; /* Take full width on small screens */
|
||||||
|
}
|
||||||
|
|
||||||
|
#model_sort_order, #model_grid_toggle {
|
||||||
|
margin-top: 10px; /* Add some space above these elements */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user