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:
2026-10-20 15:04:10 +01:00
parent 1480591a34
commit 9f29f387ba
5 changed files with 85 additions and 17 deletions
+14
View File
@@ -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)
// ---------------------------------------------------------------------------