piersolenski / wtf.nvim

Delicious diagnostic debugging in Neovim 🤤
400 stars 9 forks source link

Allow OpenAI endpoint configuration via config #18

Closed k2589 closed 2 months ago

k2589 commented 8 months ago

When a user wants to use other API-compatible services or use a local instance of GPT, might be needed to redefine the OpenAI base URL.

With new configuration option openai_base_url, the user is able to set up whatever he wants. For example usage with a local instance of "g4f":

Run g4f container:

docker run -p 8080:8080 -p 1337:1337 -p 7900:7900 --shm-size="2g" hlohaus789/g4f:latest

Update plugin config to use it:

return {
    {
        "piersolenski/wtf.nvim",
        dependencies = {
            "MunifTanjim/nui.nvim",
        },
        config = function ()
            local wtf = require("wtf")
            wtf.setup({
                openai_api_key = "sk-xxxxxxxxxxxxxx",
                openai_model_id = "gpt-3.5-turbo",
                openai_base_url = "http://127.0.0.1:1337",
            })
        end
    },
}
k2589 commented 8 months ago

@piersolenski Hey! Could you review please?

piersolenski commented 4 months ago

Hey @k2589, are you still interested in working on this?