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

fix: support piping stdin into gptme -r (resume) #344

Merged
merged 2 commits into from
Dec 18, 2024

Conversation

bjsi
Copy link
Contributor

@bjsi bjsi commented Dec 17, 2024

Almost got it to do this autonomously, but I still had to do some cleanup :P

I added the msg.role == "user" checks because those functions contain asserts that the role should be user.

Fixes #202


Important

Add support for piping stdin into gptme -r (resume) by appending piped input to prompt messages in cli.py.

  • Behavior:
    • Support piping stdin into gptme -r (resume) in cli.py.
    • Append piped input to prompt_msgs if resuming a conversation in main().
  • Functions:
    • Modify main() in cli.py to handle piped input and append to initial_msgs for new conversations.
    • Update confirm_func() and execute_cmd() logic in chat.py to handle user role checks.
  • Misc:
    • Refactor stdin reading logic in cli.py to use _read_stdin() function.

This description was created by Ellipsis for a69c42e. It will automatically update as commits are pushed.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Reviewed everything up to a69c42e in 11 seconds

More details
  • Looked at 58 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. gptme/cli.py:240
  • Draft comment:
    Consider refactoring the code to avoid redundancy when appending piped input as a system message. This pattern is repeated in multiple places.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The code in cli.py and chat.py has a repeated pattern for appending piped input as a system message. This can be refactored to avoid redundancy.

Workflow ID: wflow_WjHUDUfAniVn5nUR


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@ErikBjare ErikBjare changed the title support piping stdin into gptme -r (resume) fix: support piping stdin into gptme -r (resume) Dec 18, 2024
@ErikBjare
Copy link
Owner

Very nice! Thank you so much @bjsi ❤️

@ErikBjare ErikBjare merged commit 621ffd8 into ErikBjare:master Dec 18, 2024
5 of 7 checks passed
@ErikBjare
Copy link
Owner

Improved the behavior in #354

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 this pull request may close these issues.

Cannot pipe context into gptme -r
2 participants