diff options
Diffstat (limited to 'autogpts/autogpt/autogpt/app/utils.py')
-rw-r--r-- | autogpts/autogpt/autogpt/app/utils.py | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/autogpts/autogpt/autogpt/app/utils.py b/autogpts/autogpt/autogpt/app/utils.py index 3e986852b..49a1e2a44 100644 --- a/autogpts/autogpt/autogpt/app/utils.py +++ b/autogpts/autogpt/autogpt/app/utils.py @@ -7,20 +7,18 @@ import sys from pathlib import Path from typing import TYPE_CHECKING +import click import requests from colorama import Fore, Style from git import InvalidGitRepositoryError, Repo -from prompt_toolkit import ANSI, PromptSession -from prompt_toolkit.history import InMemoryHistory if TYPE_CHECKING: from autogpt.config import Config logger = logging.getLogger(__name__) -session = PromptSession(history=InMemoryHistory()) -async def clean_input(config: "Config", prompt: str = ""): +def clean_input(config: "Config", prompt: str = ""): try: if config.chat_messages_enabled: for plugin in config.plugins: @@ -53,11 +51,9 @@ async def clean_input(config: "Config", prompt: str = ""): # ask for input, default when just pressing Enter is y logger.debug("Asking user via keyboard...") - # 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) - return answer + return click.prompt( + text=prompt, prompt_suffix=" ", default="", show_default=False + ) except KeyboardInterrupt: logger.info("You interrupted AutoGPT") logger.info("Quitting...") |