feat(ai): run agent sessions as background tasks

This commit is contained in:
Abeautifulsnow authored and GitHub committed 2026-08-26 14:09:08 +08:00
1 parent b37a1f8538
commit eeeb4e5011
34 files changed
+3440 -184

No files matched your search

+19
View File
@@ -286,6 +286,25 @@ pub async fn delete_ai_conversation(state: State<'_, Arc<AppState>>, id: String)
state.storage.delete_ai_conversation(&id).await
}
#[tauri::command]
pub async fn save_ai_run(state: State<'_, Arc<AppState>>, run: AiRun) -> Result<(), String> {
state.storage.save_ai_run(&run).await
}
#[tauri::command]
pub async fn save_ai_run_state(
state: State<'_, Arc<AppState>>,
conversation: AiConversation,
run: AiRun,
) -> Result<(), String> {
state.storage.save_ai_run_state(&conversation, &run).await
}
#[tauri::command]
pub async fn load_ai_runs(state: State<'_, Arc<AppState>>) -> Result<Vec<AiRun>, String> {
state.storage.load_ai_runs().await
}
#[cfg(test)]
mod tests {
use std::sync::atomic::{AtomicU32, Ordering};
+3
View File
@@ -1804,6 +1804,9 @@ pub fn run() {
commands::ai::save_ai_conversation,
commands::ai::load_ai_conversations,
commands::ai::delete_ai_conversation,
commands::ai::save_ai_run,
commands::ai::save_ai_run_state,
commands::ai::load_ai_runs,
commands::ai_multi_config::save_ai_configs,
commands::ai_multi_config::load_ai_configs,
commands::ai_multi_config::set_default_ai_config,