Bryley / neoai.nvim

Neovim plugin for intracting with GPT models from OpenAI
MIT License
558 stars 51 forks source link

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

Open alizdavoodi opened 1 year ago

alizdavoodi commented 1 year ago

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.)