Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

24 lines
787B

  1. from bot import bot_factory
  2. from voice import voice_factory
  3. from config import conf
  4. from common import const
  5. class Bridge(object):
  6. def __init__(self):
  7. pass
  8. def fetch_reply_content(self, query, context):
  9. bot_type = const.CHATGPT
  10. model_type = conf().get("model")
  11. if model_type in ["gpt-3.5-turbo", "gpt-4", "gpt-4-32k"]:
  12. bot_type = const.CHATGPT
  13. elif model_type in ["text-davinci-003"]:
  14. bot_type = const.OPEN_AI
  15. return bot_factory.create_bot(bot_type).reply(query, context)
  16. def fetch_voice_to_text(self, voiceFile):
  17. return voice_factory.create_voice("openai").voiceToText(voiceFile)
  18. def fetch_text_to_voice(self, text):
  19. return voice_factory.create_voice("baidu").textToVoice(text)