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.
27
27
return configuration . get ( 'ai.azure.url' ) ?? undefined ;
28
28
}
29
29
30
- private async getOrPromptBaseUrl ( silent : boolean ) : Promise < string | undefined > {
30
+ private async getOrPromptBaseUrl ( silent : boolean , hasApiKey : boolean ) : Promise < string | undefined > {
31
31
let url : string | undefined = this . getUrl ( ) ;
32
32
33
- if ( silent || url != null ) return url ;
33
+ if ( silent || ( url != null && hasApiKey ) ) return url ;
34
34
35
35
const input = window . createInputBox ( ) ;
36
36
input . ignoreFocusOut = true ;
37
+ if ( url ) {
38
+ input . value = url ;
39
+ }
37
40
38
41
const disposables : Disposable [ ] = [ ] ;
39
42
@@ -94,10 +97,12 @@ export class AzureProvider extends OpenAICompatibleProviderBase<typeof provider.
94
97
}
95
98
96
99
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 ;
99
104
100
- return super . configured ( silent ) ;
105
+ return silent ? hasApiKey : super . configured ( silent ) ;
101
106
}
102
107
103
108
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
27
27
return configuration . get ( 'ai.openaicompatible.url' ) ?? undefined ;
28
28
}
29
29
30
- private async getOrPromptBaseUrl ( silent : boolean ) : Promise < string | undefined > {
30
+ private async getOrPromptBaseUrl ( silent : boolean , hasApiKey : boolean ) : Promise < string | undefined > {
31
31
let url : string | undefined = this . getUrl ( ) ;
32
32
33
- if ( silent || url != null ) return url ;
33
+ if ( silent || ( url != null && hasApiKey ) ) return url ;
34
34
35
35
const input = window . createInputBox ( ) ;
36
36
input . ignoreFocusOut = true ;
37
+ if ( url ) {
38
+ input . value = url ;
39
+ }
37
40
38
41
const disposables : Disposable [ ] = [ ] ;
39
42
@@ -94,9 +97,11 @@ export class OpenAICompatibleProvider extends OpenAICompatibleProviderBase<typeo
94
97
}
95
98
96
99
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 ;
99
104
100
- return super . configured ( silent ) ;
105
+ return silent ? hasApiKey : super . configured ( silent ) ;
101
106
}
102
107
}
You can’t perform that action at this time.
0 commit comments