Krazal / nppopenai

OpenAI (aka. ChatGPT) plugin for Notepad++
GNU General Public License v2.0
58 stars 15 forks source link

[Request] Expose OpenAIURL in config #11

Closed Zuellni closed 1 year ago

Zuellni commented 1 year ago

Please consider exposing the OpenAIURL variable in the config file, or checking for OPENAI_API_BASE environment variable, which would allow using this plugin with local solutions such as text-generation-webui.

Krazal commented 1 year ago

Hi!

Thank you for the idea, and sorry for the late feedback!

This feature has been added to NppOpenAI v0.2.1 which is available here: x64: https://github.com/Krazal/nppopenai/releases/download/v0.2.1/NppOpenAI_x64.zip x86: https://github.com/Krazal/nppopenai/releases/download/v0.2.1/NppOpenAI_x86.zip

You should unzip the appropriate downloaded file to the NppOpenAI plugin folder which is by default: C:\Program Files (x86)\Notepad++\plugins\NppOpenAI\

In the config file (Plugins » NppOpenAI » Edit Config) in the [API] section a new api_url row has been added with the default https://api.openai.com/ URL address. Feel free to overwrite this value with a custom URL, but keep in mind, that an endpoint value (e.g. /v1/chat/completions) will be added, so • this value: http://localhost/openai_test.php?endpoint= • will be evaluated like this: http://localhost/openai_test.php?endpoint=/v1/chat/completions

After saving the config file don't forget to click Plugins » NppOpenAI » Load Config.

I plan to support environment variables too (OPENAI_API_BASE, OPENAI_API_KEY), however I'd like to create a brand new GUI for this for a better UX.

Zuellni commented 1 year ago

Thanks a lot, after setting api_url=http://127.0.0.1:5001 it works great with the text-gen openai extension.