diff --git a/apps/desktop/src/components/right-panel/components/search-header.tsx b/apps/desktop/src/components/right-panel/components/search-header.tsx index b07c1f6b81..61a5c5e650 100644 --- a/apps/desktop/src/components/right-panel/components/search-header.tsx +++ b/apps/desktop/src/components/right-panel/components/search-header.tsx @@ -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"; @@ -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(null); @@ -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 || []; diff --git a/apps/desktop/src/components/settings/views/general.tsx b/apps/desktop/src/components/settings/views/general.tsx index 0dc8d3c172..adcf57c11a 100644 --- a/apps/desktop/src/components/settings/views/general.tsx +++ b/apps/desktop/src/components/settings/views/general.tsx @@ -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[] = [ @@ -302,6 +302,8 @@ export default function General() { )} /> + { + /* )} /> + */ + } )} /> - - 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" /> diff --git a/apps/desktop/src/locales/en/messages.po b/apps/desktop/src/locales/en/messages.po index 43b74b1ee1..ffa4efdf87 100644 --- a/apps/desktop/src/locales/en/messages.po +++ b/apps/desktop/src/locales/en/messages.po @@ -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)" @@ -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" @@ -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" @@ -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" @@ -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" @@ -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" @@ -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" diff --git a/apps/desktop/src/locales/ko/messages.po b/apps/desktop/src/locales/ko/messages.po index 1fb754d12a..3982a24265 100644 --- a/apps/desktop/src/locales/ko/messages.po +++ b/apps/desktop/src/locales/ko/messages.po @@ -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 "" @@ -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 "" @@ -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 "" @@ -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" @@ -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" @@ -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 "" @@ -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 "" diff --git a/crates/template/assets/enhance.system.jinja b/crates/template/assets/enhance.system.jinja index eb281a9ab9..301938150e 100644 --- a/crates/template/assets/enhance.system.jinja +++ b/crates/template/assets/enhance.system.jinja @@ -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) %}