Skip to content

Commit 3081a8e

Browse files
authored
Merge pull request #19 from code-yeongyu/feature/add-safety
Ask use to execute the command or not
2 parents 70a8078 + ad9d303 commit 3081a8e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

aishell/cli.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,15 @@ def ask(question: str, use_chatgpt: bool = False):
1717
query_client = GPT3Client()
1818

1919
console = Console()
20-
with console.status(f'[green] Asking `{question}` ...'):
20+
with console.status(
21+
f'''
22+
[green] AiShell is thinking of `{question}` ...[/green]
23+
24+
[italic]AiShell is not responsible for any damage caused by the command executed by the user.[/italic]'''.strip(), ):
2125
response = query_client.query(question)
2226
console.print(f'[italic]ai$hell: {response}\n')
2327

24-
os.system(response)
28+
will_execute = typer.confirm('Execute this command?')
29+
30+
if will_execute:
31+
os.system(response)

0 commit comments

Comments
 (0)