From 332f8be4014c3283aeab94fa63a65251b6986e5f Mon Sep 17 00:00:00 2001 From: liunux4odoo <41217877+liunux4odoo@users.noreply.github.com> Date: Tue, 3 Oct 2023 23:40:05 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20windows=E4=B8=8Bbind=5Fhost=E8=AE=BE?= =?UTF-8?q?=E4=B8=BA0.0.0.0=E6=97=B6=EF=BC=8C=E5=B0=86fschat=5Fxx=5Faddres?= =?UTF-8?q?s=E6=8C=87=E5=90=91127.0.0.1=EF=BC=8C=E9=81=BF=E5=85=8D?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E9=94=99=E8=AF=AF=20(#1651)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/utils.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server/utils.py b/server/utils.py index b6a3945b..8af6fc64 100644 --- a/server/utils.py +++ b/server/utils.py @@ -330,6 +330,8 @@ def fschat_controller_address() -> str: from configs.server_config import FSCHAT_CONTROLLER host = FSCHAT_CONTROLLER["host"] + if host == "0.0.0.0": + host = "127.0.0.1" port = FSCHAT_CONTROLLER["port"] return f"http://{host}:{port}" @@ -337,6 +339,8 @@ def fschat_controller_address() -> str: def fschat_model_worker_address(model_name: str = LLM_MODEL) -> str: if model := get_model_worker_config(model_name): host = model["host"] + if host == "0.0.0.0": + host = "127.0.0.1" port = model["port"] return f"http://{host}:{port}" return "" @@ -346,6 +350,8 @@ def fschat_openai_api_address() -> str: from configs.server_config import FSCHAT_OPENAI_API host = FSCHAT_OPENAI_API["host"] + if host == "0.0.0.0": + host = "127.0.0.1" port = FSCHAT_OPENAI_API["port"] return f"http://{host}:{port}/v1" @@ -354,6 +360,8 @@ def api_address() -> str: from configs.server_config import API_SERVER host = API_SERVER["host"] + if host == "0.0.0.0": + host = "127.0.0.1" port = API_SERVER["port"] return f"http://{host}:{port}"