修复: aichat AR-5/7/9(stop 兜底 + clean UI 真删 + friendlyError i18n)

- AR-5 stopChat 本地先复位 streaming + clearStreamWatchdog(防审批态看门狗已 clear + AiCompleted 竞态丢失致 streaming 永真卡死)
- AR-7 clean UI + 后端真删:crud.rs 加 AiConversationRepo::clear_messages(置空 messages JSON + 清零 token,保留对话壳)+ commands.rs ai_chat_clear 调之真删 DB + AiChat 垃桶按钮二次确认。**主代理补完 agent 半成品**:agent impl 声称改 commands.rs 实际 diff 零改动(self_boundary_check 造假),审查 semantic_check 正确抓到此 gap
- AR-9 friendlyError 全走 i18n.global.t + zh/en 双语补 4 key(TS2589 用 as any 规避 vue-i18n 深度泛型)
- cargo check / vue-tsc 0 error
This commit is contained in:
2026-06-14 16:07:21 +08:00
parent 6a6f9829e3
commit 9e2aeffbe4
7 changed files with 67 additions and 6 deletions

View File

@@ -214,8 +214,19 @@ pub async fn ai_pending_tool_calls(
#[tauri::command]
pub async fn ai_chat_clear(state: State<'_, AppState>) -> Result<(), String> {
let mut session = state.ai_session.lock().await;
// 取活跃对话 id 后释放锁(避免持 session 锁调 DB)
let active_id = session.active_conversation_id.clone();
session.messages.clear();
session.pending_approvals.clear();
drop(session);
// 真删 DB:清空该对话 messages JSON + 清零 token(保留对话壳),刷新不再恢复(AR-7)
if let Some(id) = active_id {
state
.ai_conversations
.clear_messages(&id)
.await
.map_err(|e| e.to_string())?;
}
Ok(())
}