From 72994bc9ef7fabe08d0375105dd393bec3e98321 Mon Sep 17 00:00:00 2001 From: lanvent Date: Tue, 28 Mar 2023 18:56:36 +0800 Subject: [PATCH] fix: voice to text bug --- channel/wechat/wechat_channel.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/channel/wechat/wechat_channel.py b/channel/wechat/wechat_channel.py index 30b3b18..49dc9fc 100644 --- a/channel/wechat/wechat_channel.py +++ b/channel/wechat/wechat_channel.py @@ -20,8 +20,10 @@ from common.tmp_dir import TmpDir from config import conf from common.time_check import time_checker from plugins import * - - +try: + from voice.audio_convert import mp3_to_wav +except Exception as e: + pass thread_pool = ThreadPoolExecutor(max_workers=8) @@ -271,7 +273,6 @@ class WechatChannel(Channel): msg.download(mp3_path) # mp3转wav wav_path = os.path.splitext(mp3_path)[0] + '.wav' - from voice.audio_convert import mp3_to_wav mp3_to_wav(mp3_path=mp3_path, wav_path=wav_path) # 语音识别 reply = super().build_voice_to_text(wav_path)