From 6ef8844b2b36e03f1f9c9921f7ceca655ed9fc51 Mon Sep 17 00:00:00 2001 From: liunux4odoo <41217877+liunux4odoo@users.noreply.github.com> Date: Sun, 27 Aug 2023 16:46:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BD=BF=E7=94=A8chatgpt?= =?UTF-8?q?=E7=AD=89=E5=9C=A8=E7=BA=BFAPI=E6=9C=8D=E5=8A=A1=E6=97=B6?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E5=8A=A0=E8=BD=BD=E9=94=99=E8=AF=AF=20(#1271?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * close #1172: 给webui_page/utils添加一些log信息,方便定位错误 * 修复:重建知识库时页面未实时显示进度 * skip model_worker running when using online model api such as chatgpt --------- Co-authored-by: liunux4odoo --- configs/model_config.py.example | 1 - startup.py | 18 ++++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/configs/model_config.py.example b/configs/model_config.py.example index 5b2574e91..308fb8ee5 100644 --- a/configs/model_config.py.example +++ b/configs/model_config.py.example @@ -70,7 +70,6 @@ llm_model_dict = { # 4.0 seconds as it raised APIConnectionError: Error communicating with OpenAI. # 需要添加代理访问(正常开的代理软件可能会拦截不上)需要设置配置openai_proxy 或者 使用环境遍历OPENAI_PROXY 进行设置 "gpt-3.5-turbo": { - "local_model_path": "gpt-3.5-turbo", "api_base_url": "https://api.openai.com/v1", "api_key": os.environ.get("OPENAI_API_KEY"), "openai_proxy": os.environ.get("OPENAI_PROXY") diff --git a/startup.py b/startup.py index c8706e281..2ca62d932 100644 --- a/startup.py +++ b/startup.py @@ -404,14 +404,16 @@ def dump_server_info(after_start=False): processes["openai_api"] = process if args.model_worker: - process = Process( - target=run_model_worker, - name=f"model_worker({os.getpid()})", - args=(args.model_name, args.controller_address, queue, len(processes) + 1), - daemon=True, - ) - process.start() - processes["model_worker"] = process + model_path = llm_model_dict[args.model_name].get("local_model_path", "") + if os.path.isdir(model_path): + process = Process( + target=run_model_worker, + name=f"model_worker({os.getpid()})", + args=(args.model_name, args.controller_address, queue, len(processes) + 1), + daemon=True, + ) + process.start() + processes["model_worker"] = process if args.api: process = Process(