feat(parrot): v2.5.1

This commit is contained in:
2026-02-11 11:46:27 +02:00
parent 6c19e9650e
commit c27eb5c525
2 changed files with 46 additions and 41 deletions

View File

@@ -28,7 +28,7 @@
"nvim-ufo": { "branch": "main", "commit": "72d54c31079d38d8dfc5456131b1d0fb5c0264b0" }, "nvim-ufo": { "branch": "main", "commit": "72d54c31079d38d8dfc5456131b1d0fb5c0264b0" },
"nvim-web-devicons": { "branch": "master", "commit": "6788013bb9cb784e606ada44206b0e755e4323d7" }, "nvim-web-devicons": { "branch": "master", "commit": "6788013bb9cb784e606ada44206b0e755e4323d7" },
"oil.nvim": { "branch": "master", "commit": "81b8a91735ad5cd24a6b3137f14a89f19176364f" }, "oil.nvim": { "branch": "master", "commit": "81b8a91735ad5cd24a6b3137f14a89f19176364f" },
"parrot.nvim": { "branch": "main", "commit": "dcae923c7070431c8cb628b19594ab640168684c" }, "parrot.nvim": { "branch": "main", "commit": "5d7e72bdc3efe2638e1bd94ff55028ecc40edd7a" },
"plenary": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, "plenary": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" }, "promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" },

View File

@@ -1,45 +1,50 @@
return { return {
'frankroeder/parrot.nvim', 'frankroeder/parrot.nvim',
version = '2.3.0', version = '2.5.1',
dependencies = { 'ibhagwan/fzf-lua', 'nvim-lua/plenary.nvim' }, dependencies = { 'ibhagwan/fzf-lua', 'nvim-lua/plenary.nvim' },
opts = { config = function()
providers = { local parrot_opts = {
anthropic = { providers = {
name = 'anthropic', anthropic = {
endpoint = 'https://api.anthropic.com/v1/messages', name = 'anthropic',
model_endpoint = 'https://api.anthropic.com/v1/models', endpoint = 'https://api.anthropic.com/v1/messages',
api_key = { '/usr/local/bin/sops', '--config', '/dev/null', '-d', vim.fn.expand('$HOME') .. '/.claude-api' }, model_endpoint = 'https://api.anthropic.com/v1/models',
headers = function(self) api_key = { '/usr/local/bin/sops', '--config', '/dev/null', '-d', vim.fn.expand('$HOME') .. '/.claude-api' },
return { headers = function(self)
['Content-Type'] = 'application/json', return {
['x-api-key'] = self.api_key, ['Content-Type'] = 'application/json',
['anthropic-version'] = '2023-06-01', ['x-api-key'] = self.api_key,
} ['anthropic-version'] = '2023-06-01',
end, }
params = { end,
chat = { max_tokens = 4096 }, params = {
command = { max_tokens = 4096 }, chat = { max_tokens = 4096 },
}, command = { max_tokens = 4096 },
models = { },
'claude-opus-4-6', models = {
'claude-sonet-4-5', 'claude-opus-4-6',
'claude-haiku-4-5', 'claude-sonet-4-5',
}, 'claude-haiku-4-5',
preprocess_payload = function(payload) },
for _, message in ipairs(payload.messages) do preprocess_payload = function(payload)
message.content = message.content:gsub('^%s*(.-)%s*$', "%1") for _, message in ipairs(payload.messages) do
end message.content = message.content:gsub('^%s*(.-)%s*$', "%1")
if payload.messages[1] and payload.messages[1].role == 'system' then end
-- remove the first message that serves as the system prompt as anthropic if payload.messages[1] and payload.messages[1].role == 'system' then
-- expects the system prompt to be part of the API call body and not the messages -- remove the first message that serves as the system prompt as anthropic
payload.system = payload.messages[1].content -- expects the system prompt to be part of the API call body and not the messages
table.remove(payload.messages, 1) payload.system = payload.messages[1].content
end table.remove(payload.messages, 1)
return payload end
end, return payload
} end,
}, }
user_input_ui = 'buffer', },
} user_input_ui = 'buffer',
}
local parrot = require('parrot')
parrot.setup(parrot_opts)
end
} }