File tree Expand file tree Collapse file tree 2 files changed +20
-10
lines changed Expand file tree Collapse file tree 2 files changed +20
-10
lines changed Original file line number Diff line number Diff line change @@ -27,13 +27,16 @@ export class AzureProvider extends OpenAICompatibleProviderBase<typeof provider.
2727 return configuration . get ( 'ai.azure.url' ) ?? undefined ;
2828 }
2929
30- private async getOrPromptBaseUrl ( silent : boolean ) : Promise < string | undefined > {
30+ private async getOrPromptBaseUrl ( silent : boolean , hasApiKey : boolean ) : Promise < string | undefined > {
3131 let url : string | undefined = this . getUrl ( ) ;
3232
33- if ( silent || url != null ) return url ;
33+ if ( silent || ( url != null && hasApiKey ) ) return url ;
3434
3535 const input = window . createInputBox ( ) ;
3636 input . ignoreFocusOut = true ;
37+ if ( url ) {
38+ input . value = url ;
39+ }
3740
3841 const disposables : Disposable [ ] = [ ] ;
3942
@@ -94,10 +97,12 @@ export class AzureProvider extends OpenAICompatibleProviderBase<typeof provider.
9497 }
9598
9699 override async configured ( silent : boolean ) : Promise < boolean > {
97- const url = await this . getOrPromptBaseUrl ( silent ) ;
98- if ( url == null ) return false ;
100+ const hasApiKey = await super . configured ( true ) ;
101+
102+ const url = await this . getOrPromptBaseUrl ( silent , hasApiKey ) ;
103+ if ( ! url ) return false ;
99104
100- return super . configured ( silent ) ;
105+ return silent ? hasApiKey : super . configured ( silent ) ;
101106 }
102107
103108 protected override getHeaders < TAction extends AIActionType > (
Original file line number Diff line number Diff line change @@ -27,13 +27,16 @@ export class OpenAICompatibleProvider extends OpenAICompatibleProviderBase<typeo
2727 return configuration . get ( 'ai.openaicompatible.url' ) ?? undefined ;
2828 }
2929
30- private async getOrPromptBaseUrl ( silent : boolean ) : Promise < string | undefined > {
30+ private async getOrPromptBaseUrl ( silent : boolean , hasApiKey : boolean ) : Promise < string | undefined > {
3131 let url : string | undefined = this . getUrl ( ) ;
3232
33- if ( silent || url != null ) return url ;
33+ if ( silent || ( url != null && hasApiKey ) ) return url ;
3434
3535 const input = window . createInputBox ( ) ;
3636 input . ignoreFocusOut = true ;
37+ if ( url ) {
38+ input . value = url ;
39+ }
3740
3841 const disposables : Disposable [ ] = [ ] ;
3942
@@ -94,9 +97,11 @@ export class OpenAICompatibleProvider extends OpenAICompatibleProviderBase<typeo
9497 }
9598
9699 override async configured ( silent : boolean ) : Promise < boolean > {
97- const url = await this . getOrPromptBaseUrl ( silent ) ;
98- if ( url == null || isAzureUrl ( url ) ) return false ;
100+ const hasApiKey = await super . configured ( true ) ;
101+
102+ const url = await this . getOrPromptBaseUrl ( silent , hasApiKey ) ;
103+ if ( ! url || isAzureUrl ( url ) ) return false ;
99104
100- return super . configured ( silent ) ;
105+ return silent ? hasApiKey : super . configured ( silent ) ;
101106 }
102107}
You can’t perform that action at this time.
0 commit comments