mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-05-03 09:24:20 +08:00
[voice] using baidu service to gen reply voice
This commit is contained in:
@@ -9,6 +9,7 @@ import time
|
||||
import speech_recognition
|
||||
import pyttsx3
|
||||
from common.log import logger
|
||||
from common.tmp_dir import TmpDir
|
||||
from voice.voice import Voice
|
||||
|
||||
|
||||
@@ -42,7 +43,7 @@ class GoogleVoice(Voice):
|
||||
return "抱歉,无法连接到 Google 语音识别服务;{0}".format(e)
|
||||
|
||||
def textToVoice(self, text):
|
||||
textFile = self.tmpFilePath + '语音回复_' + str(int(time.time())) + '.mp3'
|
||||
textFile = TmpDir().path() + '语音回复_' + str(int(time.time())) + '.mp3'
|
||||
self.engine.save_to_file(text, textFile)
|
||||
self.engine.runAndWait()
|
||||
logger.info(
|
||||
|
||||
Reference in New Issue
Block a user