Skip to content

Commit 0451bc8

Browse files
authored
Update s06_context_compact.py
fix: repair auto_compact truncating latest messages bug
1 parent a9c7100 commit 0451bc8

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

agents/s06_context_compact.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def auto_compact(messages: list) -> list:
104104
f.write(json.dumps(msg, default=str) + "\n")
105105
print(f"[transcript saved: {transcript_path}]")
106106
# Ask LLM to summarize
107-
conversation_text = json.dumps(messages, default=str)[:80000]
107+
conversation_text = json.dumps(messages, default=str)[-80000:]
108108
response = client.messages.create(
109109
model=MODEL,
110110
messages=[{"role": "user", "content":

0 commit comments

Comments
 (0)