@@ -40,7 +40,18 @@ export class GhostModel {
4040 if ( ! ( await checkKilocodeBalance ( profile . kilocodeToken , profile . kilocodeOrganizationId ) ) ) continue
4141 }
4242
43- this . loadProfile ( providerSettingsManager , selectedProfile , provider )
43+ const profile = await providerSettingsManager . getProfile ( {
44+ id : selectedProfile . id ,
45+ } )
46+
47+ this . apiHandler = buildApiHandler ( {
48+ ...profile ,
49+ [ modelIdKeysByProvider [ provider ] ] : AUTOCOMPLETE_PROVIDER_MODELS [ provider ] ,
50+ } )
51+
52+ if ( this . apiHandler instanceof OpenRouterHandler ) {
53+ await this . apiHandler . fetchModel ( )
54+ }
4455 this . loaded = true
4556 return true
4657 }
@@ -49,25 +60,6 @@ export class GhostModel {
4960 return false
5061 }
5162
52- public async loadProfile (
53- providerSettingsManager : ProviderSettingsManager ,
54- selectedProfile : ProviderSettingsEntry ,
55- provider : keyof typeof AUTOCOMPLETE_PROVIDER_MODELS ,
56- ) : Promise < void > {
57- const profile = await providerSettingsManager . getProfile ( {
58- id : selectedProfile . id ,
59- } )
60-
61- this . apiHandler = buildApiHandler ( {
62- ...profile ,
63- [ modelIdKeysByProvider [ provider ] ] : AUTOCOMPLETE_PROVIDER_MODELS [ provider ] ,
64- } )
65-
66- if ( this . apiHandler instanceof OpenRouterHandler ) {
67- await this . apiHandler . fetchModel ( )
68- }
69- }
70-
7163 /**
7264 * Generate response with streaming callback support
7365 */
0 commit comments