AutoGPT: Clean up CLI prompts

This commit is contained in:
Reinier van der Leer
2023-10-16 15:58:06 -07:00
parent 0278873fb5
commit a558c9fd04
4 changed files with 10 additions and 11 deletions

View File

@@ -476,7 +476,7 @@ async def get_user_feedback(
console_input = await clean_input(config, "Waiting for your response...")
else:
console_input = await clean_input(
config, Fore.MAGENTA + "Input: " + Style.RESET_ALL
config, Fore.MAGENTA + "Input:" + Style.RESET_ALL
)
# Parse user input
@@ -551,7 +551,7 @@ Name: {ai_config.ai_name}
Role: {ai_config.ai_role}
Goals: {ai_config.ai_goals}
API Budget: {"infinite" if ai_config.api_budget <= 0 else f"${ai_config.api_budget}"}
Continue ({config.authorise_key}/{config.exit_key}): """,
Continue ({config.authorise_key}/{config.exit_key}):""",
)
if should_continue.lower() == config.exit_key:
ai_config = AIConfig()

View File

@@ -60,7 +60,7 @@ async def interactive_ai_config_setup(
)
user_desire = await utils.clean_input(
config, f"{Fore.LIGHTBLUE_EX}I want AutoGPT to{Style.RESET_ALL}: "
config, f"{Fore.LIGHTBLUE_EX}I want AutoGPT to{Style.RESET_ALL}:"
)
if user_desire.strip() == "":
@@ -125,7 +125,7 @@ async def generate_aiconfig_manual(
message="For example, 'Entrepreneur-GPT'",
title_color=Fore.GREEN,
)
ai_name = await utils.clean_input(config, "AI Name: ")
ai_name = await utils.clean_input(config, "AI Name:")
if ai_name == "":
ai_name = "Entrepreneur-GPT"
@@ -145,7 +145,7 @@ async def generate_aiconfig_manual(
" the sole goal of increasing your net worth.'",
title_color=Fore.GREEN,
)
ai_role = await utils.clean_input(config, f"{ai_name} is: ")
ai_role = await utils.clean_input(config, f"{ai_name} is:")
if ai_role == "":
ai_role = "an AI designed to autonomously develop and run businesses with the"
" sole goal of increasing your net worth."
@@ -164,7 +164,7 @@ async def generate_aiconfig_manual(
ai_goals = []
for i in range(5):
ai_goal = await utils.clean_input(
config, f"{Fore.LIGHTBLUE_EX}Goal{Style.RESET_ALL} {i+1}: "
config, f"{Fore.LIGHTBLUE_EX}Goal{Style.RESET_ALL} {i+1}:"
)
if ai_goal == "":
break
@@ -184,7 +184,7 @@ async def generate_aiconfig_manual(
)
logger.info("Enter nothing to let the AI run without monetary limit")
api_budget_input = await utils.clean_input(
config, f"{Fore.LIGHTBLUE_EX}Budget{Style.RESET_ALL}: $"
config, f"{Fore.LIGHTBLUE_EX}Budget ($){Style.RESET_ALL}:"
)
if api_budget_input == "":
api_budget = 0.0

View File

@@ -50,7 +50,7 @@ async def clean_input(config: Config, prompt: str = ""):
# handle_sigint must be set to False, so the signal handler in the
# autogpt/main.py could be employed properly. This referes to
# https://github.com/Significant-Gravitas/AutoGPT/pull/4799/files/3966cdfd694c2a80c0333823c3bc3da090f85ed3#r1264278776
answer = await session.prompt_async(ANSI(prompt), handle_sigint=False)
answer = await session.prompt_async(ANSI(prompt + " "), handle_sigint=False)
return answer
except KeyboardInterrupt:
logger.info("You interrupted AutoGPT")

View File

@@ -27,7 +27,6 @@ from autogpt.core.utils.json_schema import JSONSchema
enabled=lambda config: not config.noninteractive_mode,
)
async def ask_user(question: str, agent: Agent) -> str:
resp = await clean_input(
agent.legacy_config, f"{agent.ai_config.ai_name} asks: '{question}': "
)
print(f"\nQ: {question}")
resp = await clean_input(agent.legacy_config, "A:")
return f"The user's answer: '{resp}'"