Phase 6: Llama-server manager, settings UI, packaging, and polish
- Implement LlamaManager in Rust for llama-server lifecycle: spawn with port allocation, health check, clean shutdown on Drop, model listing - Add llama_start/stop/status/list_models Tauri commands - Add load_settings/save_settings commands with JSON persistence - Build SettingsModal with tabs for Transcription, AI Provider, Local AI settings (model size, device, language, API keys, provider selection) - Wire settings into pipeline calls (model, device, language, skip diarization) - Configure Tauri packaging: asset protocol for local audio files, CSP policy, bundle metadata, Linux .deb/.AppImage and Windows .msi config - Add keyboard shortcuts: Space (play/pause), Ctrl+O (import), Ctrl+, (settings), Escape (close menus/modals) - Close export dropdown on outside click - Tests: 30 Python, 6 Rust, 0 Svelte errors Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
48
src/lib/stores/settings.ts
Normal file
48
src/lib/stores/settings.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import { writable } from 'svelte/store';
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
|
||||
export interface AppSettings {
|
||||
ai_provider: string;
|
||||
openai_api_key: string;
|
||||
anthropic_api_key: string;
|
||||
openai_model: string;
|
||||
anthropic_model: string;
|
||||
litellm_model: string;
|
||||
local_model_path: string;
|
||||
local_binary_path: string;
|
||||
transcription_model: string;
|
||||
transcription_device: string;
|
||||
transcription_language: string;
|
||||
skip_diarization: boolean;
|
||||
}
|
||||
|
||||
const defaults: AppSettings = {
|
||||
ai_provider: 'local',
|
||||
openai_api_key: '',
|
||||
anthropic_api_key: '',
|
||||
openai_model: 'gpt-4o-mini',
|
||||
anthropic_model: 'claude-sonnet-4-6',
|
||||
litellm_model: 'gpt-4o-mini',
|
||||
local_model_path: '',
|
||||
local_binary_path: 'llama-server',
|
||||
transcription_model: 'base',
|
||||
transcription_device: 'cpu',
|
||||
transcription_language: '',
|
||||
skip_diarization: false,
|
||||
};
|
||||
|
||||
export const settings = writable<AppSettings>({ ...defaults });
|
||||
|
||||
export async function loadSettings(): Promise<void> {
|
||||
try {
|
||||
const saved = await invoke<Record<string, unknown>>('load_settings');
|
||||
settings.update(s => ({ ...s, ...saved } as AppSettings));
|
||||
} catch {
|
||||
// Use defaults if settings can't be loaded
|
||||
}
|
||||
}
|
||||
|
||||
export async function saveSettings(s: AppSettings): Promise<void> {
|
||||
settings.set(s);
|
||||
await invoke('save_settings', { settings: s });
|
||||
}
|
||||
Reference in New Issue
Block a user