mirror of
https://github.com/shareAI-lab/learn-claude-code.git
synced 2026-04-28 06:19:32 +00:00
auto_compact llm request error fixed
This commit is contained in:
parent
a9c71002d2
commit
1ffdf3d739
5 changed files with 2 additions and 5 deletions
|
|
@ -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."},
|
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue