@@ -40,7 +40,7 @@ export default class LMStudioProvider extends BaseProvider {
40
40
* Running in Server
41
41
* Backend: Check if we're running in Docker
42
42
*/
43
- const isDocker = process . env . RUNNING_IN_DOCKER === 'true' ;
43
+ const isDocker = process ? .env ?. RUNNING_IN_DOCKER === 'true' || serverEnv ? .RUNNING_IN_DOCKER === 'true' ;
44
44
45
45
baseUrl = isDocker ? baseUrl . replace ( 'localhost' , 'host.docker.internal' ) : baseUrl ;
46
46
baseUrl = isDocker ? baseUrl . replace ( '127.0.0.1' , 'host.docker.internal' ) : baseUrl ;
@@ -58,7 +58,7 @@ export default class LMStudioProvider extends BaseProvider {
58
58
}
59
59
getModelInstance : ( options : {
60
60
model : string ;
61
- serverEnv : Env ;
61
+ serverEnv ? : Env ;
62
62
apiKeys ?: Record < string , string > ;
63
63
providerSettings ?: Record < string , IProviderSetting > ;
64
64
} ) => LanguageModelV1 = ( options ) => {
@@ -75,16 +75,17 @@ export default class LMStudioProvider extends BaseProvider {
75
75
throw new Error ( 'No baseUrl found for LMStudio provider' ) ;
76
76
}
77
77
78
+ const isDocker = process . env . RUNNING_IN_DOCKER === 'true' || serverEnv ?. RUNNING_IN_DOCKER === 'true' ;
79
+
78
80
if ( typeof window === 'undefined' ) {
79
- const isDocker = process . env . RUNNING_IN_DOCKER === 'true' ;
80
81
baseUrl = isDocker ? baseUrl . replace ( 'localhost' , 'host.docker.internal' ) : baseUrl ;
81
82
baseUrl = isDocker ? baseUrl . replace ( '127.0.0.1' , 'host.docker.internal' ) : baseUrl ;
82
83
}
83
84
84
85
logger . debug ( 'LMStudio Base Url used: ' , baseUrl ) ;
85
86
86
87
const lmstudio = createOpenAI ( {
87
- baseUrl : `${ baseUrl } /v1` ,
88
+ baseURL : `${ baseUrl } /v1` ,
88
89
apiKey : '' ,
89
90
} ) ;
90
91
0 commit comments