mirror of
https://github.com/open-webui/open-webui
synced 2024-12-28 23:02:25 +00:00
refac: admin models settings
This commit is contained in:
parent
f9e24968e3
commit
29fac5ecca
@ -38,9 +38,16 @@
|
|||||||
let showResetModal = false;
|
let showResetModal = false;
|
||||||
|
|
||||||
$: if (models) {
|
$: if (models) {
|
||||||
filteredModels = models.filter(
|
filteredModels = models
|
||||||
(m) => searchValue === '' || m.name.toLowerCase().includes(searchValue.toLowerCase())
|
.filter((m) => searchValue === '' || m.name.toLowerCase().includes(searchValue.toLowerCase()))
|
||||||
);
|
.sort((a, b) => {
|
||||||
|
// Check if either model is inactive and push them to the bottom
|
||||||
|
if ((a.is_active ?? true) !== (b.is_active ?? true)) {
|
||||||
|
return (b.is_active ?? true) - (a.is_active ?? true);
|
||||||
|
}
|
||||||
|
// If both models' active states are the same, sort alphabetically
|
||||||
|
return a.name.localeCompare(b.name);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let searchValue = '';
|
let searchValue = '';
|
||||||
|
@ -688,6 +688,7 @@
|
|||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
// Prevent Enter key from creating a new line
|
// Prevent Enter key from creating a new line
|
||||||
|
// Uses keyCode '13' for Enter key for chinese/japanese keyboards
|
||||||
if (e.keyCode === 13 && !e.shiftKey) {
|
if (e.keyCode === 13 && !e.shiftKey) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user