fix for avante updates

This commit is contained in:
2024-11-16 20:52:58 -07:00
parent c721aef662
commit 207cbdbad0
4 changed files with 101 additions and 42 deletions

View File

@ -8,7 +8,7 @@ return {
["local"] = true,
},
-- Begin opts
provider = "ol_llama",
provider = "ol_qwenm",
vendors = {
---@type AvanteProvider
ol_llama = {
@ -24,7 +24,31 @@ return {
},
body = {
model = opts.model,
messages = require("avante.providers").copilot.parse_message(code_opts), -- you can make your own message, but this is very advanced
messages = require("avante.providers").copilot.parse_messages(code_opts), -- you can make your own message, but this is very advanced
max_tokens = 2048,
stream = true,
},
}
end,
parse_response_data = function(data_stream, event_state, opts)
require("avante.providers").openai.parse_response(data_stream, event_state, opts)
end,
},
---@type AvanteProvider
ol_qwenl = {
["local"] = true,
endpoint = "127.0.0.1:11434/v1",
model = "qwen2.5-coder:32b",
parse_curl_args = function(opts, code_opts)
return {
url = opts.endpoint .. "/chat/completions",
headers = {
["Accept"] = "application/json",
["Content-Type"] = "application/json",
},
body = {
model = opts.model,
messages = require("avante.providers").copilot.parse_messages(code_opts), -- you can make your own message, but this is very advanced
max_tokens = 2048,
stream = true,
},
@ -48,7 +72,7 @@ return {
},
body = {
model = opts.model,
messages = require("avante.providers").copilot.parse_message(code_opts), -- you can make your own message, but this is very advanced
messages = require("avante.providers").copilot.parse_messages(code_opts), -- you can make your own message, but this is very advanced
max_tokens = 2048,
stream = true,
},
@ -59,10 +83,10 @@ return {
end,
},
---@type AvanteProvider
ol_gemma = {
ol_qwenm = {
["local"] = true,
endpoint = "127.0.0.1:11434/v1",
model = "codegemma",
model = "qwen2.5-coder:14b",
parse_curl_args = function(opts, code_opts)
return {
url = opts.endpoint .. "/chat/completions",
@ -72,7 +96,7 @@ return {
},
body = {
model = opts.model,
messages = require("avante.providers").copilot.parse_message(code_opts), -- you can make your own message, but this is very advanced
messages = require("avante.providers").copilot.parse_messages(code_opts), -- you can make your own message, but this is very advanced
max_tokens = 2048,
stream = true,
},

View File

@ -22,4 +22,39 @@ return {
labels = "hoeadstnbufgmlzxcv",
},
},
{
"hrsh7th/nvim-cmp",
init = function()
vim.g.cmp_disabled = false
end,
opts = function(_, opts)
opts.enabled = function()
-- local context = require("cmp.config.context")
if vim.g.cmp_disabled == true then
return false
end
-- some other conditions (like not in commments) can go here
return not disabled
end
end,
keys = {
{
"<leader>ua",
function()
vim.g.cmp_disabled = not vim.g.cmp_disabled
local msg = ""
if vim.g.cmp_disabled == true then
msg = "Autocompletion (cmp) disabled"
else
msg = "Autocompletion (cmp) enabled"
end
vim.notify(msg, vim.log.levels.INFO)
end,
noremap = true,
silent = true,
desc = "toggle autocompletion",
},
},
},
}