mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-18 06:24:20 +01:00
Clean up where last_run_settings go
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -7,3 +7,4 @@ package-lock.json
|
|||||||
scripts/auto_gpt_workspace/*
|
scripts/auto_gpt_workspace/*
|
||||||
*.mpeg
|
*.mpeg
|
||||||
.env
|
.env
|
||||||
|
last_run_ai_settings.yaml
|
||||||
@@ -1,14 +1,18 @@
|
|||||||
import yaml
|
import yaml
|
||||||
import data
|
import data
|
||||||
|
|
||||||
|
|
||||||
class AIConfig:
|
class AIConfig:
|
||||||
def __init__(self, ai_name="", ai_role="", ai_goals=[]):
|
def __init__(self, ai_name="", ai_role="", ai_goals=[]):
|
||||||
self.ai_name = ai_name
|
self.ai_name = ai_name
|
||||||
self.ai_role = ai_role
|
self.ai_role = ai_role
|
||||||
self.ai_goals = ai_goals
|
self.ai_goals = ai_goals
|
||||||
|
|
||||||
|
# Soon this will go in a folder where it remembers more stuff about the run(s)
|
||||||
|
SAVE_FILE = "last_run_ai_settings.yaml"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def load(cls, config_file="config.yaml"):
|
def load(cls, config_file=SAVE_FILE):
|
||||||
# Load variables from yaml file if it exists
|
# Load variables from yaml file if it exists
|
||||||
try:
|
try:
|
||||||
with open(config_file) as file:
|
with open(config_file) as file:
|
||||||
@@ -22,10 +26,10 @@ class AIConfig:
|
|||||||
|
|
||||||
return cls(ai_name, ai_role, ai_goals)
|
return cls(ai_name, ai_role, ai_goals)
|
||||||
|
|
||||||
def save(self, config_file="config.yaml"):
|
def save(self, config_file=SAVE_FILE):
|
||||||
config = {"ai_name": self.ai_name, "ai_role": self.ai_role, "ai_goals": self.ai_goals}
|
config = {"ai_name": self.ai_name, "ai_role": self.ai_role, "ai_goals": self.ai_goals}
|
||||||
with open(config_file, "w") as file:
|
with open(config_file, "w") as file:
|
||||||
documents = yaml.dump(config, file)
|
yaml.dump(config, file)
|
||||||
|
|
||||||
def construct_full_prompt(self):
|
def construct_full_prompt(self):
|
||||||
prompt_start = """Your decisions must always be made independently without seeking user assistance. Play to your strengths as an LLM and pursue simple strategies with no legal complications."""
|
prompt_start = """Your decisions must always be made independently without seeking user assistance. Play to your strengths as an LLM and pursue simple strategies with no legal complications."""
|
||||||
|
|||||||
@@ -172,7 +172,11 @@ def construct_prompt():
|
|||||||
Fore.GREEN,
|
Fore.GREEN,
|
||||||
"Let's continue our journey.",
|
"Let's continue our journey.",
|
||||||
speak_text=True)
|
speak_text=True)
|
||||||
should_continue = input(f"Continue with the last settings? (Settings: {config.ai_name}, {config.ai_role}, {config.ai_goals}) (Y/n): ")
|
should_continue = input(f"""Continue with the last settings?
|
||||||
|
Name: {config.ai_name}
|
||||||
|
Role: {config.ai_role}
|
||||||
|
Goals: {config.ai_goals}
|
||||||
|
Continue (Y/n): """)
|
||||||
if should_continue.lower() == "n":
|
if should_continue.lower() == "n":
|
||||||
config = AIConfig()
|
config = AIConfig()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user