@@ -11,9 +11,9 @@ import { IInstantiationService } from '../../../util/vs/platform/instantiation/c
11
11
import { CopilotLanguageModelWrapper } from '../../conversation/vscode-node/languageModelAccess' ;
12
12
import { BYOKAuthType , BYOKKnownModels , byokKnownModelsToAPIInfo , BYOKModelCapabilities , BYOKModelProvider , resolveModelInfo } from '../common/byokProvider' ;
13
13
import { OpenAIEndpoint } from '../node/openAIEndpoint' ;
14
+ import { OpenAIResponsesEndpoint } from '../node/openAIResponsesEndpoint' ;
14
15
import { IBYOKStorageService } from './byokStorageService' ;
15
16
import { promptForAPIKey } from './byokUIService' ;
16
- import { OpenAIResponsesEndpoint } from '../node/openAIResponsesEndpoint' ;
17
17
18
18
export abstract class BaseOpenAICompatibleLMProvider implements BYOKModelProvider < LanguageModelChatInformation > {
19
19
@@ -107,9 +107,14 @@ export abstract class BaseOpenAICompatibleLMProvider implements BYOKModelProvide
107
107
return ;
108
108
}
109
109
const newAPIKey = await promptForAPIKey ( this . _name , await this . _byokStorageService . getAPIKey ( this . _name ) !== undefined ) ;
110
- if ( newAPIKey ) {
110
+ if ( newAPIKey === undefined ) {
111
+ return ;
112
+ } else if ( newAPIKey === '' ) {
113
+ this . _apiKey = undefined ;
114
+ await this . _byokStorageService . deleteAPIKey ( this . _name , this . authType ) ;
115
+ } else if ( newAPIKey !== undefined ) {
111
116
this . _apiKey = newAPIKey ;
112
- this . _byokStorageService . storeAPIKey ( this . _name , this . _apiKey , BYOKAuthType . GlobalApiKey ) ;
117
+ await this . _byokStorageService . storeAPIKey ( this . _name , this . _apiKey , BYOKAuthType . GlobalApiKey ) ;
113
118
}
114
119
}
115
120
}
0 commit comments