feat: auto select the first model as default model

This commit is contained in:
Henry Li
2026-01-26 17:13:34 +08:00
parent 22004406a7
commit 3ce4968e95
4 changed files with 17 additions and 8 deletions

View File

@@ -2,10 +2,11 @@ import { useQuery } from "@tanstack/react-query";
import { loadModels } from "./api";
export function useModels() {
export function useModels({ enabled = true }: { enabled?: boolean } = {}) {
const { data, isLoading, error } = useQuery({
queryKey: ["models"],
queryFn: () => loadModels(),
enabled,
});
return { models: data ?? [], isLoading, error };
}