Skip to content

Commit ad9d303

Browse files
committed
Add safety guard for executing command
This commit fixes #2
1 parent 89c9450 commit ad9d303

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)