Skip to content

bug: auto_compact 截取文本时丢弃最新对话,导致摘要丢失当前状态 #109

@Zheisenbergy

Description

@Zheisenbergy

在 s06_context_compact.py 的 auto_compact 函数中:
conversation_text = json.dumps(messages, default=str)[:80000]
这里使用 [:80000] 截取字符串开头,而 messages 是按时间正序存储的:旧消息在前,最新消息在后。
将截取方式改为取末尾:conversation_text = json.dumps(messages, default=str)[-80000:]
或者保留最近 N 条原始消息再压缩前面所有

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions