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

Cannot pipe into aichat -e #531

Closed
denniswebb opened this issue May 21, 2024 · 1 comment · Fixed by #930
Closed

Cannot pipe into aichat -e #531

denniswebb opened this issue May 21, 2024 · 1 comment · Fixed by #930

Comments

@denniswebb
Copy link

denniswebb commented May 21, 2024

Describe the bug

On Mac, piping data to aichat -e always exits non-zero and without allowing you to run with the error

Error: IO error: Failed to initialize input reader

Caused by:
    Failed to initialize input reader

You can tell that it receives the data and a response from the GPT because it actually shows the proposed command, just exits with the error instead of waiting for your response.

This works as expected without -e but of course isn't what I need.

To Reproduce

Pipe any input into aichat -e

Expected behavior

App would present the EREC menu and await my response.

Screenshots/Logs

image

Configuration

model               openai:gpt-4o
max_output_tokens   -
temperature         -
top_p               -
dry_run             false
save                false
save_session        -
highlight           true
light_theme         true
wrap                no
wrap_code           false
auto_copy           false
keybindings         emacs
prelude             -
compress_threshold  2000

Environment (please complete the following information):

  • os version: Sonoma 14.4 (23E214) - Darwin Kernel Version 23.4.0
  • aichat version: 0.17.0
  • terminal version: bash-5.2, fish 3.7.1, iTerm2 3.5.0

Additional context

I know you've had a few patches before related to this.

@sigoden
Copy link
Owner

sigoden commented May 21, 2024

The problem is related to inquire which provide interactive prompts (mikaelmello/inquire#200), Inquire uses an outdated version of crossterm that lacks support for reading standard input from a pipe.

I've encountered similar issue #257 before, but I resolved them by enabling the use-dev-tty feature for crossterm (#264).

I have submitted a issue (mikaelmello/inquire#252) to request that Inquire update its crossterm dependency.

Before that, the pipe stdin cannot be used with aichat -e .

@sigoden sigoden changed the title Cannot pipe into aichat -e with or without --no-stream Cannot pipe into aichat -e May 21, 2024
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

Successfully merging a pull request may close this issue.

2 participants