aicommits
aicommits copied to clipboard
feat: `hostname` config to support other api services
Nice work! This is also a feature that I have been expecting.
However, after taking a quick look at your commit, I have a few suggestions regarding the code (Please forgive me for not being familiar with JavaScript or Node.js, so my suggestions below may contain errors):
-
According to the OpenAI Node.js Library, it is actually possible to achieve this functionality by setting the
basePath
. However, it seems that this project may have modified some of the logic to support proxies, which has resulted in the inability to use this feature. However, I still recommend referring to the naming in the OpenAI Node.js Library and considering usingbasePath
as a more appropriate naming option instead ofhostname
. -
And this commit has given me inspiration. When checking for
OPENAI_KEY
, OpenAI usessk-
as a prefix. However, when using a third-partybasePath
, some API distributors or proxies may not adhere to this format. Therefore, when using a third-partybasePath
, I suggest no longer checking the key format.
However, it seems that this project may have modified some of the logic to support proxies, which has resulted in the inability to use this feature.
Yes, aicommits
encapsulates the logic for the standalone request itself, without the help of the official OpenAI Node.js Library, which requires a lot of tweaking because the basePath in the official library is different from the hostname
in the current pr.
For the OPENAI_KEY checksum, it's not really related to basePath, so maybe we can provide another pr to do it.
Bump on this. Though it looks like hostname must now always be provided and doesn't default to the openai api
Can you add also custom path for api? I need not /v1/chat/completions but /openai/v1/chat/completions
Not to step on toes but I made this PR: https://github.com/Nutlope/aicommits/pull/272
Currently using this with an Azure instance of GPT and it's working for me.