BuilderIO / ai-shell

A CLI that converts natural language to shell commands.
MIT License
3.75k stars 225 forks source link

Duplicated response #110

Closed llagerlof closed 5 hours ago

llagerlof commented 2 weeks ago

This is happening in my two OSs. WSL 2 on Windows 11 and EndeavourOS (arch based). Both bash.

Look at the section "Your script". It shows the command twice separated by the "script" word. This happens 100% of the times, prompt independent. If I run or edit the command, ai-shell show the correct response.

[me@pc ~]$ ai --version
1.0.9
[me@pc ~]$ ai install ssh client

┌  AI Shell
│
◇  Your script:

sudo pacman -S --noconfirm opensshscript sudo pacman -S --noconfirm openssh

•
│
◇  Explanation:

1. Run the script with superuser privileges using sudo.
2. Use the package manager pacman to install the package openssh.
3. Skip the confirmation prompt by using the --noconfirm flag.

•
│
◆  Run this script?
│  ● ✅ Yes (Lets go!)
│  ○ 📝 Edit
│  ○ 🔁 Revise
│  ○ 📋 Copy
│  ○ ❌ Cancel
└
llagerlof commented 6 days ago

I found the cause of this issue:

https://github.com/BuilderIO/ai-shell/blob/ce1fcfba66cacf33221e8bad4b1151a3d57a155d/src/prompt.ts#L123

I removed the line, and the program now shows the correct response, without duplicating it on screen.

llagerlof commented 5 hours ago

The fix was merged.