Explorar el Código

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

fix: config name optimize
develop
zhayujie GitHub hace 1 año
padre
commit
776cdaf63c
No se encontró ninguna clave conocida en la base de datos para esta firma ID de clave GPG: 4AEE18F83AFDEB23
Se han modificado 3 ficheros con 8 adiciones y 8 borrados
  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 Ver fichero

@@ -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 Ver fichero

@@ -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 Ver fichero

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




Cargando…
Cancelar
Guardar