Open ShowUNow opened 1 year ago
同问,如何添加语音合成平台的api key
config.json
中设置 "speech_recognition": true 即可, 这个配置在 template中有。 启动程序后 私聊 就会支持语音识别,会对所有收到的语音消息转成文字,并回复文字。
有多种可选平台,以下提供两种方案,默认是OpenAI识别,Google语音合成:
(1) 安装依赖: pip3 install baidu-aip chardet
(2) 在 config.json
中添加配置:
{
"speech_recognition": true,
"voice_reply_voice": true,
"baidu_app_id": "YOUR BAIDU APP ID",
"baidu_api_key": "YOUR BAIDU API KEY",
"baidu_secret_key": "YOUR BAIDU SERVICE KEY"
}
(1) 安装 SpeechRecognition: pip3 install SpeechRecognition
(2) 安装 ffmpeg 和 espeak
(3) 在 config.json
中添加配置:
{
"speech_recognition": true,
"voice_reply_voice": true
}
注:在itchat中只能回复mp3文件;在wechaty中可以回复语音消息,wechaty中使用需要安装额外依赖:
pip3 install pysilk-mod
pip3 install pydub
"group_speech_recognition": true
加入配置项
PR: https://github.com/zhayujie/chatgpt-on-wechat/pull/385 by @wanggang1987 https://github.com/zhayujie/chatgpt-on-wechat/pull/476 by @Chiaki-Chan https://github.com/zhayujie/chatgpt-on-wechat/pull/623 by @Chiaki-Chan
你好。为什么我填好了之后还是提示这个错误呢?
[ERROR][2023-03-10 09:04:23][wechat_channel.py:151] - 'session_id' Traceback (most recent call last): File "E:\Enviroment\PythonWorks\src\chatgpt-on-wechat-20230310\chatgpt-on-wechat-1.0.5\channel\wechat\wechat_channel.py", line 145, in _do_send_voice reply_text = super().build_reply_content(query, context) File "E:\Enviroment\PythonWorks\src\chatgpt-on-wechat-20230310\chatgpt-on-wechat-1.0.5\channel\channel.py", line 31, in build_reply_content return Bridge().fetch_reply_content(query, context) File "E:\Enviroment\PythonWorks\src\chatgpt-on-wechat-20230310\chatgpt-on-wechat-1.0.5\bridge\bridge.py", line 10, in fetch_reply_content return bot_factory.create_bot("chatGPT").reply(query, context) File "E:\Enviroment\PythonWorks\src\chatgpt-on-wechat-20230310\chatgpt-on-wechat-1.0.5\bot\chatgpt\chat_gpt_bot.py", line 27, in reply session_id = context['session_id'] KeyError: 'session_id'
你好。为什么我填好了之后还是提示这个错误呢?
[ERROR][2023-03-10 09:04:23][wechat_channel.py:151] - 'session_id' Traceback (most recent call last): File "E:\Enviroment\PythonWorks\src\chatgpt-on-wechat-20230310\chatgpt-on-wechat-1.0.5\channel\wechat\wechat_channel.py", line 145, in _do_send_voice reply_text = super().build_reply_content(query, context) File "E:\Enviroment\PythonWorks\src\chatgpt-on-wechat-20230310\chatgpt-on-wechat-1.0.5\channel\channel.py", line 31, in build_reply_content return Bridge().fetch_reply_content(query, context) File "E:\Enviroment\PythonWorks\src\chatgpt-on-wechat-20230310\chatgpt-on-wechat-1.0.5\bridge\bridge.py", line 10, in fetch_reply_content return bot_factory.create_bot("chatGPT").reply(query, context) File "E:\Enviroment\PythonWorks\src\chatgpt-on-wechat-20230310\chatgpt-on-wechat-1.0.5\bot\chatgpt\chat_gpt_bot.py", line 27, in reply session_id = context['session_id'] KeyError: 'session_id'
修改了下,可以获取最新代码再试试
我同样的问题,获取最新的代码后在执行,提示:
[ERROR][2023-03-10 10:00:50][wechat_channel.py:151] - No module named 'aip'
Traceback (most recent call last):
File "/root/chatgpt-on-wechat/channel/wechat/wechat_channel.py", line 147, in _do_send_voice
replyFile = super().build_text_to_voice(reply_text)
File "/root/chatgpt-on-wechat/channel/channel.py", line 37, in build_text_to_voice
return Bridge().fetch_text_to_voice(text)
File "/root/chatgpt-on-wechat/bridge/bridge.py", line 16, in fetch_text_to_voice
return voice_factory.create_voice("baidu").textToVoice(text)
File "/root/chatgpt-on-wechat/voice/voice_factory.py", line 12, in create_voice
from voice.baidu.baidu_voice import BaiduVoice
File "/root/chatgpt-on-wechat/voice/baidu/baidu_voice.py", line 6, in
我同样的问题,获取最新的代码后在执行,提示: [ERROR][2023-03-10 10:00:50][wechat_channel.py:151] - No module named 'aip' Traceback (most recent call last): File "/root/chatgpt-on-wechat/channel/wechat/wechat_channel.py", line 147, in _do_send_voice replyFile = super().build_text_to_voice(reply_text) File "/root/chatgpt-on-wechat/channel/channel.py", line 37, in build_text_to_voice return Bridge().fetch_text_to_voice(text) File "/root/chatgpt-on-wechat/bridge/bridge.py", line 16, in fetch_text_to_voice return voice_factory.create_voice("baidu").textToVoice(text) File "/root/chatgpt-on-wechat/voice/voice_factory.py", line 12, in create_voice from voice.baidu.baidu_voice import BaiduVoice File "/root/chatgpt-on-wechat/voice/baidu/baidu_voice.py", line 6, in from aip import AipSpeech ModuleNotFoundError: No module named 'aip'
你需要安装:pip install baidu-aip
安装下pip3 install baidu-aip chardet
因为调用了baidu-aip库,终端输入pip3 install baidu-aip chardet 。
谢谢,已经解决了,程序默认的语音类型的百度,我没安装百度的这个库,刚刚改成谷歌了。谢谢~~
[INFO][2023-03-10 16:30:44][openai_voice.py:22] - [Openai] voiceToText text=回复一个语言 voice file name=tmp/230310-163043.mp3 [INFO][2023-03-10 16:30:44][chat_gpt_bot.py:26] - [OPEN_AI] query=回复一个语言 [INFO][2023-03-10 16:30:46][google_voice.py:49] - [Google] textToVoice text=您好!请问题用哪种语言提问,我将用相同的语言进行回答。 voice file name=tmp/语音回复_1678437046.mp3 [INFO][2023-03-10 16:30:46][wechat_channel.py:149] - [WX] sendFile=tmp/语音回复_1678437046.mp3, receiver=@68bd8f5f7464a0ffee8f9ef10bf401e8b83abc33ad375cc6c2c6167d6842e19b
使用的是谷歌的语音类型,但是微信没有回复任何消息
在itchat中只能回复mp3文件,在wechaty中可以回复语音消息 wechaty 所需要的版本是多少,需要指定某个版本吗?
itchat和wechaty,是在哪个配置项,还是哪个文件上指定了
wechaty比itchat更容易被封吗?
wechaty 语音功能还不支持
Start auto replying. [INFO][2023-03-12 22:46:58][openai_voice.py:22] - [Openai] voiceToText text=趕快睡覺吧,別 搞了 voice file name=tmp/230312-224657.mp3 [INFO][2023-03-12 22:46:58][chat_gpt_bot.py:27] - [OPEN_AI] query=趕快睡覺吧,別 搞了 [ERROR][2023-03-12 22:47:03][baidu_voice.py:35] - [Baidu] textToVoice error={'err_detail': '16: Open api characters limit reached', 'err_msg': '16: Open api characters limit reached', 'err_no': 502, 'err_subcode': 16, 'tts_logid': 3749716633} [INFO][2023-03-12 22:47:03][wechat_channel.py:149] - [WX] sendFile=None, receiver=@590c249050a578793750164dda76be47
这个语音错误是杂回事啊
[INFO][2023-03-13 00:36:38][openai_voice.py:22] - [Openai] voiceToText text=A, B, C. voice file name=tmp/230313-003636.mp3
[INFO][2023-03-13 00:36:38][chat_gpt_bot.py:26] - [OPEN_AI] query=A, B, C.
[ERROR][2023-03-13 00:36:40][wechat_channel.py:151] - 'NoneType' object has no attribute 'strip'
Traceback (most recent call last):
File "/home/pi/chatgpt-on-wechat/channel/wechat/wechat_channel.py", line 147, in _do_send_voice
replyFile = super().build_text_to_voice(reply_text)
File "/home/pi/chatgpt-on-wechat/channel/channel.py", line 37, in build_text_to_voice
return Bridge().fetch_text_to_voice(text)
File "/home/pi/chatgpt-on-wechat/bridge/bridge.py", line 16, in fetch_text_to_voice
return voice_factory.create_voice("baidu").textToVoice(text)
File "/home/pi/chatgpt-on-wechat/voice/voice_factory.py", line 12, in create_voice
from voice.baidu.baidu_voice import BaiduVoice
File "/home/pi/chatgpt-on-wechat/voice/baidu/baidu_voice.py", line 12, in
Start auto replying. [INFO][2023-03-12 22:46:58][openai_voice.py:22] - [Openai] voiceToText text=趕快睡覺吧,別 搞了 voice file name=tmp/230312-224657.mp3 [INFO][2023-03-12 22:46:58][chat_gpt_bot.py:27] - [OPEN_AI] query=趕快睡覺吧,別 搞了 [ERROR][2023-03-12 22:47:03][baidu_voice.py:35] - [Baidu] textToVoice error={'err_detail': '16: Open api characters limit reached', 'err_msg': '16: Open api characters limit reached', 'err_no': 502, 'err_subcode': 16, 'tts_logid': 3749716633} [INFO][2023-03-12 22:47:03][wechat_channel.py:149] - [WX] sendFile=None, receiver=@590c249050a578793750164dda76be47
这个语音错误是杂回事啊
在百度云账号领一下免费额度应该就行
一、接收语音,回复文字
config.json
中设置 "speech_recognition": true 即可, 这个配置在 template中有。 启动程序后 私聊 就会支持语音识别,会对所有收到的语音消息转成文字,并回复文字。二、接收语音,回复语音
在itchat中只能回复mp3文件,在wechaty中可以回复语音消息。 有两种可选平台:
1.百度
(1) 安装依赖:
pip3 install baidu-aip chardet
(2) 在
config.json
中添加配置:{ "speech_recognition": true, "voice_reply_voice": true, "baidu_app_id": "YOUR BAIDU APP ID", "baidu_api_key": "YOUR BAIDU API KEY", "baidu_secret_key": "YOUR BAIDU SERVICE KEY" }
2.Google
(1) 安装 SpeechRecognition:
pip3 install SpeechRecognition
(2) 安装 ffmpeg 和 espeak
* MacOS: brew install ffmpeg espeak * Windows: 下载ffmpeg.exe * Linux: apt-get install ffmpeg espeak
(3) 在
config.json
中添加配置:{ "speech_recognition": true, "voice_reply_voice": true }
PR: #385 by @wanggang1987
wechaty方案的语音识别是不是没对接?代码中找不到这部分
一、接收语音,回复文字
config.json
中设置 "speech_recognition": true 即可, 这个配置在 template中有。 启动程序后 私聊 就会支持语音识别,会对所有收到的语音消息转成文字,并回复文字。二、接收语音,回复语音
在itchat中只能回复mp3文件,在wechaty中可以回复语音消息。 有两种可选平台:
1.百度
(1) 安装依赖:
pip3 install baidu-aip chardet
(2) 在config.json
中添加配置:{ "speech_recognition": true, "voice_reply_voice": true, "baidu_app_id": "YOUR BAIDU APP ID", "baidu_api_key": "YOUR BAIDU API KEY", "baidu_secret_key": "YOUR BAIDU SERVICE KEY" }
2.Google
(1) 安装 SpeechRecognition:
pip3 install SpeechRecognition
(2) 安装 ffmpeg 和 espeak* MacOS: brew install ffmpeg espeak * Windows: 下载ffmpeg.exe * Linux: apt-get install ffmpeg espeak
(3) 在
config.json
中添加配置:{ "speech_recognition": true, "voice_reply_voice": true }
PR: #385 by @wanggang1987
wechaty方案的语音识别是不是没对接?代码中找不到这部分
一样找不到,求更新!!!
一、接收语音,回复文字
config.json
中设置 "speech_recognition": true 即可, 这个配置在 template中有。 启动程序后 私聊 就会支持语音识别,会对所有收到的语音消息转成文字,并回复文字。二、接收语音,回复语音
在itchat中只能回复mp3文件,在wechaty中可以回复语音消息。 有两种可选平台:
1.百度
(1) 安装依赖:
pip3 install baidu-aip chardet
(2) 在
config.json
中添加配置:{ "speech_recognition": true, "voice_reply_voice": true, "baidu_app_id": "YOUR BAIDU APP ID", "baidu_api_key": "YOUR BAIDU API KEY", "baidu_secret_key": "YOUR BAIDU SERVICE KEY" }
2.Google
(1) 安装 SpeechRecognition:
pip3 install SpeechRecognition
(2) 安装 ffmpeg 和 espeak
- MacOS: brew install ffmpeg espeak
- Windows: 下载ffmpeg.exe
- Linux: apt-get install ffmpeg espeak
(3) 在
config.json
中添加配置:{ "speech_recognition": true, "voice_reply_voice": true }
PR: #385 by @wanggang1987
按要求配置了"speech_recognition": true,但是实测不生效,后台日志没有显示任何反应。
[INFO][2023-03-13 00:36:38][openai_voice.py:22] - [Openai] voiceToText text=A, B, C. voice file name=tmp/230313-003636.mp3 [INFO][2023-03-13 00:36:38][chat_gpt_bot.py:26] - [OPEN_AI] query=A, B, C. [ERROR][2023-03-13 00:36:40][wechat_channel.py:151] - 'NoneType' object has no attribute 'strip' Traceback (most recent call last): File "/home/pi/chatgpt-on-wechat/channel/wechat/wechat_channel.py", line 147, in _do_send_voice replyFile = super().build_text_to_voice(reply_text) File "/home/pi/chatgpt-on-wechat/channel/channel.py", line 37, in build_text_to_voice return Bridge().fetch_text_to_voice(text) File "/home/pi/chatgpt-on-wechat/bridge/bridge.py", line 16, in fetch_text_to_voice return voice_factory.create_voice("baidu").textToVoice(text) File "/home/pi/chatgpt-on-wechat/voice/voice_factory.py", line 12, in create_voice from voice.baidu.baidu_voice import BaiduVoice File "/home/pi/chatgpt-on-wechat/voice/baidu/baidu_voice.py", line 12, in class BaiduVoice(Voice): File "/home/pi/chatgpt-on-wechat/voice/baidu/baidu_voice.py", line 16, in BaiduVoice client = AipSpeech(APP_ID, API_KEY, SECRET_KEY) File "/home/pi/.local/lib/python3.9/site-packages/aip/base.py", line 43, in init self._appId = appId.strip() AttributeError: 'NoneType' object has no attribute 'strip' 我也是,语音使用报错
[INFO][2023-03-13 00:36:38][openai_voice.py:22] - [Openai] voiceToText text=A, B, C. voice file name=tmp/230313-003636.mp3 [INFO][2023-03-13 00:36:38][chat_gpt_bot.py:26] - [OPEN_AI] query=A, B, C. [ERROR][2023-03-13 00:36:40][wechat_channel.py:151] - 'NoneType' object has no attribute 'strip' Traceback (most recent call last): File "/home/pi/chatgpt-on-wechat/channel/wechat/wechat_channel.py", line 147, in _do_send_voice replyFile = super().build_text_to_voice(reply_text) File "/home/pi/chatgpt-on-wechat/channel/channel.py", line 37, in build_text_to_voice return Bridge().fetch_text_to_voice(text) File "/home/pi/chatgpt-on-wechat/bridge/bridge.py", line 16, in fetch_text_to_voice return voice_factory.create_voice("baidu").textToVoice(text) File "/home/pi/chatgpt-on-wechat/voice/voice_factory.py", line 12, in create_voice from voice.baidu.baidu_voice import BaiduVoice File "/home/pi/chatgpt-on-wechat/voice/baidu/baidu_voice.py", line 12, in class BaiduVoice(Voice): File "/home/pi/chatgpt-on-wechat/voice/baidu/baidu_voice.py", line 16, in BaiduVoice client = AipSpeech(APP_ID, API_KEY, SECRET_KEY) File "/home/pi/.local/lib/python3.9/site-packages/aip/base.py", line 43, in init self._appId = appId.strip() AttributeError: 'NoneType' object has no attribute 'strip' 我也是,语音使用报错
这个是因为没有修改配置,代码默认使用百度,如果要使用谷歌需要在bridge/bridge.py中修改为谷歌
[INFO][2023-03-13 00:36:38][openai_voice.py:22] - [Openai] voiceToText text=A, B, C. voice file name=tmp/230313-003636.mp3 [INFO][2023-03-13 00:36:38][chat_gpt_bot.py:26] - [OPEN_AI] query=A, B, C. [ERROR][2023-03-13 00:36:40][wechat_channel.py:151] - 'NoneType' object has no attribute 'strip' Traceback (most recent call last): File "/home/pi/chatgpt-on-wechat/channel/wechat/wechat_channel.py", line 147, in _do_send_voice replyFile = super().build_text_to_voice(reply_text) File "/home/pi/chatgpt-on-wechat/channel/channel.py", line 37, in build_text_to_voice return Bridge().fetch_text_to_voice(text) File "/home/pi/chatgpt-on-wechat/bridge/bridge.py", line 16, in fetch_text_to_voice return voice_factory.create_voice("baidu").textToVoice(text) File "/home/pi/chatgpt-on-wechat/voice/voice_factory.py", line 12, in create_voice from voice.baidu.baidu_voice import BaiduVoice File "/home/pi/chatgpt-on-wechat/voice/baidu/baidu_voice.py", line 12, in class BaiduVoice(Voice): File "/home/pi/chatgpt-on-wechat/voice/baidu/baidu_voice.py", line 16, in BaiduVoice client = AipSpeech(APP_ID, API_KEY, SECRET_KEY) File "/home/pi/.local/lib/python3.9/site-packages/aip/base.py", line 43, in init self._appId = appId.strip() AttributeError: 'NoneType' object has no attribute 'strip' 我也是,语音使用报错
"baidu_app_id", "baidu_api_key", "baidu_secret_key" 这三个配置了嘛
@chiakileftcang @1018987534 对的,wechaty暂时还没对接发送语音
@chiakileftcang @1018987534 对的,wechaty暂时还没对接发送语音
我已经给你接好了,给个代码提交权限呗
@chiakileftcang 那太好了, 你直接发起 pull request 就好
[INFO][2023-03-13 00:36:38][openai_voice.py:22] - [Openai] voiceToText text=A, B, C. voice file name=tmp/230313-003636.mp3 [INFO][2023-03-13 00:36:38][chat_gpt_bot.py:26] - [OPEN_AI] query=A, B, C. [ERROR][2023-03-13 00:36:40][wechat_channel.py:151] - 'NoneType' object has no attribute 'strip' Traceback (most recent call last): File "/home/pi/chatgpt-on-wechat/channel/wechat/wechat_channel.py", line 147, in _do_send_voice replyFile = super().build_text_to_voice(reply_text) File "/home/pi/chatgpt-on-wechat/channel/channel.py", line 37, in build_text_to_voice return Bridge().fetch_text_to_voice(text) File "/home/pi/chatgpt-on-wechat/bridge/bridge.py", line 16, in fetch_text_to_voice return voice_factory.create_voice("baidu").textToVoice(text) File "/home/pi/chatgpt-on-wechat/voice/voice_factory.py", line 12, in create_voice from voice.baidu.baidu_voice import BaiduVoice File "/home/pi/chatgpt-on-wechat/voice/baidu/baidu_voice.py", line 12, in class BaiduVoice(Voice): File "/home/pi/chatgpt-on-wechat/voice/baidu/baidu_voice.py", line 16, in BaiduVoice client = AipSpeech(APP_ID, API_KEY, SECRET_KEY) File "/home/pi/.local/lib/python3.9/site-packages/aip/base.py", line 43, in init self._appId = appId.strip() AttributeError: 'NoneType' object has no attribute 'strip' 我也是,语音使用报错
[INFO][2023-03-13 00:36:38][openai_voice.py:22] - [Openai] voiceToText text=A, B, C. voice file name=tmp/230313-003636.mp3 [INFO][2023-03-13 00:36:38][chat_gpt_bot.py:26] - [OPEN_AI] query=A, B, C. [ERROR][2023-03-13 00:36:40][wechat_channel.py:151] - 'NoneType' object has no attribute 'strip' Traceback (most recent call last): File "/home/pi/chatgpt-on-wechat/channel/wechat/wechat_channel.py", line 147, in _do_send_voice replyFile = super().build_text_to_voice(reply_text) File "/home/pi/chatgpt-on-wechat/channel/channel.py", line 37, in build_text_to_voice return Bridge().fetch_text_to_voice(text) File "/home/pi/chatgpt-on-wechat/bridge/bridge.py", line 16, in fetch_text_to_voice return voice_factory.create_voice("baidu").textToVoice(text) File "/home/pi/chatgpt-on-wechat/voice/voice_factory.py", line 12, in create_voice from voice.baidu.baidu_voice import BaiduVoice File "/home/pi/chatgpt-on-wechat/voice/baidu/baidu_voice.py", line 12, in class BaiduVoice(Voice): File "/home/pi/chatgpt-on-wechat/voice/baidu/baidu_voice.py", line 16, in BaiduVoice client = AipSpeech(APP_ID, API_KEY, SECRET_KEY) File "/home/pi/.local/lib/python3.9/site-packages/aip/base.py", line 43, in init self._appId = appId.strip() AttributeError: 'NoneType' object has no attribute 'strip' 我也是,语音使用报错
这个是因为没有修改配置,代码默认使用百度,如果要使用谷歌需要在bridge/bridge.py中修改为谷歌
在bridge的位置如何修改为google ?
fetch_text_to_voice函数中的“baidu“换成"google"
wechaty 回复语音已实现:https://github.com/zhayujie/chatgpt-on-wechat/pull/476
@chiakileftcang @1018987534 对的,wechaty暂时还没对接发送语音
我已经给你接好了,给个代码提交权限呗
[ERROR][2023-03-15 22:12:16][wechaty_channel.py:215] - [Errno 2] No such file or directory: 'ffprobe' Traceback (most recent call last): File "/work/chatGPT/chatgpt-on-wechat/channel/wechat/wechaty_channel.py", line 197, in _do_send_voice audio = AudioSegment.from_file(mp3_file, format="mp3") File "/usr/local/lib/python3.8/site-packages/pydub/audio_segment.py", line 728, in from_file info = mediainfo_json(orig_file, read_ahead_limit=read_ahead_limit) File "/usr/local/lib/python3.8/site-packages/pydub/utils.py", line 274, in mediainfo_json res = Popen(command, stdin=stdin_parameter, stdout=PIPE, stderr=PIPE) File "/usr/local/lib/python3.8/subprocess.py", line 858, in init self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/local/lib/python3.8/subprocess.py", line 1706, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'ffprobe' /usr/local/lib/python3.8/site-packages/pydub/utils.py:198: RuntimeWarning: Couldn't find ffprobe or avprobe - defaulting to ffprobe, but may not work warn("Couldn't find ffprobe or avprobe - defaulting to ffprobe, but may not work", RuntimeWarning)
语音回复,这是啥情况??
@chiakileftcang @1018987534 对的,wechaty暂时还没对接发送语音
我已经给你接好了,给个代码提交权限呗
[ERROR][2023-03-15 22:12:16][wechaty_channel.py:215] - [Errno 2] No such file or directory: 'ffprobe' Traceback (most recent call last): File "/work/chatGPT/chatgpt-on-wechat/channel/wechat/wechaty_channel.py", line 197, in _do_send_voice audio = AudioSegment.from_file(mp3_file, format="mp3") File "/usr/local/lib/python3.8/site-packages/pydub/audio_segment.py", line 728, in from_file info = mediainfo_json(orig_file, read_ahead_limit=read_ahead_limit) File "/usr/local/lib/python3.8/site-packages/pydub/utils.py", line 274, in mediainfo_json res = Popen(command, stdin=stdin_parameter, stdout=PIPE, stderr=PIPE) File "/usr/local/lib/python3.8/subprocess.py", line 858, in init self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/local/lib/python3.8/subprocess.py", line 1706, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'ffprobe' /usr/local/lib/python3.8/site-packages/pydub/utils.py:198: RuntimeWarning: Couldn't find ffprobe or avprobe - defaulting to ffprobe, but may not work warn("Couldn't find ffprobe or avprobe - defaulting to ffprobe, but may not work", RuntimeWarning)
语音回复,这是啥情况??
你的环境里没有安装 ffmpeg ,“ Couldn't find ffprobe” 这个ffprobe是ffmpeg中的工具。
[INFO][2023-03-18 02:24:18][openai_voice.py:22] - [Openai] voiceToText text=你是誰? voice file name=tmp/230318-022417.mp3 [INFO][2023-03-18 02:24:18][chat_gpt_bot.py:28] - [OPEN_AI] query=你是誰? [INFO][2023-03-18 02:24:27][baidu_voice.py:32] - [Baidu] textToVoice text=我是ChatGPT,一個由OpenAI訓練的大型語言模型。我旨在回答和解決人們的各種問題,並且可以使用多種語言與人交流。 voice file name=tmp/语音回复_1679077467.mp3 [ERROR][2023-03-18 02:24:33][wechat_channel.py:151] - HTTPSConnectionPool(host='file.wx2.qq.com', port=443): Max retries exceeded with url: /cgi-bin/mmwebwx-bin/webwxuploadmedia?f=json (Caused by ProxyError('Cannot connect to proxy.', ConnectionResetError(10054, '远程主机强迫关闭了一个现有的连接。', None, 10054, None))) Traceback (most recent call last): File "Python\Python39\site-packages\urllib3\connectionpool.py", line 700, in urlopen self._prepare_proxy(conn) File "Python\Python39\site-packages\urllib3\connectionpool.py", line 996, in _prepare_proxy conn.connect() File "Python\Python39\site-packages\urllib3\connection.py", line 414, in connect self.sock = ssl_wrapsocket( File "Python\Python39\site-packages\urllib3\util\ssl.py", line 449, in ssl_wrap_socket ssl_sock = _ssl_wrap_socketimpl( File "Python\Python39\site-packages\urllib3\util\ssl.py", line 493, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock, server_hostname=server_hostname) File "C:\Program Files\Python39\lib\ssl.py", line 501, in wrap_socket return self.sslsocket_class._create( File "C:\Program Files\Python39\lib\ssl.py", line 1041, in _create self.do_handshake() File "C:\Program Files\Python39\lib\ssl.py", line 1310, in do_handshake self._sslobj.do_handshake() ConnectionResetError: [WinError 10054] 远程主机强迫关闭了一个现有的连接。 啥子情况哦,能识别到了,但是发不出来
按要求配置了"speech_recognition": true,但是实测不生效,后台日志没有显示任何反应。
一、接收语音,回复文字
config.json
中设置 "speech_recognition": true 即可, 这个配置在 template中有。 启动程序后 私聊 就会支持语音识别,会对所有收到的语音消息转成文字,并回复文字。二、接收语音,回复语音
有两种可选平台:
1.百度
(1) 安装依赖:
pip3 install baidu-aip chardet
(2) 在
config.json
中添加配置:{ "speech_recognition": true, "voice_reply_voice": true, "baidu_app_id": "YOUR BAIDU APP ID", "baidu_api_key": "YOUR BAIDU API KEY", "baidu_secret_key": "YOUR BAIDU SERVICE KEY" }
2.Google
(1) 安装 SpeechRecognition:
pip3 install SpeechRecognition
(2) 安装 ffmpeg 和 espeak
* MacOS: brew install ffmpeg espeak * Windows: 下载ffmpeg.exe * Linux: apt-get install ffmpeg espeak
(3) 在
config.json
中添加配置:{ "speech_recognition": true, "voice_reply_voice": true }
注:在itchat中只能回复mp3文件;在wechaty中可以回复语音消息,wechaty中使用需要安装额外依赖:
pip3 install pysilk pip3 install pysilk-mod pip3 install pydub
PR: #385 by @wanggang1987 #476 by @Chiaki-Chan
penai的whisper模型识别为文字
问题是我按照要求做了, 但是whisper的识别语音 ,在程序成功运行后一点反应都没有,文字是正常回复但是语音就一点动静哦都没有,至少给我一个提示说哪里错了。这也没有
使用了google的语音,在日志中可以看到回复,但是实际上在微信上没有收到语音回复。好奇怪
pip3 install SpeechRecognitio
看了下好像没有实现send_file方法?
~/chatgpt-on-wechat$ nohup python3 app.py & tail -f nohup.out [1] 1174 nohup: ignoring input and appending output to 'nohup.out' File "/home/ubuntu/.local/lib/python3.8/site-packages/itchat/components/register.py", line 60, in configured_reply r = replyFn(msg) File "/home/ubuntu/chatgpt-on-wechat/channel/wechat/wechat_channel.py", line 23, in handler_single_msg WechatChannel().handle_text(msg) File "/home/ubuntu/chatgpt-on-wechat/channel/wechat/wechat_channel.py", line 71, in handle_text self._handle_single_msg(msg, content) File "/home/ubuntu/chatgpt-on-wechat/channel/wechat/wechat_channel.py", line 76, in _handle_single_msg other_user_id = msg['User']['UserName'] # 对手方id KeyError: 'UserName'
[ERROR][2023-03-21 03:17:53][app.py:19] - App startup failed!
[ERROR][2023-03-21 03:17:53][app.py:20] - Extra data: line 17 column 2 (char 547)
Traceback (most recent call last):
File "app.py", line 11, in
不加语音可以正常运行,加了语音就报错。求解
目前我遇到的是使用google的语音进行语音回复测试,查看日志是有回复信息的,但实际上没有回复 Login successfully as ChatGPT Start auto replying. [INFO][2023-03-21 16:33:11][openai_voice.py:22] - [Openai] voiceToText text=你好 voice file name=tmp/230321-163307.mp3 [INFO][2023-03-21 16:33:11][chat_gpt_bot.py:28] - [OPEN_AI] query=你好 [INFO][2023-03-21 16:33:24][google_voice.py:49] - [Google] textToVoice text=你好,有什么问题我可以帮你解答吗? voice file name=tmp/语音回复_1679387604.mp3 [INFO][2023-03-21 16:33:24][wechat_channel.py:149] - [WX] sendFile=tmp/语音回复_1679387604.mp3
config.load_config()
File "/root/chatgpt-on-wechat/config.py", line 102, in load_config config = Config(json.loads(config_str)) File "/usr/lib/python3.8/json/init.py", line 357, in loads return _default_decoder.decode(s) File "/usr/lib/python3.8/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python3.8/json/decoder.py", line 353, in raw_decode obj, end = self.scan_once(s, idx) json.decoder.JSONDecodeError: Expecting ',' delimiter: line 16 column 4 (char 598) nohup: ignoring input and appending output to 'nohup.out' [ERROR][2023-03-26 03:44:19][app.py:23] - App startup failed! [ERROR][2023-03-26 03:44:19][app.py:24] - Expecting ',' delimiter: line 16 column 4 (char 598) Traceback (most recent call last): File "app.py", line 12, in run config.load_config() File "/root/chatgpt-on-wechat/config.py", line 102, in load_config config = Config(json.loads(config_str)) File "/usr/lib/python3.8/json/init.py", line 357, in loads return _default_decoder.decode(s) File "/usr/lib/python3.8/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python3.8/json/decoder.py", line 353, in raw_decode obj, end = self.scan_once(s, idx) json.decoder.JSONDecodeError: Expecting ',' delimiter: line 16 column 4 (char 598) 用的是百度。。请问这是啥错误。。
@luojin520520 json配置格式问题
怎么显示发送语音文件了,但是接收不到?
用的googl的语音,能发生mp3文件,但无论我要求什么,她都只会一个大小为46b的文件,打开后是空的,这个有什么解决方法吗?我换过百度的不知道是api接口的问题还是什么,回复的内容一直是,有领取百度开发者的新手额度
[ERROR][2023-03-27 11:53:12][baidu_voice.py:36] - [Baidu] textToVoice error={'err_detail': '16: Open api characters limit reached', 'err_msg': '16: Open api characters limit reached', 'err_no': 502, 'err_subcode': 16, 'tts_logid': 3084016285}
使用baidu-aip成功了,不过跟想象中的不一样,对话返回的是个MP3音频文件
跟着楼主步骤来没问题,补充一下百度baidu_app_id和baidu_api_key获取方式: 1、注册登录百度智能云,百度云账号就可以 https://login.bce.baidu.com/ 2、在控制台搜索语音技术 3、创建应用,按照操作指引来 领取免费额度需要选择 语音合成 4、拷贝参数到配置文件,可以直接试试语音交互了
是不是需要购买一下百度语音的资源包呢,开通语音识别到是免费
------------------ 原始邮件 ------------------ 发件人: "zhayujie/chatgpt-on-wechat" @.>; 发送时间: 2023年3月27日(星期一) 下午3:31 @.>; @.**@.>; 主题: Re: [zhayujie/chatgpt-on-wechat] 关于语音识别功能的使用 (Issue #415)
使用baidu-aip成功了,不过跟想象中的不一样,对话返回的是个MP3音频文件
跟着楼主步骤来没问题,补充一下百度baidu_app_id和baidu_api_key获取方式: 1、注册登录百度智能云,百度云账号就可以 https://login.bce.baidu.com/ 2、在控制台搜索语音技术
3、创建应用,按照操作指引来
领取免费额度需要选择 语音合成
4、拷贝参数到配置文件,可以直接试试语音交互了
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
是不是需要购买一下百度语音的资源包呢,开通语音识别到是免费 … ------------------ 原始邮件 ------------------ 发件人: "zhayujie/chatgpt-on-wechat" @.>; 发送时间: 2023年3月27日(星期一) 下午3:31 @.>; @.**@.>; 主题: Re: [zhayujie/chatgpt-on-wechat] 关于语音识别功能的使用 (Issue #415) 使用baidu-aip成功了,不过跟想象中的不一样,对话返回的是个MP3音频文件 跟着楼主步骤来没问题,补充一下百度baidu_app_id和baidu_api_key获取方式: 1、注册登录百度智能云,百度云账号就可以 https://login.bce.baidu.com/ 2、在控制台搜索语音技术 3、创建应用,按照操作指引来 领取免费额度需要选择 语音合成 4、拷贝参数到配置文件,可以直接试试语音交互了 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
不需要,登录注册都是免费的,接口也可以领取免费次数,全部可以白嫖
用的googl的语音,能发生mp3文件,但无论我要求什么,她都只会一个大小为46b的文件,打开后是空的,这个有什么解决方法吗?我换过百度的不知道是api接口的问题还是什么,回复的内容一直是,有领取百度开发者的新手额度
[ERROR][2023-03-27 11:53:12][baidu_voice.py:36] - [Baidu] textToVoice error={'err_detail': '16: Open api characters limit reached', 'err_msg': '16: Open api characters limit reached', 'err_no': 502, 'err_subcode': 16, 'tts_logid': 3084016285}
解决了,在百度那领取免费额度的时候,领错了,领成语音识别了
解决了,感谢
用的googl的语音,能生成mp3文件,但无论我要什么,她都会一个很大的小为46b的文件,打开后是空的,这个有什么解决方法的不清楚吗?我换过接口的问题还是什么,回复的内容一直是,有领取百度开发者的新手头度
[ERROR][2023-03-27 11:53:12][baidu_voice.py:36] - [Baidu] textToVoice error={'err_detail': '16: Open api characters limit reached', 'err_msg': '16: Open api characters limit reached', 'err_no': 502, 'err_subcode': 16, 'tts_logid': 3084016285}
解决了,在百度那领取免费额度的时候,领错了,领成语语音识别了 哥们,最新的代码使用的默认就是Google的语音识别吧,怎么修改成百度的呢
怎么使用 wechaty 进行语音回复呢,有没有大佬指教一下,辛苦辛苦💦
用了Railway部署后,语音mp3发不到微信上去了,卡在了这里: [INFO][2023-03-28 19:48:17][openai_voice.py:25] - [Openai] voiceToText text=你好 voice file name=tmp/230328-194814.wav [INFO][2023-03-28 19:48:17][wechat_channel.py:301] - [WX]receive voice, checkprefix didn't match
试过了google和baidu的语音合成都不成功
登录成功,@名称 提问无响应怎么回事呢
前置确认
问题描述
"voice_reply_voice": true这个语句没在config-template.json里找到,不过应该是添加到chatgpt-on-wechat/config.json里面吧?...
对应语音合成平台的key是阿里云的
终端日志 (如有报错)
环境
python3 -V
):python 3.9pip3 -V
):pip 23.0.1