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
cleanup: cleaned up dev logging
Gabriel Stein328e5b926f61
diff --git a/CHANGELOG.md b/CHANGELOG.mdnew file mode 100644index 000000000..26ea419a4--- /dev/null+++ b/CHANGELOG.md@@ -0,0 +1,65 @@+# Changelog++All notable changes to this project will be documented in this file.++The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),+and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).++## [Unreleased]++### Changed+- **[BREAKING]** Project rebranded from "OpenScribe" to "OpenWispr"+- Cleaned up excessive developer logging for better user experience+- Improved console output clarity by removing verbose operational messages++### Fixed+- Reduced console noise while preserving essential error handling+- Maintained all critical debugging information for troubleshooting++### Technical Details+- Removed routine operational confirmations from App.jsx+- Cleaned up verbose success messages in ControlPanel.tsx+- Streamlined environment loading and system setup logging in main.js+- Preserved all error messages, database operations, and accessibility features+- Maintained appropriate logging for open-source project debugging++## [0.1.0] - 2024-XX-XX++### Added+- Initial release of OpenWispr (formerly OpenScribe)+- Desktop dictation application using OpenAI Whisper+- Local and cloud-based speech-to-text transcription+- Real-time audio recording and processing+- Automatic text pasting via accessibility features+- SQLite database for transcription history+- macOS tray icon integration+- Global hotkey support (backtick key)+- Control panel for settings and configuration+- Local Whisper model management+- OpenAI API integration+- Cross-platform support (macOS, Windows, Linux)++### Features+- **Speech-to-Text**: Convert voice to text using OpenAI Whisper+- **Dual Processing**: Choose between local processing (private) or cloud processing (fast)+- **Model Management**: Download and manage local Whisper models (tiny, base, small, medium, large)+- **Transcription History**: View, copy, and delete past transcriptions+- **Accessibility Integration**: Automatic text pasting with proper permission handling+- **API Key Management**: Secure storage and management of OpenAI API keys+- **Real-time UI**: Live feedback during recording and processing+- **Global Hotkey**: Quick access via customizable keyboard shortcut+- **Database Storage**: Persistent storage of transcriptions with SQLite+- **Permission Management**: Streamlined macOS accessibility permission setup++### Technical Stack+- **Frontend**: React 19, Vite, TailwindCSS, Shadcn/UI components+- **Backend**: Electron 36, Node.js+- **Database**: better-sqlite3 for local storage+- **AI Processing**: OpenAI Whisper (local and API)+- **Build System**: Electron Builder for cross-platform packaging++### Security+- Local-first approach with optional cloud processing+- Secure API key storage and management+- Sandboxed renderer processes with context isolation+- Proper clipboard and accessibility permission handlingdiff --git a/main.js b/main.jsindex efbddde4c..27e73fbc1 100644--- a/main.js+++ b/main.js@@ -23,32 +23,16 @@ function loadEnvironmentVariables() {try {const fs = require('fs');if (fs.existsSync(envPath)) {- console.log(`π Trying to load .env from: ${envPath}`);const result = require('dotenv').config({ path: envPath });if (!result.error) {- console.log(`β .env file loaded successfully from: ${envPath}`);envLoaded = true;break;- } else {- console.log(`β οΈ .env file found but failed to parse: ${envPath}`, result.error);}}} catch (error) {- console.log(`β Could not load .env from ${envPath}:`, error.message);+ // Continue to next path}}-- if (!envLoaded) {- console.log('β οΈ No .env file found in any expected location');- console.log('π‘ You can still set the API key via the Control Panel');- console.log('π Expected locations:', possibleEnvPaths);- }-- console.log('π Environment:', process.env.NODE_ENV || 'production');- console.log('π OpenAI API Key present:', process.env.OPENAI_API_KEY ? 'Yes' : 'No');- if (process.env.OPENAI_API_KEY) {- console.log('π OpenAI API Key preview:', process.env.OPENAI_API_KEY.substring(0, 10) + '...');- }}// Load environment variables@@ -87,9 +71,7 @@ function getAppUrl(isControlPanel = false) {// __dirname in packaged app points to the root of app.asarconst htmlPath = path.join(__dirname, 'src', 'dist', 'index.html');- console.log('Loading HTML from:', htmlPath);- console.log('__dirname:', __dirname);- console.log('process.resourcesPath:', process.resourcesPath);+ // Production build pathsreturn isControlPanel? `file://${htmlPath}?panel=true`@@ -105,11 +87,7 @@ async function createWindow() {const x = display.bounds.x + Math.round((display.workArea.width - width) / 2);const y = Math.max(0, display.workArea.height); // Position above the dock/menu bar with padding- console.log('Display info:', {- bounds: display.bounds,- workArea: display.workArea,- windowPosition: { x, y, width, height }- });+ // Window positioning calculatedmainWindow = new BrowserWindow({width,@@ -134,10 +112,7 @@ async function createWindow() {// Load URL with retry logic for developmentconst loadMainWindow = async () => {const appUrl = getAppUrl(false);- console.log('Loading main window URL:', appUrl);-if (process.env.NODE_ENV === 'development') {- console.log('Development mode: waiting for dev server...');const isReady = await waitForDevServer('http://localhost:5174/');if (!isReady) {console.error('Dev server not ready, loading anyway...');@@ -236,7 +211,7 @@ async function createControlPanelWindow() {// Load control panel with same retry logicconst loadControlPanel = async () => {const appUrl = getAppUrl(true);- console.log('Loading control panel URL:', appUrl);+ // Loading control panelif (process.env.NODE_ENV === 'development') {const isReady = await waitForDevServer('http://localhost:5174/');@@ -265,8 +240,7 @@ function initDatabase() {: 'transcriptions.db';const dbPath = path.join(app.getPath('userData'), dbFileName);- console.log(`ποΈ Database environment: ${process.env.NODE_ENV || 'production'}`);- console.log('π Database path:', dbPath);+ // Database initializationdb = new Database(dbPath);@@ -288,10 +262,6 @@ function initDatabase() {}app.whenReady().then(async () => {- console.log('Electron app ready, creating window...');- console.log('__dirname:', __dirname);- console.log('process.resourcesPath:', process.resourcesPath);- console.log('NODE_ENV:', process.env.NODE_ENV);// Initialize databasetry {@@ -302,13 +272,11 @@ app.whenReady().then(async () => {// In development, add a small delay to let Vite start properlyif (process.env.NODE_ENV === 'development') {- console.log('Development mode: waiting 2 seconds for Vite to stabilize...');await new Promise(resolve => setTimeout(resolve, 2000));}try {await createWindow();- console.log('Main window created successfully');} catch (error) {console.error('Error creating main window:', error);}@@ -323,7 +291,6 @@ app.whenReady().then(async () => {if (process.env.NODE_ENV === 'development') {// Development mode - load from assets folderconst iconPath = path.join(__dirname, 'assets', 'iconTemplate.png');- console.log('Development: Loading tray icon from:', iconPath);trayIcon = nativeImage.createFromPath(iconPath);} else {// Production mode - try different locations for the icon@@ -351,7 +318,6 @@ app.whenReady().then(async () => {}if (iconPath) {- console.log('Production: Loading tray icon from:', iconPath);trayIcon = nativeImage.createFromPath(iconPath);} else {console.error('Could not find tray icon in any expected location');@@ -383,10 +349,8 @@ app.whenReady().then(async () => {}mainWindow.focus();});- console.log('Tray icon created successfully');} catch (error) {console.error('Error creating tray icon:', error);- console.log('Tray will not be available');}}})diff --git a/src/App.jsx b/src/App.jsxindex 574f10cfe..c487c9dba 100644--- a/src/App.jsx+++ b/src/App.jsx@@ -16,21 +16,17 @@ export default function App() {const startRecording = async () => {try {- console.log("Starting recording...")setError('');const stream = await navigator.mediaDevices.getUserMedia({ audio: true });- console.log("Microphone access granted")mediaRecorderRef.current = new window.MediaRecorder(stream);audioChunksRef.current = [];mediaRecorderRef.current.ondataavailable = (event) => {- console.log("Audio data chunk received, size:", event.data.size)audioChunksRef.current.push(event.data);};mediaRecorderRef.current.onstop = async () => {- console.log("Recording stopped, processing audio...")const audioBlob = new Blob(audioChunksRef.current, { type: 'audio/wav' });await processAudio(audioBlob);stream.getTracks().forEach(track => track.stop());@@ -38,7 +34,6 @@ export default function App() {mediaRecorderRef.current.start();setIsRecording(true);- console.log("Recording started successfully")} catch (err) {console.error("Recording error:", err)setError('Failed to access microphone: ' + err.message);@@ -63,17 +58,13 @@ export default function App() {const processAudio = async (audioBlob) => {try {- console.log("Processing audio blob, size:", audioBlob.size)-// Check if local Whisper is available and user preferenceconst useLocalWhisper = localStorage.getItem('useLocalWhisper') === 'true';const whisperModel = localStorage.getItem('whisperModel') || 'base';if (useLocalWhisper) {- console.log("Using local Whisper model:", whisperModel);await processWithLocalWhisper(audioBlob, whisperModel);} else {- console.log("Using OpenAI Whisper API");await processWithOpenAIAPI(audioBlob);}@@ -87,8 +78,6 @@ export default function App() {const processWithLocalWhisper = async (audioBlob, model = 'base') => {try {- console.log("Starting local Whisper transcription...");-// Check Whisper installation firstconst installCheck = await window.electronAPI.checkWhisperInstallation();if (!installCheck.installed || !installCheck.working) {@@ -100,7 +89,6 @@ export default function App() {if (result.success && result.text) {const text = result.text.trim();- console.log("Local Whisper transcription result:", text)if (text) {setTranscript(text);@@ -108,7 +96,6 @@ export default function App() {// Save transcription to databasetry {await window.electronAPI.saveTranscription(text);- console.log("β Transcription saved to database");} catch (err) {console.error("Failed to save transcription:", err);}@@ -125,7 +112,6 @@ export default function App() {} catch (err) {console.error("Local Whisper error:", err);// Fallback to OpenAI API if local fails- console.log("Falling back to OpenAI API...");setError('Local Whisper failed, trying OpenAI API...');await processWithOpenAIAPI(audioBlob);}@@ -150,7 +136,6 @@ export default function App() {return;}- console.log("Sending request to OpenAI Whisper API...")const response = await fetch('https://api.openai.com/v1/audio/transcriptions', {method: 'POST',headers: {@@ -159,7 +144,6 @@ export default function App() {body: formData});- console.log("Response status:", response.status)if (!response.ok) {const errorText = await response.text()console.error("API Error:", errorText)@@ -168,17 +152,14 @@ export default function App() {}const result = await response.json();- console.log("Transcription result:", result)const text = result.text.trim();if (text) {setTranscript(text);- console.log("Transcribed text:", text)// Save transcription to databasetry {await window.electronAPI.saveTranscription(text);- console.log("β Transcription saved to database");} catch (err) {console.error("Failed to save transcription:", err);}@@ -187,7 +168,6 @@ export default function App() {await safePaste(text);} else {setError('No text transcribed. Try again.');- console.log("No text transcribed")}} catch (err) {console.error("OpenAI API error:", err)diff --git a/src/components/ControlPanel.tsx b/src/components/ControlPanel.tsxindex 8c7f7e2a8..2c8423d48 100644--- a/src/components/ControlPanel.tsx+++ b/src/components/ControlPanel.tsx@@ -3,7 +3,19 @@ import { Card, CardContent, CardHeader, CardTitle } from "./ui/card";import { Button } from "./ui/button";import { Input } from "./ui/input";import { Tooltip } from "./ui/tooltip";-import { Copy, Trash2, RefreshCw, Download, Check, X, Settings, Keyboard, FileText, Info, Mic } from "lucide-react";+import {+ Copy,+ Trash2,+ RefreshCw,+ Download,+ Check,+ X,+ Settings,+ Keyboard,+ FileText,+ Info,+ Mic,+} from "lucide-react";// Type declaration for electronAPIdeclare global {@@ -12,7 +24,9 @@ declare global {pasteText: (text: string) => Promise<void>;hideWindow: () => Promise<void>;onToggleDictation: (callback: () => void) => void;- saveTranscription: (text: string) => Promise<{ id: number; success: boolean }>;+ saveTranscription: (+ text: string+ ) => Promise<{ id: number; success: boolean }>;getTranscriptions: (limit?: number) => Promise<TranscriptionItem[]>;clearTranscriptions: () => Promise<{ cleared: number; success: boolean }>;deleteTranscription: (id: number) => Promise<{ success: boolean }>;@@ -21,14 +35,68 @@ declare global {readClipboard: () => Promise<string>;createProductionEnvFile: (key: string) => Promise<void>;transcribeLocalWhisper: (audioBlob: Blob, options?: any) => Promise<any>;- checkWhisperInstallation: () => Promise<{ installed: boolean; working: boolean; error?: string }>;- installWhisper: () => Promise<{ success: boolean; message: string; output: string }>;- onWhisperInstallProgress: (callback: (event: any, data: { type: string; message: string; output?: string }) => void) => void;- downloadWhisperModel: (modelName: string) => Promise<{ success: boolean; model: string; downloaded: boolean; size_mb?: number; error?: string }>;- onWhisperDownloadProgress: (callback: (event: any, data: { type: string; model: string; percentage?: number; downloaded_bytes?: number; total_bytes?: number; error?: string; result?: any }) => void) => void;- checkModelStatus: (modelName: string) => Promise<{ success: boolean; model: string; downloaded: boolean; size_mb?: number; error?: string }>;- listWhisperModels: () => Promise<{ success: boolean; models: Array<{ model: string; downloaded: boolean; size_mb?: number }>; cache_dir: string }>;- deleteWhisperModel: (modelName: string) => Promise<{ success: boolean; model: string; deleted: boolean; freed_mb?: number; error?: string }>;+ checkWhisperInstallation: () => Promise<{+ installed: boolean;+ working: boolean;+ error?: string;+ }>;+ installWhisper: () => Promise<{+ success: boolean;+ message: string;+ output: string;+ }>;+ onWhisperInstallProgress: (+ callback: (+ event: any,+ data: { type: string; message: string; output?: string }+ ) => void+ ) => void;+ downloadWhisperModel: (+ modelName: string+ ) => Promise<{+ success: boolean;+ model: string;+ downloaded: boolean;+ size_mb?: number;+ error?: string;+ }>;+ onWhisperDownloadProgress: (+ callback: (+ event: any,+ data: {+ type: string;+ model: string;+ percentage?: number;+ downloaded_bytes?: number;+ total_bytes?: number;+ error?: string;+ result?: any;+ }+ ) => void+ ) => void;+ checkModelStatus: (+ modelName: string+ ) => Promise<{+ success: boolean;+ model: string;+ downloaded: boolean;+ size_mb?: number;+ error?: string;+ }>;+ listWhisperModels: () => Promise<{+ success: boolean;+ models: Array<{ model: string; downloaded: boolean; size_mb?: number }>;+ cache_dir: string;+ }>;+ deleteWhisperModel: (+ modelName: string+ ) => Promise<{+ success: boolean;+ model: string;+ deleted: boolean;+ freed_mb?: number;+ error?: string;+ }>;};}}@@ -49,68 +117,68 @@ export default function ControlPanel() {const [whisperModel, setWhisperModel] = useState("base");const [whisperInstalled, setWhisperInstalled] = useState(false);const [checkingWhisper, setCheckingWhisper] = useState(false);- const [modelList, setModelList] = useState<Array<{ model: string; downloaded: boolean; size_mb?: number }>>([]);+ const [modelList, setModelList] = useState<+ Array<{ model: string; downloaded: boolean; size_mb?: number }>+ >([]);const [downloadingModel, setDownloadingModel] = useState<string | null>(null);const [downloadProgress, setDownloadProgress] = useState(0);const [loadingModels, setLoadingModels] = useState(false);const [installingWhisper, setInstallingWhisper] = useState(false);- const [installProgress, setInstallProgress] = useState<string>('');+ const [installProgress, setInstallProgress] = useState<string>("");useEffect(() => {// Load saved settings- const savedKey = localStorage.getItem('dictationKey');+ const savedKey = localStorage.getItem("dictationKey");if (savedKey) setKey(savedKey);-+// Load Whisper settings- const savedUseLocal = localStorage.getItem('useLocalWhisper') === 'true';- const savedModel = localStorage.getItem('whisperModel') || 'base';+ const savedUseLocal = localStorage.getItem("useLocalWhisper") === "true";+ const savedModel = localStorage.getItem("whisperModel") || "base";setUseLocalWhisper(savedUseLocal);setWhisperModel(savedModel);-+// Load API key from main process first, then fallback to localStorageconst loadApiKey = async () => {try {const envApiKey = await window.electronAPI.getOpenAIKey();- if (envApiKey && envApiKey !== 'your_openai_api_key_here') {+ if (envApiKey && envApiKey !== "your_openai_api_key_here") {setApiKey(envApiKey);} else {- const savedApiKey = localStorage.getItem('openaiApiKey');+ const savedApiKey = localStorage.getItem("openaiApiKey");if (savedApiKey) setApiKey(savedApiKey);}} catch (error) {- console.error('Failed to load API key:', error);- const savedApiKey = localStorage.getItem('openaiApiKey');+ const savedApiKey = localStorage.getItem("openaiApiKey");if (savedApiKey) setApiKey(savedApiKey);}};-+loadApiKey();-+// Load transcription history from databaseloadTranscriptions();-+// Check Whisper installationcheckWhisperInstallation();-+// Set up progress listener for Whisper installationwindow.electronAPI.onWhisperInstallProgress((event, data) => {setInstallProgress(data.message);});-+// Set up progress listener for model downloadswindow.electronAPI.onWhisperDownloadProgress((event, data) => {- if (data.type === 'progress') {+ if (data.type === "progress") {// Force re-render by setting both state valuessetDownloadProgress(data.percentage || 0);- } else if (data.type === 'complete') {+ } else if (data.type === "complete") {setDownloadingModel(null);setDownloadProgress(0);// Refresh model list after successful downloadloadModelList();- } else if (data.type === 'error') {+ } else if (data.type === "error") {setDownloadingModel(null);setDownloadProgress(0);- console.error('Download error:', data.error);}});}, []);@@ -120,9 +188,7 @@ export default function ControlPanel() {setIsLoading(true);const transcriptions = await window.electronAPI.getTranscriptions(50);setHistory(transcriptions);- console.log('π Loaded', transcriptions.length, 'transcriptions');} catch (error) {- console.error('β Failed to load transcriptions:', error);} finally {setIsLoading(false);}@@ -133,14 +199,12 @@ export default function ControlPanel() {setCheckingWhisper(true);const result = await window.electronAPI.checkWhisperInstallation();setWhisperInstalled(result.installed && result.working);- console.log('π Whisper installation check:', result);-+// If Whisper is installed, also load model listif (result.installed && result.working) {loadModelList();}} catch (error) {- console.error('β Failed to check Whisper installation:', error);setWhisperInstalled(false);} finally {setCheckingWhisper(false);@@ -153,10 +217,8 @@ export default function ControlPanel() {const result = await window.electronAPI.listWhisperModels();if (result.success) {setModelList(result.models);- console.log('π Model list loaded:', result.models);}} catch (error) {- console.error('β Failed to load model list:', error);} finally {setLoadingModels(false);}@@ -165,42 +227,43 @@ export default function ControlPanel() {const installWhisper = async () => {try {setInstallingWhisper(true);- setInstallProgress('Starting Whisper installation...');- console.log('π§ Installing Whisper automatically...');-+ setInstallProgress("Starting Whisper installation...");+const result = await window.electronAPI.installWhisper();-+if (result.success) {- alert('β Whisper installed successfully! You can now download and use local models.');+ alert(+ "β Whisper installed successfully! You can now download and use local models."+ );// Recheck installation statuscheckWhisperInstallation();} else {alert(`β Failed to install Whisper: ${result.message}`);}} catch (error) {- console.error('β Whisper installation error:', error);alert(`β Failed to install Whisper: ${error}`);} finally {setInstallingWhisper(false);- setInstallProgress('');+ setInstallProgress("");}};const downloadModel = async (modelName: string) => {try {setDownloadingModel(modelName);-+const result = await window.electronAPI.downloadWhisperModel(modelName);-+if (result.success) {- alert(`β Model "${modelName}" downloaded successfully! (${result.size_mb}MB)`);+ alert(+ `β Model "${modelName}" downloaded successfully! (${result.size_mb}MB)`+ );// Refresh model listloadModelList();} else {alert(`β Failed to download model "${modelName}": ${result.error}`);}} catch (error) {- console.error('β Model download error:', error);alert(`β Failed to download model "${modelName}": ${error}`);} finally {setDownloadingModel(null);@@ -208,26 +271,31 @@ export default function ControlPanel() {};const deleteModel = async (modelName: string) => {- if (confirm(`Are you sure you want to delete the "${modelName}" model? This will free up disk space but you'll need to re-download it if you want to use it again.`)) {+ if (+ confirm(+ `Are you sure you want to delete the "${modelName}" model? This will free up disk space but you'll need to re-download it if you want to use it again.`+ )+ ) {try {const result = await window.electronAPI.deleteWhisperModel(modelName);-+if (result.success) {- alert(`β Model "${modelName}" deleted successfully! Freed ${result.freed_mb}MB of disk space.`);+ alert(+ `β Model "${modelName}" deleted successfully! Freed ${result.freed_mb}MB of disk space.`+ );// Refresh model listloadModelList();} else {alert(`β Failed to delete model "${modelName}": ${result.error}`);}} catch (error) {- console.error('β Model delete error:', error);alert(`β Failed to delete model "${modelName}": ${error}`);}}};const saveKey = () => {- localStorage.setItem('dictationKey', key);+ localStorage.setItem("dictationKey", key);alert(`Dictation key inscribed: ${key}`);};@@ -236,49 +304,61 @@ export default function ControlPanel() {// Save to main process (updates environment variable)await window.electronAPI.saveOpenAIKey(apiKey);// Also save to localStorage as backup- localStorage.setItem('openaiApiKey', apiKey);-+ localStorage.setItem("openaiApiKey", apiKey);+// In production, try to create a .env file in user data directorytry {await window.electronAPI.createProductionEnvFile(apiKey);- alert('OpenAI API key inscribed successfully! Your credentials have been securely recorded for transcription services.');+ alert(+ "OpenAI API key inscribed successfully! Your credentials have been securely recorded for transcription services."+ );} catch (envError) {- console.log('Could not create production .env file:', envError);- alert('OpenAI API key saved successfully and will be available for transcription');+ console.log("Could not create production .env file:", envError);+ alert(+ "OpenAI API key saved successfully and will be available for transcription"+ );}} catch (error) {- console.error('Failed to save API key:', error);+ console.error("Failed to save API key:", error);// Fallback to localStorage only- localStorage.setItem('openaiApiKey', apiKey);- alert('OpenAI API key saved to localStorage (fallback mode)');+ localStorage.setItem("openaiApiKey", apiKey);+ alert("OpenAI API key saved to localStorage (fallback mode)");}};const saveWhisperSettings = () => {- localStorage.setItem('useLocalWhisper', useLocalWhisper.toString());- localStorage.setItem('whisperModel', whisperModel);- alert(`Whisper settings saved! ${useLocalWhisper ? `Using local model: ${whisperModel}` : 'Using OpenAI API'}`);+ localStorage.setItem("useLocalWhisper", useLocalWhisper.toString());+ localStorage.setItem("whisperModel", whisperModel);+ alert(+ `Whisper settings saved! ${+ useLocalWhisper+ ? `Using local model: ${whisperModel}`+ : "Using OpenAI API"+ }`+ );};const copyToClipboard = async (text: string) => {try {await navigator.clipboard.writeText(text);- alert('Text copied to your scribal collection!');- } catch (err) {- console.error('Failed to copy:', err);- }+ alert("Text copied to your scribal collection!");+ } catch (err) {}};const clearHistory = async () => {- if (confirm('Are you certain you wish to clear all inscribed records? This action cannot be undone.')) {+ if (+ confirm(+ "Are you certain you wish to clear all inscribed records? This action cannot be undone."+ )+ ) {try {const result = await window.electronAPI.clearTranscriptions();- console.log(`ποΈ Cleared ${result.cleared} transcriptions`);setHistory([]);- alert(`Successfully cleared ${result.cleared} transcriptions from your chronicles.`);+ alert(+ `Successfully cleared ${result.cleared} transcriptions from your chronicles.`+ );} catch (error) {- console.error('β Failed to clear transcriptions:', error);- alert('Failed to clear history. Please try again.');+ alert("Failed to clear history. Please try again.");}}};@@ -286,19 +366,25 @@ export default function ControlPanel() {const requestPermissions = async () => {try {await navigator.mediaDevices.getUserMedia({ audio: true });- alert('Microphone access granted! Your voice may now be inscribed.');+ alert("Microphone access granted! Your voice may now be inscribed.");} catch (err) {- alert('Please grant microphone permissions to enable voice inscription.');+ alert("Please grant microphone permissions to enable voice inscription.");}};const requestAccessibilityPermissions = async () => {try {// Test if pasting works- await window.electronAPI.pasteText('Test inscription - please verify this appears in another application');- alert('Accessibility permissions appear to be working! Check if the test inscription appeared in another app.');+ await window.electronAPI.pasteText(+ "Test inscription - please verify this appears in another application"+ );+ alert(+ "Accessibility permissions appear to be working! Check if the test inscription appeared in another app."+ );} catch (err) {- alert('Accessibility permissions required! The app will guide you through granting the necessary privileges for automatic text inscription.');+ alert(+ "Accessibility permissions required! The app will guide you through granting the necessary privileges for automatic text inscription."+ );}};@@ -341,48 +427,58 @@ Click OK when you're ready to open System Settings.`;// Try to open the accessibility settings directlyconst commands = ['open "x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility"',- 'open -b com.apple.systempreferences',- 'open "/System/Library/PreferencePanes/Security.prefPane"'+ "open -b com.apple.systempreferences",+ 'open "/System/Library/PreferencePanes/Security.prefPane"',];-+// We can't directly execute these from the renderer, but we can guide the user- alert('Opening System Settings... Look for the Accessibility section under Privacy & Security.');-+ alert(+ "Opening System Settings... Look for the Accessibility section under Privacy & Security."+ );+// Try the URL scheme approach- window.open('x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility', '_blank');+ window.open(+ "x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility",+ "_blank"+ );}};const deleteTranscription = async (id: number) => {- if (confirm('Are you certain you wish to remove this inscription from your records?')) {+ if (+ confirm(+ "Are you certain you wish to remove this inscription from your records?"+ )+ ) {try {const result = await window.electronAPI.deleteTranscription(id);if (result.success) {// Remove from local state- setHistory(prev => prev.filter(item => item.id !== id));+ setHistory((prev) => prev.filter((item) => item.id !== id));console.log(`ποΈ Deleted transcription ${id}`);} else {- alert('Failed to delete transcription. It may have already been removed.');+ alert(+ "Failed to delete transcription. It may have already been removed."+ );}} catch (error) {- console.error('β Failed to delete transcription:', error);- alert('Failed to delete transcription. Please try again.');+ console.error("β Failed to delete transcription:", error);+ alert("Failed to delete transcription. Please try again.");}}};const refreshHistory = async () => {- console.log('π Refreshing transcription history...');+ console.log("π Refreshing transcription history...");await loadTranscriptions();};// Enhanced keyboard paste handler for API key inputconst handleApiKeyKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {// Handle Cmd+V on Mac or Ctrl+V on Windows/Linux- if ((e.metaKey || e.ctrlKey) && e.key === 'v') {+ if ((e.metaKey || e.ctrlKey) && e.key === "v") {e.preventDefault(); // Prevent default to handle manually- console.log('Paste shortcut detected, attempting manual paste...');-+// Try to paste from clipboardsetTimeout(async () => {try {@@ -390,19 +486,14 @@ Click OK when you're ready to open System Settings.`;const text = await window.electronAPI.readClipboard();if (text && text.trim()) {setApiKey(text.trim());- console.log('β Keyboard paste successful via Electron clipboard');} else {// Fallback to web clipboard APIconst webText = await navigator.clipboard.readText();if (webText && webText.trim()) {setApiKey(webText.trim());- console.log('β Keyboard paste successful via Web API');}}- } catch (err) {- console.error('β Keyboard paste failed:', err);- // Don't show alert for keyboard shortcuts, just log the error- }+ } catch (err) {}}, 0);}};@@ -410,7 +501,6 @@ Click OK when you're ready to open System Settings.`;return (<div className="min-h-screen bg-gradient-to-br from-neutral-50 via-white to-indigo-50/30 p-6"><div className="max-w-4xl mx-auto space-y-6">-{/* Header */}<div className="text-center mb-10"><div className="flex items-center justify-center mb-6">@@ -421,9 +511,7 @@ Click OK when you're ready to open System Settings.`;<h1 className="text-3xl font-semibold text-neutral-900 mb-2">OpenWispr</h1>- <p className="text-neutral-600">- Your voice, your data, your AI- </p>+ <p className="text-neutral-600">Your voice, your data, your AI</p></div>{/* Transcription Setup Card */}@@ -434,7 +522,8 @@ Click OK when you're ready to open System Settings.`;Transcription Setup</CardTitle><p className="text-sm text-neutral-600 mt-2 leading-relaxed">- Choose how you want to convert speech to text. You can always change this later.+ Choose how you want to convert speech to text. You can always+ change this later.</p></CardHeader><CardContent className="space-y-6">@@ -448,34 +537,44 @@ Click OK when you're ready to open System Settings.`;<buttononClick={() => setUseLocalWhisper(false)}className={`p-4 border-2 rounded-xl text-left transition-all ${- !useLocalWhisper- ? 'border-indigo-500 bg-indigo-50'- : 'border-neutral-200 bg-white hover:border-neutral-300'+ !useLocalWhisper+ ? "border-indigo-500 bg-indigo-50"+ : "border-neutral-200 bg-white hover:border-neutral-300"}`}><div className="flex items-center justify-between mb-2">- <h4 className="font-medium text-neutral-900">Cloud Processing</h4>- <span className="text-xs text-green-600 bg-green-100 px-2 py-1 rounded-full">Fastest</span>+ <h4 className="font-medium text-neutral-900">+ Cloud Processing+ </h4>+ <span className="text-xs text-green-600 bg-green-100 px-2 py-1 rounded-full">+ Fastest+ </span></div><p className="text-sm text-neutral-600">- Audio sent to OpenAI servers. Faster processing, requires API key.+ Audio sent to OpenAI servers. Faster processing, requires+ API key.</p></button>-+<buttononClick={() => setUseLocalWhisper(true)}className={`p-4 border-2 rounded-xl text-left transition-all ${- useLocalWhisper- ? 'border-indigo-500 bg-indigo-50'- : 'border-neutral-200 bg-white hover:border-neutral-300'+ useLocalWhisper+ ? "border-indigo-500 bg-indigo-50"+ : "border-neutral-200 bg-white hover:border-neutral-300"}`}><div className="flex items-center justify-between mb-2">- <h4 className="font-medium text-neutral-900">Local Processing</h4>- <span className="text-xs text-blue-600 bg-blue-100 px-2 py-1 rounded-full">Private</span>+ <h4 className="font-medium text-neutral-900">+ Local Processing+ </h4>+ <span className="text-xs text-blue-600 bg-blue-100 px-2 py-1 rounded-full">+ Private+ </span></div><p className="text-sm text-neutral-600">- Audio stays on your device. Complete privacy, works offline.+ Audio stays on your device. Complete privacy, works+ offline.</p></button></div>@@ -484,7 +583,9 @@ Click OK when you're ready to open System Settings.`;{/* Cloud Configuration */}{!useLocalWhisper && (<div className="space-y-4 p-4 bg-blue-50 border border-blue-200 rounded-xl">- <h4 className="font-medium text-blue-900">OpenAI API Setup</h4>+ <h4 className="font-medium text-blue-900">+ OpenAI API Setup+ </h4><div><label className="block text-sm font-medium text-blue-800 mb-2">API Key@@ -497,22 +598,30 @@ Click OK when you're ready to open System Settings.`;onChange={(e) => setApiKey(e.target.value)}className="flex-1"/>- <Button+ <Buttonvariant="outline"onClick={async () => {try {- const text = await window.electronAPI.readClipboard();+ const text =+ await window.electronAPI.readClipboard();if (text && text.trim()) {setApiKey(text.trim());- console.log('Manual paste successful via Electron');+ console.log(+ "Manual paste successful via Electron"+ );} else {- const webText = await navigator.clipboard.readText();+ const webText =+ await navigator.clipboard.readText();setApiKey(webText.trim());- console.log('Manual paste successful via Web API');+ console.log(+ "Manual paste successful via Web API"+ );}} catch (err) {- console.error('Manual paste failed:', err);- alert('Could not paste from clipboard. Please try typing or using Cmd+V/Ctrl+V.');+ console.error("Manual paste failed:", err);+ alert(+ "Could not paste from clipboard. Please try typing or using Cmd+V/Ctrl+V."+ );}}}>@@ -530,14 +639,22 @@ Click OK when you're ready to open System Settings.`;{useLocalWhisper && (<div className="space-y-4 p-4 bg-purple-50 border border-purple-200 rounded-xl"><div className="flex items-center justify-between">- <h4 className="font-medium text-purple-900">Local Whisper Setup</h4>+ <h4 className="font-medium text-purple-900">+ Local Whisper Setup+ </h4><div className="flex items-center space-x-2">{checkingWhisper ? (- <span className="text-purple-600 text-sm">Checking...</span>+ <span className="text-purple-600 text-sm">+ Checking...+ </span>) : whisperInstalled ? (- <span className="text-emerald-600 text-sm font-medium">β Ready</span>+ <span className="text-emerald-600 text-sm font-medium">+ β Ready+ </span>) : (- <span className="text-amber-600 text-sm font-medium">β Not installed</span>+ <span className="text-amber-600 text-sm font-medium">+ β Not installed+ </span>)}</div></div>@@ -553,14 +670,23 @@ Click OK when you're ready to open System Settings.`;onChange={(e) => setWhisperModel(e.target.value)}className="w-full p-3 border border-purple-300 rounded-lg bg-white text-purple-900 focus:outline-none focus:ring-1 focus:ring-purple-500/20 focus:border-purple-500">- <option value="tiny">Tiny - Fastest, lower quality</option>- <option value="base">Base - Good balance (recommended)</option>- <option value="small">Small - Better quality, slower</option>+ <option value="tiny">+ Tiny - Fastest, lower quality+ </option>+ <option value="base">+ Base - Good balance (recommended)+ </option>+ <option value="small">+ Small - Better quality, slower+ </option><option value="medium">Medium - High quality</option>- <option value="large">Large - Best quality, slowest</option>+ <option value="large">+ Large - Best quality, slowest+ </option></select><p className="text-xs text-purple-700 mt-2">- Larger models need more memory but give better results.+ Larger models need more memory but give better+ results.</p></div>@@ -577,32 +703,44 @@ Click OK when you're ready to open System Settings.`;</span></div><div className="w-full bg-purple-200 rounded-full h-2">- <div+ <divclassName="bg-gradient-to-r from-purple-500 to-purple-600 h-2 rounded-full transition-all duration-300 ease-out"- style={{ width: `${Math.min(downloadProgress, 100)}%` }}+ style={{+ width: `${Math.min(downloadProgress, 100)}%`,+ }}></div></div></div>)}-+<div className="p-4"><div className="flex items-center justify-between mb-3">- <h5 className="font-medium text-purple-900">Available Models</h5>- <Button+ <h5 className="font-medium text-purple-900">+ Available Models+ </h5>+ <ButtononClick={() => setLoadingModels(!loadingModels)}variant="outline"size="sm"disabled={loadingModels}className="border-purple-300 text-purple-700 hover:bg-purple-50 hover:border-purple-600">- <RefreshCw size={14} className={loadingModels ? "animate-spin" : ""} />- <span className="ml-1">{loadingModels ? "Checking..." : "Refresh"}</span>+ <RefreshCw+ size={14}+ className={loadingModels ? "animate-spin" : ""}+ />+ <span className="ml-1">+ {loadingModels ? "Checking..." : "Refresh"}+ </span></Button></div>-+<div className="space-y-2">{modelList.map((model) => (- <div key={model.model} className="flex items-center justify-between p-3 bg-purple-50 rounded-lg border border-purple-200">+ <div+ key={model.model}+ className="flex items-center justify-between p-3 bg-purple-50 rounded-lg border border-purple-200"+ ><div className="flex items-center space-x-3"><span className="font-medium text-purple-900 capitalize">{model.model}@@ -617,7 +755,7 @@ Click OK when you're ready to open System Settings.`;</span>)}</div>-+<div className="flex gap-2">{model.downloaded && (<Button@@ -633,13 +771,17 @@ Click OK when you're ready to open System Settings.`;{!model.downloaded && (<ButtononClick={() => downloadModel(model.model)}- disabled={downloadingModel === model.model}+ disabled={+ downloadingModel === model.model+ }size="sm"className="bg-purple-600 hover:bg-purple-700"><Download size={14} /><span className="ml-1">- {downloadingModel === model.model ? "Downloading..." : "Download"}+ {downloadingModel === model.model+ ? "Downloading..."+ : "Download"}</span></Button>)}@@ -658,15 +800,18 @@ Click OK when you're ready to open System Settings.`;Install Local Processing</h5><p className="text-sm text-purple-700 mb-4 max-w-sm mx-auto">- We'll install Whisper automatically. No technical setup required.+ We'll install Whisper automatically. No technical+ setup required.</p>-+{installingWhisper ? (<div className="space-y-4"><div className="bg-purple-50 rounded-lg p-4 border border-purple-200"><div className="flex items-center justify-center space-x-3 mb-2"><div className="animate-spin rounded-full h-4 w-4 border-b-2 border-purple-600"></div>- <span className="font-medium text-purple-900">Installing...</span>+ <span className="font-medium text-purple-900">+ Installing...+ </span></div>{installProgress && (<div className="text-xs text-purple-600 bg-white p-2 rounded font-mono">@@ -680,16 +825,18 @@ Click OK when you're ready to open System Settings.`;</div>) : (<div className="space-y-4">- <Button+ <ButtononClick={installWhisper}className="bg-purple-600 hover:bg-purple-700">Install Whisper</Button>-+<div className="flex items-center justify-center">- <Button- onClick={() => setCheckingWhisper(!checkingWhisper)}+ <Button+ onClick={() =>+ setCheckingWhisper(!checkingWhisper)+ }variant="outline"size="sm"className="text-purple-600 border-purple-300 hover:bg-purple-50"@@ -705,12 +852,12 @@ Click OK when you're ready to open System Settings.`;</div>)}- <Button+ <ButtononClick={useLocalWhisper ? saveWhisperSettings : saveApiKey}className="w-full"disabled={!useLocalWhisper && !apiKey.trim()}>- {useLocalWhisper ? 'Save Whisper Settings' : 'Save API Key'}+ {useLocalWhisper ? "Save Whisper Settings" : "Save API Key"}</Button></div></CardContent>@@ -739,36 +886,33 @@ Click OK when you're ready to open System Settings.`;onChange={(e) => setKey(e.target.value)}className="mb-3"/>- <Button- onClick={saveKey}- disabled={!key.trim()}- variant="outline"+ <Button+ onClick={saveKey}+ disabled={!key.trim()}+ variant="outline"size="sm">Save Key</Button></div>-+<div className="grid grid-cols-1 md:grid-cols-2 gap-3">- <Button- onClick={requestPermissions}- variant="outline"- >+ <Button onClick={requestPermissions} variant="outline"><span className="mr-2">π€</span>Enable Microphone</Button>- <Button- onClick={requestAccessibilityPermissions}+ <Button+ onClick={requestAccessibilityPermissions}variant="outline"><span className="mr-2">π</span>Check Permissions</Button></div>-- <Button- onClick={resetAccessibilityPermissions}- variant="secondary"++ <Button+ onClick={resetAccessibilityPermissions}+ variant="secondary"className="w-full"><span className="mr-2">βοΈ</span>@@ -793,18 +937,14 @@ Click OK when you're ready to open System Settings.`;</div><div className="flex gap-2"><Tooltip content="Refresh history">- <Button- onClick={refreshHistory}- variant="ghost"- size="icon"- >+ <Button onClick={refreshHistory} variant="ghost" size="icon"><RefreshCw size={16} /></Button></Tooltip><Tooltip content="Clear all transcriptions">- <Button- onClick={clearHistory}- variant="ghost"+ <Button+ onClick={clearHistory}+ variant="ghost"size="icon"className="text-red-600 hover:text-red-700 hover:bg-red-50">@@ -820,15 +960,13 @@ Click OK when you're ready to open System Settings.`;<div className="w-8 h-8 mx-auto mb-3 bg-indigo-600 rounded-lg flex items-center justify-center"><span className="text-white text-sm">π</span></div>- <p className="text-neutral-600">- Loading transcriptions...- </p>+ <p className="text-neutral-600">Loading transcriptions...</p></div>) : (<div className="space-y-3 max-h-80 overflow-y-auto">{history.map((item, index) => (- <div- key={item.id}+ <div+ key={item.id}className="relative bg-gradient-to-b from-blue-50/30 to-white rounded-xl overflow-hidden shadow-sm hover:shadow-md transition-shadow"style={{backgroundImage: `repeating-linear-gradient(@@ -836,52 +974,61 @@ Click OK when you're ready to open System Settings.`;transparent 24px,#d1d5db 24px,#d1d5db 25px- )`+ )`,}}>{/* Left margin line */}<div className="absolute left-12 top-0 bottom-0 w-px bg-red-300"></div>-+{/* Content */}- <div className="p-6 pl-16" style={{ paddingTop: '8px' }}>+ <div className="p-6 pl-16" style={{ paddingTop: "8px" }}><div className="flex items-start justify-between"><div className="flex-1 mr-3">- <div- className="flex items-center gap-2 mb-1"- style={{- marginTop: '2px',- lineHeight: '24px'+ <div+ className="flex items-center gap-2 mb-1"+ style={{+ marginTop: "2px",+ lineHeight: "24px",}}>- <span className="text-indigo-600 text-xs font-medium">#{history.length - index}</span>+ <span className="text-indigo-600 text-xs font-medium">+ #{history.length - index}+ </span><div className="w-px h-3 bg-neutral-300"></div><span className="text-xs text-neutral-500">- {new Date(item.timestamp).toLocaleString('en-US', {- month: 'short',- day: 'numeric',- hour: '2-digit',- minute: '2-digit'- })}+ {new Date(item.timestamp).toLocaleString(+ "en-US",+ {+ month: "short",+ day: "numeric",+ hour: "2-digit",+ minute: "2-digit",+ }+ )}</span></div>- <p+ <pclassName="text-neutral-800 text-sm"style={{- fontFamily: 'Noto Sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',- lineHeight: '24px',- textAlign: 'left',- marginTop: '2px',- paddingBottom: '2px'+ fontFamily:+ 'Noto Sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',+ lineHeight: "24px",+ textAlign: "left",+ marginTop: "2px",+ paddingBottom: "2px",}}>{item.text}</p></div>- <div className="flex gap-1 flex-shrink-0" style={{ marginTop: '2px' }}>+ <div+ className="flex gap-1 flex-shrink-0"+ style={{ marginTop: "2px" }}+ ><Tooltip content="Copy to clipboard">- <Button- size="icon"- variant="ghost"+ <Button+ size="icon"+ variant="ghost"onClick={() => copyToClipboard(item.text)}className="h-7 w-7">@@ -889,9 +1036,9 @@ Click OK when you're ready to open System Settings.`;</Button></Tooltip><Tooltip content="Delete transcription">- <Button- size="icon"- variant="ghost"+ <Button+ size="icon"+ variant="ghost"onClick={() => deleteTranscription(item.id)}className="h-7 w-7 text-red-600 hover:text-red-700 hover:bg-red-50">@@ -918,15 +1065,21 @@ Click OK when you're ready to open System Settings.`;</CardHeader><CardContent><p className="text-neutral-600 text-sm leading-relaxed mb-6">- OpenWispr converts your speech to text using AI. Press your hotkey, speak, and we'll type what you said wherever your cursor is.+ OpenWispr converts your speech to text using AI. Press your+ hotkey, speak, and we'll type what you said wherever your cursor+ is.</p><div className="grid grid-cols-1 md:grid-cols-3 gap-4 text-sm"><div className="text-center p-4 border border-neutral-200 rounded-xl bg-neutral-50/30"><div className="w-8 h-8 mx-auto mb-2 bg-indigo-600 rounded-lg flex items-center justify-center"><span className="text-white text-sm">β¨οΈ</span></div>- <p className="font-medium text-neutral-800 mb-1">Default Hotkey</p>- <p className="text-neutral-600 font-mono text-xs">` (backtick)</p>+ <p className="font-medium text-neutral-800 mb-1">+ Default Hotkey+ </p>+ <p className="text-neutral-600 font-mono text-xs">+ ` (backtick)+ </p></div><div className="text-center p-4 border border-neutral-200 rounded-xl bg-neutral-50/30"><div className="w-8 h-8 mx-auto mb-2 bg-emerald-600 rounded-lg flex items-center justify-center">