Browse Source

Fixes #2940 relaxes OpenAI key validation

main
Eric Amodio 1 year ago
parent
commit
00c9e6611e
2 changed files with 3 additions and 2 deletions
  1. +1
    -0
      CHANGELOG.md
  2. +2
    -2
      src/ai/openaiProvider.ts

+ 1
- 0
CHANGELOG.md View File

@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
### Fixed ### Fixed
- Fixes [#2940](https://github.com/gitkraken/vscode-gitlens/issues/2940) - Can't use Azure OpenAI model because i can't save the openai key because of the verification
- Fixes [#2928](https://github.com/gitkraken/vscode-gitlens/issues/2928) - Apply Changes should create new files when needed - Fixes [#2928](https://github.com/gitkraken/vscode-gitlens/issues/2928) - Apply Changes should create new files when needed
- Fixes [#2896](https://github.com/gitkraken/vscode-gitlens/issues/2896) - Repositories view stuck in loading state - Fixes [#2896](https://github.com/gitkraken/vscode-gitlens/issues/2896) - Repositories view stuck in loading state
- Fixes issue with "View as [List|Tree]" toggle not working in the _Commit Details_ view - Fixes issue with "View as [List|Tree]" toggle not working in the _Commit Details_ view

+ 2
- 2
src/ai/openaiProvider.ts View File

@ -174,7 +174,7 @@ async function getApiKey(storage: Storage): Promise {
disposables.push( disposables.push(
input.onDidHide(() => resolve(undefined)), input.onDidHide(() => resolve(undefined)),
input.onDidChangeValue(value => { input.onDidChangeValue(value => {
if (value && !/sk-[a-zA-Z0-9]{32}/.test(value)) {
if (value && !/(?:sk-)?[a-zA-Z0-9]{32}/.test(value)) {
input.validationMessage = 'Please enter a valid OpenAI API key'; input.validationMessage = 'Please enter a valid OpenAI API key';
return; return;
} }
@ -182,7 +182,7 @@ async function getApiKey(storage: Storage): Promise {
}), }),
input.onDidAccept(() => { input.onDidAccept(() => {
const value = input.value.trim(); const value = input.value.trim();
if (!value || !/sk-[a-zA-Z0-9]{32}/.test(value)) {
if (!value || !/(?:sk-)?[a-zA-Z0-9]{32}/.test(value)) {
input.validationMessage = 'Please enter a valid OpenAI API key'; input.validationMessage = 'Please enter a valid OpenAI API key';
return; return;
} }

Loading…
Cancel
Save