diff --git a/apps/desktop/src/components/toast/model-download.tsx b/apps/desktop/src/components/toast/model-download.tsx index d83c9ba691..a044d22cef 100644 --- a/apps/desktop/src/components/toast/model-download.tsx +++ b/apps/desktop/src/components/toast/model-download.tsx @@ -41,6 +41,14 @@ export default function ModelDownloadNotification() { refetchInterval: 5000, }); + const listDownloadedModels = useQuery({ + queryKey: ["list-downloaded-models"], + queryFn: async () => { + return localLlmCommands.listDownloadedModel(); + }, + refetchInterval: 3000, + }); + const sttModelDownloading = useQuery({ enabled: !checkForModelDownload.data?.sttModelDownloaded, queryKey: ["stt-model-downloading"], @@ -77,7 +85,7 @@ export default function ModelDownloadNotification() { } const needsSttModel = !checkForModelDownload.data?.sttModelDownloaded; - const needsLlmModel = !checkForModelDownload.data?.llmModelDownloaded; + const needsLlmModel = listDownloadedModels.data?.length === 0; let title: string; let content: string; diff --git a/apps/desktop/src/components/welcome-modal/index.tsx b/apps/desktop/src/components/welcome-modal/index.tsx index 973b2773a0..0388da8d75 100644 --- a/apps/desktop/src/components/welcome-modal/index.tsx +++ b/apps/desktop/src/components/welcome-modal/index.tsx @@ -78,6 +78,9 @@ export function WelcomeModal({ isOpen, onClose }: WelcomeModalProps) { const handleModelSelected = (model: SupportedModel) => { selectSTTModel.mutate(model); + + sessionStorage.setItem("model-download-toast-dismissed", "true"); + onClose(); }; diff --git a/plugins/local-llm/build.rs b/plugins/local-llm/build.rs index bda06d322d..6a34ca67de 100644 --- a/plugins/local-llm/build.rs +++ b/plugins/local-llm/build.rs @@ -1,6 +1,5 @@ const COMMANDS: &[&str] = &[ "models_dir", - "list_supported_models", "is_server_running", "is_model_downloaded", "is_model_downloading", @@ -10,6 +9,7 @@ const COMMANDS: &[&str] = &[ "restart_server", "get_current_model", "set_current_model", + "list_downloaded_model", ]; fn main() { diff --git a/plugins/local-llm/permissions/autogenerated/commands/list_downloaded_model.toml b/plugins/local-llm/permissions/autogenerated/commands/list_downloaded_model.toml new file mode 100644 index 0000000000..7454fc0fbd --- /dev/null +++ b/plugins/local-llm/permissions/autogenerated/commands/list_downloaded_model.toml @@ -0,0 +1,13 @@ +# Automatically generated - DO NOT EDIT! + +"$schema" = "../../schemas/schema.json" + +[[permission]] +identifier = "allow-list-downloaded-model" +description = "Enables the list_downloaded_model command without any pre-configured scope." +commands.allow = ["list_downloaded_model"] + +[[permission]] +identifier = "deny-list-downloaded-model" +description = "Denies the list_downloaded_model command without any pre-configured scope." +commands.deny = ["list_downloaded_model"] diff --git a/plugins/local-llm/permissions/autogenerated/commands/list_supported_models.toml b/plugins/local-llm/permissions/autogenerated/commands/list_supported_models.toml deleted file mode 100644 index 0240e3c9ad..0000000000 --- a/plugins/local-llm/permissions/autogenerated/commands/list_supported_models.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-list-supported-models" -description = "Enables the list_supported_models command without any pre-configured scope." -commands.allow = ["list_supported_models"] - -[[permission]] -identifier = "deny-list-supported-models" -description = "Denies the list_supported_models command without any pre-configured scope." -commands.deny = ["list_supported_models"] diff --git a/plugins/local-llm/permissions/autogenerated/reference.md b/plugins/local-llm/permissions/autogenerated/reference.md index 79386a35be..dbd98ee19a 100644 --- a/plugins/local-llm/permissions/autogenerated/reference.md +++ b/plugins/local-llm/permissions/autogenerated/reference.md @@ -14,7 +14,7 @@ Default permissions for the plugin - `allow-restart-server` - `allow-get-current-model` - `allow-set-current-model` -- `allow-list-supported-models` +- `allow-list-downloaded-model` ## Permission Table @@ -184,12 +184,12 @@ Denies the is_server_running command without any pre-configured scope.