瀏覽代碼

Merge pull request #1168 from zhayujie/feature-app-market

fix: config name optimize
master
zhayujie GitHub 1 年之前
父節點
當前提交
776cdaf63c
沒有發現已知的金鑰在資料庫的簽署中 GPG 金鑰 ID: 4AEE18F83AFDEB23
共有 3 個檔案被更改,包括 8 行新增8 行删除
  1. +4
    -4
      bot/linkai/link_ai_bot.py
  2. +1
    -1
      bridge/bridge.py
  3. +3
    -3
      config.py

+ 4
- 4
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


+ 1
- 1
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 = {}



+ 3
- 3
config.py 查看文件

@@ -99,9 +99,9 @@ available_setting = {
"appdata_dir": "", # 数据目录
# 插件配置
"plugin_trigger_prefix": "$", # 规范插件提供聊天相关指令的前缀,建议不要和管理员指令前缀"#"冲突
# 应用市场配置
"app_market_api_key": "",
"app_code": ""
# 知识库平台配置
"linkai_api_key": "",
"linkai_app_code": ""
}




Loading…
取消
儲存