From f9dba6113c956a99cf22849ac10ca16f58d24413 Mon Sep 17 00:00:00 2001 From: ikaros <327209194@qq.com> Date: Sun, 21 Apr 2024 12:49:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8A=A5=E9=94=99=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 4 +++- utils/gpt_model/sparkdesk.py | 18 +++++++++++------- utils/my_handle.py | 1 + 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 1f334fe5..75bfbe66 100644 --- a/.gitignore +++ b/.gitignore @@ -233,4 +233,6 @@ tests/test_faster_whisper/*.wav out/图像识别/*.png -main copy.py \ No newline at end of file +main copy.py + +data/*.db \ No newline at end of file diff --git a/utils/gpt_model/sparkdesk.py b/utils/gpt_model/sparkdesk.py index 68ae8b80..4ca32250 100644 --- a/utils/gpt_model/sparkdesk.py +++ b/utils/gpt_model/sparkdesk.py @@ -35,13 +35,17 @@ def __init__(self, data): version = data["version"] ) else: - self.sparkAPI = SparkAPI( - app_id = data["app_id"], - api_secret = data["api_secret"], - api_key = data["api_key"], - version = data["version"], - assistant_id = data["assistant_id"] - ) + try: + self.sparkAPI = SparkAPI( + app_id = data["app_id"], + api_secret = data["api_secret"], + api_key = data["api_key"], + version = data["version"], + assistant_id = data["assistant_id"] + ) + except TypeError as e: + logging.error(e) + logging.error("如果没有assistant_id传参,说明你的sparkdesk-api库版本太低,请更新至最新版本。\n请先激活conda环境,然后更新,参考命令:pip install git+https://gitee.com/ikaros-521/sparkdesk-api -U") else: logging.info("讯飞星火配置为空") diff --git a/utils/my_handle.py b/utils/my_handle.py index d7b05217..9357f33d 100644 --- a/utils/my_handle.py +++ b/utils/my_handle.py @@ -320,6 +320,7 @@ def config_load(self): logging.debug('创建integral(积分)表') except Exception as e: logging.error(traceback.format_exc()) + logging.error(f'数据库 {My_handle.config.get("database", "path")} 创建失败,请查看日志排查问题!!!') # 重载config