From c3c2bf3a73ae06ef4c265e179ef884e1bb492cda Mon Sep 17 00:00:00 2001 From: Deokhaeng Lee Date: Thu, 4 Sep 2025 12:25:18 -0700 Subject: [PATCH 1/4] fixed vocab storing issue --- .../src/components/settings/views/general.tsx | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/apps/desktop/src/components/settings/views/general.tsx b/apps/desktop/src/components/settings/views/general.tsx index 0dc8d3c172..121c3a8ce9 100644 --- a/apps/desktop/src/components/settings/views/general.tsx +++ b/apps/desktop/src/components/settings/views/general.tsx @@ -22,8 +22,8 @@ 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 { Textarea } from "@hypr/ui/components/ui/textarea"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@hypr/ui/components/ui/select"; import { Switch } from "@hypr/ui/components/ui/switch"; @@ -302,6 +302,7 @@ 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" /> From a1a108177d6c3bacaf92030f5208e0c744bfd813 Mon Sep 17 00:00:00 2001 From: Deokhaeng Lee Date: Thu, 4 Sep 2025 12:57:58 -0700 Subject: [PATCH 2/4] fixed some stuff --- .../src/components/editor-area/index.tsx | 2 + .../right-panel/components/search-header.tsx | 45 +++++++++++++++++++ .../src/components/settings/views/general.tsx | 14 +++--- apps/desktop/src/locales/en/messages.po | 18 ++++---- apps/desktop/src/locales/ko/messages.po | 18 ++++---- crates/template/assets/enhance.system.jinja | 1 + 6 files changed, 74 insertions(+), 24 deletions(-) diff --git a/apps/desktop/src/components/editor-area/index.tsx b/apps/desktop/src/components/editor-area/index.tsx index 0802761c25..d690a69674 100644 --- a/apps/desktop/src/components/editor-area/index.tsx +++ b/apps/desktop/src/components/editor-area/index.tsx @@ -480,6 +480,8 @@ export function useEnhanceMutation({ }, ); + console.log("systemMessage", systemMessage); + const userMessage = await templateCommands.render( "enhance.user", { 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 121c3a8ce9..adcf57c11a 100644 --- a/apps/desktop/src/components/settings/views/general.tsx +++ b/apps/desktop/src/components/settings/views/general.tsx @@ -23,9 +23,9 @@ import { FormMessage, } from "@hypr/ui/components/ui/form"; import { Popover, PopoverContent, PopoverTrigger } from "@hypr/ui/components/ui/popover"; -import { Textarea } from "@hypr/ui/components/ui/textarea"; 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,7 +302,8 @@ export default function General() { )} /> - {/* + { + /* )} /> - */} + */ + } mutation.mutate(form.getValues())} onKeyDown={(e) => { - if (e.key === 'Enter') { - e.preventDefault(); + if (e.key === "Enter") { + e.preventDefault(); mutation.mutate(form.getValues()); - e.currentTarget.blur(); + e.currentTarget.blur(); } }} placeholder={t({ 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..e1c89a10ce 100644 --- a/crates/template/assets/enhance.system.jinja +++ b/crates/template/assets/enhance.system.jinja @@ -1,4 +1,5 @@ You are a professional assistant that generates enhanced meetings notes while maintaining accuracy, completeness, and professional terminology in {{ config.general.summary_language | language }}. +There might be errors/typos in the transcript. If they look like any of the words in [{{ config.general.jargons | join(", ") }}], you should correct them. {%- set specificity = config.ai.ai_specificity | default(3) %} From 4621787accb8ec43d59f79104a62a790a0c74168 Mon Sep 17 00:00:00 2001 From: Deokhaeng Lee Date: Thu, 4 Sep 2025 13:00:01 -0700 Subject: [PATCH 3/4] removed console log --- apps/desktop/src/components/editor-area/index.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/apps/desktop/src/components/editor-area/index.tsx b/apps/desktop/src/components/editor-area/index.tsx index d690a69674..0802761c25 100644 --- a/apps/desktop/src/components/editor-area/index.tsx +++ b/apps/desktop/src/components/editor-area/index.tsx @@ -480,8 +480,6 @@ export function useEnhanceMutation({ }, ); - console.log("systemMessage", systemMessage); - const userMessage = await templateCommands.render( "enhance.user", { From 71d75a219137a7c39fdcdab20ba90e93006e147e Mon Sep 17 00:00:00 2001 From: yujonglee Date: Thu, 4 Sep 2025 13:14:18 -0700 Subject: [PATCH 4/4] Update crates/template/assets/enhance.system.jinja Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- crates/template/assets/enhance.system.jinja | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/template/assets/enhance.system.jinja b/crates/template/assets/enhance.system.jinja index e1c89a10ce..301938150e 100644 --- a/crates/template/assets/enhance.system.jinja +++ b/crates/template/assets/enhance.system.jinja @@ -1,5 +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 }}. -There might be errors/typos in the transcript. If they look like any of the words in [{{ config.general.jargons | join(", ") }}], you should correct them. +{%- 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) %}