重构: F-09 batch4 启用多会话上线(决策e真并发·F-09完整)
- IPC签名加conv_id: ai_is_generating/ai_chat_send/ai_chat_force_send/ai_chat_stop + 内部移除active一致性校验(后台conv可操作) - 删switch readonly分支 + 删ai_conversation_create强制结束旧loop(决策e,切走旧loop不退出) - 删双写桥接+顶层字段: messages/generating/stop_flag/notify/iteration_used/agent_language/model_override/session_trust全删,per_conv唯一真相源 + 删双写代码(全模块)+ 删fallback读 + pending_approvals retain目标conv - 前端: api/ai.ts+useAiSend/useAiWindow传conv_id 保留: session_state(SW预留标allow)/readonly(前端不读);零调用方预留按用户指导保留 主代兜底: cargo check --workspace 0 + vue-tsc 0 + test 98 + grep顶层删除/per_conv唯一印证 F-09完整(batch1 PerConvState+batch2迁移+batch5限流调整+batch8恢复+batch4上线);双会话人工验收留用户
This commit is contained in:
@@ -121,9 +121,10 @@ async function doSend(text: string, skill?: string, force = false, parts?: Conte
|
||||
const override = modelOverride.value
|
||||
if (force) {
|
||||
// F-05 Phase 2c: 透传 parts(图片)给后端 ai_chat_force_send,多模态全链生效
|
||||
await aiApi.forceSend(text.trim(), lang, skill, override, parts)
|
||||
// F-260616-09 B 批4(决策 e):传 activeConversationId,操作指定 conv 的 per_conv。
|
||||
await aiApi.forceSend(text.trim(), lang, skill, override, parts, state.activeConversationId)
|
||||
} else {
|
||||
await aiApi.sendMessage(text.trim(), lang, skill, override, parts)
|
||||
await aiApi.sendMessage(text.trim(), lang, skill, override, parts, state.activeConversationId)
|
||||
}
|
||||
} catch (e) {
|
||||
// IPC 失败(spawn 前/provider 配置错等):回滚 streaming 防光标卡死 + 移除 user 消息与空气泡占位;
|
||||
@@ -310,9 +311,10 @@ async function sendMessage(text: string, skill?: string, forceMode = false, part
|
||||
}
|
||||
|
||||
// B-260615-22(方案 A):发送前 IPC 查后端真实 generating。
|
||||
// F-260616-09 B 批4(决策 e):传 activeConversationId 精确查当前 conv(不读全局单值)。
|
||||
let backendGenerating = false
|
||||
try {
|
||||
backendGenerating = await invoke<boolean>('ai_is_generating')
|
||||
backendGenerating = await invoke<boolean>('ai_is_generating', { conversationId: state.activeConversationId || null })
|
||||
} catch {
|
||||
backendGenerating = false
|
||||
}
|
||||
@@ -495,7 +497,8 @@ async function stopChat() {
|
||||
// 后端 agentic.rs:190 emit AiCompleted 注释明确「保证前端收事件时后端已可接下一条,队列续发不被拒」;
|
||||
// 当前未完成回复已入库(agentic.rs:185 save_conversation)保留为截断回复。
|
||||
try {
|
||||
await aiApi.stopChat()
|
||||
// F-260616-09 B 批4(决策 e):传 activeConversationId,停止仅作用于当前 conv。
|
||||
await aiApi.stopChat(state.activeConversationId)
|
||||
} catch (e) {
|
||||
// stop 信号未送达后端:重启看门狗(后端继续生成时活跃事件会重置它,真 hang 则 130s 后兜底收尾),
|
||||
// 避免后端仍在跑却无任何恢复路径(原 clearStreamWatchdog 已把兜底关掉)。
|
||||
|
||||
Reference in New Issue
Block a user