Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

refactor: major design refactor

Gabriel Stein5d0d3b7bdd51
diff --git a/main.js b/main.js
index 024ea39aa..bfc214113 100644
--- a/main.js
+++ b/main.js
@@ -1088,8 +1088,29 @@ ipcMain.handle('download-whisper-model', async (event, modelName) => {
});
downloadProcess.stderr.on('data', (data) => {
- stderr += data.toString();
- console.log('Model download log:', data.toString());
+ const output = data.toString();
+ stderr += output;
+ console.log('Model download log:', output);
+
+ // Parse progress messages
+ const lines = output.split('\n');
+ for (const line of lines) {
+ if (line.startsWith('PROGRESS:')) {
+ try {
+ const progressData = JSON.parse(line.substring(9)); // Remove 'PROGRESS:' prefix
+ console.log('πŸ“Š Download progress:', progressData);
+
+ // Forward progress to renderer
+ event.sender.send('whisper-download-progress', {
+ type: 'progress',
+ model: modelName,
+ ...progressData
+ });
+ } catch (parseError) {
+ console.error('Failed to parse progress data:', parseError);
+ }
+ }
+ }
});
downloadProcess.on('close', (code) => {
@@ -1097,6 +1118,14 @@ ipcMain.handle('download-whisper-model', async (event, modelName) => {
try {
const result = JSON.parse(stdout);
console.log(`βœ… Model ${modelName} download completed:`, result);
+
+ // Send final completion event
+ event.sender.send('whisper-download-progress', {
+ type: 'complete',
+ model: modelName,
+ result: result
+ });
+
resolve(result);
} catch (parseError) {
console.error('❌ Failed to parse download result:', parseError);
@@ -1105,12 +1134,28 @@ ipcMain.handle('download-whisper-model', async (event, modelName) => {
} else {
console.error('❌ Model download failed with code:', code);
console.error('Stderr:', stderr);
+
+ // Send error event
+ event.sender.send('whisper-download-progress', {
+ type: 'error',
+ model: modelName,
+ error: `Model download failed (code ${code}): ${stderr}`
+ });
+
reject(new Error(`Model download failed (code ${code}): ${stderr}`));
}
});
downloadProcess.on('error', (error) => {
console.error('❌ Model download process error:', error);
+
+ // Send error event
+ event.sender.send('whisper-download-progress', {
+ type: 'error',
+ model: modelName,
+ error: `Model download process error: ${error.message}`
+ });
+
reject(new Error(`Model download process error: ${error.message}`));
});
@@ -1230,3 +1275,55 @@ ipcMain.handle('list-whisper-models', async (event) => {
throw error;
}
});
+
+// Delete Whisper model
+ipcMain.handle('delete-whisper-model', async (event, modelName) => {
+ try {
+ console.log(`πŸ—‘οΈ Deleting Whisper model: ${modelName}`);
+
+ const pythonCmd = await findPythonExecutable();
+ const whisperScriptPath = path.join(__dirname, 'whisper_bridge.py');
+
+ const args = [whisperScriptPath, '--mode', 'delete', '--model', modelName];
+
+ return new Promise((resolve, reject) => {
+ const deleteProcess = spawn(pythonCmd, args);
+
+ let stdout = '';
+ let stderr = '';
+
+ deleteProcess.stdout.on('data', (data) => {
+ stdout += data.toString();
+ });
+
+ deleteProcess.stderr.on('data', (data) => {
+ stderr += data.toString();
+ });
+
+ deleteProcess.on('close', (code) => {
+ if (code === 0) {
+ try {
+ const result = JSON.parse(stdout);
+ console.log(`πŸ—‘οΈ Model ${modelName} delete result:`, result);
+ resolve(result);
+ } catch (parseError) {
+ console.error('❌ Failed to parse delete result:', parseError);
+ reject(new Error(`Failed to parse delete result: ${parseError.message}`));
+ }
+ } else {
+ console.error('❌ Model delete failed with code:', code);
+ reject(new Error(`Model delete failed (code ${code}): ${stderr}`));
+ }
+ });
+
+ deleteProcess.on('error', (error) => {
+ console.error('❌ Model delete error:', error);
+ reject(new Error(`Model delete error: ${error.message}`));
+ });
+ });
+
+ } catch (error) {
+ console.error('❌ Model delete error:', error);
+ throw error;
+ }
+});
diff --git a/preload.js b/preload.js
index 6fedffb1d..db7491ff0 100644
--- a/preload.js
+++ b/preload.js
@@ -25,6 +25,8 @@ contextBridge.exposeInMainWorld('electronAPI', {
installWhisper: () => ipcRenderer.invoke('install-whisper'),
onWhisperInstallProgress: (callback) => ipcRenderer.on('whisper-install-progress', callback),
downloadWhisperModel: (modelName) => ipcRenderer.invoke('download-whisper-model', modelName),
+ onWhisperDownloadProgress: (callback) => ipcRenderer.on('whisper-download-progress', callback),
checkModelStatus: (modelName) => ipcRenderer.invoke('check-model-status', modelName),
listWhisperModels: () => ipcRenderer.invoke('list-whisper-models'),
+ deleteWhisperModel: (modelName) => ipcRenderer.invoke('delete-whisper-model', modelName),
});
\ No newline at end of file
diff --git a/src/components/ControlPanel.tsx b/src/components/ControlPanel.tsx
index c9cf72046..bd82fca98 100644
--- a/src/components/ControlPanel.tsx
+++ b/src/components/ControlPanel.tsx
@@ -2,6 +2,8 @@ import React, { useState, useEffect } from "react";
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";
// Type declaration for electronAPI
declare global {
@@ -23,8 +25,10 @@ declare global {
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 }>;
};
}
}
@@ -47,6 +51,7 @@ export default function ControlPanel() {
const [checkingWhisper, setCheckingWhisper] = useState(false);
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>('');
@@ -91,6 +96,23 @@ export default function ControlPanel() {
window.electronAPI.onWhisperInstallProgress((event, data) => {
setInstallProgress(data.message);
});
+
+ // Set up progress listener for model downloads
+ window.electronAPI.onWhisperDownloadProgress((event, data) => {
+ if (data.type === 'progress') {
+ // Force re-render by setting both state values
+ setDownloadProgress(data.percentage || 0);
+ } else if (data.type === 'complete') {
+ setDownloadingModel(null);
+ setDownloadProgress(0);
+ // Refresh model list after successful download
+ loadModelList();
+ } else if (data.type === 'error') {
+ setDownloadingModel(null);
+ setDownloadProgress(0);
+ console.error('Download error:', data.error);
+ }
+ });
}, []);
const loadTranscriptions = async () => {
@@ -167,7 +189,6 @@ export default function ControlPanel() {
const downloadModel = async (modelName: string) => {
try {
setDownloadingModel(modelName);
- console.log(`πŸ“₯ Downloading model: ${modelName}`);
const result = await window.electronAPI.downloadWhisperModel(modelName);
@@ -186,6 +207,25 @@ 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.`)) {
+ try {
+ const result = await window.electronAPI.deleteWhisperModel(modelName);
+
+ if (result.success) {
+ alert(`βœ… Model "${modelName}" deleted successfully! Freed ${result.freed_mb}MB of disk space.`);
+ // Refresh model list
+ loadModelList();
+ } 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);
alert(`Dictation key inscribed: ${key}`);
@@ -368,271 +408,295 @@ Click OK when you're ready to open System Settings.`;
};
return (
- <div className="min-h-screen bg-gradient-to-br from-[#F5F0E6] via-[#F9F6F1] to-[#EDE7DC] p-8">
- <div className="max-w-4xl mx-auto space-y-8">
+ <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-12">
- <h1 className="brand-heading text-5xl font-bold text-[#2B1F14] mb-3">
- OpenScribe
+ <div className="text-center mb-10">
+ <div className="flex items-center justify-center mb-6">
+ <div className="w-12 h-12 bg-indigo-600 rounded-xl flex items-center justify-center shadow-sm">
+ <span className="text-white text-xl font-medium">W</span>
+ </div>
+ </div>
+ <h1 className="text-3xl font-semibold text-neutral-900 mb-2">
+ OpenWhisper
</h1>
- <p className="brand-script text-xl text-[#6B5D52] italic">
- "Your words, inscribed with care"
+ <p className="text-neutral-600">
+ Your voice, your data, your AI
</p>
- <div className="w-24 h-px bg-gradient-to-r from-transparent via-[#C0A77D] to-transparent mx-auto mt-4"></div>
</div>
- {/* API Configuration Card */}
- <Card className="card">
- <CardHeader className="border-b border-[#DDD4C7] bg-gradient-to-r from-[#FFFFFF] to-[#F9F6F1]">
- <CardTitle className="brand-heading text-2xl text-[#2B1F14] flex items-center gap-3">
- <span className="text-[#C0A77D]">πŸ”‘</span>
- OpenAI API Configuration
+ {/* Transcription Setup Card */}
+ <Card>
+ <CardHeader>
+ <CardTitle className="flex items-center gap-2">
+ <Settings size={18} className="text-indigo-600" />
+ Transcription Setup
</CardTitle>
- <p className="text-sm text-[#6B5D52] mt-2">
- Configure your transcription credentials to enable voice-to-text inscription.
+ <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.
</p>
</CardHeader>
- <CardContent className="space-y-6 p-8">
+ <CardContent className="space-y-6">
<div className="space-y-4">
+ {/* Processing Choice */}
<div>
- <label className="block text-sm font-semibold text-[#2B1F14] mb-3 brand-body">
- OpenAI API Key
+ <label className="block text-sm font-medium text-neutral-700 mb-4">
+ Processing Method
</label>
- <div className="flex gap-3">
- <Input
- type="password"
- placeholder="sk-..."
- value={apiKey}
- onChange={(e) => setApiKey(e.target.value)}
- className="flex-1 text-base"
- onPaste={(e) => {
- e.stopPropagation();
- console.log('Paste event triggered');
- }}
- onKeyDown={handleApiKeyKeyDown}
- autoComplete="off"
- spellCheck={false}
- />
- <Button
- variant="outline"
- onClick={async () => {
- try {
- const text = await window.electronAPI.readClipboard();
- if (text && text.trim()) {
- setApiKey(text.trim());
- console.log('Manual paste successful via Electron');
- } else {
- const webText = await navigator.clipboard.readText();
- setApiKey(webText.trim());
- 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.');
- }
- }}
+ <div className="grid grid-cols-1 md:grid-cols-2 gap-3">
+ <button
+ onClick={() => 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'
+ }`}
>
- Inscribe
- </Button>
- </div>
- <p className="text-xs text-[#6B5D52] mt-2 italic">
- Your API key will be securely stored and used only for transcription services.
- </p>
- </div>
- <Button
- onClick={saveApiKey}
- disabled={!apiKey.trim()}
- className="w-full bg-[#4B2E2B] hover:bg-[#C0A77D] text-[#F5F0E6] hover:text-[#2B1F14] font-semibold py-3"
- >
- Save API Credentials
- </Button>
- </div>
- </CardContent>
- </Card>
-
- {/* Whisper Engine Settings Card */}
- <Card className="card">
- <CardHeader className="border-b border-[#DDD4C7] bg-gradient-to-r from-[#FFFFFF] to-[#F9F6F1]">
- <CardTitle className="brand-heading text-2xl text-[#2B1F14] flex items-center gap-3">
- <span className="text-[#C0A77D]">πŸ€–</span>
- Whisper Engine Settings
- </CardTitle>
- <p className="text-sm text-[#6B5D52] mt-2">
- Configure your speech recognition engine: local processing or cloud API.
- </p>
- </CardHeader>
- <CardContent className="space-y-6 p-8">
- <div className="space-y-4">
- <div className="flex items-center justify-between p-4 border border-[#DDD4C7] rounded-lg bg-gradient-to-r from-[#FFFFFF] to-[#F9F6F1]">
- <div className="flex items-center space-x-3">
- <input
- type="checkbox"
- id="useLocalWhisper"
- checked={useLocalWhisper}
- onChange={(e) => setUseLocalWhisper(e.target.checked)}
- className="w-5 h-5"
- />
- <label htmlFor="useLocalWhisper" className="text-base font-semibold text-[#2B1F14] brand-body">
- Use Local Whisper (Privacy Mode)
- </label>
- </div>
- <div className="flex items-center space-x-2">
- {checkingWhisper ? (
- <span className="text-[#C0A77D] text-sm">Checking...</span>
- ) : whisperInstalled ? (
- <span className="text-green-600 text-sm">βœ… Installed</span>
- ) : (
- <span className="text-red-600 text-sm">❌ Not Found</span>
- )}
+ <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>
+ </div>
+ <p className="text-sm text-neutral-600">
+ Audio sent to OpenAI servers. Faster processing, requires API key.
+ </p>
+ </button>
+
+ <button
+ onClick={() => 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'
+ }`}
+ >
+ <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>
+ </div>
+ <p className="text-sm text-neutral-600">
+ Audio stays on your device. Complete privacy, works offline.
+ </p>
+ </button>
</div>
</div>
- {useLocalWhisper && (
- <div className="pl-8 space-y-4">
+ {/* 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>
<div>
- <label className="block text-sm font-semibold text-[#2B1F14] mb-3 brand-body">
- Whisper Model
+ <label className="block text-sm font-medium text-blue-800 mb-2">
+ API Key
</label>
- <select
- value={whisperModel}
- onChange={(e) => setWhisperModel(e.target.value)}
- className="w-full p-3 border border-[#DDD4C7] rounded-lg bg-white text-[#2B1F14] focus:outline-none focus:ring-2 focus:ring-[#C0A77D]"
- >
- <option value="tiny">Tiny (39M params - Fastest)</option>
- <option value="base">Base (74M params - Balanced)</option>
- <option value="small">Small (244M params - Better quality)</option>
- <option value="medium">Medium (769M params - High quality)</option>
- <option value="large">Large (1550M params - Best quality)</option>
- <option value="turbo">Turbo (809M params - Fast + quality)</option>
- </select>
- <p className="text-xs text-[#6B5D52] mt-2 italic">
- Larger models provide better accuracy but use more memory and are slower.
+ <div className="flex gap-3">
+ <Input
+ type="password"
+ placeholder="sk-..."
+ value={apiKey}
+ onChange={(e) => setApiKey(e.target.value)}
+ className="flex-1"
+ />
+ <Button
+ variant="outline"
+ onClick={async () => {
+ try {
+ const text = await window.electronAPI.readClipboard();
+ if (text && text.trim()) {
+ setApiKey(text.trim());
+ console.log('Manual paste successful via Electron');
+ } else {
+ const webText = await navigator.clipboard.readText();
+ setApiKey(webText.trim());
+ 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.');
+ }
+ }}
+ >
+ Paste
+ </Button>
+ </div>
+ <p className="text-xs text-blue-700 mt-2">
+ Get your API key from platform.openai.com
</p>
</div>
+ </div>
+ )}
- {/* Model Management Section */}
- {whisperInstalled && (
- <div className="bg-green-50 border border-green-200 rounded-lg p-4">
- <div className="flex items-center justify-between mb-3">
- <h4 className="font-semibold text-green-800">Model Management</h4>
- <Button
- onClick={loadModelList}
- variant="outline"
- size="sm"
- disabled={loadingModels}
+ {/* Local Configuration */}
+ {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>
+ <div className="flex items-center space-x-2">
+ {checkingWhisper ? (
+ <span className="text-purple-600 text-sm">Checking...</span>
+ ) : whisperInstalled ? (
+ <span className="text-emerald-600 text-sm font-medium">βœ“ Ready</span>
+ ) : (
+ <span className="text-amber-600 text-sm font-medium">⚠ Not installed</span>
+ )}
+ </div>
+ </div>
+
+ {whisperInstalled ? (
+ <div className="space-y-4">
+ <div>
+ <label className="block text-sm font-medium text-purple-800 mb-2">
+ Model Quality
+ </label>
+ <select
+ value={whisperModel}
+ 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"
>
- {loadingModels ? "Loading..." : "Refresh Models"}
- </Button>
+ <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>
+ </select>
+ <p className="text-xs text-purple-700 mt-2">
+ Larger models need more memory but give better results.
+ </p>
</div>
-
- <div className="space-y-3">
- {modelList.length > 0 ? (
- modelList.map((model) => (
- <div key={model.model} className="flex items-center justify-between p-3 bg-white rounded border">
- <div className="flex items-center space-x-3">
- <span className="font-medium text-green-900 capitalize">
- {model.model}
- </span>
- {model.downloaded ? (
- <span className="text-xs text-green-600 bg-green-100 px-2 py-1 rounded">
- βœ… Downloaded ({model.size_mb}MB)
- </span>
- ) : (
- <span className="text-xs text-gray-500 bg-gray-100 px-2 py-1 rounded">
- Not downloaded
+
+ <div className="bg-white border border-purple-200 rounded-lg overflow-hidden">
+ {/* Download Progress Bar */}
+ {downloadingModel && (
+ <div className="bg-purple-50 border-b border-purple-200 p-3">
+ <div className="flex items-center justify-between mb-2">
+ <span className="text-sm font-medium text-purple-900">
+ Downloading {downloadingModel} model...
+ </span>
+ <span className="text-xs text-purple-700">
+ {Math.round(downloadProgress)}%
+ </span>
+ </div>
+ <div className="w-full bg-purple-200 rounded-full h-2">
+ <div
+ className="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)}%` }}
+ ></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
+ onClick={() => 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>
+ </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 className="flex items-center space-x-3">
+ <span className="font-medium text-purple-900 capitalize">
+ {model.model}
</span>
- )}
- </div>
-
- {!model.downloaded && (
- <Button
- onClick={() => downloadModel(model.model)}
- disabled={downloadingModel === model.model}
- size="sm"
- className="bg-green-600 hover:bg-green-700 text-white"
- >
- {downloadingModel === model.model ? (
- <>πŸ“₯ Downloading...</>
+ {model.downloaded ? (
+ <span className="text-xs text-emerald-600 bg-emerald-100 px-2 py-1 rounded-md">
+ βœ“ Downloaded ({model.size_mb}MB)
+ </span>
) : (
- <>πŸ“₯ Download</>
+ <span className="text-xs text-neutral-500 bg-neutral-100 px-2 py-1 rounded-md">
+ Not downloaded
+ </span>
)}
- </Button>
- )}
- </div>
- ))
- ) : (
- <div className="text-center py-4">
- <p className="text-sm text-green-700">
- {loadingModels ? "Loading model information..." : "Click 'Refresh Models' to check available models"}
- </p>
+ </div>
+
+ <div className="flex gap-2">
+ {model.downloaded && (
+ <Button
+ onClick={() => deleteModel(model.model)}
+ size="sm"
+ variant="outline"
+ className="text-red-600 hover:text-red-700 hover:bg-red-50 border-red-200 hover:border-red-600"
+ >
+ <Trash2 size={14} />
+ <span className="ml-1">Delete</span>
+ </Button>
+ )}
+ {!model.downloaded && (
+ <Button
+ onClick={() => downloadModel(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"}
+ </span>
+ </Button>
+ )}
+ </div>
+ </div>
+ ))}
</div>
- )}
- </div>
-
- <div className="mt-3 p-3 bg-blue-50 border border-blue-200 rounded text-sm text-blue-700">
- <p><strong>πŸ’‘ Tip:</strong> Download models you plan to use for faster transcription. The first time you use a model, it will be downloaded automatically, but pre-downloading prevents delays during dictation.</p>
+ </div>
</div>
</div>
- )}
-
- {!whisperInstalled && (
- <div className="bg-gradient-to-r from-blue-50 to-purple-50 border border-blue-200 rounded-lg p-6">
+ ) : (
+ <div className="bg-white border border-purple-200 rounded-lg p-6">
<div className="text-center">
- <div className="text-4xl mb-4">πŸš€</div>
- <h4 className="font-bold text-blue-900 text-lg mb-2">
- Ready to Enable Local Processing?
- </h4>
- <p className="text-sm text-blue-700 mb-4 max-w-md mx-auto">
- We'll automatically install Whisper for you! No terminal commands needed - just click the button below.
+ <div className="text-3xl mb-4">πŸ“¦ </div>
+ <h5 className="font-medium text-purple-900 text-lg mb-2">
+ 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.
</p>
{installingWhisper ? (
<div className="space-y-4">
- <div className="bg-white rounded-lg p-4 border">
- <div className="flex items-center justify-center space-x-3 mb-3">
- <div className="animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"></div>
- <span className="font-semibold text-blue-900">Installing Whisper...</span>
+ <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>
</div>
{installProgress && (
- <div className="text-xs text-blue-600 bg-blue-50 p-2 rounded font-mono">
+ <div className="text-xs text-purple-600 bg-white p-2 rounded font-mono">
{installProgress}
</div>
)}
</div>
- <p className="text-xs text-blue-600 italic">
- This may take a few minutes. Please don't close the app.
+ <p className="text-xs text-purple-600">
+ This takes a few minutes. Keep the app open.
</p>
</div>
) : (
<div className="space-y-4">
<Button
onClick={installWhisper}
- className="bg-gradient-to-r from-blue-600 to-purple-600 hover:from-blue-700 hover:to-purple-700 text-white font-bold py-3 px-8 rounded-lg shadow-lg transform hover:scale-105 transition-all"
- size="lg"
+ className="bg-purple-600 hover:bg-purple-700"
>
- πŸ”§ Install Whisper Automatically
+ Install Whisper
</Button>
- <div className="flex items-center justify-center space-x-4 text-xs text-blue-600">
+ <div className="flex items-center justify-center">
<Button
- onClick={checkWhisperInstallation}
+ onClick={() => setCheckingWhisper(!checkingWhisper)}
variant="outline"
size="sm"
- className="text-blue-600 border-blue-300 hover:bg-blue-50"
+ className="text-purple-600 border-purple-300 hover:bg-purple-50"
>
- πŸ”„ Check Again
+ Check if already installed
</Button>
</div>
-
- <div className="bg-white rounded-lg p-3 text-xs text-blue-700 border border-blue-200">
- <p className="font-semibold mb-1">✨ What we'll install:</p>
- <ul className="space-y-1 text-left">
- <li>β€’ OpenAI Whisper package (speech recognition)</li>
- <li>β€’ Required dependencies (torch, numpy, etc.)</li>
- <li>β€’ Everything needed for local AI transcription</li>
- </ul>
- </div>
</div>
)}
</div>
@@ -641,166 +705,200 @@ Click OK when you're ready to open System Settings.`;
</div>
)}
- <div className="bg-blue-50 border border-blue-200 rounded-lg p-4">
- <h4 className="font-semibold text-blue-800 mb-2">Privacy Information</h4>
- <div className="text-sm text-blue-700 space-y-2">
- <p><strong>Local Whisper:</strong> Audio processed on your device, complete privacy, no internet required (after initial model download).</p>
- <p><strong>OpenAI API:</strong> Audio sent to OpenAI servers, requires API key and internet connection.</p>
- </div>
- </div>
-
<Button
- onClick={saveWhisperSettings}
- className="w-full bg-[#4B2E2B] hover:bg-[#C0A77D] text-[#F5F0E6] hover:text-[#2B1F14] font-semibold py-3"
+ onClick={useLocalWhisper ? saveWhisperSettings : saveApiKey}
+ className="w-full"
+ disabled={!useLocalWhisper && !apiKey.trim()}
>
- Save Whisper Settings
+ {useLocalWhisper ? 'Save Whisper Settings' : 'Save API Key'}
</Button>
</div>
</CardContent>
</Card>
{/* Dictation Settings Card */}
- <Card className="card">
- <CardHeader className="border-b border-[#DDD4C7] bg-gradient-to-r from-[#FFFFFF] to-[#F9F6F1]">
- <CardTitle className="brand-heading text-2xl text-[#2B1F14] flex items-center gap-3">
- <span className="text-[#C0A77D]">⌨️</span>
- Dictation Preferences
+ <Card>
+ <CardHeader>
+ <CardTitle className="flex items-center gap-2">
+ <Keyboard size={18} className="text-indigo-600" />
+ Dictation Setup
</CardTitle>
- <p className="text-sm text-[#6B5D52] mt-2">
- Configure your voice inscription settings and system permissions.
+ <p className="text-sm text-neutral-600 mt-2 leading-relaxed">
+ Configure how you want to activate voice transcription.
</p>
</CardHeader>
- <CardContent className="space-y-6 p-8">
- <div className="space-y-4">
+ <CardContent className="space-y-5">
+ <div className="space-y-5">
<div>
- <label className="block text-sm font-semibold text-[#2B1F14] mb-3 brand-body">
- Dictation Activation Key
+ <label className="block text-sm font-medium text-neutral-700 mb-2">
+ Activation Key
</label>
<Input
- placeholder="Currently: ` (backtick)"
+ placeholder="Current: ` (backtick)"
value={key}
onChange={(e) => setKey(e.target.value)}
- className="mb-3 text-base"
- onPaste={(e) => {
- e.stopPropagation();
- console.log('Hotkey paste event triggered');
- }}
- onKeyDown={(e) => {
- if ((e.metaKey || e.ctrlKey) && e.key === 'v') {
- console.log('Hotkey paste shortcut detected');
- }
- }}
- autoComplete="off"
- spellCheck={false}
+ className="mb-3"
/>
- <Button onClick={saveKey} disabled={!key.trim()} variant="outline" className="mb-6">
- Save Activation Key
+ <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-4">
- <Button onClick={requestPermissions} variant="outline" className="py-3">
+ <div className="grid grid-cols-1 md:grid-cols-2 gap-3">
+ <Button
+ onClick={requestPermissions}
+ variant="outline"
+ >
<span className="mr-2">🎀</span>
- Request Microphone Access
+ Enable Microphone
</Button>
- <Button onClick={requestAccessibilityPermissions} variant="outline" className="py-3">
+ <Button
+ onClick={requestAccessibilityPermissions}
+ variant="outline"
+ >
<span className="mr-2">πŸ”“</span>
- Verify Accessibility
+ Check Permissions
</Button>
</div>
- <Button onClick={resetAccessibilityPermissions} variant="secondary" className="w-full py-3">
- <span className="mr-2">πŸ”„</span>
- Reset Accessibility Permissions
+ <Button
+ onClick={resetAccessibilityPermissions}
+ variant="secondary"
+ className="w-full"
+ >
+ <span className="mr-2">βš™οΈ</span>
+ Fix Permission Issues
</Button>
</div>
</CardContent>
</Card>
- {/* Transcription History Card */}
- <Card className="card">
- <CardHeader className="border-b border-[#DDD4C7] bg-gradient-to-r from-[#FFFFFF] to-[#F9F6F1]">
+ {/* Recent Transcriptions Card */}
+ <Card>
+ <CardHeader>
<div className="flex flex-row items-center justify-between">
<div>
- <CardTitle className="brand-heading text-2xl text-[#2B1F14] flex items-center gap-3">
- <span className="text-[#C0A77D]">πŸ“œ</span>
- Inscription Chronicles
+ <CardTitle className="flex items-center gap-2">
+ <FileText size={18} className="text-indigo-600" />
+ Recent Transcriptions
</CardTitle>
- <p className="text-sm text-[#6B5D52] mt-2">
- Your recorded voice transcriptions, preserved for posterity.
+ <p className="text-sm text-neutral-600 mt-2">
+ Your voice recordings, converted to text.
</p>
</div>
- <div className="flex gap-3">
- <Button onClick={refreshHistory} variant="outline" size="sm">
- <span className="mr-1">πŸ”„</span>
- Refresh
- </Button>
- <Button onClick={clearHistory} variant="destructive" size="sm">
- <span className="mr-1">πŸ—‘οΈ</span>
- Clear All
- </Button>
+ <div className="flex gap-2">
+ <Tooltip content="Refresh history">
+ <Button
+ onClick={refreshHistory}
+ variant="ghost"
+ size="icon"
+ >
+ <RefreshCw size={16} />
+ </Button>
+ </Tooltip>
+ <Tooltip content="Clear all transcriptions">
+ <Button
+ onClick={clearHistory}
+ variant="ghost"
+ size="icon"
+ className="text-red-600 hover:text-red-700 hover:bg-red-50"
+ >
+ <Trash2 size={16} />
+ </Button>
+ </Tooltip>
</div>
</div>
</CardHeader>
- <CardContent className="p-8">
+ <CardContent>
{isLoading ? (
- <div className="text-center py-12">
- <div className="text-[#C0A77D] text-2xl mb-3">πŸ“–</div>
- <p className="text-[#6B5D52] brand-body">
- Loading your inscription chronicles...
- </p>
- </div>
- ) : history.length === 0 ? (
- <div className="text-center py-12">
- <div className="text-[#C0A77D] text-4xl mb-4">βœ’οΈ</div>
- <p className="text-[#6B5D52] brand-body text-lg mb-2">
- No inscriptions yet recorded
- </p>
- <p className="text-[#6B5D52] text-sm italic">
- Begin dictating to see your chronicles appear here
+ <div className="text-center py-8">
+ <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>
</div>
) : (
- <div className="space-y-4 max-h-96 overflow-y-auto">
+ <div className="space-y-3 max-h-80 overflow-y-auto">
{history.map((item, index) => (
- <div key={item.id} className="border border-[#DDD4C7] rounded-lg p-6 bg-gradient-to-r from-[#FFFFFF] to-[#F9F6F1] hover:shadow-md transition-all duration-200">
- <div className="flex items-start justify-between">
- <div className="flex-1 mr-4">
- <div className="flex items-center gap-2 mb-2">
- <span className="text-[#C0A77D] text-sm">#{history.length - index}</span>
- <div className="w-px h-4 bg-[#DDD4C7]"></div>
- <span className="text-xs text-[#6B5D52] brand-body">
- {new Date(item.timestamp).toLocaleString('en-US', {
- weekday: 'short',
- year: 'numeric',
- month: 'short',
- day: 'numeric',
- hour: '2-digit',
- minute: '2-digit'
- })}
- </span>
+ <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(
+ transparent,
+ 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="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'
+ }}
+ >
+ <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'
+ })}
+ </span>
+ </div>
+ <p
+ className="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'
+ }}
+ >
+ {item.text}
+ </p>
+ </div>
+ <div className="flex gap-1 flex-shrink-0" style={{ marginTop: '2px' }}>
+ <Tooltip content="Copy to clipboard">
+ <Button
+ size="icon"
+ variant="ghost"
+ onClick={() => copyToClipboard(item.text)}
+ className="h-7 w-7"
+ >
+ <Copy size={12} />
+ </Button>
+ </Tooltip>
+ <Tooltip content="Delete transcription">
+ <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"
+ >
+ <Trash2 size={12} />
+ </Button>
+ </Tooltip>
</div>
- <p className="text-[#2B1F14] brand-body leading-relaxed text-base">
- "{item.text}"
- </p>
- </div>
- <div className="flex gap-2 flex-shrink-0">
- <Button
- size="sm"
- variant="outline"
- onClick={() => copyToClipboard(item.text)}
- className="text-xs"
- >
- Copy
- </Button>
- <Button
- size="sm"
- variant="destructive"
- onClick={() => deleteTranscription(item.id)}
- className="text-xs"
- >
- Remove
- </Button>
</div>
</div>
</div>
@@ -811,45 +909,50 @@ Click OK when you're ready to open System Settings.`;
</Card>
{/* About Card */}
- <Card className="card">
- <CardHeader className="border-b border-[#DDD4C7] bg-gradient-to-r from-[#FFFFFF] to-[#F9F6F1]">
- <CardTitle className="brand-heading text-2xl text-[#2B1F14] flex items-center gap-3">
- <span className="text-[#C0A77D]">ℹ️</span>
- About OpenScribe
+ <Card>
+ <CardHeader>
+ <CardTitle className="flex items-center gap-2">
+ <Info size={18} className="text-indigo-600" />
+ About
</CardTitle>
</CardHeader>
- <CardContent className="p-8">
- <p className="text-[#6B5D52] brand-body text-base leading-relaxed mb-6">
- OpenScribe is an elegant dictation companion that transforms your spoken words into written text using advanced AI transcription.
- Like a skilled scribe of old, it captures your thoughts with precision and care.
+ <CardContent>
+ <p className="text-neutral-600 text-sm leading-relaxed mb-6">
+ OpenWhisper 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-6 text-sm">
- <div className="text-center p-4 border border-[#DDD4C7] rounded-lg bg-gradient-to-b from-[#FFFFFF] to-[#F9F6F1]">
- <div className="text-[#C0A77D] text-xl mb-2">⌨️</div>
- <p className="font-semibold text-[#2B1F14] mb-1">Default Hotkey</p>
- <p className="text-[#6B5D52]">` (backtick)</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>
</div>
- <div className="text-center p-4 border border-[#DDD4C7] rounded-lg bg-gradient-to-b from-[#FFFFFF] to-[#F9F6F1]">
- <div className="text-[#C0A77D] text-xl mb-2">🏷️</div>
- <p className="font-semibold text-[#2B1F14] mb-1">Version</p>
- <p className="text-[#6B5D52]">0.1.0</p>
+ <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">
+ <span className="text-white text-sm">🏷️</span>
+ </div>
+ <p className="font-medium text-neutral-800 mb-1">Version</p>
+ <p className="text-neutral-600 text-xs">0.1.0</p>
</div>
- <div className="text-center p-4 border border-[#DDD4C7] rounded-lg bg-gradient-to-b from-[#FFFFFF] to-[#F9F6F1]">
- <div className="text-[#C0A77D] text-xl mb-2">βœ…</div>
- <p className="font-semibold text-[#2B1F14] mb-1">Status</p>
- <p className="status-active">Active</p>
+ <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-green-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">Status</p>
+ <p className="text-green-600 text-xs font-medium">Active</p>
</div>
</div>
</CardContent>
</Card>
{/* Footer */}
- <div className="text-center py-8">
- <p className="text-[#6B5D52] text-sm brand-script italic">
- "In every word lies a story waiting to be inscribed"
+ <div className="text-center py-6">
+ <p className="text-neutral-500 text-sm">
+ Built for thinkers who move at the speed of thought
</p>
</div>
</div>
</div>
);
-}
\ No newline at end of file
+}
diff --git a/src/components/ui/button.tsx b/src/components/ui/button.tsx
index d1341301a..d893e0960 100644
--- a/src/components/ui/button.tsx
+++ b/src/components/ui/button.tsx
@@ -5,21 +5,21 @@ import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "../lib/utils"
const buttonVariants = cva(
- "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-medium transition-all duration-150 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:ring-2 focus-visible:ring-indigo-500/30 focus-visible:ring-offset-1",
{
variants: {
variant: {
default:
- "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
+ "bg-indigo-600 text-white shadow-sm hover:bg-indigo-700 active:bg-indigo-800 focus:outline-none focus:ring-2 focus:ring-indigo-500/30 focus:ring-offset-1",
destructive:
- "bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
+ "bg-red-600 text-white shadow-sm hover:bg-red-700 active:bg-red-800 focus:outline-none focus:ring-2 focus:ring-red-500/30 focus:ring-offset-1",
outline:
- "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
+ "border border-neutral-300 bg-white text-neutral-700 shadow-sm hover:bg-neutral-50 hover:border-neutral-400 focus:outline-none focus:ring-2 focus:ring-indigo-500/30 focus:ring-offset-1",
secondary:
- "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
+ "bg-neutral-100 text-neutral-900 shadow-sm hover:bg-neutral-200 focus:outline-none focus:ring-2 focus:ring-neutral-500/30 focus:ring-offset-1",
ghost:
- "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
- link: "text-primary underline-offset-4 hover:underline",
+ "text-neutral-700 hover:bg-neutral-100 hover:text-neutral-900 focus:outline-none focus:ring-2 focus:ring-neutral-500/30 focus:ring-offset-1",
+ link: "text-indigo-600 underline-offset-4 hover:underline focus:outline-none focus:ring-2 focus:ring-indigo-500/30 focus:ring-offset-1",
},
size: {
default: "h-9 px-4 py-2 has-[>svg]:px-3",
diff --git a/src/components/ui/toggle.tsx b/src/components/ui/toggle.tsx
new file mode 100644
index 000000000..6c4b0c4dd
--- /dev/null
+++ b/src/components/ui/toggle.tsx
@@ -0,0 +1,24 @@
+import React from "react";
+
+interface ToggleProps {
+ checked: boolean;
+ onChange: (checked: boolean) => void;
+ disabled?: boolean;
+}
+
+export const Toggle = ({ checked, onChange, disabled = false }: ToggleProps) => (
+ <button
+ onClick={() => !disabled && onChange(!checked)}
+ disabled={disabled}
+ className={`relative inline-flex h-5 w-9 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-indigo-500/30 focus:ring-offset-1 ${
+ checked ? 'bg-indigo-600' : 'bg-neutral-300'
+ } ${disabled ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer'}`}
+ >
+ <span
+ className={`inline-block h-3 w-3 transform rounded-full bg-white transition-transform shadow-sm ${
+ checked ? 'translate-x-5' : 'translate-x-1'
+ }`}
+ />
+ </button>
+);
+
diff --git a/src/components/ui/tooltip.tsx b/src/components/ui/tooltip.tsx
new file mode 100644
index 000000000..637c32943
--- /dev/null
+++ b/src/components/ui/tooltip.tsx
@@ -0,0 +1,27 @@
+import React, { useState } from "react";
+
+interface TooltipProps {
+ children: React.ReactNode;
+ content: string;
+}
+
+export const Tooltip = ({ children, content }: TooltipProps) => {
+ const [isVisible, setIsVisible] = useState(false);
+
+ return (
+ <div className="relative inline-block">
+ <div
+ onMouseEnter={() => setIsVisible(true)}
+ onMouseLeave={() => setIsVisible(false)}
+ >
+ {children}
+ </div>
+ {isVisible && (
+ <div className="absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 px-2 py-1 text-xs text-white bg-neutral-900 rounded-md whitespace-nowrap z-10">
+ {content}
+ <div className="absolute top-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-l-2 border-r-2 border-t-2 border-transparent border-t-neutral-900"></div>
+ </div>
+ )}
+ </div>
+ );
+};
diff --git a/src/index.css b/src/index.css
index 93eb3f2d9..5e05491b2 100644
--- a/src/index.css
+++ b/src/index.css
@@ -1,34 +1,31 @@
@import "tailwindcss";
-@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=Lora:ital,wght@0,400;0,500;0,600;1,400&family=Italiana&display=swap');
-@theme {
- /* OpenScribe Brand Theme - Parchment & Ink */
- --color-primary: #4B2E2B;
- --color-primary-foreground: #F5F0E6;
- --color-secondary: #F5F0E6;
- --color-secondary-foreground: #2B1F14;
- --color-muted: #EDE7DC;
- --color-muted-foreground: #6B5D52;
- --color-accent: #C0A77D;
- --color-accent-foreground: #2B1F14;
- --color-destructive: #874F3E;
- --color-destructive-foreground: #F5F0E6;
- --color-border: #DDD4C7;
- --color-input: #F9F6F1;
- --color-ring: #C0A77D;
- --color-background: #F5F0E6;
- --color-foreground: #2B1F14;
- --color-card: #FFFFFF;
- --color-card-foreground: #2B1F14;
- --color-popover: #FFFFFF;
- --color-popover-foreground: #2B1F14;
- --color-link: #2E3659;
+:root {
+ /* OpenWhisper Modern Theme - Clean & Professional */
+ --color-primary: #4f46e5;
+ --color-primary-foreground: #ffffff;
+ --color-secondary: #f5f5f5;
+ --color-secondary-foreground: #171717;
+ --color-muted: #f5f5f5;
+ --color-muted-foreground: #737373;
+ --color-accent: #f5f5f5;
+ --color-accent-foreground: #171717;
+ --color-destructive: #dc2626;
+ --color-destructive-foreground: #ffffff;
+ --color-border: #e5e5e5;
+ --color-input: #ffffff;
+ --color-ring: #4f46e5;
+ --color-background: #ffffff;
+ --color-foreground: #171717;
+ --color-card: #ffffff;
+ --color-card-foreground: #171717;
+ --color-popover: #ffffff;
+ --color-popover-foreground: #171717;
+ --color-link: #4f46e5;
--radius: 0.5rem;
}
-@custom-variant dark (&:is(.dark *));
-
-@variant dark {
+.dark {
/* Dark mode - sophisticated and rich */
--color-background: oklch(0.08 0 0);
--color-foreground: oklch(0.95 0 0);
@@ -52,14 +49,14 @@
@layer base {
* {
- @apply border-border outline-ring/50;
+ @apply border-gray-200 outline-indigo-500/50;
}
body {
- @apply bg-background text-foreground;
+ @apply bg-white text-gray-900;
margin: 0;
padding: 0;
- font-family: 'Lora', 'Libre Baskerville', Georgia, serif;
+ font-family: 'Noto Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
font-feature-settings: "liga" 1, "kern" 1;
text-rendering: optimizeLegibility;
}
@@ -72,18 +69,18 @@
/* OpenScribe Brand Typography */
.brand-heading {
- font-family: 'Cormorant Garamond', 'Crimson Pro', serif;
+ font-family: 'Noto Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
font-weight: 600;
letter-spacing: -0.02em;
}
.brand-body {
- font-family: 'Lora', 'Libre Baskerville', Georgia, serif;
+ font-family: 'Noto Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
line-height: 1.6;
}
.brand-script {
- font-family: 'Italiana', cursive;
+ font-family: 'Noto Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
font-style: italic;
}
@@ -111,7 +108,7 @@
}
h1, h2, h3, h4, h5, h6 {
- font-family: 'Cormorant Garamond', 'Crimson Pro', serif;
+ font-family: 'Noto Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
font-weight: 600;
letter-spacing: -0.02em;
line-height: 1.2;
@@ -122,108 +119,27 @@ h1 {
font-weight: 700;
}
+/* Modern Button Styling - handled by button component */
button {
- border-radius: 8px;
- border: 1px solid transparent;
- padding: 0.6em 1.2em;
- font-size: 1em;
- font-weight: 500;
- font-family: 'Lora', Georgia, serif;
+ font-family: 'Noto Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
cursor: pointer;
- transition: all 0.2s ease;
- box-shadow: 0 2px 4px rgba(43, 31, 20, 0.1);
-}
-
-/* OpenScribe Brand Button Styling */
-:root button {
- background-color: #FFFFFF;
- color: #2B1F14;
- border-color: #DDD4C7;
-}
-
-:root button:hover {
- border-color: #C0A77D;
- background-color: #F9F6F1;
- box-shadow: 0 4px 8px rgba(43, 31, 20, 0.1);
- transform: translateY(-1px);
-}
-
-/* Primary CTA buttons - Deep oxblood with bronze hover */
-button[class*="bg-primary"] {
- background-color: #4B2E2B;
- color: #F5F0E6;
- border-color: #4B2E2B;
- font-weight: 600;
-}
-
-button[class*="bg-primary"]:hover {
- background-color: #C0A77D;
- color: #2B1F14;
- border-color: #C0A77D;
- box-shadow: 0 6px 12px rgba(75, 46, 43, 0.2);
-}
-
-/* Secondary buttons - Parchment with ink accents */
-:root button[class*="variant-secondary"] {
- background-color: #F5F0E6;
- border-color: #C0A77D;
- color: #2B1F14;
-}
-
-:root button[class*="variant-secondary"]:hover {
- background-color: #EDE7DC;
- border-color: #4B2E2B;
- color: #4B2E2B;
-}
-
-/* Outline buttons */
-:root button[class*="variant-outline"] {
- background-color: transparent;
- border-color: #C0A77D;
- color: #4B2E2B;
-}
-
-:root button[class*="variant-outline"]:hover {
- background-color: #F9F6F1;
- border-color: #4B2E2B;
- color: #2B1F14;
-}
-
-/* Destructive buttons - Dried blood red */
-button[class*="variant-destructive"] {
- background-color: #874F3E;
- color: #F5F0E6;
- border-color: #874F3E;
}
-button[class*="variant-destructive"]:hover {
- background-color: #6B3D32;
- border-color: #6B3D32;
-}
-
-/* Dark mode button styling */
-.dark button {
- background-color: oklch(0.12 0 0);
- color: oklch(0.9 0 0);
- border-color: oklch(0.22 0 0);
-}
-
-.dark button:hover {
- border-color: oklch(0.55 0.25 250);
- background-color: oklch(0.15 0 0);
-}
-
-button:focus,
-button:focus-visible {
- outline: 2px solid #C0A77D;
- outline-offset: 2px;
+/* Ensure all interactive elements have pointer cursor */
+button:hover,
+[role="button"]:hover,
+.cursor-pointer:hover,
+svg:hover,
+[data-icon]:hover,
+.icon:hover {
+ cursor: pointer;
}
/* Embossed paper-like input styling */
input, textarea {
border-radius: 8px;
transition: all 0.2s ease;
- font-family: 'Lora', Georgia, serif;
+ font-family: 'Noto Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
box-shadow: inset 0 1px 3px rgba(43, 31, 20, 0.1);
}
@@ -271,11 +187,13 @@ a {
color: #2E3659;
text-decoration: none;
transition: color 0.2s ease;
+ cursor: pointer;
}
a:hover {
color: #4B2E2B;
text-decoration: underline;
+ cursor: pointer;
}
/* Status indicators */
@@ -300,40 +218,10 @@ a:hover {
color: #2E3659;
}
-@theme inline {
+/* Additional CSS variables for theme support */
+:root {
--radius-sm: calc(var(--radius) - 4px);
--radius-md: calc(var(--radius) - 2px);
--radius-lg: var(--radius);
--radius-xl: calc(var(--radius) + 4px);
- --color-background: var(--background);
- --color-foreground: var(--foreground);
- --color-card: var(--card);
- --color-card-foreground: var(--card-foreground);
- --color-popover: var(--popover);
- --color-popover-foreground: var(--popover-foreground);
- --color-primary: var(--primary);
- --color-primary-foreground: var(--primary-foreground);
- --color-secondary: var(--secondary);
- --color-secondary-foreground: var(--secondary-foreground);
- --color-muted: var(--muted);
- --color-muted-foreground: var(--muted-foreground);
- --color-accent: var(--accent);
- --color-accent-foreground: var(--accent-foreground);
- --color-destructive: var(--destructive);
- --color-border: var(--border);
- --color-input: var(--input);
- --color-ring: var(--ring);
- --color-chart-1: var(--chart-1);
- --color-chart-2: var(--chart-2);
- --color-chart-3: var(--chart-3);
- --color-chart-4: var(--chart-4);
- --color-chart-5: var(--chart-5);
- --color-sidebar: var(--sidebar);
- --color-sidebar-foreground: var(--sidebar-foreground);
- --color-sidebar-primary: var(--sidebar-primary);
- --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
- --color-sidebar-accent: var(--sidebar-accent);
- --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
- --color-sidebar-border: var(--sidebar-border);
- --color-sidebar-ring: var(--sidebar-ring);
}
diff --git a/src/index.html b/src/index.html
index 50a8b663f..3550eb72e 100644
--- a/src/index.html
+++ b/src/index.html
@@ -4,6 +4,9 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/png" href="./assets/icon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <link rel="preconnect" href="https://fonts.googleapis.com">
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
+ <link href="https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&display=swap" rel="stylesheet">
<title>OpenScribe</title>
</head>
<body>
diff --git a/whisper_bridge.py b/whisper_bridge.py
index 64d45beef..cc87239ff 100755
--- a/whisper_bridge.py
+++ b/whisper_bridge.py
@@ -11,6 +11,9 @@ import os
import argparse
from pathlib import Path
import whisper
+import threading
+import time
+import requests
def load_model(model_name="base"):
"""Load Whisper model with error handling"""
@@ -23,29 +26,159 @@ def load_model(model_name="base"):
print(f"Error loading model: {e}", file=sys.stderr)
return None
+def get_expected_model_size(model_name):
+ """Get expected file size for a model by checking the remote URL"""
+ try:
+ model_url = whisper._MODELS[model_name]
+ response = requests.head(model_url, timeout=10)
+ if response.status_code == 200:
+ content_length = response.headers.get('content-length')
+ if content_length:
+ return int(content_length)
+ except Exception as e:
+ print(f"Could not get expected size for {model_name}: {e}", file=sys.stderr)
+
+ # Fallback to approximate sizes (in bytes)
+ approximate_sizes = {
+ "tiny": 39 * 1024 * 1024, # ~39MB
+ "base": 74 * 1024 * 1024, # ~74MB
+ "small": 244 * 1024 * 1024, # ~244MB
+ "medium": 769 * 1024 * 1024, # ~769MB
+ "large": 1550 * 1024 * 1024, # ~1550MB
+ "turbo": 809 * 1024 * 1024 # ~809MB
+ }
+ return approximate_sizes.get(model_name, 100 * 1024 * 1024) # Default 100MB
+
+def monitor_download_progress(model_name, expected_size):
+ """Monitor download progress by watching file size growth"""
+ cache_dir = os.path.expanduser("~/.cache/whisper")
+ model_url = whisper._MODELS[model_name]
+ model_file = os.path.join(cache_dir, os.path.basename(model_url))
+
+ # Create cache directory if it doesn't exist
+ os.makedirs(cache_dir, exist_ok=True)
+
+ last_size = 0
+ last_update_time = time.time()
+ stagnant_count = 0
+
+ while True:
+ try:
+ current_size = 0
+ if os.path.exists(model_file):
+ current_size = os.path.getsize(model_file)
+
+ current_time = time.time()
+
+ # Only send updates if size changed or every 2 seconds
+ if current_size != last_size or (current_time - last_update_time) >= 2:
+ percentage = min((current_size / expected_size * 100) if expected_size > 0 else 0, 100)
+
+ progress_data = {
+ "type": "progress",
+ "model": model_name,
+ "downloaded_bytes": current_size,
+ "total_bytes": expected_size,
+ "percentage": round(percentage, 1),
+ "speed_mbps": 0
+ }
+
+ # Calculate download speed if we have a previous measurement
+ if last_size > 0 and current_time > last_update_time:
+ bytes_per_second = (current_size - last_size) / (current_time - last_update_time)
+ mbps = (bytes_per_second * 8) / (1024 * 1024) # Convert to Mbps
+ progress_data["speed_mbps"] = round(mbps, 2)
+
+ print(f"PROGRESS:{json.dumps(progress_data)}", file=sys.stderr)
+
+ last_size = current_size
+ last_update_time = current_time
+
+ # Check if download is complete
+ if current_size >= expected_size * 0.95: # 95% threshold to account for slight size differences
+ print(f"Download appears complete: {current_size}/{expected_size} bytes", file=sys.stderr)
+ break
+
+ # Check for stagnation (no progress for too long)
+ if current_size == last_size:
+ stagnant_count += 1
+ if stagnant_count > 100: # 10 seconds of no progress
+ print(f"Download may be stagnant, checking if complete...", file=sys.stderr)
+ if current_size > 0:
+ break # Assume download is done
+ else:
+ stagnant_count = 0
+
+ except Exception as e:
+ print(f"Error monitoring progress: {e}", file=sys.stderr)
+
+ time.sleep(0.1) # Check every 100ms
+
def download_model(model_name="base"):
- """Download Whisper model and return download info"""
+ """Download Whisper model with real-time progress monitoring"""
try:
- print(f"Downloading Whisper model: {model_name}", file=sys.stderr)
-
- # This will download the model if it doesn't exist
- model = whisper.load_model(model_name)
+ print(f"Starting download of Whisper model: {model_name}", file=sys.stderr)
- # Get model file info
- model_path = whisper._MODELS[model_name]
+ # Check if model is already downloaded
cache_dir = os.path.expanduser("~/.cache/whisper")
- model_file = os.path.join(cache_dir, os.path.basename(model_path))
+ model_url = whisper._MODELS[model_name]
+ model_file = os.path.join(cache_dir, os.path.basename(model_url))
- file_size = 0
if os.path.exists(model_file):
file_size = os.path.getsize(model_file)
+ print(f"Model {model_name} already exists ({file_size} bytes)", file=sys.stderr)
+ return {
+ "model": model_name,
+ "downloaded": True,
+ "path": model_file,
+ "size_bytes": file_size,
+ "size_mb": round(file_size / (1024 * 1024), 1),
+ "success": True
+ }
+
+ # Get expected file size
+ expected_size = get_expected_model_size(model_name)
+ print(f"Expected size for {model_name}: {expected_size} bytes ({expected_size/(1024*1024):.1f} MB)", file=sys.stderr)
+
+ # Start progress monitoring in background thread
+ progress_thread = threading.Thread(
+ target=monitor_download_progress,
+ args=(model_name, expected_size),
+ daemon=True
+ )
+ progress_thread.start()
+
+ # Start the actual download (this will block until complete)
+ print(f"Initiating Whisper model download: {model_name}", file=sys.stderr)
+ model = whisper.load_model(model_name)
+
+ # Wait a moment for the progress thread to finish
+ time.sleep(0.5)
+
+ # Get final file info
+ final_size = 0
+ if os.path.exists(model_file):
+ final_size = os.path.getsize(model_file)
+
+ print(f"Download completed: {model_name} ({final_size} bytes)", file=sys.stderr)
+
+ # Send final progress update
+ final_progress = {
+ "type": "progress",
+ "model": model_name,
+ "downloaded_bytes": final_size,
+ "total_bytes": expected_size,
+ "percentage": 100,
+ "speed_mbps": 0
+ }
+ print(f"PROGRESS:{json.dumps(final_progress)}", file=sys.stderr)
return {
"model": model_name,
"downloaded": True,
"path": model_file,
- "size_bytes": file_size,
- "size_mb": round(file_size / (1024 * 1024), 1),
+ "size_bytes": final_size,
+ "size_mb": round(final_size / (1024 * 1024), 1),
"success": True
}
@@ -103,6 +236,43 @@ def list_models():
"success": True
}
+def delete_model(model_name="base"):
+ """Delete a downloaded Whisper model"""
+ try:
+ print(f"Deleting Whisper model: {model_name}", file=sys.stderr)
+
+ cache_dir = os.path.expanduser("~/.cache/whisper")
+ model_url = whisper._MODELS[model_name]
+ model_file = os.path.join(cache_dir, os.path.basename(model_url))
+
+ if os.path.exists(model_file):
+ file_size = os.path.getsize(model_file)
+ os.remove(model_file)
+ print(f"Model {model_name} deleted successfully ({file_size} bytes freed)", file=sys.stderr)
+ return {
+ "model": model_name,
+ "deleted": True,
+ "freed_bytes": file_size,
+ "freed_mb": round(file_size / (1024 * 1024), 1),
+ "success": True
+ }
+ else:
+ print(f"Model {model_name} not found, nothing to delete", file=sys.stderr)
+ return {
+ "model": model_name,
+ "deleted": False,
+ "error": "Model not found",
+ "success": False
+ }
+ except Exception as e:
+ print(f"Error deleting model: {e}", file=sys.stderr)
+ return {
+ "model": model_name,
+ "deleted": False,
+ "error": str(e),
+ "success": False
+ }
+
def transcribe_audio(audio_path, model_name="base", language=None):
"""Transcribe audio file using Whisper"""
try:
@@ -139,7 +309,7 @@ def transcribe_audio(audio_path, model_name="base", language=None):
def main():
parser = argparse.ArgumentParser(description="Whisper Bridge for OpenScribe")
parser.add_argument("--mode", default="transcribe",
- choices=["transcribe", "download", "check", "list"],
+ choices=["transcribe", "download", "check", "list", "delete"],
help="Operation mode (default: transcribe)")
parser.add_argument("audio_file", nargs="?", help="Path to audio file to transcribe")
parser.add_argument("--model", default="base",
@@ -165,6 +335,10 @@ def main():
result = list_models()
print(json.dumps(result))
return
+ elif args.mode == "delete":
+ result = delete_model(args.model)
+ print(json.dumps(result))
+ return
elif args.mode == "transcribe":
# Check if audio file exists
if not args.audio_file: