David-Kunz / gen.nvim

Neovim plugin to generate text using LLMs with customizable prompts
The Unlicense
977 stars 62 forks source link

So after a while of using, the prompt displays nothing. #95

Closed khraosgenetor closed 1 month ago

khraosgenetor commented 2 months ago

the config, basically the default:

return  {
        "David-Kunz/gen.nvim",
        opts = {
            model = "phi3",
            host = "localhost",
            port = "11434",
            quit_map = "q",
            retry_map = "<c-r>",
            init = function(options)
                pcall(io.popen, "ollama serve > /dev/null 2>&1 &")
            end,
            -- Function to initialize Ollama
            command = function(options)
                local body = { model = options.model, stream = true }
                return "curl --silent --no-buffer -X POST http://"
                    .. options.host
                    .. ":"
                    .. options.port
                    .. "/api/chat -d $body"
            end,
            display_mode = "float",
            show_prompt = false,
            show_model = false,
            no_auto_close = false,
            debug = false,
        },
        config = function()
            vim.keymap.set({ "n", "v" }, "<leader>ai", ":Gen<CR>")
            require("gen").prompts["Elaborate_Text"] = {
                prompt = "Elaborate the following text:\n$text",
                replace = true,
            }
            require("gen").prompts["Fix_Code"] = {
                prompt = "Fix the following code. Only output the result in format ```$filetype\n...\n```:\n```$filetype\n$text\n```",
                replace = true,
                extract = "```$filetype\n(.-)```",
            }
        end,
    } -- Custom Parameters (with defaults)

Phi3 runs normally outside NeoVim.

khraosgenetor commented 2 months ago

So uhh, the problem is that giving it long lines of code breaks it. Is there a way to allow long lines of code without breaking it?

khraosgenetor commented 2 months ago

Also config = function() end breaks it