Compare commits
2 Commits
e15b36801c
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| fba919fe08 | |||
| ec03680eb1 |
40
lua/config/codecompanion.lua
Normal file
40
lua/config/codecompanion.lua
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
require("codecompanion").setup({
|
||||||
|
interactions = {
|
||||||
|
chat = {
|
||||||
|
adapter = "auraid",
|
||||||
|
opts = {
|
||||||
|
completion_provider = "cmp",
|
||||||
|
context_management = { enabled = false },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
inline = { adapter = "auraid" },
|
||||||
|
},
|
||||||
|
adapters = {
|
||||||
|
http = {
|
||||||
|
auraid = function()
|
||||||
|
return require("codecompanion.adapters").extend("ollama", {
|
||||||
|
env = {
|
||||||
|
url = "http://localhost:11434",
|
||||||
|
},
|
||||||
|
headers = {
|
||||||
|
["Content-Type"] = "application/json",
|
||||||
|
},
|
||||||
|
schema = {
|
||||||
|
model = { default = "qwen36-vision:latest" },
|
||||||
|
temperature = { default = 0.7 },
|
||||||
|
think = { default = false },
|
||||||
|
max_tokens = { default = 268288 },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
opts = {
|
||||||
|
show_model_choices = false,
|
||||||
|
show_presets = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
log_level = "TRACE",
|
||||||
|
send_code = true,
|
||||||
|
},
|
||||||
|
})
|
||||||
@ -31,7 +31,10 @@ require("lazy").setup({
|
|||||||
-- colorscheme that will be used when installing plugins.
|
-- colorscheme that will be used when installing plugins.
|
||||||
install = { colorscheme = { "habamax" } },
|
install = { colorscheme = { "habamax" } },
|
||||||
-- automatically check for plugin updates
|
-- automatically check for plugin updates
|
||||||
checker = { enabled = true },
|
checker = {
|
||||||
|
enabled = true,
|
||||||
|
notify = false
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
local function augroup(name)
|
local function augroup(name)
|
||||||
|
|||||||
@ -4,7 +4,7 @@ require'nvim-treesitter'.setup {
|
|||||||
disable = function(lang, buf)
|
disable = function(lang, buf)
|
||||||
-- Проверяем, существует ли буфер и связан ли он с файлом
|
-- Проверяем, существует ли буфер и связан ли он с файлом
|
||||||
if not buf or buf == 0 then
|
if not buf or buf == 0 then
|
||||||
return true
|
--return true
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Получаем информацию о файле
|
-- Получаем информацию о файле
|
||||||
|
|||||||
@ -53,7 +53,16 @@ return {
|
|||||||
"folke/noice.nvim",
|
"folke/noice.nvim",
|
||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
opts = {
|
opts = {
|
||||||
-- add any options here
|
presets = {
|
||||||
|
lsp_doc_border = true,
|
||||||
|
},
|
||||||
|
routes = {
|
||||||
|
{
|
||||||
|
filter = { event = "msg_show" },
|
||||||
|
view = "mini",
|
||||||
|
opts = { timeout = 900 },
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
dependencies = {
|
dependencies = {
|
||||||
-- if you lazy-load any plugin below, make sure to add proper `module="..."` entries
|
-- if you lazy-load any plugin below, make sure to add proper `module="..."` entries
|
||||||
@ -151,43 +160,15 @@ return {
|
|||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
'gsuuon/model.nvim',
|
"olimorris/codecompanion.nvim",
|
||||||
|
opts = {},
|
||||||
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
},
|
||||||
config = function()
|
config = function()
|
||||||
local bash_provider = {
|
require("config.codecompanion")
|
||||||
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,
|
end,
|
||||||
run = function(messages, config)
|
},
|
||||||
local last_message = messages[#messages]
|
|
||||||
return { input = last_message.content }
|
|
||||||
end
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
end
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user