@@ -40,7 +40,7 @@ export default class LMStudioProvider extends BaseProvider {
4040 * Running in Server
4141 * Backend: Check if we're running in Docker
4242 */
43- const isDocker = process . env . RUNNING_IN_DOCKER === 'true' ;
43+ const isDocker = process ? .env ?. RUNNING_IN_DOCKER === 'true' || serverEnv ? .RUNNING_IN_DOCKER === 'true' ;
4444
4545 baseUrl = isDocker ? baseUrl . replace ( 'localhost' , 'host.docker.internal' ) : baseUrl ;
4646 baseUrl = isDocker ? baseUrl . replace ( '127.0.0.1' , 'host.docker.internal' ) : baseUrl ;
@@ -58,7 +58,7 @@ export default class LMStudioProvider extends BaseProvider {
5858 }
5959 getModelInstance : ( options : {
6060 model : string ;
61- serverEnv : Env ;
61+ serverEnv ? : Env ;
6262 apiKeys ?: Record < string , string > ;
6363 providerSettings ?: Record < string , IProviderSetting > ;
6464 } ) => LanguageModelV1 = ( options ) => {
@@ -75,16 +75,17 @@ export default class LMStudioProvider extends BaseProvider {
7575 throw new Error ( 'No baseUrl found for LMStudio provider' ) ;
7676 }
7777
78+ const isDocker = process . env . RUNNING_IN_DOCKER === 'true' || serverEnv ?. RUNNING_IN_DOCKER === 'true' ;
79+
7880 if ( typeof window === 'undefined' ) {
79- const isDocker = process . env . RUNNING_IN_DOCKER === 'true' ;
8081 baseUrl = isDocker ? baseUrl . replace ( 'localhost' , 'host.docker.internal' ) : baseUrl ;
8182 baseUrl = isDocker ? baseUrl . replace ( '127.0.0.1' , 'host.docker.internal' ) : baseUrl ;
8283 }
8384
8485 logger . debug ( 'LMStudio Base Url used: ' , baseUrl ) ;
8586
8687 const lmstudio = createOpenAI ( {
87- baseUrl : `${ baseUrl } /v1` ,
88+ baseURL : `${ baseUrl } /v1` ,
8889 apiKey : '' ,
8990 } ) ;
9091
0 commit comments