mirror of
https://github.com/shareAI-lab/analysis_claude_code.git
synced 2026-05-06 16:26:16 +08:00
fix s06:some model textblock may not be the first element (#156)
Co-authored-by: liuyuchao.tick <liuyuchao.tick@bytedance.com>
This commit is contained in:
@@ -118,7 +118,9 @@ def auto_compact(messages: list) -> list:
|
||||
"Be concise but preserve critical details.\n\n" + conversation_text}],
|
||||
max_tokens=2000,
|
||||
)
|
||||
summary = response.content[0].text
|
||||
summary = next((block.text for block in response.content if hasattr(block, "text")), "")
|
||||
if not summary:
|
||||
summary = "No summary generated."
|
||||
# Replace all messages with compressed summary
|
||||
return [
|
||||
{"role": "user", "content": f"[Conversation compressed. Transcript: {transcript_path}]\n\n{summary}"},
|
||||
|
||||
Reference in New Issue
Block a user