jay-aye-see-kay / chatbot-buffer.nvim Goto Github PK
View Code? Open in Web Editor NEWInteract with ai chatbots in an editable markdown buffer. Currently only supports one of openai's endpoints, may never support more.
Interact with ai chatbots in an editable markdown buffer. Currently only supports one of openai's endpoints, may never support more.
I have no idea how this would work but it would be really cool to allow this to run offline and believe it's possible
The current telescope picker is great for finding a file, but it would be nice to be able to grep the contents of the files too.
Adding commands that send a hunk of text for explanation, refactoring, or test writing would be useful. But they'd need a buffer to go to. Probably in the same directory as the conversation buffers.
Unknowns:
curl
support the server side events features required for streaming tokens, we just need to handle the format and append to the buffer as they come in. This implementation just worked, but it might be ignore some important data coming in
require("plenary.job")
:new({
command = "curl",
args = { url,
"-H", "Content-Type: application/json",
"-H", "Authorization: Bearer " .. key,
"-d", vim.fn.json_encode({
model = "gpt-3.5-turbo",
stream = true,
messages = {
{ role = "user", content = "Hello" },
},
}),
},
on_stdout = vim.schedule_wrap(function(_, data)
local maybeJson = data:sub(7)
if string.len(maybeJson) > 0 then
local _, update = pcall(vim.fn.json_decode, maybeJson)
if update ~= nil then
print(vim.inspect(update.choices[1]["delta"]["content"]))
end
end
end),
})
:start()
This requires creating a more thought out file naming scheme, something like YYYY-MM-DD_<num>_<name>.<suffix>
where name starts off as "unnamed"
. Then the name can be set with a function/command. This means we can let the user name a chat file, or turn on auto naming where we ask an ai endpoint to name the chat for us after the nth question / response.
The reason for doing this is to make a list of chat files more meaningful e.g. "I asked about X and Y on Z day - oh there's that code snippets I was looking for".
I'm not sure if I would use the manual naming feature but it's not much extra work to add it in too, and it might be nice sometimes.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.