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
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { commands as dbCommands } from "@hypr/plugin-db";
import { Button } from "@hypr/ui/components/ui/button";
import { Input } from "@hypr/ui/components/ui/input";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import useDebouncedCallback from "beautiful-react-hooks/useDebouncedCallback";
import { ChevronDownIcon, ChevronUpIcon, ReplaceIcon, XIcon } from "lucide-react";
import { useEffect, useRef, useState } from "react";
Expand All @@ -14,6 +16,44 @@ export function SearchHeader({ editorRef, onClose }: SearchHeaderProps) {
const [resultCount, setResultCount] = useState(0);
const [currentIndex, setCurrentIndex] = useState(0);

const queryClient = useQueryClient();

const config = useQuery({
queryKey: ["config", "general"],
queryFn: async () => {
const result = await dbCommands.getConfig();
return result;
},
});

const updateJargonsMutation = useMutation({
mutationFn: async (newJargon: string) => {
if (!config.data) {
return;
}

const currentJargons = config.data.general.jargons || [];
const trimmedJargon = newJargon.trim();

if (!trimmedJargon || currentJargons.includes(trimmedJargon)) {
return;
}

const updatedJargons = [...currentJargons, trimmedJargon];

await dbCommands.setConfig({
...config.data,
general: {
...config.data.general,
jargons: updatedJargons,
},
});
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ["config", "general"] });
},
});

// Add ref for the search header container
const searchHeaderRef = useRef<HTMLDivElement>(null);

Expand Down Expand Up @@ -108,6 +148,11 @@ export function SearchHeader({ editorRef, onClose }: SearchHeaderProps) {
const handleReplaceAll = () => {
if (editorRef.current && searchTerm) {
editorRef.current.editor.commands.replaceAll();

if (replaceTerm && replaceTerm.trim() && resultCount > 0) {
updateJargonsMutation.mutate(replaceTerm);
}

setTimeout(() => {
const storage = editorRef.current.editor.storage.searchAndReplace;
const results = storage.results || [];
Expand Down
19 changes: 15 additions & 4 deletions apps/desktop/src/components/settings/views/general.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import {
FormLabel,
FormMessage,
} from "@hypr/ui/components/ui/form";
import { Input } from "@hypr/ui/components/ui/input";
import { Popover, PopoverContent, PopoverTrigger } from "@hypr/ui/components/ui/popover";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@hypr/ui/components/ui/select";
import { Switch } from "@hypr/ui/components/ui/switch";
import { Textarea } from "@hypr/ui/components/ui/textarea";

type ISO_639_1_CODE = keyof typeof LANGUAGES_ISO_639_1;
const SUPPORTED_LANGUAGES: ISO_639_1_CODE[] = [
Expand Down Expand Up @@ -302,6 +302,8 @@ export default function General() {
)}
/>

{
/*
<FormField
control={form.control}
name="displayLanguage"
Expand Down Expand Up @@ -330,6 +332,8 @@ export default function General() {
</FormItem>
)}
/>
*/
}

<FormField
control={form.control}
Expand Down Expand Up @@ -411,7 +415,6 @@ export default function General() {
</FormItem>
)}
/>

<FormField
control={form.control}
name="jargons"
Expand All @@ -428,13 +431,21 @@ export default function General() {
</FormDescription>
</div>
<FormControl>
<Input
<Textarea
{...field}
rows={3}
onBlur={() => mutation.mutate(form.getValues())}
onKeyDown={(e) => {
if (e.key === "Enter") {
e.preventDefault();
mutation.mutate(form.getValues());
e.currentTarget.blur();
}
}}
placeholder={t({
id: "Type terms separated by commas (e.g., Blitz Meeting, PaC Squad)",
})}
className="focus-visible:ring-1 focus-visible:ring-ring"
className="focus-visible:ring-1 focus-visible:ring-ring resize-none"
/>
</FormControl>
<FormMessage />
Expand Down
18 changes: 9 additions & 9 deletions apps/desktop/src/locales/en/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ msgstr ""
"Plural-Forms: \n"

#. js-lingui-explicit-id
#: src/components/settings/views/general.tsx:434
#: src/components/settings/views/general.tsx:445
msgid "Type terms separated by commas (e.g., Blitz Meeting, PaC Squad)"
msgstr "Type terms separated by commas (e.g., Blitz Meeting, PaC Squad)"

Expand Down Expand Up @@ -356,7 +356,7 @@ msgstr "Add more quotes"
msgid "Add participant"
msgstr "Add participant"

#: src/components/settings/views/general.tsx:425
#: src/components/settings/views/general.tsx:428
msgid "Add specific terms or jargon for improved transcription accuracy"
msgstr "Add specific terms or jargon for improved transcription accuracy"

Expand Down Expand Up @@ -696,7 +696,7 @@ msgstr "Custom"
msgid "Custom Speech-to-Text endpoint"
msgstr "Custom Speech-to-Text endpoint"

#: src/components/settings/views/general.tsx:422
#: src/components/settings/views/general.tsx:425
msgid "Custom Vocabulary"
msgstr "Custom Vocabulary"

Expand Down Expand Up @@ -736,8 +736,8 @@ msgstr "Detect meetings automatically"
#~ msgstr "Did you get consent from everyone in the meeting?"

#: src/components/settings/views/general.tsx:312
msgid "Display language"
msgstr "Display language"
#~ msgid "Display language"
#~ msgstr "Display language"

#: src/components/settings/views/help-support.tsx:43
msgid "Documentation"
Expand Down Expand Up @@ -1337,8 +1337,8 @@ msgstr "people"
#~ msgstr "Play video"

#: src/components/settings/views/general.tsx:315
msgid "Primary language for the interface"
msgstr "Primary language for the interface"
#~ msgid "Primary language for the interface"
#~ msgstr "Primary language for the interface"

#: src/components/settings/views/billing.tsx:33
#~ msgid "Pro"
Expand Down Expand Up @@ -1501,7 +1501,7 @@ msgstr "Select Calendars"
msgid "Select how you want to process your meeting notes"
msgstr "Select how you want to process your meeting notes"

#: src/components/settings/views/general.tsx:344
#: src/components/settings/views/general.tsx:348
msgid "Select languages you speak for better transcription"
msgstr "Select languages you speak for better transcription"

Expand Down Expand Up @@ -1558,7 +1558,7 @@ msgstr "Sound"
#~ msgid "Speech to Text Model"
#~ msgstr "Speech to Text Model"

#: src/components/settings/views/general.tsx:341
#: src/components/settings/views/general.tsx:345
msgid "Spoken languages"
msgstr "Spoken languages"

Expand Down
18 changes: 9 additions & 9 deletions apps/desktop/src/locales/ko/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ msgstr ""
"Plural-Forms: \n"

#. js-lingui-explicit-id
#: src/components/settings/views/general.tsx:434
#: src/components/settings/views/general.tsx:445
msgid "Type terms separated by commas (e.g., Blitz Meeting, PaC Squad)"
msgstr ""

Expand Down Expand Up @@ -356,7 +356,7 @@ msgstr ""
msgid "Add participant"
msgstr ""

#: src/components/settings/views/general.tsx:425
#: src/components/settings/views/general.tsx:428
msgid "Add specific terms or jargon for improved transcription accuracy"
msgstr ""

Expand Down Expand Up @@ -700,7 +700,7 @@ msgstr ""
#~ msgid "Custom STT Endpoint"
#~ msgstr ""

#: src/components/settings/views/general.tsx:422
#: src/components/settings/views/general.tsx:425
msgid "Custom Vocabulary"
msgstr ""

Expand Down Expand Up @@ -740,8 +740,8 @@ msgstr ""
#~ msgstr ""

#: src/components/settings/views/general.tsx:312
msgid "Display language"
msgstr ""
#~ msgid "Display language"
#~ msgstr ""

#: src/components/settings/views/help-support.tsx:43
msgid "Documentation"
Expand Down Expand Up @@ -1341,8 +1341,8 @@ msgstr ""
#~ msgstr ""

#: src/components/settings/views/general.tsx:315
msgid "Primary language for the interface"
msgstr ""
#~ msgid "Primary language for the interface"
#~ msgstr ""

#: src/components/settings/views/billing.tsx:33
#~ msgid "Pro"
Expand Down Expand Up @@ -1505,7 +1505,7 @@ msgstr ""
msgid "Select how you want to process your meeting notes"
msgstr ""

#: src/components/settings/views/general.tsx:344
#: src/components/settings/views/general.tsx:348
msgid "Select languages you speak for better transcription"
msgstr ""

Expand Down Expand Up @@ -1562,7 +1562,7 @@ msgstr ""
#~ msgid "Speech to Text Model"
#~ msgstr ""

#: src/components/settings/views/general.tsx:341
#: src/components/settings/views/general.tsx:345
msgid "Spoken languages"
msgstr ""

Expand Down
4 changes: 4 additions & 0 deletions crates/template/assets/enhance.system.jinja
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
You are a professional assistant that generates enhanced meetings notes while maintaining accuracy, completeness, and professional terminology in {{ config.general.summary_language | language }}.
{%- set j_list = (config.general.jargons | default([])) -%}
{%- if j_list | length > 0 -%}
There might be errors/typos in the transcript. If they look like any of the words in [{{ j_list | join(", ") }}], you should correct them.
{%- endif -%}

{%- set specificity = config.ai.ai_specificity | default(3) %}

Expand Down
Loading