FoloToy / folotoy-server-self-hosting

Config files for self-hosting the FoloToy Server. Documents: https://docs.folotoy.com
https://tool.folotoy.com
GNU General Public License v3.0
453 stars 84 forks source link

TTS好像有問題 ,八爪魚機板都無對話反應 #149

Open black316h opened 5 months ago

black316h commented 5 months ago

File "core/folotoy_app.py", line 126, in core.folotoy_app.FolotoyApp.start File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 914, in connect return self.reconnect() ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 1044, in reconnect sock = self._create_socket_connection() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 3685, in _create_socket_connection return socket.create_connection(addr, timeout=self._connect_timeout, source_address=source) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/socket.py", line 851, in create_connection raise exceptions[0] File "/usr/local/lib/python3.11/socket.py", line 836, in create_connection sock.connect(sa) ConnectionRefusedError: [Errno 111] Connection refused 2024-04-07 01:55:03,050 - INFO - Sleep 2s to reconnect 2024-04-07 01:55:05,052 - ERROR - Run error: [Errno 111] Connection refused Traceback (most recent call last): File "core/folotoy_app.py", line 126, in core.folotoy_app.FolotoyApp.start File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 914, in connect return self.reconnect() ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 1044, in reconnect sock = self._create_socket_connection() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 3685, in _create_socket_connection return socket.create_connection(addr, timeout=self._connect_timeout, source_address=source) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/socket.py", line 851, in create_connection raise exceptions[0] File "/usr/local/lib/python3.11/socket.py", line 836, in create_connection sock.connect(sa) ConnectionRefusedError: [Errno 111] Connection refused 2024-04-07 01:55:05,052 - INFO - Sleep 2s to reconnect 2024-04-07 01:55:07,201 - INFO - Speech server started(0.0.0.0:8085/udp) 2024-04-07 01:55:07,223 - INFO - Connected to MQTT Broker(emqx:1883)! 2024-04-07 01:55:12,061 - DEBUG - Received /user/folotoy/24dcc3cf370c/thing/event/post: message data: {'msgId': 3, 'identifier': 'login', 'outParams': {'role': 6}} 2024-04-07 01:55:12,063 - DEBUG - Publish topic: /user/folotoy/24dcc3cf370c/thing/command/call, msg: {"msgId": 0, "identifier": "updatetoken", "inputParams": {"token": "37c41154796646a28ccf3bd06fc87364"}} 2024-04-07 01:55:12,063 - DEBUG - Publish topic: /user/folotoy/24dcc3cf370c/thing/command/call, msg: {"msgId": 1, "identifier": "updateconfig", "inputParams": {"speechUdpServerHost": "47.236.245.175", "speechUdpServerPort": 8085}} 2024-04-07 01:55:15,013 - DEBUG - Received /user/folotoy/24dcc3cf370c/thing/command/callAck: message data: {'msgId': 0, 'identifier': 'updatetoken', 'result': 1} 2024-04-07 01:55:15,013 - DEBUG - Command call ack: True, topic_tokens: {'#': [], '+': ['24dcc3cf370c']} 2024-04-07 01:55:15,558 - DEBUG - Received /user/folotoy/24dcc3cf370c/thing/command/callAck: message data: {'msgId': 1, 'identifier': 'updateconfig', 'result': 1} 2024-04-07 01:55:15,558 - DEBUG - Command call ack: True, topic_tokens: {'#': [], '+': ['24dcc3cf370c']} 2024-04-07 01:55:15,631 - DEBUG - Received /user/folotoy/24dcc3cf370c/thing/event/post: message data: {'msgId': 4, 'identifier': 'press_small_btn', 'outParams': {'keyCode': 6, 'changed': 0}} 2024-04-07 01:55:15,632 - DEBUG - Role no changed, empty the messages 2024-04-07 01:55:35,865 - DEBUG - Received /user/folotoy/24dcc3cf370c/thing/event/post: message data: {'msgId': 5, 'identifier': 'press_small_btn', 'outParams': {'keyCode': 7, 'changed': 1}} 2024-04-07 01:55:35,902 - DEBUG - Request received. Product:None Endpoint:nls-meta.cn-shanghai.aliyuncs.com Params: {'Version': '2019-02-28', 'Action': 'CreateToken', 'Format': 'JSON', 'RegionId': 'cn-shanghai', 'Timestamp': '2024-04-06T17:55:35Z', 'SignatureMethod': 'HMAC-SHA1', 'SignatureType': '', 'SignatureVersion': '1.0', 'SignatureNonce': '885fbd2d-bd33-4dca-82c7-5381012980ab', 'Signature': 'go4aD6TikVT7Lx+gi8rlTosHzoE='} 2024-04-07 01:55:36,389 - DEBUG - Response received. Product:None Response-body: b'{"ErrMsg":"","Token":{"UserId":"5963112160688087","Id":"3dc3e63f48144726b5b518d5abd79e29","ExpireTime":1712555736}}' 2024-04-07 01:55:36,390 - DEBUG - b'{"ErrMsg":"","Token":{"UserId":"5963112160688087","Id":"3dc3e63f48144726b5b518d5abd79e29","ExpireTime":1712555736}}' 2024-04-07 01:55:36,390 - DEBUG - token = 3dc3e63f48144726b5b518d5abd79e29, expire time = 1712555736 2024-04-07 01:55:36,395 - DEBUG - Starting new HTTPS connection (1): nls-gateway-cn-shanghai.aliyuncs.com:443 2024-04-07 01:55:37,023 - DEBUG - https://nls-gateway-cn-shanghai.aliyuncs.com:443 "POST /stream/v1/tts HTTP/1.1" 400 128 2024-04-07 01:55:37,024 - WARNING - TTS(openai-tts) request failed: {"task_id":"43e9c85d650248378d4010b7ef4b6398","result":"","status":40020105,"message":"Meta:APPKEY_NOT_EXIST:Appkey not exist!"}, payload: {'appkey': 'e0K2F7oETTEkg11W', 'text': '你好,我是小兔,请问有什么我可以帮助你的吗?', 'format': 'mp3'} 2024-04-07 01:56:27,079 - DEBUG - Received /user/folotoy/24dcc3cf370c/thing/event/post: message data: {'msgId': 6, 'identifier': 'press_small_btn', 'outParams': {'keyCode': 1, 'changed': 1}} 2024-04-07 01:56:27,082 - DEBUG - Starting new HTTPS connection (1): nls-gateway-cn-shanghai.aliyuncs.com:443 2024-04-07 01:56:27,658 - DEBUG - https://nls-gateway-cn-shanghai.aliyuncs.com:443 "POST /stream/v1/tts HTTP/1.1" 400 128 2024-04-07 01:56:27,659 - WARNING - TTS(openai-tts) request failed: {"task_id":"95e6c3a4f4e342eb8fa1d0d950ff00df","result":"","status":40020105,"message":"Meta:APPKEY_NOT_EXIST:Appkey not exist!"}, payload: {'appkey': 'e0K2F7oETTEkg11W', 'text': '你好,我是陪伴兔,请问有什么我可以帮助你的吗?', 'format': 'mp3'} 2024-04-07 01:56:32,104 - DEBUG - Received /user/folotoy/24dcc3cf370c/thing/event/post: message data: {'msgId': 7, 'identifier': 'press_small_btn', 'outParams': {'keyCode': 7, 'changed': 1}} 2024-04-07 01:56:32,107 - DEBUG - Starting new HTTPS connection (1): nls-gateway-cn-shanghai.aliyuncs.com:443 2024-04-07 01:56:32,739 - DEBUG - https://nls-gateway-cn-shanghai.aliyuncs.com:443 "POST /stream/v1/tts HTTP/1.1" 400 128 2024-04-07 01:56:32,740 - WARNING - TTS(openai-tts) request failed: {"task_id":"6e4af89def234c8fbe88ed410264ef2a","result":"","status":40020105,"message":"Meta:APPKEY_NOT_EXIST:Appkey not exist!"}, payload: {'appkey': 'e0K2F7oETTEkg11W', 'text': '你好,我是小兔,请问有什么我可以帮助你的吗?', 'format': 'mp3'} 2024-04-07 01:56:43,423 - DEBUG - Received /user/folotoy/24dcc3cf370c/thing/event/post: message data: {'msgId': 0, 'identifier': 'login', 'outParams': {'role': 5}} 2024-04-07 01:56:43,424 - DEBUG - Publish topic: /user/folotoy/24dcc3cf370c/thing/command/call, msg: {"msgId": 0, "identifier": "updatetoken", "inputParams": {"token": "31460e0bb6634d4195180fff082c7f05"}} 2024-04-07 01:56:43,424 - DEBUG - Publish topic: /user/folotoy/24dcc3cf370c/thing/command/call, msg: {"msgId": 1, "identifier": "updateconfig", "inputParams": {"speechUdpServerHost": "47.236.245.175", "speechUdpServerPort": 8085}} 2024-04-07 01:56:44,377 - DEBUG - Received /user/folotoy/24dcc3cf370c/thing/command/callAck: message data: {'msgId': 0, 'identifier': 'updatetoken', 'result': 1} 2024-04-07 01:56:44,377 - DEBUG - Command call ack: True, topic_tokens: {'#': [], '+': ['24dcc3cf370c']} 2024-04-07 01:56:45,889 - DEBUG - Received /user/folotoy/24dcc3cf370c/thing/command/callAck: message data: {'msgId': 1, 'identifier': 'updateconfig', 'result': 1} 2024-04-07 01:56:45,889 - DEBUG - Command call ack: True, topic_tokens: {'#': [], '+': ['24dcc3cf370c']} 2024-04-07 01:56:45,957 - DEBUG - Received /user/folotoy/24dcc3cf370c/thing/event/post: message data: {'msgId': 1, 'identifier': 'press_small_btn', 'outParams': {'keyCode': 5, 'changed': 1}} 2024-04-07 01:56:45,959 - DEBUG - Starting new HTTPS connection (1): nls-gateway-cn-shanghai.aliyuncs.com:443 2024-04-07 01:56:46,565 - DEBUG - https://nls-gateway-cn-shanghai.aliyuncs.com:443 "POST /stream/v1/tts HTTP/1.1" 400 128 2024-04-07 01:56:46,566 - WARNING - TTS(openai-tts) request failed: {"task_id":"ab17317a1b4a4444843ad9394f7f21a4","result":"","status":40020105,"message":"Meta:APPKEY_NOT_EXIST:Appkey not exist!"}, payload: {'appkey': 'e0K2F7oETTEkg11W', 'text': '你好,我是口算兔,我们一起来玩玩口算游戏吧?', 'format': 'mp3'} 2024-04-07 01:57:02,294 - DEBUG - Received /user/folotoy/24dcc3cf370c/thing/event/post: message data: {'msgId': 2, 'identifier': 'press_small_btn', 'outParams': {'keyCode': 6, 'changed': 1}} 2024-04-07 01:57:02,296 - DEBUG - Starting new HTTPS connection (1): nls-gateway-cn-shanghai.aliyuncs.com:443 2024-04-07 01:57:02,991 - DEBUG - https://nls-gateway-cn-shanghai.aliyuncs.com:443 "POST /stream/v1/tts HTTP/1.1" 400 128 2024-04-07 01:57:02,992 - WARNING - TTS(openai-tts) request failed: {"task_id":"9942aab55e1147bf9099d8e0d2c200d0","result":"","status":40020105,"message":"Meta:APPKEY_NOT_EXIST:Appkey not exist!"}, payload: {'appkey': 'e0K2F7oETTEkg11W', 'text': '你好,我是台湾兔,请问有什么我可以帮助你的吗?', 'format': 'mp3'} 2024-04-07 01:57:34,124 - INFO - [folotoy] Connection is disconnect,return code=7 2024-04-07 01:57:49,166 - INFO - Connected to MQTT Broker(emqx:1883)! /usr/local/lib/python3.11/site-packages/pydub/utils.py:170: RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning) 2024-04-07 01:57:55,327 - INFO - FoloToy Server Version: v24.7.1.3-beta 2024-04-07 01:57:55,338 - INFO - Speech server started(0.0.0.0:8085/udp) 2024-04-07 01:57:55,339 - INFO - Connected to MQTT Broker(emqx:1883)! 2024-04-07 01:58:05,908 - DEBUG - Received /user/folotoy/24dcc3cf370c/thing/event/post: message data: {'msgId': 3, 'identifier': 'login', 'outParams': {'role': 6}} 2024-04-07 01:58:05,908 - DEBUG - Publish topic: /user/folotoy/24dcc3cf370c/thing/command/call, msg: {"msgId": 0, "identifier": "updatetoken", "inputParams": {"token": "15722b596fbe46138a9004da903614c2"}} 2024-04-07 01:58:05,908 - DEBUG - Publish topic: /user/folotoy/24dcc3cf370c/thing/command/call, msg: {"msgId": 1, "identifier": "updateconfig", "inputParams": {"speechUdpServerHost": "47.236.245.175", "speechUdpServerPort": 8085}} 2024-04-07 01:58:08,861 - DEBUG - Received /user/folotoy/24dcc3cf370c/thing/command/callAck: message data: {'msgId': 0, 'identifier': 'updatetoken', 'result': 1} 2024-04-07 01:58:08,861 - DEBUG - Command call ack: True, topic_tokens: {'#': [], '+': ['24dcc3cf370c']} 2024-04-07 01:58:09,379 - DEBUG - Received /user/folotoy/24dcc3cf370c/thing/command/callAck: message data: {'msgId': 1, 'identifier': 'updateconfig', 'result': 1} 2024-04-07 01:58:09,379 - DEBUG - Command call ack: True, topic_tokens: {'#': [], '+': ['24dcc3cf370c']} 2024-04-07 01:58:09,447 - DEBUG - Received /user/folotoy/24dcc3cf370c/thing/event/post: message data: {'msgId': 4, 'identifier': 'press_small_btn', 'outParams': {'keyCode': 6, 'changed': 0}} 2024-04-07 01:58:09,447 - DEBUG - Role no changed, empty the messages 2024-04-07 01:59:03,319 - DEBUG - Received /user/folotoy/24dcc3cf370c/thing/event/post: message data: {'msgId': 5, 'identifier': 'press_small_btn', 'outParams': {'keyCode': 7, 'changed': 1}} 2024-04-07 01:59:03,325 - DEBUG - Request received. Product:None Endpoint:nls-meta.cn-shanghai.aliyuncs.com Params: {'Version': '2019-02-28', 'Action': 'CreateToken', 'Format': 'JSON', 'RegionId': 'cn-shanghai', 'Timestamp': '2024-04-06T17:59:03Z', 'SignatureMethod': 'HMAC-SHA1', 'SignatureType': '', 'SignatureVersion': '1.0', 'SignatureNonce': 'b89b9fbc-1f6a-4972-9b99-e7943cf1d170', 'Signature': 'RFLuh9l5xtjebEONUh38+VpUAjc='} 2024-04-07 01:59:03,762 - DEBUG - Response received. Product:None Response-body: b'{"ErrMsg":"","Token":{"UserId":"5963112160688087","Id":"e49ea74d72ad4d7bb3c8dd509e252c62","ExpireTime":1712555943}}' 2024-04-07 01:59:03,762 - DEBUG - b'{"ErrMsg":"","Token":{"UserId":"5963112160688087","Id":"e49ea74d72ad4d7bb3c8dd509e252c62","ExpireTime":1712555943}}' 2024-04-07 01:59:03,762 - DEBUG - token = e49ea74d72ad4d7bb3c8dd509e252c62, expire time = 1712555943 2024-04-07 01:59:03,765 - DEBUG - Starting new HTTPS connection (1): nls-gateway-cn-shanghai.aliyuncs.com:443 2024-04-07 01:59:04,394 - DEBUG - https://nls-gateway-cn-shanghai.aliyuncs.com:443 "POST /stream/v1/tts HTTP/1.1" 400 128 2024-04-07 01:59:04,395 - WARNING - TTS(openai-tts) request failed: {"task_id":"2aa97bd8b5c3446699cc5f92f6742815","result":"","status":40020105,"message":"Meta:APPKEY_NOT_EXIST:Appkey not exist!"}, payload: {'appkey': 'e0K2F7oETTEkg11W', 'text': '你好,我是小兔,请问有什么我可以帮助你的吗?', 'format': 'mp3'} 2024-04-07 01:59:24,716 - DEBUG - Received /user/folotoy/24dcc3cf370c/thing/event/post: message data: {'msgId': 6, 'identifier': 'press_small_btn', 'outParams': {'keyCode': 6, 'changed': 1}} 2024-04-07 01:59:24,718 - DEBUG - Starting new HTTPS connection (1): nls-gateway-cn-shanghai.aliyuncs.com:443 2024-04-07 01:59:25,369 - DEBUG - https://nls-gateway-cn-shanghai.aliyuncs.com:443 "POST /stream/v1/tts HTTP/1.1" 400 128 2024-04-07 01:59:25,370 - WARNING - TTS(openai-tts) request failed: {"task_id":"181e678d10974e97aa88e445fb277bc3","result":"","status":40020105,"message":"Meta:APPKEY_NOT_EXIST:Appkey not exist!"}, payload: {'appkey': 'e0K2F7oETTEkg11W', 'text': '你好,我是台湾兔,请问有什么我可以帮助你的吗?', 'format': 'mp3'}

------------------------------------------opt/1panel/docker/compose/folotoy-server/config/roles.json------------------------------------- { "1": { "start_text": "你好,我是陪伴兔,请问有什么我可以帮助你的吗?", "prompt": "你扮演一个孩子的小伙伴,名字叫陪伴兔,性格和善,说话活泼可爱,对孩子充满爱心,经常赞赏和鼓励孩子,用5岁孩子容易理解语言提供有趣和创新的回答,每次回复根据聊天主题询问她的看法以激发她的思考和好奇心。" }, "2": { "start_text": "你好,俺是东北兔,请问有什么俺可以帮助你的吗?", "prompt": "你是一个知识渊博,乐于助人的智能机器人,你的名字叫“东北兔”,你的任务是陪我聊天,请用简短的对话方式,用中文讲一段话,每次回答不超过50个字!" }, "3": { "start_text": "Hi, I'm Fofo. Nice to meet you.", "prompt": "You're a knowledgeable and helpful AI named \"Fofo\". Your task is to chat with me. Please respond in English, keeping your answers brief – no more than 50 words each time!" }, "4": { "start_text": "你好,额是夸夸兔,请问有什么额可以帮助你的吗? ", "prompt": "夸夸我" }, "5": { "start_text": "你好,我是口算兔,我们一起来玩玩口算游戏吧?", "prompt": "我是一个6岁小朋友,你陪我玩口算游戏。你出题,我回答结果。如果答对了你就说好棒,答错了你就告诉我正确答案,并且鼓励我。你一题一题的出,我一个个回答。不要有太多的解释说明。明白了吗?" }, "6": { "start_text": "你好,我是台湾兔,请问有什么我可以帮助你的吗?", "prompt": "你是一个知识渊博,乐于助人的智能机器人,你的名字叫“台湾兔”,你的任务是陪我聊天,请用简短的对话方式,用中文讲一段话,每次回答不超过50个字!" }, "7": { "start_text": "你好,我是小兔,请问有什么我可以帮助你的吗?", "prompt": "你是一个知识渊博,乐于助人的智能机器人,你的名字叫“小兔”,你的任务是陪我聊天,请用简短的对话方式,用中文讲一段话,每次回答不超过50个字!" } }

-------------------------opt/1panel/docker/compose/folotoy-server/docker-compose.yml----------------------

version: '3' volumes: emqx-etc: emqx-data: emqx-log: services: emqx: image: emqx/emqx:latest restart: always ports:

lewangdev commented 5 months ago

日志显示阿里云的tts appkey错误

{"task_id":"181e678d10974e97aa88e445fb277bc3","result":"","status":40020105,"message":"Meta:APPKEY_NOT_EXIST:Appkey not exist!"}, payload

lewangdev commented 5 months ago

也参考这里添加app_key到roles.json

https://docs.folotoy.com/zh/docs/configuration/tts/aliyun-tts