fix: 修复 taskId 不一致导致 conversation.json 找不到的问题
- messageHandler 复用 historyManager 的 taskId 而非重新生成 - 环境切换为 dev,超时时间统一为 5 分钟 - agentCard 添加调试智能体相关工具名称映射 - 移除冗余的 segments 调试日志
This commit is contained in:
@ -8,7 +8,7 @@ import * as vscode from "vscode";
|
||||
type Environment = "dev" | "test" | "prod";
|
||||
|
||||
/** 当前环境 - 修改这里切换环境 */
|
||||
const CURRENT_ENV: Environment = "test";
|
||||
const CURRENT_ENV: Environment = "dev";
|
||||
|
||||
/** 配置项接口 */
|
||||
export interface IccoderConfig {
|
||||
@ -25,7 +25,7 @@ const ENV_CONFIG: Record<Environment, IccoderConfig> = {
|
||||
/** 本地开发环境 */
|
||||
dev: {
|
||||
backendUrl: "http://localhost:2233",
|
||||
timeout: 60000,
|
||||
timeout: 300000, // 5分钟,与子智能体超时一致
|
||||
userId: "default-user",
|
||||
},
|
||||
/** 测试服务器环境 */
|
||||
|
||||
@ -127,18 +127,20 @@ async function handleUserMessageWithBackend(
|
||||
mode?: RunMode,
|
||||
reuseTaskId?: string // 可选,复用现有 taskId(用于 Plan 模式确认后继续执行)
|
||||
): Promise<void> {
|
||||
const historyManager = ChatHistoryManager.getInstance();
|
||||
|
||||
// 获取 historyManager 中的 taskId(由 ICHelperPanel 创建)
|
||||
// 优先使用 reuseTaskId,其次使用 historyManager 的 taskId
|
||||
const taskIdToUse = reuseTaskId || historyManager.getCurrentTaskId();
|
||||
|
||||
// 创建或复用会话
|
||||
if (!currentSession || !currentSession.active) {
|
||||
currentSession = dialogManager.createSession(extensionPath, reuseTaskId);
|
||||
currentSession = dialogManager.createSession(extensionPath, taskIdToUse || undefined);
|
||||
// 保存 taskId 用于后续操作(如压缩)
|
||||
lastTaskId = currentSession.getTaskId();
|
||||
if (reuseTaskId) {
|
||||
console.log("[MessageHandler] 复用 taskId 创建会话:", reuseTaskId);
|
||||
}
|
||||
console.log("[MessageHandler] 创建会话: taskId=", lastTaskId, "来源=", taskIdToUse ? "historyManager" : "新生成");
|
||||
}
|
||||
|
||||
const historyManager = ChatHistoryManager.getInstance();
|
||||
|
||||
// 显示状态栏
|
||||
panel.webview.postMessage({
|
||||
command: "updateStatus",
|
||||
@ -196,10 +198,6 @@ async function handleUserMessageWithBackend(
|
||||
|
||||
// 最后一次发送完整的段落
|
||||
console.log("[MessageHandler] 对话完成, 段落数:", segments.length);
|
||||
console.log(
|
||||
"[MessageHandler] segments 内容:",
|
||||
JSON.stringify(segments)
|
||||
);
|
||||
|
||||
const result = await panel.webview.postMessage({
|
||||
command: "updateSegments",
|
||||
|
||||
@ -126,7 +126,11 @@ export function getAgentCardScript(): string {
|
||||
'addPlan': '添加计划',
|
||||
'addEdge': '添加边',
|
||||
'showPlan': '显示计划',
|
||||
'spawnExplorer': '代码探索'
|
||||
'spawnExplorer': '代码探索',
|
||||
'spawnDebugger': '波形调试',
|
||||
'queryByBFS': 'BFS查询',
|
||||
'queryStateTransitions': '查询状态转移',
|
||||
'addStateTransition': '添加状态转移'
|
||||
};
|
||||
return toolNameMap[toolName] || toolName;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user