Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.
JavaScript aianthropiccross-platformgeminigroqlinuxmacosnvidiaopen-sourceopenaiparakeetspeech-to-texttranscribewhisperwindows
fix(chat): address code review findings — extract shared toolIcons, wire archive, fix i18n and types
Gabriel Stein16ae25985160
diff --git a/src/components/AgentOverlay.tsx b/src/components/AgentOverlay.tsxindex a0ed30b21..124bd84fc 100644--- a/src/components/AgentOverlay.tsx+++ b/src/components/AgentOverlay.tsx@@ -176,13 +176,6 @@ export default function AgentOverlay() {};}, []);- const handleTextSubmit = useCallback(- (text: string) => {- handleTranscriptionComplete(text);- },- [handleTranscriptionComplete]- );-const handleNewChat = useCallback(() => {persistenceNewChat();setPartialTranscript("");@@ -211,7 +204,7 @@ export default function AgentOverlay() {partialTranscript={partialTranscript}toolStatus={toolStatus}activeToolName={activeToolName}- onTextSubmit={handleTextSubmit}+ onTextSubmit={handleTranscriptionComplete}/></div>diff --git a/src/components/chat/ChatInput.tsx b/src/components/chat/ChatInput.tsxindex 53ba4d2aa..4885466a2 100644--- a/src/components/chat/ChatInput.tsx+++ b/src/components/chat/ChatInput.tsx@@ -1,20 +1,11 @@import { useState, useRef, useCallback } from "react";-import {- Mic,- SendHorizontal,- Search,- Globe,- ClipboardCheck,- Calendar,- FileText,- FilePlus,- FilePen,-} from "lucide-react";+import { Mic, SendHorizontal } from "lucide-react";import { useTranslation } from "react-i18next";import { cn } from "../lib/utils";import { useSettingsStore } from "../../stores/settingsStore";import { formatHotkeyLabel, isGlobeLikeHotkey } from "../../utils/hotkeys";import type { AgentState } from "./types";+import { toolIcons } from "./toolIcons";interface ChatInputProps {agentState: AgentState;@@ -25,16 +16,6 @@ interface ChatInputProps {showHotkey?: boolean;}-const toolIcons: Record<string, typeof Search> = {- search_notes: Search,- web_search: Globe,- copy_to_clipboard: ClipboardCheck,- get_calendar_events: Calendar,- get_note: FileText,- create_note: FilePlus,- update_note: FilePen,-};-function Kbd({ children }: { children: React.ReactNode }) {return (<kbddiff --git a/src/components/chat/ChatMessage.tsx b/src/components/chat/ChatMessage.tsxindex a1b50606e..2a83265c5 100644--- a/src/components/chat/ChatMessage.tsx+++ b/src/components/chat/ChatMessage.tsx@@ -4,12 +4,7 @@ import {Copy,Check,Search,- Globe,- ClipboardCheck,- Calendar,FileText,- FilePlus,- FilePen,ChevronDown,ChevronRight,CircleAlert,@@ -17,6 +12,7 @@ import {import { cn } from "../lib/utils";import { MarkdownRenderer } from "../ui/MarkdownRenderer";import type { ToolCallInfo } from "./types";+import { toolIcons } from "./toolIcons";interface ChatMessageProps {role: "user" | "assistant";@@ -25,16 +21,6 @@ interface ChatMessageProps {toolCalls?: ToolCallInfo[];}-const toolIcons: Record<string, typeof Search> = {- search_notes: Search,- web_search: Globe,- copy_to_clipboard: ClipboardCheck,- get_calendar_events: Calendar,- get_note: FileText,- create_note: FilePlus,- update_note: FilePen,-};-const NOTE_TOOLS = new Set(["create_note", "update_note", "get_note"]);function ToolCallStep({ toolCall }: { toolCall: ToolCallInfo }) {diff --git a/src/components/chat/ChatView.tsx b/src/components/chat/ChatView.tsxindex 9216ebdfd..df9aa61b7 100644--- a/src/components/chat/ChatView.tsx+++ b/src/components/chat/ChatView.tsx@@ -16,7 +16,7 @@ const platform = getCachedPlatform();export default function ChatView() {const { t } = useTranslation();const [activeConversationId, setActiveConversationId] = useState<number | null>(null);- const [activeTitle, setActiveTitle] = useState("Untitled");+ const [activeTitle, setActiveTitle] = useState(t("chat.untitled"));const [refreshKey, setRefreshKey] = useState(0);const { confirmDialog, showConfirmDialog, hideConfirmDialog } = useDialogs();@@ -49,9 +49,9 @@ export default function ChatView() {const handleNewChat = useCallback(() => {setActiveConversationId(null);- setActiveTitle("Untitled");+ setActiveTitle(t("chat.untitled"));persistence.handleNewChat();- }, [persistence]);+ }, [persistence, t]);const handleTextSubmit = useCallback(async (text: string) => {@@ -69,10 +69,10 @@ export default function ChatView() {isStreaming: false,};persistence.setMessages((prev) => [...prev, userMsg]);- persistence.saveUserMessage(text);+ await persistence.saveUserMessage(text);const allMessages = [...persistence.messages, userMsg];- streaming.sendToAI(text, allMessages);+ await streaming.sendToAI(text, allMessages);},[activeConversationId, persistence, streaming]);@@ -87,9 +87,13 @@ export default function ChatView() {[activeConversationId]);- const handleArchive = useCallback(async (_id: number) => {- // Archive not yet supported in the DB API- }, []);+ const handleArchive = useCallback(async (id: number) => {+ await window.electronAPI?.archiveAgentConversation?.(id);+ if (activeConversationId === id) {+ handleNewChat();+ }+ setRefreshKey((k) => k + 1);+ }, [activeConversationId, handleNewChat]);const handleDelete = useCallback((id: number) => {diff --git a/src/components/chat/ConversationItem.tsx b/src/components/chat/ConversationItem.tsxindex f0c2a7036..6df2963e9 100644--- a/src/components/chat/ConversationItem.tsx+++ b/src/components/chat/ConversationItem.tsx@@ -33,11 +33,12 @@ function formatTimestamp(dateStr: string): string {if (Number.isNaN(date.getTime())) return "";const now = new Date();const diff = now.getTime() - date.getTime();+ const seconds = Math.floor(diff / 1000);const minutes = Math.floor(diff / 60000);const hours = Math.floor(diff / 3600000);const days = Math.floor(diff / 86400000);- if (minutes < 1) return "now";+ if (seconds < 60) return "<1m";if (minutes < 60) return `${minutes}m`;if (hours < 24) return `${hours}h`;if (days < 7) return `${days}d`;diff --git a/src/components/chat/ConversationList.tsx b/src/components/chat/ConversationList.tsxindex f7d18c984..35fd2794e 100644--- a/src/components/chat/ConversationList.tsx+++ b/src/components/chat/ConversationList.tsx@@ -108,13 +108,16 @@ export default function ConversationList({const loadConversations = useCallback(async () => {try {- const result = await window.electronAPI.getAgentConversations?.(200);+ const result = await window.electronAPI?.getAgentConversationsWithPreview?.(200, 0, showArchived);if (result) {setConversations(result.map((c) => ({- ...c,- preview: undefined,- is_archived: false,+ id: c.id,+ title: c.title || "Untitled",+ preview: c.last_message,+ created_at: c.created_at,+ updated_at: c.updated_at,+ is_archived: !!(c.archived_at),})));}@@ -128,7 +131,7 @@ export default function ConversationList({showSkeletonTimer.current = null;}}- }, []);+ }, [showArchived]);useEffect(() => {setIsLoading(true);diff --git a/src/components/chat/toolIcons.ts b/src/components/chat/toolIcons.tsnew file mode 100644index 000000000..c01881107--- /dev/null+++ b/src/components/chat/toolIcons.ts@@ -0,0 +1,19 @@+import {+ Search,+ Globe,+ ClipboardCheck,+ Calendar,+ FileText,+ FilePlus,+ FilePen,+} from "lucide-react";++export const toolIcons: Record<string, typeof Search> = {+ search_notes: Search,+ web_search: Globe,+ copy_to_clipboard: ClipboardCheck,+ get_calendar_events: Calendar,+ get_note: FileText,+ create_note: FilePlus,+ update_note: FilePen,+};diff --git a/src/components/chat/types.ts b/src/components/chat/types.tsindex b2ca6a8c4..987630295 100644--- a/src/components/chat/types.ts+++ b/src/components/chat/types.ts@@ -22,3 +22,5 @@ export type AgentState =| "thinking"| "streaming"| "tool-executing";++export { toolIcons } from "./toolIcons";diff --git a/src/locales/de/translation.json b/src/locales/de/translation.jsonindex 0cccff0f4..191607247 100644--- a/src/locales/de/translation.json+++ b/src/locales/de/translation.json@@ -1753,7 +1753,8 @@"unarchive": "Dearchivieren","delete": "Löschen","deleteConfirm": "Diese Unterhaltung wird dauerhaft gelöscht. Dies kann nicht rückgängig gemacht werden.",- "editTitle": "Doppelklick zum Bearbeiten des Titels"+ "editTitle": "Doppelklick zum Bearbeiten des Titels",+ "untitled": "Ohne Titel"},"usage": {"approachingLimit": "Wochenlimit fast erreicht",diff --git a/src/locales/en/translation.json b/src/locales/en/translation.jsonindex 793ef3ec9..fb8a85663 100644--- a/src/locales/en/translation.json+++ b/src/locales/en/translation.json@@ -1541,7 +1541,8 @@"unarchive": "Unarchive","delete": "Delete","deleteConfirm": "This conversation will be permanently deleted. This cannot be undone.",- "editTitle": "Double-click to edit title"+ "editTitle": "Double-click to edit title",+ "untitled": "Untitled"},"referral": {"title": "Refer and earn rewards",diff --git a/src/locales/es/translation.json b/src/locales/es/translation.jsonindex a79fd6874..d979b1bda 100644--- a/src/locales/es/translation.json+++ b/src/locales/es/translation.json@@ -1753,7 +1753,8 @@"unarchive": "Desarchivar","delete": "Eliminar","deleteConfirm": "Esta conversación se eliminará permanentemente. No se puede deshacer.",- "editTitle": "Doble clic para editar el título"+ "editTitle": "Doble clic para editar el título",+ "untitled": "Sin título"},"usage": {"approachingLimit": "Cerca del límite semanal",diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.jsonindex 9fdc11707..853bd4914 100644--- a/src/locales/fr/translation.json+++ b/src/locales/fr/translation.json@@ -1493,7 +1493,8 @@"unarchive": "Désarchiver","delete": "Supprimer","deleteConfirm": "Cette conversation sera définitivement supprimée. Cette action est irréversible.",- "editTitle": "Double-cliquez pour modifier le titre"+ "editTitle": "Double-cliquez pour modifier le titre",+ "untitled": "Sans titre"},"referral": {"title": "Parrainez et gagnez des récompenses",diff --git a/src/locales/it/translation.json b/src/locales/it/translation.jsonindex b4f87c422..4644afbf2 100644--- a/src/locales/it/translation.json+++ b/src/locales/it/translation.json@@ -1753,7 +1753,8 @@"unarchive": "Ripristina","delete": "Elimina","deleteConfirm": "Questa conversazione verrà eliminata permanentemente. Non è possibile annullare.",- "editTitle": "Doppio clic per modificare il titolo"+ "editTitle": "Doppio clic per modificare il titolo",+ "untitled": "Senza titolo"},"usage": {"approachingLimit": "Limite settimanale quasi raggiunto",diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.jsonindex 408d54e8c..d3daa92f7 100644--- a/src/locales/ja/translation.json+++ b/src/locales/ja/translation.json@@ -1753,7 +1753,8 @@"unarchive": "アーカイブ解除","delete": "削除","deleteConfirm": "この会話は完全に削除されます。元に戻すことはできません。",- "editTitle": "ダブルクリックでタイトルを編集"+ "editTitle": "ダブルクリックでタイトルを編集",+ "untitled": "無題"},"usage": {"approachingLimit": "週間制限に近づいています",diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.jsonindex 7683a1348..1bdd2cdc2 100644--- a/src/locales/pt/translation.json+++ b/src/locales/pt/translation.json@@ -1753,7 +1753,8 @@"unarchive": "Desarquivar","delete": "Excluir","deleteConfirm": "Esta conversa será excluída permanentemente. Não é possível desfazer.",- "editTitle": "Clique duplo para editar o título"+ "editTitle": "Clique duplo para editar o título",+ "untitled": "Sem título"},"usage": {"approachingLimit": "Próximo do limite semanal",diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.jsonindex 7f15d2e50..76fb471aa 100644--- a/src/locales/ru/translation.json+++ b/src/locales/ru/translation.json@@ -1753,7 +1753,8 @@"unarchive": "Из архива","delete": "Удалить","deleteConfirm": "Эта беседа будет удалена навсегда. Отменить действие невозможно.",- "editTitle": "Двойной клик для редактирования названия"+ "editTitle": "Двойной клик для редактирования названия",+ "untitled": "Без названия"},"usage": {"approachingLimit": "Приближается недельный лимит",diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.jsonindex 79afac049..5916023ae 100644--- a/src/locales/zh-CN/translation.json+++ b/src/locales/zh-CN/translation.json@@ -992,7 +992,12 @@"annualEquivalent": "$16.67","includesPrefix": "所有 Pro 功能 +","badge": "最受欢迎",- "features": ["无限会议录制", "代理模式", "与您的数据对话(即将推出)", "优先支持"],+ "features": [+ "无限会议录制",+ "代理模式",+ "与您的数据对话(即将推出)",+ "优先支持"+ ],"cta": "开始使用","switchToAnnual": "切换为年付"},@@ -1748,7 +1753,8 @@"unarchive": "取消归档","delete": "删除","deleteConfirm": "此对话将被永久删除,无法撤消。",- "editTitle": "双击编辑标题"+ "editTitle": "双击编辑标题",+ "untitled": "无标题"},"usage": {"approachingLimit": "即将达到周限额",diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.jsonindex 818b8208d..104298420 100644--- a/src/locales/zh-TW/translation.json+++ b/src/locales/zh-TW/translation.json@@ -992,7 +992,12 @@"annualEquivalent": "$16.67","includesPrefix": "所有 Pro 功能 +","badge": "最熱門",- "features": ["無限會議錄製", "代理模式", "與您的資料對話(即將推出)", "優先支援"],+ "features": [+ "無限會議錄製",+ "代理模式",+ "與您的資料對話(即將推出)",+ "優先支援"+ ],"cta": "開始使用","switchToAnnual": "切換為年付"},@@ -1748,7 +1753,8 @@"unarchive": "取消封存","delete": "刪除","deleteConfirm": "此對話將被永久刪除,無法復原。",- "editTitle": "雙擊編輯標題"+ "editTitle": "雙擊編輯標題",+ "untitled": "無標題"},"usage": {"approachingLimit": "即將達到每週上限",