From 3590babd8bfb1bea7f2e3835585094e846a4d41d Mon Sep 17 00:00:00 2001 From: zhayujie Date: Mon, 29 May 2023 15:52:26 +0800 Subject: [PATCH 1/2] fix: config name optimize --- bot/linkai/link_ai_bot.py | 8 ++++---- bridge/bridge.py | 2 +- config.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bot/linkai/link_ai_bot.py b/bot/linkai/link_ai_bot.py index e7b9703..a92466d 100644 --- a/bot/linkai/link_ai_bot.py +++ b/bot/linkai/link_ai_bot.py @@ -37,22 +37,22 @@ class LinkAIBot(Bot): session.messages.pop(0) # load config - app_code = conf().get("app_code") - app_market_api_key = conf().get("app_market_api_key") + app_code = conf().get("linkai_app_code") + linkai_api_key = conf().get("linkai_api_key") logger.info(f"[LINKAI] query={query}, app_code={app_code}") body = { "appCode": app_code, "messages": session.messages } - headers = {"Authorization": "Bearer " + app_market_api_key} + headers = {"Authorization": "Bearer " + linkai_api_key} # do http request res = requests.post(url=self.base_url + "/chat/completion", json=body, headers=headers).json() if not res or not res["success"]: if res.get("code") == self.AUTH_FAILED_CODE: - logger.exception(f"[LINKAI] please check your app_market_api_key, res={res}") + logger.exception(f"[LINKAI] please check your linkai_api_key, res={res}") return Reply(ReplyType.ERROR, "请再问我一次吧") else: # retry diff --git a/bridge/bridge.py b/bridge/bridge.py index 4de71fe..119e855 100644 --- a/bridge/bridge.py +++ b/bridge/bridge.py @@ -23,7 +23,7 @@ class Bridge(object): self.btype["chat"] = const.OPEN_AI if conf().get("use_azure_chatgpt", False): self.btype["chat"] = const.CHATGPTONAZURE - if conf().get("app_market_api_key") and conf().get("app_code"): + if conf().get("linkai_api_key") and conf().get("linkai_app_code"): self.btype["chat"] = const.LINKAI self.bots = {} diff --git a/config.py b/config.py index 97f5feb..9869c23 100644 --- a/config.py +++ b/config.py @@ -100,8 +100,8 @@ available_setting = { # 插件配置 "plugin_trigger_prefix": "$", # 规范插件提供聊天相关指令的前缀,建议不要和管理员指令前缀"#"冲突 # 应用市场配置 - "app_market_api_key": "", - "app_code": "" + "linkai_api_key": "", + "linkai_app_code": "" } From 69b685574568ef080dcddefb755b2271b6150d53 Mon Sep 17 00:00:00 2001 From: zhayujie Date: Mon, 29 May 2023 15:55:48 +0800 Subject: [PATCH 2/2] fix: comment modify --- config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.py b/config.py index 9869c23..26b2f8a 100644 --- a/config.py +++ b/config.py @@ -99,7 +99,7 @@ available_setting = { "appdata_dir": "", # 数据目录 # 插件配置 "plugin_trigger_prefix": "$", # 规范插件提供聊天相关指令的前缀,建议不要和管理员指令前缀"#"冲突 - # 应用市场配置 + # 知识库平台配置 "linkai_api_key": "", "linkai_app_code": "" }