From e424e187cfb1ecaa07f2673138464e303fa7e699 Mon Sep 17 00:00:00 2001 From: hcyang Date: Wed, 20 May 2026 21:30:49 +0800 Subject: [PATCH 1/2] =?UTF-8?q?refactor(ui):=20=E4=BD=BF=E7=94=A8=20resetP?= =?UTF-8?q?romptInput=20=E7=AE=80=E5=8C=96=E6=92=A4=E9=94=80=E5=92=8C?= =?UTF-8?q?=E5=9B=9E=E7=BB=95=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 替换手动状态重置为调用 resetPromptInput 函数 - 简化代码提高可读性和维护性 - 保持撤销(undo)和回绕(rewind)命令处理逻辑一致 - 移除重复的状态重置代码块 --- src/ui/PromptInput.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/ui/PromptInput.tsx b/src/ui/PromptInput.tsx index 074cab6..d2af534 100644 --- a/src/ui/PromptInput.tsx +++ b/src/ui/PromptInput.tsx @@ -659,11 +659,7 @@ export const PromptInput = React.memo(function PromptInput({ } if (item.kind === "undo") { onSubmit({ text: "/undo", imageUrls: [], command: "undo" }); - setBuffer(EMPTY_BUFFER); - clearUndoRedoStacks(); - setImageUrls([]); - setSelectedSkills([]); - setShowSkillsDropdown(false); + resetPromptInput(); return; } if (item.kind === "mcp") { From a858684cf1d246d597552f0f16dc65bdedde422d Mon Sep 17 00:00:00 2001 From: hcyang Date: Wed, 20 May 2026 21:36:50 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix(executor):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=A0=BC=E5=BC=8F=E4=B8=8E=E8=AF=AD=E6=B3=95?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在工具类型列表的最后一项添加缺失的逗号 - 修正测试用例中 JSON 对象的格式错误 - 确保工具调用参数语法规范合理 - 修复断言前的代码缩进问题 --- src/tests/tool-executor.test.ts | 6 +++--- src/tools/executor.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tests/tool-executor.test.ts b/src/tests/tool-executor.test.ts index f7def2f..f36def2 100644 --- a/src/tests/tool-executor.test.ts +++ b/src/tests/tool-executor.test.ts @@ -29,9 +29,9 @@ test("ToolExecutor accepts title-case built-in tool aliases", async () => { type: "function", function: { name: "Read", - arguments: JSON.stringify({ file_path: filePath }) - } - } + arguments: JSON.stringify({ file_path: filePath }), + }, + }, ]); assert.equal(executions.length, 1); diff --git a/src/tools/executor.ts b/src/tools/executor.ts index edfca6f..220fc89 100644 --- a/src/tools/executor.ts +++ b/src/tools/executor.ts @@ -93,7 +93,7 @@ const BUILT_IN_TOOL_NAME_ALIASES = new Map([ ["Bash", "bash"], ["Read", "read"], ["Write", "write"], - ["Edit", "edit"] + ["Edit", "edit"], ]); export type ToolCallExecution = {