| 1 | pub mod app_info; |
| 2 | pub mod chat; |
| 3 | pub mod constants; |
| 4 | pub mod events; |
| 5 | pub mod setup; |
| 6 | |
| 7 | /// Re-export onde's inference helpers so `crate::inference::*` paths work. |
| 8 | pub mod inference { |
| 9 | pub use onde::inference::{models, token}; |
| 10 | } |
| 11 | |
| 12 | use app_info::app_build_version; |
| 13 | use chat::{ |
| 14 | chat_clear_history, chat_get_history, chat_get_status, chat_list_models, chat_load_model, |
| 15 | chat_send_message, chat_set_model, chat_unload_model, |
| 16 | }; |
| 17 | |
| 18 | #[cfg_attr(mobile, tauri::mobile_entry_point)] |
| 19 | pub fn run() { |
| 20 | tauri::Builder::default() |
| 21 | .plugin( |
| 22 | tauri_plugin_log::Builder::new() |
| 23 | .level(log::LevelFilter::Info) |
| 24 | // Quiet the chattiest inference/download dependencies. |
| 25 | .level_for("tokenizers", log::LevelFilter::Warn) |
| 26 | .level_for("hf_hub", log::LevelFilter::Warn) |
| 27 | .level_for("rustls", log::LevelFilter::Warn) |
| 28 | .level_for("hyper", log::LevelFilter::Warn) |
| 29 | .level_for("candle_core", log::LevelFilter::Warn) |
| 30 | .level_for("candle_nn", log::LevelFilter::Warn) |
| 31 | .target(tauri_plugin_log::Target::new( |
| 32 | tauri_plugin_log::TargetKind::Stdout, |
| 33 | )) |
| 34 | .build(), |
| 35 | ) |
| 36 | .plugin(tauri_plugin_opener::init()) |
| 37 | .setup(|app| { |
| 38 | // Disable telemetry + redirect the model cache into the shared |
| 39 | // App Group container. Must run before any onde / hf-hub code. |
| 40 | setup::setup(app)?; |
| 41 | Ok(()) |
| 42 | }) |
| 43 | .invoke_handler(tauri::generate_handler![ |
| 44 | // Chat commands: fully on-device LLM inference |
| 45 | chat_load_model, |
| 46 | chat_unload_model, |
| 47 | chat_get_status, |
| 48 | chat_send_message, |
| 49 | chat_clear_history, |
| 50 | chat_get_history, |
| 51 | chat_list_models, |
| 52 | chat_set_model, |
| 53 | // App metadata |
| 54 | app_build_version, |
| 55 | ]) |
| 56 | .run(tauri::generate_context!()) |
| 57 | .expect("error while running tauri application"); |
| 58 | } |