重构+修复: ARC-06 composables/ai 循环依赖破环 + B-34 多选审批 select_type 回归
- ARC-06: 提 aiShared.ts 下沉 nextMsgId+_msgCounter(叶子模块),useAiEvents/useAiStream/useAiSend/useAiWindow import 源改 aiShared,useAiStream 不再 import useAiEvents 环消除。watchdog 三函数留 useAiStream(持计时器状态非纯函数)。行为零变化。 - B-34(另一会话走查发现 P0): stores/project.ts:273 selectType→select_type(Tauri 2 IPC 不转 camelCase),对齐后端 workflow.rs:211。F-260615-01 多选审批回归修复——前端传 selectType 后端收 None 归一化 Single 致多选被拒。删错误注释。 批1 wwllb4ith(ARC-06)+主代理(B-34),vue-tsc 0 err
This commit is contained in:
@@ -7,9 +7,12 @@
|
||||
//! - sendMessage 启动生成时 resetStreamWatchdog() 启动计时
|
||||
//! - handleEvent 每个活跃事件(delta/工具/新轮/审批结果)重置;审批等待/完成/错误 clear
|
||||
//! - 超时回调 onStreamTimeout 直接改 state 并补一条错误消息
|
||||
//!
|
||||
//! 依赖:nextMsgId 取自 aiShared(原从 useAiEvents 取,构成 useAiEvents ↔ useAiStream
|
||||
//! 循环依赖;下沉到 aiShared 后本模块不再 import useAiEvents,环消除)
|
||||
|
||||
import { state } from '../../stores/ai'
|
||||
import { nextMsgId } from './useAiEvents'
|
||||
import { nextMsgId } from './aiShared'
|
||||
|
||||
/// ≥ 后端 STREAM_IDLE_TIMEOUT(120s, ai.rs:848)+余量;
|
||||
/// 前端若短于后端,慢首 token 会被前端先误杀
|
||||
@@ -26,7 +29,8 @@ export function onStreamTimeout() {
|
||||
// 文案区分:若已有 completed 工具调用,说明工具执行完后续回复被中断(常见为审批后
|
||||
// 续生成卡住),引导用户继续;否则按纯流式中断处理。
|
||||
// 数据源:state.messages[].toolCalls[].status,反向扫尾部提前退出(O(1) 均,同 findToolCall);
|
||||
// 不复用 useAiEvents.findToolCall 避免反向 import 循环依赖(useAiEvents 已 import 本模块)
|
||||
// 不复用 useAiEvents.findToolCall:本模块不依赖 useAiEvents(已下沉 nextMsgId 到 aiShared 破环),
|
||||
// 且此处需遍历查找任一 completed 卡片而非按 id 定位,语义不同
|
||||
let hasCompletedTool = false
|
||||
for (let i = state.messages.length - 1; i >= 0; i--) {
|
||||
const toolCalls = state.messages[i].toolCalls
|
||||
|
||||
Reference in New Issue
Block a user