fix: 全面测试修复 — useTools TDZ 错误 + CSS 变量缺失

- agent-engine.ts: 修复 useTools 在声明前使用导致运行时 ReferenceError
- style.css: 补充 --primary, --primary-bg, --bg-hover 三个缺失的 CSS 变量
This commit is contained in:
thzxx
2026-04-18 09:55:32 +08:00
parent 8ea7a056f3
commit c6fc8b116c
2 changed files with 7 additions and 3 deletions
+4 -3
View File
@@ -367,6 +367,10 @@ export async function runAgentLoop(
// 检查模型是否支持 Tool Calling
const modelSupportsTools = state.get<boolean>('modelSupportsTools', false);
// 提前获取工具列表,供后续系统 prompt 构建使用
const tools = getEnabledToolDefinitions();
const useTools = tools.length > 0;
const messages: OllamaMessage[] = [];
let systemPromptParts: string[] = [];
@@ -449,9 +453,6 @@ export async function runAgentLoop(
};
messages.push(userMsg);
const tools = getEnabledToolDefinitions();
const useTools = tools.length > 0;
logInfo(`ReAct Agent Loop 启动: ${model}`, `工具: ${useTools ? '开启' : '关闭'}, 记忆: ${isMemoryEnabled() ? '开启' : '关闭'}`);
let loopCount = 0;