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
421 stars 77 forks source link

连接服务器后没声音,不能录音 #207

Open oddled opened 2 weeks ago

oddled commented 2 weeks ago

以下是服务器日志: 2024-07-08 11:06:39,332 - WARNING - Read json file:/config/roles.json failed: [Errno 2] No such file or directory: '/config/roles.json' 2024-07-08 11:06:42,120 - INFO - FoloToy Server Version: v24.25.6.1-beta 2024-07-08 11:06:42,122 - ERROR - Run error: [Errno 111] Connection refused Traceback (most recent call last): File "core/folotoy_app.py", line 141, in core.folotoy_app.FolotoyApp.start File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 1429, in connect return self.reconnect() ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 1592, in reconnect self._sock = self._create_socket() ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 4598, in _create_socket sock = self._create_socket_connection() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 4623, 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-07-08 11:06:42,125 - INFO - Sleep 2s to reconnect to emqx:1883 2024-07-08 11:06:44,127 - ERROR - Run error: [Errno 111] Connection refused Traceback (most recent call last): File "core/folotoy_app.py", line 141, in core.folotoy_app.FolotoyApp.start File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 1429, in connect return self.reconnect() ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 1592, in reconnect self._sock = self._create_socket() ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 4598, in _create_socket sock = self._create_socket_connection() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 4623, 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-07-08 11:06:44,128 - INFO - Sleep 2s to reconnect to emqx:1883 2024-07-08 11:06:46,130 - ERROR - Run error: [Errno 111] Connection refused Traceback (most recent call last): File "core/folotoy_app.py", line 141, in core.folotoy_app.FolotoyApp.start File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 1429, in connect return self.reconnect() ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 1592, in reconnect self._sock = self._create_socket() ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 4598, in _create_socket sock = self._create_socket_connection() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 4623, 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-07-08 11:06:46,132 - INFO - Sleep 2s to reconnect to emqx:1883 2024-07-08 11:06:48,142 - INFO - Connected to MQTT Broker(emqx:1883)! 2024-07-08 11:06:48,143 - INFO - Speech server started(0.0.0.0:8085/udp) 2024-07-08 11:07:44,385 - DEBUG - Received /user/folotoy/ec64c98ecee0/thing/event/post: message data: {'msgId': 1, 'identifier': 'login', 'outParams': {'role': 6}} 2024-07-08 11:07:44,389 - DEBUG - Publish topic: /user/folotoy/ec64c98ecee0/thing/command/call, msg: {"msgId": 0, "identifier": "updatetoken", "inputParams": {"token": "1ccc286f9d8d45a481bc586318b54849"}} 2024-07-08 11:07:44,390 - DEBUG - Publish topic: /user/folotoy/ec64c98ecee0/thing/command/call, msg: {"msgId": 1, "identifier": "updateconfig", "inputParams": {"speechUdpServerHost": "116.198.242.104", "speechUdpServerPort": 8085}} 2024-07-08 11:07:44,564 - DEBUG - Received /user/folotoy/ec64c98ecee0/thing/data/post: message data: {'msgId': 0, 'identifier': 'real_time_data', 'outParams': {'battery_level': 92, 'rssi': 0}} 2024-07-08 11:07:45,923 - DEBUG - Received /user/folotoy/ec64c98ecee0/thing/command/callAck: message data: {'msgId': 0, 'identifier': 'updatetoken', 'result': 1} 2024-07-08 11:07:45,923 - DEBUG - Command call ack: True, topic_tokens: {'#': [], '+': ['ec64c98ecee0']} 2024-07-08 11:07:46,563 - DEBUG - Received /user/folotoy/ec64c98ecee0/thing/data/post: message data: {'msgId': 2, 'identifier': 'data_config', 'outParams': {'hardware_ver': 'v0.2.3', 'software_version': '24.20.4.31', 'devicekey': 'ec64c98ecee0', 'voice_start_threshold': 55, 'voice_end_threshold': 45, 'record_type': 1, 'timeout': 30, 'open_tip_type': 1, 'volume': 100, 'role': 6, 'led_brightness': 255}} 2024-07-08 11:07:46,647 - DEBUG - Received /user/folotoy/ec64c98ecee0/thing/command/callAck: message data: {'msgId': 1, 'identifier': 'updateconfig', 'result': 1} 2024-07-08 11:07:46,647 - DEBUG - Command call ack: True, topic_tokens: {'#': [], '+': ['ec64c98ecee0']} 2024-07-08 11:07:46,693 - DEBUG - Received /user/folotoy/ec64c98ecee0/thing/event/post: message data: {'msgId': 3, 'identifier': 'press_small_btn', 'outParams': {'keyCode': 6, 'changed': 1}} 2024-07-08 11:07:46,694 - DEBUG - Cannot find role config for sn=ec64c98ecee0, role=6 Exception in thread paho-mqtt-client-folotoy: Traceback (most recent call last): File "/usr/local/lib/python3.11/threading.py", line 1038, in _bootstrap_inner self.run() File "/usr/local/lib/python3.11/threading.py", line 975, in run self._target(*self._args, **self._kwargs) File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 4517, in _thread_main self.loop_forever(retry_first_connection=True) File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 2291, in loop_forever rc = self._loop(timeout) ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 1680, in _loop rc = self.loop_read() ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 2094, in loop_read rc = self._packet_read() ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 3137, in _packet_read rc = self._packet_handle() ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 3803, in _packet_handle return self._handle_publish() ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 4140, in _handle_publish self._handle_on_message(message) File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 4496, in _handle_on_message on_message(self, self._userdata, message) File "core/folotoy_app.py", line 130, in core.folotoy_app.FolotoyApp.start.on_message File "core/folotoy_app.py", line 99, in core.folotoy_app.FolotoyApp.process_mqtt_message File "core/folotoy_msg_processor.py", line 212, in core.folotoy_msg_processor.FolotoyMsgProcessor.process_press_small_btn TypeError: 'NoneType' object is not iterable 以下是yml文件,用的是中转key,京东云服务器 version: '3' volumes: emqx-etc: emqx-data: emqx-log: services: emqx: image: emqx/emqx:latest restart: always ports:

SHLcy commented 2 weeks ago

roles.json放在 config 文件夹下

oddled commented 2 weeks ago

修改了,现在能发声了,但是还是不能对话,按A按钮不能录音,灯变不了绿色

oddled commented 2 weeks ago

按A按钮有反应了,我是八爪鱼mini,但是不像说明书一样长按变绿色,得点按A才能变绿色,而且闪烁很久也没回复

SHLcy commented 2 weeks ago

八爪鱼mini默认现在是点按一下,然后直接说话,停止说话后设备自动停止录音(停止录音的时候设备会发出一个声音) 可根据灯的状态判断一下:1 绿灯常亮:处于录音状态。2 绿灯闪烁:在等待服务器返回

oddled commented 2 weeks ago

但是绿灯闪烁将近十秒后又变为白色常亮,并且没有语音返回

SHLcy commented 2 weeks ago

能否把服务器的日志发一下,从设备的反应来看应该是服务器报错了

oddled commented 2 weeks ago

2024-07-08 11:44:39,357 - DEBUG - Received token: bbd50e3532c34b578550c9b19f91f1c2 RecordingId: 6 2024-07-08 11:44:39,357 - DEBUG - Received frame type: b'\x01' 2024-07-08 11:44:39,391 - DEBUG - Peer: ('223.104.204.52', 13484) Len: 1043B 2024-07-08 11:44:39,391 - DEBUG - Received token: bbd50e3532c34b578550c9b19f91f1c2 RecordingId: 6 2024-07-08 11:44:39,391 - DEBUG - Received frame type: b'\x01' 2024-07-08 11:44:39,397 - DEBUG - Peer: ('223.104.204.52', 13484) Len: 1043B 2024-07-08 11:44:39,397 - DEBUG - Received token: bbd50e3532c34b578550c9b19f91f1c2 RecordingId: 6 2024-07-08 11:44:39,397 - DEBUG - Received frame type: b'\x01' 2024-07-08 11:44:39,428 - DEBUG - Peer: ('223.104.204.52', 13484) Len: 1043B 2024-07-08 11:44:39,428 - DEBUG - Received token: bbd50e3532c34b578550c9b19f91f1c2 RecordingId: 6 2024-07-08 11:44:39,428 - DEBUG - Received frame type: b'\x01' 2024-07-08 11:44:39,431 - DEBUG - Peer: ('223.104.204.52', 13484) Len: 1043B 2024-07-08 11:44:39,431 - DEBUG - Received token: bbd50e3532c34b578550c9b19f91f1c2 RecordingId: 6 2024-07-08 11:44:39,431 - DEBUG - Received frame type: b'\x01' 2024-07-08 11:44:39,467 - DEBUG - Peer: ('223.104.204.52', 13484) Len: 1043B 2024-07-08 11:44:39,467 - DEBUG - Received token: bbd50e3532c34b578550c9b19f91f1c2 RecordingId: 6 2024-07-08 11:44:39,467 - DEBUG - Received frame type: b'\x01' 2024-07-08 11:44:39,467 - DEBUG - Peer: ('223.104.204.52', 13484) Len: 1043B 2024-07-08 11:44:39,467 - DEBUG - Received token: bbd50e3532c34b578550c9b19f91f1c2 RecordingId: 6 2024-07-08 11:44:39,467 - DEBUG - Received frame type: b'\x01' 2024-07-08 11:44:39,487 - DEBUG - Peer: ('223.104.204.52', 13484) Len: 1043B 2024-07-08 11:44:39,487 - DEBUG - Received token: bbd50e3532c34b578550c9b19f91f1c2 RecordingId: 6 2024-07-08 11:44:39,487 - DEBUG - Received frame type: b'\x01' 2024-07-08 11:44:39,507 - DEBUG - Peer: ('223.104.204.52', 13484) Len: 1043B 2024-07-08 11:44:39,507 - DEBUG - Received token: bbd50e3532c34b578550c9b19f91f1c2 RecordingId: 6 2024-07-08 11:44:39,507 - DEBUG - Received frame type: b'\x01' 2024-07-08 11:44:39,507 - DEBUG - Peer: ('223.104.204.52', 13484) Len: 1043B 2024-07-08 11:44:39,507 - DEBUG - Received token: bbd50e3532c34b578550c9b19f91f1c2 RecordingId: 6 2024-07-08 11:44:39,507 - DEBUG - Received frame type: b'\x01' 2024-07-08 11:44:39,527 - DEBUG - Peer: ('223.104.204.52', 13484) Len: 1043B 2024-07-08 11:44:39,527 - DEBUG - Received token: bbd50e3532c34b578550c9b19f91f1c2 RecordingId: 6 2024-07-08 11:44:39,528 - DEBUG - Received frame type: b'\x01' 2024-07-08 11:44:39,562 - DEBUG - Peer: ('223.104.204.52', 13484) Len: 1043B 2024-07-08 11:44:39,562 - DEBUG - Received token: bbd50e3532c34b578550c9b19f91f1c2 RecordingId: 6 2024-07-08 11:44:39,562 - DEBUG - Received frame type: b'\x01' 2024-07-08 11:44:39,562 - DEBUG - Peer: ('223.104.204.52', 13484) Len: 1043B 2024-07-08 11:44:39,562 - DEBUG - Received token: bbd50e3532c34b578550c9b19f91f1c2 RecordingId: 6 2024-07-08 11:44:39,562 - DEBUG - Received frame type: b'\x01' 2024-07-08 11:44:39,587 - DEBUG - Peer: ('223.104.204.52', 13484) Len: 1043B 2024-07-08 11:44:39,587 - DEBUG - Received token: bbd50e3532c34b578550c9b19f91f1c2 RecordingId: 6 2024-07-08 11:44:39,587 - DEBUG - Received frame type: b'\x01' 2024-07-08 11:44:39,607 - DEBUG - Peer: ('223.104.204.52', 13484) Len: 1043B 2024-07-08 11:44:39,607 - DEBUG - Received token: bbd50e3532c34b578550c9b19f91f1c2 RecordingId: 6 2024-07-08 11:44:39,607 - DEBUG - Received frame type: b'\x01' 2024-07-08 11:44:39,627 - DEBUG - Peer: ('223.104.204.52', 13484) Len: 1043B 2024-07-08 11:44:39,627 - DEBUG - Received token: bbd50e3532c34b578550c9b19f91f1c2 RecordingId: 6 2024-07-08 11:44:39,627 - DEBUG - Received frame type: b'\x01' 2024-07-08 11:44:39,631 - DEBUG - Peer: ('223.104.204.52', 13484) Len: 1043B 2024-07-08 11:44:39,631 - DEBUG - Received token: bbd50e3532c34b578550c9b19f91f1c2 RecordingId: 6 2024-07-08 11:44:39,631 - DEBUG - Received frame type: b'\x01' 2024-07-08 11:44:39,667 - DEBUG - Peer: ('223.104.204.52', 13484) Len: 1043B 2024-07-08 11:44:39,667 - DEBUG - Received token: bbd50e3532c34b578550c9b19f91f1c2 RecordingId: 6 2024-07-08 11:44:39,667 - DEBUG - Received frame type: b'\x01' 2024-07-08 11:44:39,671 - DEBUG - Peer: ('223.104.204.52', 13484) Len: 1043B 2024-07-08 11:44:39,672 - DEBUG - Received token: bbd50e3532c34b578550c9b19f91f1c2 RecordingId: 6 2024-07-08 11:44:39,672 - DEBUG - Received frame type: b'\x01' 2024-07-08 11:44:39,692 - DEBUG - Peer: ('223.104.204.52', 13484) Len: 1043B 2024-07-08 11:44:39,692 - DEBUG - Received token: bbd50e3532c34b578550c9b19f91f1c2 RecordingId: 6 2024-07-08 11:44:39,692 - DEBUG - Received frame type: b'\x01' 2024-07-08 11:44:39,721 - DEBUG - Peer: ('223.104.204.52', 13484) Len: 1043B 2024-07-08 11:44:39,721 - DEBUG - Received token: bbd50e3532c34b578550c9b19f91f1c2 RecordingId: 6 2024-07-08 11:44:39,721 - DEBUG - Received frame type: b'\x01' 2024-07-08 11:44:39,721 - DEBUG - Peer: ('223.104.204.52', 13484) Len: 1043B 2024-07-08 11:44:39,721 - DEBUG - Received token: bbd50e3532c34b578550c9b19f91f1c2 RecordingId: 6 2024-07-08 11:44:39,721 - DEBUG - Received frame type: b'\x01' 2024-07-08 11:44:39,747 - DEBUG - Peer: ('223.104.204.52', 13484) Len: 1043B 2024-07-08 11:44:39,747 - DEBUG - Received token: bbd50e3532c34b578550c9b19f91f1c2 RecordingId: 6 2024-07-08 11:44:39,747 - DEBUG - Received frame type: b'\x01' 2024-07-08 11:44:39,767 - DEBUG - Peer: ('223.104.204.52', 13484) Len: 1043B 2024-07-08 11:44:39,767 - DEBUG - Received token: bbd50e3532c34b578550c9b19f91f1c2 RecordingId: 6 2024-07-08 11:44:39,767 - DEBUG - Received frame type: b'\x01' 2024-07-08 11:44:39,787 - DEBUG - Peer: ('223.104.204.52', 13484) Len: 1043B 2024-07-08 11:44:39,787 - DEBUG - Received token: bbd50e3532c34b578550c9b19f91f1c2 RecordingId: 6 2024-07-08 11:44:39,787 - DEBUG - Received frame type: b'\x01' 2024-07-08 11:44:39,787 - DEBUG - Peer: ('223.104.204.52', 13484) Len: 20B 2024-07-08 11:44:39,787 - DEBUG - Received token: bbd50e3532c34b578550c9b19f91f1c2 RecordingId: 6 2024-07-08 11:44:39,787 - DEBUG - Received frame type: b'\x02' 2024-07-08 11:44:39,788 - DEBUG - Recording file created: /audio/recording-466a2e2b19ec425bb01a129ef6f1b975.wav 2024-07-08 11:44:39,788 - DEBUG - Current dkey=ec64c98ecee0 role=4 2024-07-08 11:44:39,789 - DEBUG - load_ssl_context verify=True cert=None trust_env=True http2=False 2024-07-08 11:44:39,789 - DEBUG - load_verify_locations cafile='/usr/local/lib/python3.11/site-packages/certifi/cacert.pem' 2024-07-08 11:44:39,797 - DEBUG - Request options: {'method': 'post', 'url': '/audio/transcriptions', 'headers': {'Content-Type': 'multipart/form-data'}, 'timeout': 5.0, 'files': [('file', SerializationIterator(index=0, iterator=SerializationIterator(index=0, iterator=<_io.BufferedReader name='/audio/recording-466a2e2b19ec425bb01a129ef6f1b975.wav'>)))], 'json_data': {'model': 'whisper-1', 'language': 'zh', 'prompt': "ok. let's begin.", 'response_format': 'json'}} 2024-07-08 11:44:39,798 - DEBUG - connect_tcp.started host='free.gpt.ge' port=443 local_address=None timeout=5.0 socket_options=None 2024-07-08 11:44:39,837 - DEBUG - connect_tcp.complete return_value=<httpcore._backends.sync.SyncStream object at 0x7f16500ca650> 2024-07-08 11:44:39,837 - DEBUG - start_tls.started ssl_context=<ssl.SSLContext object at 0x7f16515583b0> server_hostname='free.gpt.ge' timeout=5.0 2024-07-08 11:44:39,905 - DEBUG - start_tls.complete return_value=<httpcore._backends.sync.SyncStream object at 0x7f16500ca710> 2024-07-08 11:44:39,905 - DEBUG - send_request_headers.started request=<Request [b'POST']> 2024-07-08 11:44:39,906 - DEBUG - send_request_headers.complete 2024-07-08 11:44:39,906 - DEBUG - send_request_body.started request=<Request [b'POST']> 2024-07-08 11:44:40,145 - DEBUG - send_request_body.complete 2024-07-08 11:44:40,145 - DEBUG - receive_response_headers.started request=<Request [b'POST']> 2024-07-08 11:44:40,543 - DEBUG - receive_response_headers.complete return_value=(b'HTTP/1.1', 200, b'OK', [(b'Server', b'nginx'), (b'Date', b'Mon, 08 Jul 2024 03:44:40 GMT'), (b'Content-Type', b'text/html; charset=utf-8'), (b'Content-Length', b'389'), (b'Connection', b'keep-alive'), (b'Cache-Control', b'no-cache'), (b'Content-Encoding', b'gzip'), (b'Vary', b'Accept-Encoding'), (b'X-Oneapi-Request-Id', b'2024070811444049302921968948766'), (b'Cache-Control', b'no-cache')]) 2024-07-08 11:44:40,543 - INFO - HTTP Request: POST https://free.gpt.ge/audio/transcriptions "HTTP/1.1 200 OK" 2024-07-08 11:44:40,544 - DEBUG - receive_response_body.started request=<Request [b'POST']> 2024-07-08 11:44:40,544 - DEBUG - receive_response_body.complete 2024-07-08 11:44:40,544 - DEBUG - response_closed.started 2024-07-08 11:44:40,544 - DEBUG - response_closed.complete 2024-07-08 11:44:40,544 - DEBUG - HTTP Request: POST https://free.gpt.ge/audio/transcriptions "200 OK" 2024-07-08 11:44:40,544 - DEBUG - Could not read JSON from response data due to <class 'json.decoder.JSONDecodeError'> - Expecting value: line 1 column 1 (char 0) 2024-07-08 11:46:25,768 - DEBUG - Received /user/folotoy/ec64c98ecee0/thing/data/post: message data: {'msgId': 5, 'identifier': 'real_time_data', 'outParams': {'battery_level': 84, 'rssi': 26}}

SHLcy commented 2 weeks ago

语音服务这里报错了,是用的gpt转发的么?要保证返回的数据格式和openAI的一致

oddled commented 2 weeks ago

都是gpt,但是是代理的apikey,那该怎么修改呢

SHLcy commented 2 weeks ago

您和代理的那边确认一下,接口数据需要保持和openAI的一致