diff --git a/frontend/app/components/assistant-ui/thread.tsx b/frontend/app/components/assistant-ui/thread.tsx index 60747da..7355b1b 100644 --- a/frontend/app/components/assistant-ui/thread.tsx +++ b/frontend/app/components/assistant-ui/thread.tsx @@ -27,6 +27,7 @@ import { MoreHorizontalIcon, PencilIcon, RefreshCwIcon, + SearchIcon, SquareIcon, WrenchIcon, } from "lucide-react"; @@ -92,6 +93,8 @@ type ClawStoredSession = { type ModelOption = { id: string; + provider?: string; + model_type?: string; }; type ContextBudget = { @@ -589,6 +592,19 @@ function ModelPickerButton({ setModel: (model: string) => Promise; }; }) { + const [query, setQuery] = useState(""); + const normalizedQuery = query.trim().toLowerCase(); + const filteredModels = useMemo(() => { + if (!normalizedQuery) return status.models; + return status.models.filter((model) => { + const provider = model.provider ?? modelProvider(model.id); + return ( + model.id.toLowerCase().includes(normalizedQuery) || + provider.toLowerCase().includes(normalizedQuery) + ); + }); + }, [normalizedQuery, status.models]); + return ( @@ -608,28 +624,46 @@ function ModelPickerButton({ side="top" align="end" sideOffset={10} - className="z-50 w-72 rounded-2xl border bg-popover p-2 text-popover-foreground shadow-lg outline-none" + className="z-50 w-[min(36rem,calc(100vw-2rem))] rounded-2xl border bg-popover p-2 text-popover-foreground shadow-lg outline-none" >
切换模型
+
+ + setQuery(event.target.value)} + placeholder="搜索模型或来源" + className="h-8 w-full rounded-lg border bg-background pr-2.5 pl-8 text-sm outline-none transition-colors placeholder:text-muted-foreground focus:border-ring" + /> +
{status.models.length ? ( - status.models.map((model) => ( - - )) +
+ {filteredModels.length ? ( + filteredModels.map((model) => ( + + )) + ) : ( +
+ 没有匹配的模型 +
+ )} +
) : (
模型列表读取中