|
| 1 | +return { |
| 2 | + 'David-Kunz/gen.nvim', |
| 3 | + opts = { |
| 4 | + model = 'llama3.2', -- The default model to use. |
| 5 | + quit_map = 'q', -- set keymap to close the response window |
| 6 | + retry_map = '<c-r>', -- set keymap to re-send the current prompt |
| 7 | + accept_map = '<c-cr>', -- set keymap to replace the previous selection with the last result |
| 8 | + host = 'localhost', -- The host running the Ollama service. |
| 9 | + port = '11434', -- The port on which the Ollama service is listening. |
| 10 | + display_mode = 'split', -- The display mode. Can be "float" or "split" or "horizontal-split". |
| 11 | + show_prompt = false, -- Shows the prompt submitted to Ollama. |
| 12 | + show_model = false, -- Displays which model you are using at the beginning of your chat session. |
| 13 | + no_auto_close = false, -- Never closes the window automatically. |
| 14 | + file = false, -- Write the payload to a temporary file to keep the command short. |
| 15 | + hidden = false, -- Hide the generation window (if true, will implicitly set `prompt.replace = true`), requires Neovim >= 0.10 |
| 16 | + init = function(options) |
| 17 | + pcall(io.popen, 'ollama serve > /dev/null 2>&1 &') |
| 18 | + end, |
| 19 | + -- Function to initialize Ollama |
| 20 | + command = function(options) |
| 21 | + local body = { model = options.model, stream = true } |
| 22 | + return 'curl --silent --no-buffer -X POST http://' .. options.host .. ':' .. options.port .. '/api/chat -d $body' |
| 23 | + end, |
| 24 | + -- The command for the Ollama service. You can use placeholders $prompt, $model and $body (shellescaped). |
| 25 | + -- This can also be a command string. |
| 26 | + -- The executed command must return a JSON object with { response, context } |
| 27 | + -- (context property is optional). |
| 28 | + -- list_models = '<omitted lua function>', -- Retrieves a list of model names |
| 29 | + debug = false, -- Prints errors and the command which is run. |
| 30 | + opts = function() |
| 31 | + require('gen').prompts['Review_Code'] = { |
| 32 | + prompt = 'Review the following code and make concise suggestions:\n```$filetype\n$text\n```', |
| 33 | + } |
| 34 | + end, |
| 35 | + }, |
| 36 | +} |
0 commit comments