You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 satır
1.9KB

  1. """
  2. channel factory
  3. """
  4. from common import const
  5. from common.log import logger
  6. def create_bot(bot_type):
  7. """
  8. create a bot_type instance
  9. :param bot_type: bot type code
  10. :return: bot instance
  11. """
  12. if bot_type == const.BAIDU:
  13. # 替换Baidu Unit为Baidu文心千帆对话接口
  14. # from bot.baidu.baidu_unit_bot import BaiduUnitBot
  15. # return BaiduUnitBot()
  16. from bot.baidu.baidu_wenxin import BaiduWenxinBot
  17. return BaiduWenxinBot()
  18. elif bot_type == const.CHATGPT:
  19. # ChatGPT 网页端web接口
  20. from bot.chatgpt.chat_gpt_bot import ChatGPTBot
  21. return ChatGPTBot()
  22. elif bot_type == const.OPEN_AI:
  23. # OpenAI 官方对话模型API
  24. from bot.openai.open_ai_bot import OpenAIBot
  25. return OpenAIBot()
  26. elif bot_type == const.CHATGPTONAZURE:
  27. # Azure chatgpt service https://azure.microsoft.com/en-in/products/cognitive-services/openai-service/
  28. from bot.chatgpt.chat_gpt_bot import AzureChatGPTBot
  29. return AzureChatGPTBot()
  30. elif bot_type == const.XUNFEI:
  31. from bot.xunfei.xunfei_spark_bot import XunFeiBot
  32. return XunFeiBot()
  33. elif bot_type == const.LINKAI:
  34. from bot.linkai.link_ai_bot import LinkAIBot
  35. return LinkAIBot()
  36. elif bot_type == const.CLAUDEAI:
  37. from bot.claude.claude_ai_bot import ClaudeAIBot
  38. return ClaudeAIBot()
  39. elif bot_type == const.CLAUDEAPI:
  40. from bot.claudeapi.claude_api_bot import ClaudeAPIBot
  41. return ClaudeAPIBot()
  42. elif bot_type == const.QWEN:
  43. from bot.ali.ali_qwen_bot import AliQwenBot
  44. return AliQwenBot()
  45. elif bot_type == const.GEMINI:
  46. from bot.gemini.google_gemini_bot import GoogleGeminiBot
  47. return GoogleGeminiBot()
  48. elif bot_type == const.ZHIPU_AI:
  49. from bot.zhipuai.zhipuai_bot import ZHIPUAIBot
  50. return ZHIPUAIBot()
  51. raise RuntimeError