@@ -28,6 +28,11 @@ async def wrap_done(fn: Awaitable, event: asyncio.Event):
28
28
# Signal the aiter to stop.
29
29
event .set ()
30
30
31
+ def getlocalip (host : str = "127.0.0.1" ):
32
+ if host == "0.0.0.0" :
33
+ return "127.0.0.1"
34
+ return host
35
+
31
36
def fschat_controller_address () -> str :
32
37
host = FSCHAT_CONTROLLER ["host" ]
33
38
if host == "0.0.0.0" :
@@ -209,7 +214,7 @@ def get_model_worker_config(model_name: str = None) -> dict:
209
214
webui_config = configinst .dump ()
210
215
server_config = webui_config .get ("ServerConfig" )
211
216
212
- config ["host" ] = server_config .get ("default_host_ip" )
217
+ config ["host" ] = getlocalip ( server_config .get ("default_host_ip" ) )
213
218
config ["port" ] = server_config ["fastchat_model_worker" ]["default" ].get ("port" )
214
219
config ["vllm_enable" ] = server_config ["fastchat_model_worker" ]["default" ].get ("vllm_enable" )
215
220
@@ -250,7 +255,7 @@ def get_vtot_worker_config(model_name: str = None) -> dict:
250
255
configinst = InnerJsonConfigWebUIParse ()
251
256
webui_config = configinst .dump ()
252
257
server_config = webui_config .get ("ServerConfig" )
253
- config ["host" ] = server_config .get ("default_host_ip" )
258
+ config ["host" ] = getlocalip ( server_config .get ("default_host_ip" ) )
254
259
config ["port" ] = server_config ["vtot_model_worker" ].get ("port" )
255
260
256
261
if model_name is None or model_name == "" :
@@ -282,7 +287,7 @@ def get_speech_worker_config(model_name: str = None) -> dict:
282
287
configinst = InnerJsonConfigWebUIParse ()
283
288
webui_config = configinst .dump ()
284
289
server_config = webui_config .get ("ServerConfig" )
285
- config ["host" ] = server_config .get ("default_host_ip" )
290
+ config ["host" ] = getlocalip ( server_config .get ("default_host_ip" ) )
286
291
config ["port" ] = server_config ["ttov_model_worker" ].get ("port" )
287
292
288
293
if model_name is None or model_name == "" :
@@ -314,7 +319,7 @@ def get_image_recognition_worker_config(model_name: str = None) -> dict:
314
319
configinst = InnerJsonConfigWebUIParse ()
315
320
webui_config = configinst .dump ()
316
321
server_config = webui_config .get ("ServerConfig" )
317
- config ["host" ] = server_config .get ("default_host_ip" )
322
+ config ["host" ] = getlocalip ( server_config .get ("default_host_ip" ) )
318
323
config ["port" ] = server_config ["image_recognition_worker" ].get ("port" )
319
324
320
325
if model_name is None or model_name == "" :
@@ -340,7 +345,7 @@ def get_image_generation_worker_config(model_name: str = None) -> dict:
340
345
configinst = InnerJsonConfigWebUIParse ()
341
346
webui_config = configinst .dump ()
342
347
server_config = webui_config .get ("ServerConfig" )
343
- config ["host" ] = server_config .get ("default_host_ip" )
348
+ config ["host" ] = getlocalip ( server_config .get ("default_host_ip" ) )
344
349
config ["port" ] = server_config ["image_generation_worker" ].get ("port" )
345
350
346
351
if model_name is None or model_name == "" :
0 commit comments