noice + notify
This commit is contained in:
32
lua/config/model.lua
Normal file
32
lua/config/model.lua
Normal file
@ -0,0 +1,32 @@
|
||||
local bash_provider = {
|
||||
request_completion = function(handlers, params, options)
|
||||
local input = params.input
|
||||
local command = "~/test '" .. input .. "'"
|
||||
local handle = io.popen(command)
|
||||
local result = handle:read("*a")
|
||||
handle:close()
|
||||
|
||||
local response = vim.json.decode(result)
|
||||
handlers.on_partial(response.message.content)
|
||||
handlers.on_finish()
|
||||
end
|
||||
}
|
||||
|
||||
require('model').setup({
|
||||
chats = {
|
||||
mybash = {
|
||||
provider = bash_provider,
|
||||
create = function(input, context)
|
||||
return {
|
||||
messages = {
|
||||
{ role = 'user', content = input }
|
||||
}
|
||||
}
|
||||
end,
|
||||
run = function(messages, config)
|
||||
local last_message = messages[#messages]
|
||||
return { input = last_message.content }
|
||||
end
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user