gsuuon / model.nvim

Neovim plugin for interacting with LLM's and building editor integrated prompts.
MIT License
293 stars 21 forks source link

fix: carriage return in response #45

Closed randoentity closed 6 months ago

randoentity commented 6 months ago

When using an openai compatible API (text-generation-webui) I kept getting no response in nvim, while it was being generated and received on the network. Upon inspecting the response I saw that all but the first message had \r\n\r\n at their ends. Looking at the code it seems that the carriage return gets removed for the first message with the headers, but not for subsequent messages. I think there's more to this, but I'm very new to Lua, so digging deeper is proving difficult.