fix: 修复多轮对话400/Provider通知反复弹出/浏览器环境隔离三大缺陷
1. 多轮对话第二次发消息 AI 不响应 (CRITICAL) handlers.ts: 保存 tool 结果消息到数据库,DeepSeek API 要求 assistant 有 tool_calls 时后续必须有对应 tool 结果消息 openai-format.ts: assistant 有 tool_calls 时 content 设为 null (API 规范,空字符串会导致 400) agent-store.ts: 前端加载历史时过滤 tool 消息,避免冗余卡片 2. Provider 切换通知每次发消息都弹出 main.ts: reloadAdapter 添加配置签名比较 (lastConfigSig),配置未变化时幂等返回 true,不再重建 adapter 或发 toast 3. 浏览器工具无环境隔离 browser-window-manager.ts: 独立 partition 隔离 Cookie/存储; 恢复 webSecurity,CORS 通过 webRequest 处理; setWindowOpenHandler 拦截 window.open; 并发互斥锁串行化 open 调用; destroy() 改用 win.destroy() + clearStorageData 清理残留
This commit is contained in:
+14
-10
@@ -153,16 +153,20 @@ export const useAgentStore = create<AgentState>((set, get) => ({
|
||||
attachments?: Array<{ id: string; name: string; type: string; size: number; preview?: string; textContent?: string }>;
|
||||
iteration?: number;
|
||||
timestamp: number;
|
||||
}>).map((m) => ({
|
||||
id: m.id,
|
||||
role: m.role as ChatMessage['role'],
|
||||
content: m.content,
|
||||
reasoningContent: m.reasoningContent,
|
||||
toolCalls: m.toolCalls as ToolCallInfo[] | undefined,
|
||||
attachments: m.attachments as AttachmentInfo[] | undefined,
|
||||
iteration: m.iteration,
|
||||
timestamp: m.timestamp,
|
||||
}));
|
||||
}>)
|
||||
// v0.3.0 修复: 过滤掉 tool 消息 — tool 结果已包含在 assistant 消息的 toolCalls 中
|
||||
// 独立的 tool 消息只用于 LLM API 上下文,不需要在前端显示为独立卡片
|
||||
.filter((m) => m.role !== 'tool')
|
||||
.map((m) => ({
|
||||
id: m.id,
|
||||
role: m.role as ChatMessage['role'],
|
||||
content: m.content,
|
||||
reasoningContent: m.reasoningContent,
|
||||
toolCalls: m.toolCalls as ToolCallInfo[] | undefined,
|
||||
attachments: m.attachments as AttachmentInfo[] | undefined,
|
||||
iteration: m.iteration,
|
||||
timestamp: m.timestamp,
|
||||
}));
|
||||
set({ messages });
|
||||
}).catch((err) => { console.error('[AgentStore]', err); });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user