feat: 添加一键优化提示词功能

- 在 ICHelperPanel.ts 添加 optimizePrompt 消息处理分支
- 新增 promptOptimizeService.ts 调用后端优化 API
- 完善 WebView 端优化按钮交互逻辑
This commit is contained in:
XiaoFeng
2026-01-13 19:29:17 +08:00
parent 21a8abd5cf
commit 5753e120ba
6 changed files with 238 additions and 12 deletions

View File

@ -9,6 +9,7 @@ import {
handleReplaceInFile,
handleUserAnswer,
abortCurrentDialog,
handleOptimizePrompt,
handlePlanAction,
getCurrentTaskId,
setLastTaskId,
@ -328,6 +329,17 @@ export async function showICHelperPanel(
}
}
break;
case "optimizePrompt":
if (typeof message.prompt === "string") {
void handleOptimizePrompt(panel, message.prompt);
} else {
panel.webview.postMessage({
command: "optimizeResult",
success: false,
error: "提示词为空或格式错误",
});
}
break;
// 处理计划操作(只做模式切换,响应已通过 submitAnswer 发送)
case "planAction":
if (message.action === "confirm") {