aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Reinier van der Leer <pwuts@agpt.co> 2024-04-24 18:56:43 +0200
committerGravatar Reinier van der Leer <pwuts@agpt.co> 2024-04-24 18:56:43 +0200
commitbdda3a6698cc83d304d2c7d2f81f796bf6cfd7e1 (patch)
treed36323e7b39ea267ffdac4e4170e312971b2d305
parentfeat(agent/cli): Speed up loading of saved agents (diff)
downloadAuto-GPT-bdda3a6698cc83d304d2c7d2f81f796bf6cfd7e1.tar.gz
Auto-GPT-bdda3a6698cc83d304d2c7d2f81f796bf6cfd7e1.tar.bz2
Auto-GPT-bdda3a6698cc83d304d2c7d2f81f796bf6cfd7e1.zip
fix(agent): Omit `EventHistory` progress message if empty
Also add a heading to the progress section
-rw-r--r--autogpts/autogpt/autogpt/components/event_history.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/autogpts/autogpt/autogpt/components/event_history.py b/autogpts/autogpt/autogpt/components/event_history.py
index 5de1926f4..a66b18e2d 100644
--- a/autogpts/autogpt/autogpt/components/event_history.py
+++ b/autogpts/autogpt/autogpt/components/event_history.py
@@ -34,13 +34,12 @@ class EventHistoryComponent(MessageProvider, AfterParse, AfterExecute):
self.llm_provider = llm_provider
def get_messages(self) -> Iterator[ChatMessage]:
- yield ChatMessage.system(
- self._compile_progress(
- self.event_history.episodes,
- self.max_tokens,
- self.count_tokens,
- )
- )
+ if progress := self._compile_progress(
+ self.event_history.episodes,
+ self.max_tokens,
+ self.count_tokens,
+ ):
+ yield ChatMessage.system(f"## Progress on your Task so far\n\n{progress}")
def after_parse(self, result: ThoughtProcessOutput) -> None:
if result.command_name: