web: filter the chat model picker
Add a search field that narrows models by name, id or provider in place, keeps focus while typing, and reports when nothing matches.
This commit is contained in:
@@ -871,6 +871,20 @@ export function isChatSessionUnseen(session, { activeId = null, seen = null, ope
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Narrow a model list by a case-insensitive substring over its display name,
|
||||
* model id and provider. A blank query returns the whole list in its existing
|
||||
* (server) order; the picker never re-sorts.
|
||||
*/
|
||||
export function filterChatModels(models, query) {
|
||||
const list = (models ?? []).filter((model) => model && (model.id || model.name));
|
||||
const needle = str(query).trim().toLowerCase();
|
||||
if (needle === "") return list;
|
||||
return list.filter((model) =>
|
||||
`${str(model.name)}\u0000${str(model.id)}\u0000${str(model.provider)}`.toLowerCase().includes(needle),
|
||||
);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Session narrowing and grouping (ChatListFilter.kt)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user