From bdda3a6698cc83d304d2c7d2f81f796bf6cfd7e1 Mon Sep 17 00:00:00 2001 From: Reinier van der Leer Date: Wed, 24 Apr 2024 18:56:43 +0200 Subject: fix(agent): Omit `EventHistory` progress message if empty Also add a heading to the progress section --- autogpts/autogpt/autogpt/components/event_history.py | 13 ++++++------- 1 file 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: -- cgit v1.2.3