ErikBjare / gptme

Your agent in your terminal, equipped with local tools: writes code, uses the terminal, browses the web, vision.
https://gptme.org/docs/
MIT License
2.64k stars 180 forks source link

feat(server): support interrupting stream, support slash commands #248

Closed ErikBjare closed 2 weeks ago

ErikBjare commented 2 weeks ago

…lash commands


[!IMPORTANT] Refactor api_conversation_generate() to handle user commands during streaming and manage client disconnections in gptme/server/api.py.

  • Behavior:
    • Refactor api_conversation_generate() to execute user commands during streaming.
    • Handle client disconnections in generate(), marking output as interrupted.
  • Functions:
    • Remove user-command execution from the initial part of api_conversation_generate().
    • Add client_disconnected() placeholder in generate().
  • Misc:
    • Minor logging changes in generate() to reflect client disconnection and completion.

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

codecov-commenter commented 2 weeks ago

Codecov Report

Attention: Patch coverage is 24.00000% with 19 lines in your changes missing coverage. Please review.

Project coverage is 72.09%. Comparing base (b3f3118) to head (a12ace2). Report is 1 commits behind head on master.

:white_check_mark: All tests successful. No failed tests found.

Files with missing lines Patch % Lines
gptme/server/api.py 24.00% 19 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #248 +/- ## ========================================== - Coverage 72.36% 72.09% -0.27% ========================================== Files 60 60 Lines 3893 3906 +13 ========================================== - Hits 2817 2816 -1 - Misses 1076 1090 +14 ``` | [Flag](https://app.codecov.io/gh/ErikBjare/gptme/pull/248/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Erik+Bj%C3%A4reholt) | Coverage Δ | | |---|---|---| | [anthropic/claude-3-haiku-20240307](https://app.codecov.io/gh/ErikBjare/gptme/pull/248/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Erik+Bj%C3%A4reholt) | `71.07% <24.00%> (-0.32%)` | :arrow_down: | | [openai/gpt-4o-mini](https://app.codecov.io/gh/ErikBjare/gptme/pull/248/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Erik+Bj%C3%A4reholt) | `70.96% <24.00%> (-0.32%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Erik+Bj%C3%A4reholt#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.