Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to initialize input reader #2

Open
remino opened this issue Oct 26, 2023 · 1 comment
Open

Failed to initialize input reader #2

remino opened this issue Oct 26, 2023 · 1 comment

Comments

@remino
Copy link

remino commented Oct 26, 2023

Yup, I’m back.

This is probably not an issue in Shai, but affects it.

I followed the instructions in the README. Installed the necessary script to make it work in my shell as well. I’ve tried both in my default Zsh and in Bash.

First, in Zsh, when starting Shai, it exits immediately and outputs:

Failed to initialize input reader

Seems it cannot capture stdin or something.

I’m using Oh-My-Zsh. I thought maybe tmux, or atuin, or fzf was interfering. I started Zsh without no config and no plugin instead, except the script needed by Shai. I even tried different keybindings. Sadly, same error.

I tried the same in Bash. The UI does show up, and I can the commands after sending my prompt. But accepting the command just exits, and outputs nothing in the command line.

Sounds like this is an issue in crossterm not working with ttys on macOS as mentioned in an issue with rust-pager. I see Shai is using crossterm. I guess it isn’t that cross-platform after all. ¯\_(ツ)_/¯

For now, I can at least use Shai in Zsh with the following:

shai ask --operating-system macos --shell zsh --model open-aigpt4-32k --write-stdout
@jonboh
Copy link
Owner

jonboh commented Oct 27, 2023

Following some of the links it seems that the crossterm problem can be fixed, here's the link to a repo example https://github.com/cosmikwolf/piped_cli_interactive, I cannot test it, but if you give it a try I can integrate the changes necessary to make shai work properly on mac as well.

Are you able to use the edit-command-line feature in zsh? The feature allows to change the buffer line text with your editor. shai uses the feature to work as the editor, that way shai can take the content of your buffer line and write its output to it. The way the contents are passed into shai and back to the buffer line is by a temporary file that zsh generates.
If you can use edit-command-line with your editor, shai should be able to work as well (maybe with some fix for the crossterm issue).

I'll try to investigate a bit more this issue this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants