my-nvim-lua/lua/custom/plugins/configs/code-gpt.lua

41 lines
1.9 KiB
Lua
Raw Normal View History

2023-07-07 11:04:44 +00:00
local ok, codegpt = pcall(require, "codegpt")
if not ok then
vim.notify("missing module codegpt", vim.log.levels.WARN)
return
end
local M = {}
M.setup = function()
vim.g["codegpt_chat_completions_url"] = "http://localai.srvlan:8080/v1/chat/completions"
2023-07-07 11:04:44 +00:00
vim.g["codegpt_commands"] = {
["q4"] = {
2023-10-10 20:13:56 +00:00
callback_type = "code_popup",
system_message_template = "You are a {{filetype}} software pair assistant AI. Answer my questions. Think step by step out loud.",
user_message_template = "I have a question about the following {{language}} code: ```{{filetype}} {{text_selection}}``` {{command_args}}"
},
2023-07-07 11:04:44 +00:00
["tests"] = {
language_instructions = {
python = "Use pytest framework."
}
},
2023-08-06 12:15:51 +00:00
["code4"] = {
system_message_template = "You are a Programming pair Assistant AI. You are helpful with improving and optimizing source code using the best idiomatic practicies.",
model = "gpt-4",
user_message_template = "I have the following {{language}} code: ```{{filetype}}\n{{text_selection}}```\n{{command_args}}. {{language_instructions}} Think step by step then only return the code snippet and nothing else."
},
2023-07-07 11:04:44 +00:00
["docu4"] = {
2023-08-07 12:40:31 +00:00
language_instructions = {
python = "Use docstings to document the code. This project uses Sphinx. Use the google style python docstrings. Add sphinx directives if needed."
},
system_message_template = "You are a technical documentation assistant to a software developer. Help the user write clean detailed and easy to read project documentation.",
user_message_template = "Create or improve the documentation for: ```{{text_selection}}```\n. Use a professional tone. {{language_instructions}} {{command_args}}",
2023-07-13 14:18:06 +00:00
model = "gpt-4"
2023-07-07 11:04:44 +00:00
},
}
end
return M