新增: ai_list_recoverable IPC+桌面可恢复入口双轨数据源(B3)

This commit is contained in:
lxy
2026-10-06 12:54:11 +08:00
parent 40392ebded
commit 7c252cff96
5 changed files with 56 additions and 5 deletions
@@ -278,6 +278,30 @@ pub async fn ai_conversation_list(
Ok(active)
}
/// B3(无人值守可靠性专项):列出可恢复会话(loop_state='parked')。
///
/// V49 断点续跑的完备真相查询:重启时 mark_running_as_parked 改写的会话在此列出,
/// 桌面任务卡「可恢复」分区与飞书投影共用本 IPC(单一事实源)。与 ai_conversation_list
/// 的 loop_state 透出互补——list 是侧栏全量摘要(截断 limit 内),本 IPC 是 parked 专项
/// 全量清单(不受侧栏 limit 截断),且附任务上下文(标题+最后更新时间)供恢复决策。
#[tauri::command]
pub async fn ai_list_recoverable(
state: State<'_, AppState>,
) -> Result<Vec<serde_json::Value>, String> {
let records = state.ai_conversations.list_parked().await.map_err(err_str)?;
Ok(records
.iter()
.map(|r| {
serde_json::json!({
"id": r.id,
"title": r.title,
"model": r.model,
"updated_at": r.updated_at,
})
})
.collect())
}
/// 切换到指定对话(从 DB 加载 messages 到内存 + 返回 messages 给前端)
#[tauri::command]
pub async fn ai_conversation_switch(
+1
View File
@@ -449,6 +449,7 @@ pub fn run() {
// AI 对话管理
commands::ai::ai_conversation_create,
commands::ai::ai_conversation_list,
commands::ai::ai_list_recoverable,
commands::ai::ai_conversation_switch,
// S3 子代理轨迹只读窥视(复用 switch 读路径,不切任何会话状态)
commands::ai::ai_conversation_peek,