From f2d76f699b2b390837b44dd4954e7c1fb021276a Mon Sep 17 00:00:00 2001 From: thzxx Date: Sat, 27 Jun 2026 22:07:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9C=80=E5=A4=A7=E8=BF=AD=E4=BB=A3?= =?UTF-8?q?=E6=AC=A1=E6=95=B0=E5=92=8C=E8=B6=85=E6=97=B6=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E4=BB=8E=E6=9C=AA=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit main.ts 启动时未读取 agent.maxIterations/agent.totalTimeoutMs 配置,Engine 始终使用硬编码默认值(20/600000)。 现在启动时从 configService 读取并传入 AgentLoopEngine, 设置中的值终于生效。需重启应用后生效。 --- electron/main.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/electron/main.ts b/electron/main.ts index e2cf96c..1423747 100644 --- a/electron/main.ts +++ b/electron/main.ts @@ -148,8 +148,14 @@ async function initialize(): Promise { // ===== Agent Loop ===== const ollamaNumCtx = configService.get('ollama.numCtx'); + const agentMaxIter = configService.get('agent.maxIterations'); + const agentTimeout = configService.get('agent.totalTimeoutMs'); const agentLoop = new AgentLoopEngine( - { contextLength: ollamaNumCtx ?? undefined }, + { + maxIterations: agentMaxIter ?? 20, + totalTimeoutMs: agentTimeout ?? 600_000, + contextLength: ollamaNumCtx ?? undefined, + }, adapter, toolRegistry, preToolHooks, postToolHooks, ); agentLoop.setTools(toolRegistry.listTools());