mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2026-02-18 04:34:24 +01:00
feat(agent): Gracefully handle failure to load non-existing agent (#6938)
This commit is contained in:
committed by
GitHub
parent
30762c211e
commit
1881f4f7cd
@@ -164,7 +164,12 @@ async def run_auto_gpt(
|
||||
if re.match(r"^\d+$", load_existing_agent):
|
||||
load_existing_agent = existing_agents[int(load_existing_agent) - 1]
|
||||
elif load_existing_agent and load_existing_agent not in existing_agents:
|
||||
raise ValueError(f"Unknown agent '{load_existing_agent}'")
|
||||
logger.info(
|
||||
f"Unknown agent '{load_existing_agent}', "
|
||||
f"creating a new one instead.",
|
||||
extra={"color": Fore.YELLOW},
|
||||
)
|
||||
load_existing_agent = ""
|
||||
|
||||
# Either load existing or set up new agent state
|
||||
agent = None
|
||||
|
||||
Reference in New Issue
Block a user