This commit is contained in:
fengchuanhn@gmail.com
2026-05-18 15:14:37 +08:00
parent cdbf605205
commit 0b39d7e36f
7 changed files with 454 additions and 2 deletions

View File

@@ -5,6 +5,8 @@ pub mod audio_db;
pub mod audio_store;
pub mod avatar_db;
pub mod avatar_store;
pub mod video_db;
pub mod video_store;
pub mod local_config;
pub mod asr;
pub mod auth_session;
@@ -27,12 +29,14 @@ pub fn run() {
.manage(app_config::AppConfig::new())
.manage(avatar_store::AvatarStore::new())
.manage(audio_store::AudioStore::new())
.manage(video_store::VideoStore::new())
.setup(|app| {
let handle = app.handle().clone();
tauri::async_runtime::block_on(async move {
let app_config = handle.state::<app_config::AppConfig>();
let avatar_store = handle.state::<avatar_store::AvatarStore>();
let audio_store = handle.state::<audio_store::AudioStore>();
let video_store = handle.state::<video_store::VideoStore>();
let dir = handle
.path()
.app_data_dir()
@@ -41,6 +45,7 @@ pub fn run() {
app_config.init_local_store(db_path).await?;
avatar_store.init(dir.join("avatars.db")).await?;
audio_store.init(dir.join("generated_audios.db")).await?;
video_store.init(dir.join("generated_videos.db")).await?;
Ok::<(), String>(())
})
.map_err(|e| -> Box<dyn std::error::Error> { e.into() })?;
@@ -81,6 +86,10 @@ pub fn run() {
commands::audio::list_generated_audios,
commands::audio::insert_generated_audio,
commands::audio::delete_generated_audio,
commands::video::list_generated_videos,
commands::video::insert_generated_video,
commands::video::import_generated_video,
commands::video::delete_generated_video,
])
.run(tauri::generate_context!())
.expect("error while running tauri application");