|
|
@@ -19,38 +19,42 @@ class Bridge(object): |
|
|
|
"translate": conf().get("translate", "baidu"), |
|
|
|
} |
|
|
|
# 这边取配置的模型 |
|
|
|
model_type = conf().get("model") or const.GPT35 |
|
|
|
if model_type in ["text-davinci-003"]: |
|
|
|
self.btype["chat"] = const.OPEN_AI |
|
|
|
if conf().get("use_azure_chatgpt", False): |
|
|
|
self.btype["chat"] = const.CHATGPTONAZURE |
|
|
|
if model_type in ["wenxin", "wenxin-4"]: |
|
|
|
self.btype["chat"] = const.BAIDU |
|
|
|
if model_type in ["xunfei"]: |
|
|
|
self.btype["chat"] = const.XUNFEI |
|
|
|
if model_type in [const.QWEN]: |
|
|
|
self.btype["chat"] = const.QWEN |
|
|
|
if model_type in [const.QWEN_TURBO, const.QWEN_PLUS, const.QWEN_MAX]: |
|
|
|
self.btype["chat"] = const.QWEN_DASHSCOPE |
|
|
|
if model_type in [const.GEMINI]: |
|
|
|
self.btype["chat"] = const.GEMINI |
|
|
|
if model_type in [const.ZHIPU_AI]: |
|
|
|
self.btype["chat"] = const.ZHIPU_AI |
|
|
|
if model_type and model_type.startswith("claude-3"): |
|
|
|
self.btype["chat"] = const.CLAUDEAPI |
|
|
|
bot_type = conf().get("bot_type") |
|
|
|
if bot_type: |
|
|
|
self.btype["chat"] = bot_type |
|
|
|
else: |
|
|
|
model_type = conf().get("model") or const.GPT35 |
|
|
|
if model_type in ["text-davinci-003"]: |
|
|
|
self.btype["chat"] = const.OPEN_AI |
|
|
|
if conf().get("use_azure_chatgpt", False): |
|
|
|
self.btype["chat"] = const.CHATGPTONAZURE |
|
|
|
if model_type in ["wenxin", "wenxin-4"]: |
|
|
|
self.btype["chat"] = const.BAIDU |
|
|
|
if model_type in ["xunfei"]: |
|
|
|
self.btype["chat"] = const.XUNFEI |
|
|
|
if model_type in [const.QWEN]: |
|
|
|
self.btype["chat"] = const.QWEN |
|
|
|
if model_type in [const.QWEN_TURBO, const.QWEN_PLUS, const.QWEN_MAX]: |
|
|
|
self.btype["chat"] = const.QWEN_DASHSCOPE |
|
|
|
if model_type in [const.GEMINI]: |
|
|
|
self.btype["chat"] = const.GEMINI |
|
|
|
if model_type in [const.ZHIPU_AI]: |
|
|
|
self.btype["chat"] = const.ZHIPU_AI |
|
|
|
if model_type and model_type.startswith("claude-3"): |
|
|
|
self.btype["chat"] = const.CLAUDEAPI |
|
|
|
|
|
|
|
if model_type in ["claude"]: |
|
|
|
self.btype["chat"] = const.CLAUDEAI |
|
|
|
if model_type in ["claude"]: |
|
|
|
self.btype["chat"] = const.CLAUDEAI |
|
|
|
|
|
|
|
if model_type in ["moonshot-v1-8k", "moonshot-v1-32k", "moonshot-v1-128k"]: |
|
|
|
self.btype["chat"] = const.MOONSHOT |
|
|
|
if model_type in ["moonshot-v1-8k", "moonshot-v1-32k", "moonshot-v1-128k"]: |
|
|
|
self.btype["chat"] = const.MOONSHOT |
|
|
|
|
|
|
|
if conf().get("use_linkai") and conf().get("linkai_api_key"): |
|
|
|
self.btype["chat"] = const.LINKAI |
|
|
|
if not conf().get("voice_to_text") or conf().get("voice_to_text") in ["openai"]: |
|
|
|
self.btype["voice_to_text"] = const.LINKAI |
|
|
|
if not conf().get("text_to_voice") or conf().get("text_to_voice") in ["openai", const.TTS_1, const.TTS_1_HD]: |
|
|
|
self.btype["text_to_voice"] = const.LINKAI |
|
|
|
if conf().get("use_linkai") and conf().get("linkai_api_key"): |
|
|
|
self.btype["chat"] = const.LINKAI |
|
|
|
if not conf().get("voice_to_text") or conf().get("voice_to_text") in ["openai"]: |
|
|
|
self.btype["voice_to_text"] = const.LINKAI |
|
|
|
if not conf().get("text_to_voice") or conf().get("text_to_voice") in ["openai", const.TTS_1, const.TTS_1_HD]: |
|
|
|
self.btype["text_to_voice"] = const.LINKAI |
|
|
|
|
|
|
|
self.bots = {} |
|
|
|
self.chat_bots = {} |
|
|
|