plugins/parrot: init

This commit is contained in:
Gaetan Lepage 2025-04-11 17:35:33 +02:00 committed by nix-infra-bot
parent 16879e3034
commit 327d491936
2 changed files with 141 additions and 0 deletions

View file

@ -0,0 +1,34 @@
{ lib, ... }:
lib.nixvim.plugins.mkNeovimPlugin {
name = "parrot";
packPathName = "parrot.nvim";
package = "parrot-nvim";
maintainers = [ lib.maintainers.GaetanLepage ];
extraConfig = {
dependencies.ripgrep.enable = lib.mkDefault true;
};
settingsExample = lib.literalExpression ''
{
cmd_prefix = "Parrot";
providers = {
github = {
api_key.__raw = "os.getenv 'GITHUB_TOKEN'";
topic.model = "gpt-4o";
};
};
hooks = {
Ask.__raw = '''
function(parrot, params)
local template = "Please, answer to this question: {{command}}."
local model_obj = parrot.get_model("command")
parrot.logger.info("Asking model: " .. model_obj.name)
parrot.Prompt(params, parrot.ui.Target.popup, model_obj, "🤖 Ask ~ ", template)
end
''';
};
};
'';
}

View file

@ -0,0 +1,107 @@
# Not including defaults are they are too big
{
minimal = {
plugins.parrot = {
enable = true;
settings.providers.github.__empty = null;
};
};
example = {
plugins.parrot = {
enable = true;
# https://github.com/frankroeder/parrot.nvim?tab=readme-ov-file#configuration
settings = {
providers = {
anthropic = {
api_key.__raw = "os.getenv('ANTHROPIC_API_KEY')";
endpoint = "https://api.anthropic.com/v1/messages";
topic_prompt = "You only respond with 3 to 4 words to summarize the past conversation.";
topic = {
model = "claude-3-haiku-20240307";
params.max_tokens = 32;
};
params = {
chat.max_tokens = 4096;
command.max_tokens = 4096;
};
models = [
"claude-3-haiku-20240307"
"claude-3-opus-20240229"
"claude-3-sonnet-20240229"
];
};
};
cmd_prefix = "Prt";
curl_params = [ ];
state_dir.__raw = "vim.fn.stdpath('data'):gsub('/$', '') .. '/parrot/persisted'";
chat_dir.__raw = "vim.fn.stdpath('data'):gsub('/$', '') .. '/parrot/chats'";
chat_user_prefix = "🗨:";
llm_prefix = "🦜:";
chat_confirm_delete = true;
online_model_selection = false;
chat_shortcut_respond = {
modes = [
"n"
"i"
"v"
"x"
];
shortcut = "<C-g><C-g>";
};
chat_shortcut_delete = {
modes = [
"n"
"i"
"v"
"x"
];
shortcut = "<C-g>d";
};
chat_shortcut_stop = {
modes = [
"n"
"i"
"v"
"x"
];
shortcut = "<C-g>s";
};
chat_shortcut_new = {
modes = [
"n"
"i"
"v"
"x"
];
shortcut = "<C-g>c";
};
chat_free_cursor = false;
chat_prompt_buf_type = false;
toggle_target = "vsplit";
user_input_ui = "native";
style_popup_border = "single";
style_popup_margin_bottom = 8;
style_popup_margin_left = 1;
style_popup_margin_right = 2;
style_popup_margin_top = 2;
style_popup_max_width = 160;
command_prompt_prefix_template = "🤖 {{llm}} ~ ";
command_auto_select_response = true;
fzf_lua_opts = {
"--ansi" = true;
"--sort" = "";
"--info" = "inline";
"--layout" = "reverse";
"--preview-window" = "nohidden:right:75%";
};
enable_spinner = true;
spinner_type = "star";
show_context_hints = true;
show_thinking_window = true;
};
};
};
}