AutoGPT: Fix plugin commands accumulating

pull/5481/head^2
Reinier van der Leer 2023-10-02 16:41:18 -05:00
parent a30cbcc2ce
commit 563df6ca3a
No known key found for this signature in database
GPG Key ID: CDC1180FDAE06193
1 changed files with 6 additions and 2 deletions

View File

@ -244,8 +244,8 @@ class BaseAgent(Configurable[BaseAgentSettings], ABC):
def build_prompt( def build_prompt(
self, self,
scratchpad: PromptScratchpad, scratchpad: PromptScratchpad,
extra_commands: list[CompletionModelFunction] = [], extra_commands: Optional[list[CompletionModelFunction]] = None,
extra_messages: list[ChatMessage] = [], extra_messages: Optional[list[ChatMessage]] = None,
**extras, **extras,
) -> ChatPrompt: ) -> ChatPrompt:
"""Constructs and returns a prompt with the following structure: """Constructs and returns a prompt with the following structure:
@ -256,6 +256,10 @@ class BaseAgent(Configurable[BaseAgentSettings], ABC):
Params: Params:
cycle_instruction: The final instruction for a thinking cycle 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 # Apply additions from plugins
for plugin in self.config.plugins: for plugin in self.config.plugins: