mirror of
https://github.com/shareAI-lab/analysis_claude_code.git
synced 2026-05-30 14:42:30 +08:00
auto_compact llm request error fixed
This commit is contained in:
@@ -117,7 +117,6 @@ def auto_compact(messages: list) -> list:
|
|||||||
# Replace all messages with compressed summary
|
# Replace all messages with compressed summary
|
||||||
return [
|
return [
|
||||||
{"role": "user", "content": f"[Conversation compressed. Transcript: {transcript_path}]\n\n{summary}"},
|
{"role": "user", "content": f"[Conversation compressed. Transcript: {transcript_path}]\n\n{summary}"},
|
||||||
{"role": "assistant", "content": "Understood. I have the context from the summary. Continuing."},
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@@ -227,6 +226,7 @@ def agent_loop(messages: list):
|
|||||||
if manual_compact:
|
if manual_compact:
|
||||||
print("[manual compact]")
|
print("[manual compact]")
|
||||||
messages[:] = auto_compact(messages)
|
messages[:] = auto_compact(messages)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@@ -255,7 +255,6 @@ def auto_compact(messages: list) -> list:
|
|||||||
summary = resp.content[0].text
|
summary = resp.content[0].text
|
||||||
return [
|
return [
|
||||||
{"role": "user", "content": f"[Compressed. Transcript: {path}]\n{summary}"},
|
{"role": "user", "content": f"[Compressed. Transcript: {path}]\n{summary}"},
|
||||||
{"role": "assistant", "content": "Understood. Continuing with summary context."},
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@@ -705,6 +704,7 @@ def agent_loop(messages: list):
|
|||||||
if manual_compress:
|
if manual_compress:
|
||||||
print("[manual compact]")
|
print("[manual compact]")
|
||||||
messages[:] = auto_compact(messages)
|
messages[:] = auto_compact(messages)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
# === SECTION: repl ===
|
# === SECTION: repl ===
|
||||||
|
|||||||
@@ -81,7 +81,6 @@ def auto_compact(messages: list) -> list:
|
|||||||
)
|
)
|
||||||
return [
|
return [
|
||||||
{"role": "user", "content": f"[Compressed]\n\n{response.content[0].text}"},
|
{"role": "user", "content": f"[Compressed]\n\n{response.content[0].text}"},
|
||||||
{"role": "assistant", "content": "Understood. Continuing."},
|
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -81,7 +81,6 @@ def auto_compact(messages: list) -> list:
|
|||||||
)
|
)
|
||||||
return [
|
return [
|
||||||
{"role": "user", "content": f"[Compressed]\n\n{response.content[0].text}"},
|
{"role": "user", "content": f"[Compressed]\n\n{response.content[0].text}"},
|
||||||
{"role": "assistant", "content": "Understood. Continuing."},
|
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -81,7 +81,6 @@ def auto_compact(messages: list) -> list:
|
|||||||
)
|
)
|
||||||
return [
|
return [
|
||||||
{"role": "user", "content": f"[Compressed]\n\n{response.content[0].text}"},
|
{"role": "user", "content": f"[Compressed]\n\n{response.content[0].text}"},
|
||||||
{"role": "assistant", "content": "Understood. Continuing."},
|
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user