chatgpt-on-wechat
chatgpt-on-wechat copied to clipboard
关于语音识别功能的使用
前置确认
问题描述
"voice_reply_voice": true这个语句没在config-template.json里找到,不过应该是添加到chatgpt-on-wechat/config.json里面吧?...
对应语音合成平台的key是阿里云的
终端日志 (如有报错)
环境
- 操作系统类型 (Mac/Windows/Linux):Windows 10
- Python版本 ( 执行
python3 -V
):python 3.9 - pip版本 ( 依赖问题此项必填,执行
pip3 -V
):pip 23.0.1
同问,如何添加语音合成平台的api key
一、接收语音,回复文字
config.json
中设置 "speech_recognition": true 即可, 这个配置在 template中有。 启动程序后 私聊 就会支持语音识别,会对所有收到的语音消息转成文字,并回复文字。
二、接收语音,回复语音
有多种可选平台,以下提供两种方案,默认是OpenAI识别,Google语音合成:
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-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_wrap_socket( File "Python\Python39\site-packages\urllib3\util\ssl.py", line 449, in ssl_wrap_socket ssl_sock = ssl_wrap_socket_impl( 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] 远程主机强迫关闭了一个现有的连接。 啥子情况哦,能识别到了,但是发不出来