feat(context): 优化对话压缩系统
- 添加独立摘要模型配置支持(SUMMARY_PROVIDER/MODEL/API_KEY/BASE_URL) - 添加 CompressionStatus 枚举和 DetailedCompressionResult 详细返回类型 - 实现压缩失败检测(空摘要、token膨胀) - 添加首条 user-assistant 对保护,确保上下文连贯性 - CompressionManager 支持独立摘要模型(优先使用小模型降低成本) - Agent 自动压缩时显示详细状态信息 - 更新相关测试用例
This commit is contained in:
@@ -178,7 +178,8 @@ describe('simpleCompact - 简单压缩', () => {
|
||||
messages.push(createUserMessage(`Message ${i}: ${'a'.repeat(100)}`));
|
||||
}
|
||||
|
||||
const result = simpleCompact(messages, testConfig);
|
||||
// 禁用首条保护以便测试摘要消息在第一位
|
||||
const result = simpleCompact(messages, testConfig, { protectFirstPair: false });
|
||||
|
||||
if (result.freedTokens > 0) {
|
||||
// 第一条消息应该是摘要
|
||||
@@ -192,7 +193,8 @@ describe('simpleCompact - 简单压缩', () => {
|
||||
messages.push(createUserMessage(`Message ${i}: ${'a'.repeat(100)}`));
|
||||
}
|
||||
|
||||
const result = simpleCompact(messages, testConfig);
|
||||
// 禁用首条保护以便测试摘要消息
|
||||
const result = simpleCompact(messages, testConfig, { protectFirstPair: false });
|
||||
|
||||
if (result.freedTokens > 0) {
|
||||
const summaryContent = result.messages[0].content as string;
|
||||
|
||||
Reference in New Issue
Block a user