Răsfoiți Sursa

feat: add always_reply_voice option

lanvent 3 ani în urmă
părinte
comite
d7f1f7182c
2 a modificat fișierele cu 3 adăugiri și 1 ștergeri
  1. 2 1
      channel/chat_channel.py
  2. 1 0
      config.py

+ 2 - 1
channel/chat_channel.py

@@ -98,11 +98,12 @@ class ChatChannel(Channel):
             else:
                 context.type = ContextType.TEXT
             context.content = content
+            if 'desire_rtype' not in context and conf().get('always_reply_voice'):
+                context['desire_rtype'] = ReplyType.VOICE
         elif context.type == ContextType.VOICE: 
             if 'desire_rtype' not in context and conf().get('voice_reply_voice'):
                 context['desire_rtype'] = ReplyType.VOICE
 
-
         return context
 
     # 处理消息 TODO: 如果wechaty解耦,此处逻辑可以放置到父类

+ 1 - 0
config.py

@@ -47,6 +47,7 @@ available_setting = {
     "speech_recognition": False,  # 是否开启语音识别
     "group_speech_recognition": False,  # 是否开启群组语音识别
     "voice_reply_voice": False,  # 是否使用语音回复语音,需要设置对应语音合成引擎的api key
+    "always_reply_voice": False,  # 是否一直使用语音回复
     "voice_to_text": "openai",  # 语音识别引擎,支持openai,google,azure
     "text_to_voice": "baidu",  # 语音合成引擎,支持baidu,google,pytts(offline),azure