File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change
1
+ declare global {
2
+ var midsceneGlobalConfig : Partial < ReturnType < typeof allConfigFromEnv > > | null ;
3
+ }
4
+
1
5
// config keys
2
6
export const MIDSCENE_OPENAI_INIT_CONFIG_JSON =
3
7
'MIDSCENE_OPENAI_INIT_CONFIG_JSON' ;
@@ -131,13 +135,11 @@ export const allConfigFromEnv = () => {
131
135
} ;
132
136
} ;
133
137
134
- let globalConfig : Partial < ReturnType < typeof allConfigFromEnv > > | null = null ;
135
-
136
138
const getGlobalConfig = ( ) => {
137
- if ( globalConfig === null ) {
138
- globalConfig = allConfigFromEnv ( ) ;
139
+ if ( ! globalThis . midsceneGlobalConfig ) {
140
+ globalThis . midsceneGlobalConfig = allConfigFromEnv ( ) ;
139
141
}
140
- return globalConfig ;
142
+ return globalThis . midsceneGlobalConfig ;
141
143
} ;
142
144
143
145
// import { UITarsModelVersion } from '@ui-tars/shared/constants';
@@ -276,7 +278,7 @@ export const overrideAIConfig = (
276
278
}
277
279
278
280
const currentConfig = getGlobalConfig ( ) ;
279
- globalConfig = extendMode
281
+ globalThis . midsceneGlobalConfig = extendMode
280
282
? { ...currentConfig , ...newConfig }
281
283
: { ...newConfig } ;
282
284
} ;
You can’t perform that action at this time.
0 commit comments