Skip to content

Commit c689f09

Browse files
Warn user when non-english is used with en-only model (#668)
1 parent 1ed360d commit c689f09

File tree

6 files changed

+60
-15
lines changed

6 files changed

+60
-15
lines changed

apps/desktop/src/components/settings/views/general.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { useEffect } from "react";
66
import { useForm } from "react-hook-form";
77
import { z } from "zod";
88

9+
import { showModelSelectToast } from "@/components/toast/model-select";
910
import { commands } from "@/types";
1011
import { commands as dbCommands, type ConfigGeneral } from "@hypr/plugin-db";
1112
import {
@@ -102,6 +103,10 @@ export default function General() {
102103
if (name === "autostart") {
103104
commands.setAutostart(!!value.autostart);
104105
}
106+
107+
if (name === "displayLanguage" && value.displayLanguage) {
108+
showModelSelectToast(value.displayLanguage);
109+
}
105110
});
106111

107112
return () => subscription.unsubscribe();

apps/desktop/src/components/toast/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import ModelDownloadNotification from "./model";
1+
import ModelDownloadNotification from "./model-download";
22
import OtaNotification from "./ota";
33

44
export default function Notifications() {
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { commands as localSttCommands, SupportedModel } from "@hypr/plugin-local-stt";
2+
import { commands as windowsCommands } from "@hypr/plugin-windows";
3+
import { Button } from "@hypr/ui/components/ui/button";
4+
import { sonnerToast, toast } from "@hypr/ui/components/ui/toast";
5+
6+
export async function showModelSelectToast(language: string) {
7+
const currentModel = await localSttCommands.getCurrentModel();
8+
const englishModels: SupportedModel[] = ["QuantizedTinyEn", "QuantizedBaseEn", "QuantizedSmallEn"];
9+
10+
if (language === "en" || !englishModels.includes(currentModel)) {
11+
return;
12+
}
13+
14+
const id = "language-model-mismatch";
15+
16+
toast({
17+
id,
18+
title: "Speech-to-Text Model Mismatch",
19+
content: (
20+
<div className="space-y-2">
21+
<div>
22+
English-only model can not be used with non-English languages.
23+
</div>
24+
<Button
25+
variant="default"
26+
onClick={() => {
27+
windowsCommands.windowShow({ type: "settings" }).then(() => {
28+
windowsCommands.windowEmitNavigate({ type: "settings" }, "/app/settings?tab=ai");
29+
});
30+
31+
sonnerToast.dismiss(id);
32+
}}
33+
>
34+
Open AI Settings
35+
</Button>
36+
</div>
37+
),
38+
dismissible: true,
39+
});
40+
}

apps/desktop/src/locales/en/messages.po

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ msgstr ""
1414
"Plural-Forms: \n"
1515

1616
#. js-lingui-explicit-id
17-
#: src/components/settings/views/general.tsx:193
17+
#: src/components/settings/views/general.tsx:198
1818
msgid "Type jargons (e.g., Blitz Meeting, PaC Squad)"
1919
msgstr "Type jargons (e.g., Blitz Meeting, PaC Squad)"
2020

@@ -365,7 +365,7 @@ msgstr "CEO"
365365
#~ msgid "Choose the language you want to use for the application interface"
366366
#~ msgstr "Choose the language you want to use for the application interface"
367367

368-
#: src/components/settings/views/general.tsx:150
368+
#: src/components/settings/views/general.tsx:155
369369
msgid "Choose the language you want to use for the speech-to-text model and language model"
370370
msgstr "Choose the language you want to use for the speech-to-text model and language model"
371371

@@ -555,7 +555,7 @@ msgstr "Get Started"
555555
msgid "Grant Access"
556556
msgstr "Grant Access"
557557

558-
#: src/components/settings/views/general.tsx:124
558+
#: src/components/settings/views/general.tsx:129
559559
msgid "Help us improve Hyprnote by sharing anonymous usage data"
560560
msgstr "Help us improve Hyprnote by sharing anonymous usage data"
561561

@@ -583,7 +583,7 @@ msgstr "Invite"
583583
msgid "Invite members"
584584
msgstr "Invite members"
585585

586-
#: src/components/settings/views/general.tsx:181
586+
#: src/components/settings/views/general.tsx:186
587587
msgid "Jargons"
588588
msgstr "Jargons"
589589

@@ -599,7 +599,7 @@ msgstr "Key decisions"
599599
msgid "Lab"
600600
msgstr "Lab"
601601

602-
#: src/components/settings/views/general.tsx:147
602+
#: src/components/settings/views/general.tsx:152
603603
msgid "Language"
604604
msgstr "Language"
605605

@@ -842,7 +842,7 @@ msgstr "Send invite"
842842
msgid "Settings"
843843
msgstr "Settings"
844844

845-
#: src/components/settings/views/general.tsx:121
845+
#: src/components/settings/views/general.tsx:126
846846
msgid "Share usage data"
847847
msgstr "Share usage data"
848848

@@ -1012,7 +1012,7 @@ msgstr "Works both in-person and remotely"
10121012
msgid "Works offline"
10131013
msgstr "Works offline"
10141014

1015-
#: src/components/settings/views/general.tsx:184
1015+
#: src/components/settings/views/general.tsx:189
10161016
msgid "You can make Hyprnote takes these words into account when transcribing"
10171017
msgstr "You can make Hyprnote takes these words into account when transcribing"
10181018

apps/desktop/src/locales/ko/messages.po

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ msgstr ""
1414
"Plural-Forms: \n"
1515

1616
#. js-lingui-explicit-id
17-
#: src/components/settings/views/general.tsx:193
17+
#: src/components/settings/views/general.tsx:198
1818
msgid "Type jargons (e.g., Blitz Meeting, PaC Squad)"
1919
msgstr ""
2020

@@ -365,7 +365,7 @@ msgstr ""
365365
#~ msgid "Choose the language you want to use for the application interface"
366366
#~ msgstr ""
367367

368-
#: src/components/settings/views/general.tsx:150
368+
#: src/components/settings/views/general.tsx:155
369369
msgid "Choose the language you want to use for the speech-to-text model and language model"
370370
msgstr ""
371371

@@ -555,7 +555,7 @@ msgstr ""
555555
msgid "Grant Access"
556556
msgstr ""
557557

558-
#: src/components/settings/views/general.tsx:124
558+
#: src/components/settings/views/general.tsx:129
559559
msgid "Help us improve Hyprnote by sharing anonymous usage data"
560560
msgstr ""
561561

@@ -583,7 +583,7 @@ msgstr ""
583583
msgid "Invite members"
584584
msgstr ""
585585

586-
#: src/components/settings/views/general.tsx:181
586+
#: src/components/settings/views/general.tsx:186
587587
msgid "Jargons"
588588
msgstr ""
589589

@@ -599,7 +599,7 @@ msgstr ""
599599
msgid "Lab"
600600
msgstr ""
601601

602-
#: src/components/settings/views/general.tsx:147
602+
#: src/components/settings/views/general.tsx:152
603603
msgid "Language"
604604
msgstr ""
605605

@@ -842,7 +842,7 @@ msgstr ""
842842
msgid "Settings"
843843
msgstr ""
844844

845-
#: src/components/settings/views/general.tsx:121
845+
#: src/components/settings/views/general.tsx:126
846846
msgid "Share usage data"
847847
msgstr ""
848848

@@ -1012,7 +1012,7 @@ msgstr ""
10121012
msgid "Works offline"
10131013
msgstr ""
10141014

1015-
#: src/components/settings/views/general.tsx:184
1015+
#: src/components/settings/views/general.tsx:189
10161016
msgid "You can make Hyprnote takes these words into account when transcribing"
10171017
msgstr ""
10181018

0 commit comments

Comments
 (0)