From 563df6ca3a4bc1ad11ff921a37fc3fcb624c666d Mon Sep 17 00:00:00 2001 From: Reinier van der Leer Date: Mon, 2 Oct 2023 16:41:18 -0500 Subject: [PATCH] AutoGPT: Fix plugin commands accumulating --- autogpts/autogpt/autogpt/agents/base.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/autogpts/autogpt/autogpt/agents/base.py b/autogpts/autogpt/autogpt/agents/base.py index 5f900f42..c951f20a 100644 --- a/autogpts/autogpt/autogpt/agents/base.py +++ b/autogpts/autogpt/autogpt/agents/base.py @@ -244,8 +244,8 @@ class BaseAgent(Configurable[BaseAgentSettings], ABC): def build_prompt( self, scratchpad: PromptScratchpad, - extra_commands: list[CompletionModelFunction] = [], - extra_messages: list[ChatMessage] = [], + extra_commands: Optional[list[CompletionModelFunction]] = None, + extra_messages: Optional[list[ChatMessage]] = None, **extras, ) -> ChatPrompt: """Constructs and returns a prompt with the following structure: @@ -256,6 +256,10 @@ class BaseAgent(Configurable[BaseAgentSettings], ABC): Params: cycle_instruction: The final instruction for a thinking cycle """ + if extra_commands is None: + extra_commands = [] + if extra_messages is None: + extra_messages = [] # Apply additions from plugins for plugin in self.config.plugins: