mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-04-18 01:53:47 +08:00
refactor: use enum to specify type
This commit is contained in:
@@ -4,6 +4,7 @@ baidu voice service
|
||||
"""
|
||||
import time
|
||||
from aip import AipSpeech
|
||||
from bridge.reply import Reply, ReplyType
|
||||
from common.log import logger
|
||||
from common.tmp_dir import TmpDir
|
||||
from voice.voice import Voice
|
||||
@@ -30,8 +31,8 @@ class BaiduVoice(Voice):
|
||||
with open(fileName, 'wb') as f:
|
||||
f.write(result)
|
||||
logger.info('[Baidu] textToVoice text={} voice file name={}'.format(text, fileName))
|
||||
reply = {"type": "VOICE", "content": fileName}
|
||||
reply = Reply(ReplyType.VOICE, fileName)
|
||||
else:
|
||||
logger.error('[Baidu] textToVoice error={}'.format(result))
|
||||
reply = {"type": "ERROR", "content": "抱歉,语音合成失败"}
|
||||
reply = Reply(ReplyType.ERROR, "抱歉,语音合成失败")
|
||||
return reply
|
||||
|
||||
Reference in New Issue
Block a user