Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

70 lines
2.1KB

  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.QWEN_DASHSCOPE:
  46. from bot.dashscope.dashscope_bot import DashscopeBot
  47. return DashscopeBot()
  48. elif bot_type == const.GEMINI:
  49. from bot.gemini.google_gemini_bot import GoogleGeminiBot
  50. return GoogleGeminiBot()
  51. elif bot_type == const.ZHIPU_AI:
  52. from bot.zhipuai.zhipuai_bot import ZHIPUAIBot
  53. return ZHIPUAIBot()
  54. elif bot_type == const.MOONSHOT:
  55. from bot.moonshot.moonshot_bot import MoonshotBot
  56. return MoonshotBot()
  57. raise RuntimeError