From 8f5eb70c267712cb2b3f65622fd5f6863e396cc2 Mon Sep 17 00:00:00 2001 From: glide-the <2533736852@qq.com> Date: Tue, 11 Jun 2024 16:41:05 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=B8=AD=E5=BF=83=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E4=BF=A1=E6=81=AF=20=E5=AD=90=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chatchat/config_work_space.py | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/libs/chatchat-server/chatchat/config_work_space.py b/libs/chatchat-server/chatchat/config_work_space.py index c8689816..a7ea0c9b 100644 --- a/libs/chatchat-server/chatchat/config_work_space.py +++ b/libs/chatchat-server/chatchat/config_work_space.py @@ -85,5 +85,37 @@ def model(**kwargs): print(config_model_workspace.get_config()) +@main.command("server", help="服务配置") +@click.option("--httpx_default_timeout", type=int, help="httpx默认超时时间") +@click.option("--open_cross_domain", type=click.Choice(["true", "false"]), help="是否开启跨域") +@click.option("--default_bind_host", help="默认绑定host") +@click.option("--webui_server_port", type=int, help="webui服务端口") +@click.option("--api_server_port", type=int, help="api服务端口") +@click.option("--clear", is_flag=True, help="清除配置") +@click.option("--show", is_flag=True, help="显示配置") +def server(**kwargs): + + if kwargs["httpx_default_timeout"]: + config_basic_workspace.set_httpx_default_timeout(httpx_default_timeout=kwargs["httpx_default_timeout"]) + if kwargs["open_cross_domain"]: + if kwargs["open_cross_domain"].lower() == "true": + config_basic_workspace.set_open_cross_domain(True) + else: + config_basic_workspace.set_open_cross_domain(False) + if kwargs["default_bind_host"]: + config_basic_workspace.set_default_bind_host(default_bind_host=kwargs["default_bind_host"]) + + if kwargs["webui_server_port"]: + config_basic_workspace.set_webui_server_port(webui_server_port=kwargs["webui_server_port"]) + + if kwargs["api_server_port"]: + config_basic_workspace.set_api_server_port(api_server_port=kwargs["api_server_port"]) + + if kwargs["clear"]: + config_model_workspace.clear() + if kwargs["show"]: + print(config_model_workspace.get_config()) + + if __name__ == "__main__": main()