feat: WebView 集成运行模式

- webviewContent 集成模式选择器脚本和样式
- inputArea 适配模式传递
- ICViewProvider/ICHelperPanel 传递模式参数
This commit is contained in:
XiaoFeng
2025-12-30 20:42:44 +08:00
parent 42481cd314
commit 023fdb66c3
5 changed files with 105 additions and 6 deletions

View File

@ -9,6 +9,9 @@ import {
handleReplaceInFile,
handleUserAnswer,
abortCurrentDialog,
handlePlanAction,
setPendingPlanExecution,
getCurrentTaskId,
} from "../utils/messageHandler";
import { VCDViewerPanel } from "./VCDViewerPanel";
import { ChatHistoryManager } from "../utils/chatHistoryManager";
@ -107,7 +110,7 @@ export async function showICHelperPanel(
// 切换到当前面板的任务上下文
historyManager.switchToPanelTask(panelId);
handleUserMessage(panel, message.text, context.extensionPath);
handleUserMessage(panel, message.text, context.extensionPath, message.mode);
break;
case "readFile":
handleReadFile(panel, message.filePath);
@ -181,6 +184,24 @@ export async function showICHelperPanel(
case "abortDialog":
abortCurrentDialog();
break;
// 处理计划操作(只做模式切换,响应已通过 submitAnswer 发送)
case "planAction":
if (message.action === 'confirm') {
// 确认执行:切换到 Agent 模式
panel.webview.postMessage({
command: 'switchMode',
mode: 'agent'
});
// 获取当前会话的 taskId用于复用知识图谱数据
const taskId = getCurrentTaskId();
if (taskId) {
// 设置待执行的计划,对话结束后自动执行(复用 taskId
setPendingPlanExecution(panel, message.planTitle || '计划', context.extensionPath, taskId);
} else {
console.warn('[ICHelperPanel] 无法获取当前 taskId知识图谱数据可能丢失');
}
}
break;
}
},
undefined,