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

Rewrite curl implementation using Plenary and add cancel stream functionality #45

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alizdavoodi
Copy link
Contributor

Hey,
In this MR, I am introducing a new dependency called https://github.com/nvim-lua/plenary.nvim. Plenary is a highly useful plugin with a variety of functions that simplifies the module.

Changes contains:

  1. Rewrite the curl part of the code using the Plenary package: The previous curl implementation has been updated to use the Plenary.curl module.
  2. Add cancel stream functionality: A new function named cancel_stream has been added to the OpenAI model. This function enables users to cancel the current stream and gracefully shut down the handler. This additional functionality provides better control and an improved user experience.(Additionally, there is a new keybinding Ctrl-X to cancel the stream, and if you close the NeoAI window while streaming, the stream will be canceled.)

…sage to properly handle JSON chunks.

2. Added a function to cancel the current stream and shut down the handler in openai.lua.
3. Removed an unnecessary newline in history.lua.
4. Migrated from custom curl implementation to the plenary curl module for better functionality and streamlined code.
5. Added a mapping in ui.lua to cancel the stream using the new cancel_stream() function.
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.

1 participant