-
Notifications
You must be signed in to change notification settings - Fork 390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for custom OpenAI URL #277
base: develop
Are you sure you want to change the base?
Conversation
It's quite strange how variables carry varying connotations.
And etc. Why not to keep everything in uppercase? |
Allows to run local OpenAI-compatible server. Since these local instances most likely lack proper certificates, allow using non-HTTPS endpoints as well. Signed-off-by: Alexander Bokovoy <[email protected]>
f03fc3c
to
b6ded16
Compare
@toropanov thanks, I updated to use uppercase version for both. |
src/utils/config.ts
Outdated
@@ -27,7 +27,7 @@ const configParsers = { | |||
'Please set your OpenAI API key via `aicommits config set OPENAI_KEY=<your token>`' | |||
); | |||
} | |||
parseAssert('OPENAI_KEY', key.startsWith('sk-'), 'Must start with "sk-"'); | |||
parseAssert('OPENAI_KEY', /^((sk-|no_api_key){1}[a-zA-Z0-9]*)$/.test(key), 'Must start with "sk-" or "no_api_key"'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we completely remove this check? My OpenAI instance requires an API key which doesn't start by sk-
, but still requires an API key.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can remove it in a separate commit.
The API key format is specific to a particular implementation and deployment of OPENAI API. There is no way to do common checks for it, so better to remove it at all and add some general note to the documentation instead. Signed-off-by: Alexander Bokovoy <[email protected]>
I've created a new project with your options based on aicommits. If you're interested, please check it out. |
👍🏻 I also plan to do this, it is very useful. |
Anything blocking this PR? I'd like to attach aicommits to LM Studio so I can keep everything local to my machine 🤞 |
Allows to run local OpenAI-compatible server. Since these local instances most likely lack proper certificates, allow using non-HTTPS endpoints as well.