Files
Lumotia/src-tauri/src/lib.rs
jake e70cfca63d refactor(kon): remove LLM command stubs — will be rewritten with llama-cpp-rs in Phase 3
- Remove 8 LLM command registrations from invoke_handler macro
- Delete commands/llm.rs stub file
- Remove pub mod llm from commands/mod.rs
- Build passes cleanly with cargo clippy

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 02:11:11 +00:00

82 lines
2.7 KiB
Rust

mod commands;
mod tray;
use std::sync::Arc;
use tauri::Manager;
use kon_core::types::EngineName;
use kon_transcription::LocalEngine;
/// Shared app state holding the transcription engines.
pub struct AppState {
pub whisper_engine: Arc<LocalEngine>,
pub parakeet_engine: Arc<LocalEngine>,
}
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_opener::init())
.plugin(tauri_plugin_dialog::init())
.plugin(tauri_plugin_global_shortcut::Builder::new().build())
.manage(AppState {
whisper_engine: Arc::new(LocalEngine::new(
EngineName::new("whisper"),
)),
parakeet_engine: Arc::new(LocalEngine::new(
EngineName::new("parakeet"),
)),
})
.setup(|app| {
if let Err(e) = tray::setup(app) {
eprintln!("Failed to setup tray: {e}");
}
// Close-to-tray: hide window instead of exiting
if let Some(main_window) = app.get_webview_window("main") {
let win = main_window.clone();
main_window.on_window_event(move |event| {
if let tauri::WindowEvent::CloseRequested { api, .. } =
event
{
api.prevent_close();
let _ = win.hide();
}
});
}
Ok(())
})
.invoke_handler(tauri::generate_handler![
// Whisper model management
commands::models::download_model,
commands::models::check_model,
commands::models::list_models,
commands::models::load_model,
commands::models::check_engine,
// Parakeet model management
commands::models::download_parakeet_model,
commands::models::check_parakeet_model,
commands::models::list_parakeet_models,
commands::models::load_parakeet_model,
commands::models::check_parakeet_engine,
// Transcription
commands::transcription::transcribe_pcm,
commands::transcription::transcribe_file,
commands::transcription::transcribe_pcm_parakeet,
// Audio
commands::audio::save_audio,
// Windows
commands::windows::open_task_window,
commands::windows::open_viewer_window,
// Clipboard
commands::clipboard::copy_to_clipboard,
// Hardware
commands::hardware::probe_system,
commands::hardware::rank_models,
])
.run(tauri::generate_context!())
.expect("error while running Kon");
}