From ad9d303031089c9c2e9e9957e3b02094f9b2f5e7 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Thu, 2 Mar 2023 18:26:52 +0900 Subject: [PATCH] Add safety guard for executing command This commit fixes #2 --- aishell/cli.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/aishell/cli.py b/aishell/cli.py index 79e01bb..3f591b1 100644 --- a/aishell/cli.py +++ b/aishell/cli.py @@ -17,8 +17,15 @@ def ask(question: str, use_chatgpt: bool = False): query_client = GPT3Client() console = Console() - with console.status(f'[green] Asking `{question}` ...'): + with console.status( + f''' +[green] AiShell is thinking of `{question}` ...[/green] + +[italic]AiShell is not responsible for any damage caused by the command executed by the user.[/italic]'''.strip(), ): response = query_client.query(question) console.print(f'[italic]ai$hell: {response}\n') - os.system(response) + will_execute = typer.confirm('Execute this command?') + + if will_execute: + os.system(response)