fix: 上下文压缩阈值与摘要截断修复

1. engine: 压缩阈值改用 contextLength ?? contextWindow, Ollama 小 numCtx 时正确触发压缩

2. main: reloadAdapter 在 provider 切换时同步 contextLength, 非 Ollama 清除避免残留

3. engine: compressMessages 移除每条消息 500 字符截断, 摘要请求是独立 API 调用无需截断

4. delegate-task: 修复 items 缺少 description 的 TS2741 预存错误
This commit is contained in:
thzxx
2026-07-07 21:22:24 +08:00
parent ed59305b5e
commit 9ed4837950
3 changed files with 14 additions and 4 deletions
+8
View File
@@ -232,6 +232,14 @@ async function initialize(): Promise<void> {
const reloadAdapter = () => {
const newAdapter = createAdapter();
agentLoop.setAdapter(newAdapter);
// Provider 切换时同步 contextLength:仅 Ollama 使用 numCtx 作为有效上下文窗口
const provider = configService.get<string>('llm.provider') ?? '';
if (provider === 'ollama') {
const numCtx = configService.get<number>('ollama.numCtx');
agentLoop.updateConfig({ contextLength: numCtx ?? undefined });
} else {
agentLoop.updateConfig({ contextLength: undefined });
}
};
// ===== 窗口管理 =====