浏览代码

Fixes #2940 relaxes OpenAI key validation

main
Eric Amodio 1年前
父节点
当前提交
00c9e6611e
共有 2 个文件被更改,包括 3 次插入2 次删除
  1. +1
    -0
      CHANGELOG.md
  2. +2
    -2
      src/ai/openaiProvider.ts

+ 1
- 0
CHANGELOG.md 查看文件

@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
### 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 [#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

+ 2
- 2
src/ai/openaiProvider.ts 查看文件

@ -174,7 +174,7 @@ async function getApiKey(storage: Storage): Promise {
disposables.push(
input.onDidHide(() => resolve(undefined)),
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';
return;
}
@ -182,7 +182,7 @@ async function getApiKey(storage: Storage): Promise {
}),
input.onDidAccept(() => {
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';
return;
}

正在加载...
取消
保存