Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 36 additions & 13 deletions apps/desktop/src/components/toast/model-download.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,6 @@ 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"],
Expand All @@ -67,6 +59,37 @@ export default function ModelDownloadNotification() {
refetchInterval: 3000,
});

const sttModelExists = useQuery({
queryKey: ["stt-model-exists"],
queryFn: async () => {
const results = await Promise.all([
localSttCommands.isModelDownloaded("QuantizedTiny"),
localSttCommands.isModelDownloaded("QuantizedTinyEn"),
localSttCommands.isModelDownloaded("QuantizedBase"),
localSttCommands.isModelDownloaded("QuantizedBaseEn"),
localSttCommands.isModelDownloaded("QuantizedSmall"),
localSttCommands.isModelDownloaded("QuantizedSmallEn"),
localSttCommands.isModelDownloaded("QuantizedLargeTurbo"),
]);

return results.some(Boolean);
},
refetchInterval: 3000,
});

const llmModelExists = useQuery({
queryKey: ["llm-model-exists"],
queryFn: async () => {
const results = await Promise.all([
localLlmCommands.isModelDownloaded("Llama3p2_3bQ4"),
localLlmCommands.isModelDownloaded("HyprLLM"),
]);

return results.some(Boolean);
},
refetchInterval: 3000,
});

useEffect(() => {
if (!checkForModelDownload.data) {
return;
Expand All @@ -84,8 +107,8 @@ export default function ModelDownloadNotification() {
return;
}

const needsSttModel = !checkForModelDownload.data?.sttModelDownloaded;
const needsLlmModel = listDownloadedModels.data?.length === 0;
const needsSttModel = !sttModelExists.data;
const needsLlmModel = !llmModelExists.data;

let title: string;
let content: string;
Expand All @@ -94,11 +117,11 @@ export default function ModelDownloadNotification() {
if (needsSttModel && needsLlmModel) {
title = "Transcribing & Enhancing AI Needed";
content = "Both STT models and LLMs are required for offline functionality.";
buttonLabel = "Download Both Models";
buttonLabel = "Download Models";
} else if (needsSttModel) {
title = "Transcribing Model Needed";
content = "The STT model is required for offline transcribing functionality.";
buttonLabel = "Download Transcribing Model";
buttonLabel = "Download Model";
} else if (needsLlmModel) {
title = "Enhancing AI Model Needed";
content = "The LLM model is required for offline enhancing functionality.";
Expand Down Expand Up @@ -141,7 +164,7 @@ export default function ModelDownloadNotification() {
],
dismissible: false,
});
}, [checkForModelDownload.data, sttModelDownloading.data, llmModelDownloading.data, isDismissed]);
}, [checkForModelDownload.data, sttModelDownloading.data, llmModelDownloading.data, isDismissed, sttModelExists.data, llmModelExists.data]);

return null;
}
6 changes: 5 additions & 1 deletion crates/db-user/assets/thank-you.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Please [join our Discord](https://hyprnote.com/discord)! We really want to hear from you.
We appreciate your patience while you wait for your STT&LLM models to be downloaded.

**In the meantime...** why don't you check out [our blog](https://hyprnote.com/blog) or [changelog](https://hyprnote.canny.io/changelog) for a better understanding of the service.

Also, please [join our Discord](https://hyprnote.com/discord)! We really want to hear from you.

<img alt="welcome" src="https://raw.githubusercontent.com/fastrepl/hyprnote/refs/heads/main/crates/db-user/assets/welcome.png"/>
Loading