You can place the configuration of the tools you need in the app_handler
.
- AI-Commit-Messages
- AI-Translate
- Ask
- Attach-To-Chat
- Code-Explain
- Generate-Test-Cases
- Optimize-Code
- Optimize-Code-and-Display-Diff
- Word-Translate
- Generate-Docstring
- Code-Completions
return {
{
"Kurama622/llm.nvim",
dependencies = { "nvim-lua/plenary.nvim", "MunifTanjim/nui.nvim" },
cmd = { "LLMSessionToggle", "LLMSelectedTextHandler", "LLMAppHandler" },
config = function()
local tools = require("llm.common.tools")
require("llm").setup({
-- [[ Github Models ]]
url = "https://models.inference.ai.azure.com/chat/completions",
model = "gpt-4o",
api_type = "openai",
max_tokens = 8000,
temperature = 0.3,
top_p = 0.7,
prompt = "You are a helpful chinese assistant.",
spinner = {
text = {
"",
"",
"",
"",
},
hl = "Title",
},
prefix = {
user = { text = "😃 ", hl = "Title" },
assistant = { text = " ", hl = "Added" },
},
-- history_path = "/tmp/llm-history",
save_session = true,
max_history = 15,
max_history_name_length = 20,
-- stylua: ignore
keys = {
-- The keyboard mapping for the input window.
["Input:Submit"] = { mode = "n", key = "<cr>" },
["Input:Cancel"] = { mode = {"n", "i"}, key = "<C-c>" },
["Input:Resend"] = { mode = {"n", "i"}, key = "<C-r>" },
-- only works when "save_session = true"
["Input:HistoryNext"] = { mode = {"n", "i"}, key = "<C-j>" },
["Input:HistoryPrev"] = { mode = {"n", "i"}, key = "<C-k>" },
-- The keyboard mapping for the output window in "split" style.
["Output:Ask"] = { mode = "n", key = "i" },
["Output:Cancel"] = { mode = "n", key = "<C-c>" },
["Output:Resend"] = { mode = "n", key = "<C-r>" },
-- The keyboard mapping for the output and input windows in "float" style.
["Session:Toggle"] = { mode = "n", key = "<leader>ac" },
["Session:Close"] = { mode = "n", key = {"<esc>", "Q"} },
},
-- display diff [require by action_handler]
display = {
diff = {
layout = "vertical", -- vertical|horizontal split for default provider
opts = { "internal", "filler", "closeoff", "algorithm:patience", "followwrap", "linematch:120" },
provider = "mini_diff", -- default|mini_diff
},
},
app_handler = {
-- Your AI tools Configuration
-- TOOL_NAME = { ... }
...
},
})
end,
keys = {
{ "<leader>ac", mode = "n", "<cmd>LLMSessionToggle<cr>" },
-- Your AI Tools Key mappings
{ "<leader>ts", mode = "x", "<cmd>LLMAppHandler WordTranslate<cr>" },
-- | | |
-- your key mapping your mode tool name
},
},
}