diff --git a/apps/desktop/src/settings/ai/stt/configure.tsx b/apps/desktop/src/settings/ai/stt/configure.tsx index 3dbc9c3a12..46f21590e9 100644 --- a/apps/desktop/src/settings/ai/stt/configure.tsx +++ b/apps/desktop/src/settings/ai/stt/configure.tsx @@ -13,6 +13,7 @@ import { useCallback } from "react"; import { commands as localSttCommands, type LocalModel, + type SttModelInfo, } from "@hypr/plugin-local-stt"; import { commands as openerCommands } from "@hypr/plugin-opener2"; import { @@ -99,14 +100,7 @@ function HyprProviderCard({ icon: React.ReactNode; badge?: string | null; }) { - const supportedModels = useQuery({ - queryKey: ["list-supported-models"], - queryFn: async () => { - const result = await localSttCommands.listSupportedModels(); - return result.status === "ok" ? result.data : []; - }, - staleTime: Infinity, - }); + const supportedModels = useQuery(localSttQueries.supportedModels()); const argmaxModels = supportedModels.data?.filter((m) => m.model_type === "argmax") ?? []; @@ -167,45 +161,24 @@ function HyprProviderCard({ {argmaxModels.length > 0 && ( - <> - - {argmaxModels.map((model) => ( - - ))} - + )} {whispercppModels.length > 0 && ( - <> - - {whispercppModels.map((model) => ( - - ))} - + )} {cactusModels.length > 0 && ( <> - + {/* m.key)} /> */} - - {cactusModels.map((model) => ( - - ))} )} @@ -216,52 +189,30 @@ function HyprProviderCard({ ); } -function CactusRow({ - model, - displayName, +function LocalModelSection({ + label, + models, + modelsDir = "default", }: { - model: LocalModel; - displayName: string; + label: string; + models: SttModelInfo[]; + modelsDir?: "default" | "cactus"; }) { - const handleSelectModel = useSafeSelectModel(); - const { shouldHighlightDownload } = useSttSettings(); - - const { - progress, - hasError, - isDownloaded, - showProgress, - handleDownload, - handleCancel, - handleDelete, - } = useLocalModelDownload(model, handleSelectModel); - - const handleOpen = () => { - void localSttCommands.cactusModelsDir().then((result) => { - if (result.status === "ok") { - void openerCommands.openPath(result.data, null); - } - }); - }; - return ( - -
- {displayName} +
+ +
+ {models.map((model) => ( + + ))}
- - - +
); } @@ -386,6 +337,7 @@ function LocalModelAction({ onDownload, onCancel, onDelete, + compact = false, }: { isDownloaded: boolean; showProgress: boolean; @@ -396,6 +348,7 @@ function LocalModelAction({ onDownload: () => void; onCancel: () => void; onDelete: () => void; + compact?: boolean; }) { const showShimmer = highlight && !isDownloaded && !showProgress && !hasError; @@ -404,8 +357,12 @@ function LocalModelAction({