您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

bot_factory.py 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. """
  2. channel factory
  3. """
  4. from common import const
  5. def create_bot(bot_type):
  6. """
  7. create a bot_type instance
  8. :param bot_type: bot type code
  9. :return: bot instance
  10. """
  11. if bot_type == const.BAIDU:
  12. # 替换Baidu Unit为Baidu文心千帆对话接口
  13. # from bot.baidu.baidu_unit_bot import BaiduUnitBot
  14. # return BaiduUnitBot()
  15. from bot.baidu.baidu_wenxin import BaiduWenxinBot
  16. return BaiduWenxinBot()
  17. elif bot_type == const.CHATGPT:
  18. # ChatGPT 网页端web接口
  19. from bot.chatgpt.chat_gpt_bot import ChatGPTBot
  20. return ChatGPTBot()
  21. elif bot_type == const.OPEN_AI:
  22. # OpenAI 官方对话模型API
  23. from bot.openai.open_ai_bot import OpenAIBot
  24. return OpenAIBot()
  25. elif bot_type == const.CHATGPTONAZURE:
  26. # Azure chatgpt service https://azure.microsoft.com/en-in/products/cognitive-services/openai-service/
  27. from bot.chatgpt.chat_gpt_bot import AzureChatGPTBot
  28. return AzureChatGPTBot()
  29. elif bot_type == const.LINKAI:
  30. from bot.linkai.link_ai_bot import LinkAIBot
  31. return LinkAIBot()
  32. raise RuntimeError