增加了enable_asr配置选项,更改一处潜在的bug

This commit is contained in:
Windpicker-owo
2025-07-18 13:02:38 +08:00
parent 2017b1ba83
commit 3d9f1a1d5a
4 changed files with 8 additions and 1 deletions

View File

@@ -11,6 +11,9 @@ logger = get_logger("chat_voice")
async def get_voice_text(voice_base64: str) -> str:
"""获取音频文件描述"""
if not global_config.chat.enable_asr:
logger.warning("语音识别未启用,无法处理语音消息")
return "[语音]"
try:
# 解码base64音频数据
# 确保base64字符串只包含ASCII字符