mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2026-02-20 13:44:25 +01:00
Refactor main startup to store AIConfig on Agent for plugin usage.
This commit is contained in:
@@ -10,7 +10,7 @@ from autogpt.config import Config, check_openai_api_key
|
||||
from autogpt.logs import logger
|
||||
from autogpt.memory import get_memory
|
||||
|
||||
from autogpt.prompts.prompt import construct_prompt
|
||||
from autogpt.prompts.prompt import construct_main_ai_config
|
||||
from autogpt.plugins import load_plugins
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ def main() -> None:
|
||||
cfg.set_plugins(loaded_plugins)
|
||||
|
||||
ai_name = ""
|
||||
prompt = construct_prompt()
|
||||
ai_config = construct_main_ai_config()
|
||||
# print(prompt)
|
||||
# Initialize variables
|
||||
full_message_history = []
|
||||
@@ -69,7 +69,8 @@ def main() -> None:
|
||||
memory=memory,
|
||||
full_message_history=full_message_history,
|
||||
next_action_count=next_action_count,
|
||||
prompt=prompt,
|
||||
config=ai_config,
|
||||
prompt=ai_config.construct_full_prompt(),
|
||||
user_input=user_input,
|
||||
)
|
||||
agent.start_interaction_loop()
|
||||
|
||||
@@ -31,6 +31,7 @@ class Agent:
|
||||
memory,
|
||||
full_message_history,
|
||||
next_action_count,
|
||||
config,
|
||||
prompt,
|
||||
user_input,
|
||||
):
|
||||
@@ -38,6 +39,7 @@ class Agent:
|
||||
self.memory = memory
|
||||
self.full_message_history = full_message_history
|
||||
self.next_action_count = next_action_count
|
||||
self.config = config
|
||||
self.prompt = prompt
|
||||
self.user_input = user_input
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ def build_default_prompt_generator() -> PromptGenerator:
|
||||
return prompt_generator
|
||||
|
||||
|
||||
def construct_prompt() -> str:
|
||||
def construct_main_ai_config() -> AIConfig:
|
||||
"""Construct the prompt for the AI to respond to
|
||||
|
||||
Returns:
|
||||
@@ -165,4 +165,4 @@ Continue (y/n): """
|
||||
config = prompt_user()
|
||||
config.save()
|
||||
|
||||
return config.construct_full_prompt()
|
||||
return config
|
||||
|
||||
Reference in New Issue
Block a user