diff --git a/.config/nvim/lua/plugins/extras/coding/ai/gen.lua b/.config/nvim/lua/plugins/extras/coding/ai/gen.lua index d97d70d9..f620fe56 100644 --- a/.config/nvim/lua/plugins/extras/coding/ai/gen.lua +++ b/.config/nvim/lua/plugins/extras/coding/ai/gen.lua @@ -1,29 +1,63 @@ return { - "jellydn/gen.nvim", - opts = { - model = "codellama", - display_mode = "split", - show_prompt = true, - show_model = true, - no_auto_close = false, - init = function(options) - pcall(io.popen, "ollama serve > /dev/null 2>&1 &") - end, - command = "curl --silent --no-buffer -X POST http://localhost:11434/api/generate -d $body", - }, - config = function(_, opts) - local gen = require("gen") - gen.setup(opts) + { + "jellydn/gen.nvim", + opts = { + model = "codellama", + host = "localhost", + port = "11434", + display_mode = "split", + show_prompt = true, + show_model = true, + no_auto_close = false, + init = function(options) + pcall(io.popen, "ollama serve > /dev/null 2>&1 &") + end, + command = function(options) + local body = { model = options.model, stream = true } + return "curl --silent --no-buffer -X POST http://" + .. options.host + .. ":" + .. options.port + .. "/api/generate -d $body" + end, + }, + config = function(_, opts) + local gen = require("gen") + gen.setup(opts) - gen.prompts["Elaborate_Text"] = { - prompt = "Elaborate the following text:\n$text", - } - gen.prompts["Fix_Code"] = { - prompt = "Fix the following code. Only output the result in format ```$filetype\n...\n```:\n```$filetype\n$text\n```", - extract = "```$filetype\n(.-)```", - } - end, - keys = { - { "i", "Gen", mode = { "n", "v" }, desc = "IA (Gen)" }, + gen.prompts["Elaborate_Text"] = { + prompt = "Elaborate the following text:\n$text", + } + gen.prompts["Fix_Code"] = { + prompt = "Fix the following code. Only output the result in format ```$filetype\n...\n```:\n```$filetype\n$text\n```", + extract = "```$filetype\n(.-)```", + } + end, + keys = { + { "ii", "Gen", mode = { "n", "v" }, desc = "IA (Gen)" }, + { "ig", "Gen Generate", mode = { "n" }, desc = "Generate" }, + { "ic", "Gen Chat", mode = { "n" }, desc = "Chat" }, + { "is", "Gen Summarize", mode = { "n", "v" }, desc = "Summarize" }, + { "ia", "Gen Ask", mode = { "v" }, desc = "Ask" }, + { "iH", "Gen Change", mode = { "v" }, desc = "Change" }, + { "iG", "Gen Enhance_Grammar_Spelling", mode = { "v" }, desc = "Enhance Grammar Spelling" }, + { "iw", "Gen Enhance_Wording", mode = { "v" }, desc = "Enhance Wording" }, + { "iC", "Gen Make_Concise", mode = { "v" }, desc = "Make Concise" }, + { "il", "Gen Make_List", mode = { "v" }, desc = "Make List" }, + { "it", "Gen Make_Table", mode = { "v" }, desc = "Make Table" }, + { "ir", "Gen Review_Code", mode = { "v" }, desc = "Review Code" }, + { "ie", "Gen Enhance_Code", mode = { "v" }, desc = "Enhance Code" }, + { "ih", "Gen Change_Code", mode = { "v" }, desc = "Change Code" }, + { "if", "Gen Fix_Code", mode = { "v" }, desc = "Fix Code" }, + { "iE", "Gen Elaborate_Text", mode = { "v" }, desc = "Elaborate Text" }, + }, + }, + { + "folke/which-key.nvim", + opts = { + defaults = { + ["i"] = { name = "󱚦 IA (Gen)" }, + }, + }, }, }