@@ -9,6 +9,7 @@ import { globalSettingsSchema } from "../../schemas"
99import { ProviderSettingsManager , providerProfilesSchema } from "./ProviderSettingsManager"
1010import { ContextProxy } from "./ContextProxy"
1111import { CustomModesManager } from "./CustomModesManager"
12+ import { ProviderSettings } from "../../exports/types"
1213
1314type ImportOptions = {
1415 providerSettingsManager : ProviderSettingsManager
@@ -38,6 +39,7 @@ export const importSettings = async ({ providerSettingsManager, contextProxy, cu
3839
3940 try {
4041 const previousProviderProfiles = await providerSettingsManager . export ( )
42+
4143 const { providerProfiles : newProviderProfiles , globalSettings } = schema . parse (
4244 JSON . parse ( await fs . readFile ( uris [ 0 ] . fsPath , "utf-8" ) ) ,
4345 )
@@ -61,12 +63,12 @@ export const importSettings = async ({ providerSettingsManager, contextProxy, cu
6163 await providerSettingsManager . import ( newProviderProfiles )
6264 await contextProxy . setValues ( globalSettings )
6365
64- // Roo uses providerSettingsManager to manage api configs, but Cline uses ContextProxy, and to due to some legacy
65- // code from it, we need to set the the provider setttings here as well .
66- // For the future we should remove the provider from the proxy and keep providerSettingsManager as source of truth for apiConfig.
67- const firstApiConfig = Object . values ( providerProfiles . apiConfigs ) [ 0 ]
68- if ( firstApiConfig ) {
69- contextProxy . setProviderSettings ( firstApiConfig )
66+ // For the future we should remove the provider from the proxy and keep
67+ // providerSettingsManager as source of truth for apiConfig .
68+ const providerSettings : ProviderSettings = Object . values ( providerProfiles . apiConfigs ) [ 0 ]
69+
70+ if ( providerSettings ) {
71+ contextProxy . setProviderSettings ( providerSettings )
7072 }
7173
7274 contextProxy . setValue ( "currentApiConfigName" , providerProfiles . currentApiConfigName )
0 commit comments