fix: 最大迭代次数和超时设置从未生效
main.ts 启动时未读取 agent.maxIterations/agent.totalTimeoutMs 配置,Engine 始终使用硬编码默认值(20/600000)。 现在启动时从 configService 读取并传入 AgentLoopEngine, 设置中的值终于生效。需重启应用后生效。
This commit is contained in:
+7
-1
@@ -148,8 +148,14 @@ async function initialize(): Promise<void> {
|
|||||||
|
|
||||||
// ===== Agent Loop =====
|
// ===== Agent Loop =====
|
||||||
const ollamaNumCtx = configService.get<number>('ollama.numCtx');
|
const ollamaNumCtx = configService.get<number>('ollama.numCtx');
|
||||||
|
const agentMaxIter = configService.get<number>('agent.maxIterations');
|
||||||
|
const agentTimeout = configService.get<number>('agent.totalTimeoutMs');
|
||||||
const agentLoop = new AgentLoopEngine(
|
const agentLoop = new AgentLoopEngine(
|
||||||
{ contextLength: ollamaNumCtx ?? undefined },
|
{
|
||||||
|
maxIterations: agentMaxIter ?? 20,
|
||||||
|
totalTimeoutMs: agentTimeout ?? 600_000,
|
||||||
|
contextLength: ollamaNumCtx ?? undefined,
|
||||||
|
},
|
||||||
adapter, toolRegistry, preToolHooks, postToolHooks,
|
adapter, toolRegistry, preToolHooks, postToolHooks,
|
||||||
);
|
);
|
||||||
agentLoop.setTools(toolRegistry.listTools());
|
agentLoop.setTools(toolRegistry.listTools());
|
||||||
|
|||||||
Reference in New Issue
Block a user