This commit is contained in:
fengchuanhn@gmail.com
2026-05-17 21:13:45 +08:00
parent c18176ba60
commit 9dfeaa9e18
10 changed files with 695 additions and 17 deletions

View File

@@ -1,4 +1,5 @@
pub mod app_config;
pub mod local_config;
pub mod asr;
pub mod auth_session;
pub mod chat;
@@ -18,6 +19,21 @@ pub fn run() {
tauri::Builder::default()
.manage(auth_session::AuthSession::default())
.manage(app_config::AppConfig::new())
.setup(|app| {
let handle = app.handle().clone();
tauri::async_runtime::block_on(async move {
let app_config = handle.state::<app_config::AppConfig>();
let dir = handle
.path()
.app_data_dir()
.map_err(|e| format!("无法获取应用数据目录: {e}"))?;
let db_path = dir.join("local_config.db");
app_config.init_local_store(db_path).await?;
Ok::<(), String>(())
})
.map_err(|e| -> Box<dyn std::error::Error> { e.into() })?;
Ok(())
})
.plugin(tauri_plugin_single_instance::init(|app, _args, _cwd| {
if let Some(window) = app.get_webview_window("main") {
let _ = window.unminimize();
@@ -30,6 +46,11 @@ pub fn run() {
commands::auth::sync_auth_session,
commands::app_config::get_app_config,
commands::app_config::get_app_config_last_message,
commands::app_config::get_server_app_config,
commands::app_config::get_app_config_detail,
commands::app_config::list_local_app_config,
commands::app_config::set_local_app_config,
commands::app_config::delete_local_app_config,
commands::quickjs::run_quickjs_script,
commands::quickjs::run_quickjs_script_source,
commands::quickjs::list_quickjs_scripts,