diff --git a/FunASR/安装.txt b/FunASR/安装.txt
index 7a50102..de097fb 100644
--- a/FunASR/安装.txt
+++ b/FunASR/安装.txt
@@ -3,7 +3,7 @@ git 地址:https://github.com/modelscope/FunASR/blob/main/runtime/docs/SDK_tutor
docker pull registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-online-cpu-0.1.12
-docker exec -it 5808d9cf479122f0aaa59d5500148debfc80c4274159b96e2426a2b90b2976c8 bash
+docker exec -it 367797c69268b2c68f1443aa0f8dcb5d5ac01355dbdd06fa6e18758415506c8f bash
cd FunASR/runtime
nohup bash run_server_2pass.sh \
diff --git a/audio_ai_chat/audio_ai_chat/__pycache__/__init__.cpython-310.pyc b/audio_ai_chat/audio_ai_chat/__pycache__/__init__.cpython-310.pyc
index 1f30bf6..2d4294d 100644
Binary files a/audio_ai_chat/audio_ai_chat/__pycache__/__init__.cpython-310.pyc and b/audio_ai_chat/audio_ai_chat/__pycache__/__init__.cpython-310.pyc differ
diff --git a/audio_ai_chat/audio_ai_chat/__pycache__/main.cpython-310.pyc b/audio_ai_chat/audio_ai_chat/__pycache__/main.cpython-310.pyc
index 8b020e1..f6be80c 100644
Binary files a/audio_ai_chat/audio_ai_chat/__pycache__/main.cpython-310.pyc and b/audio_ai_chat/audio_ai_chat/__pycache__/main.cpython-310.pyc differ
diff --git a/audio_ai_chat/audio_ai_chat/codec/__pycache__/ProtocolCodec.cpython-310.pyc b/audio_ai_chat/audio_ai_chat/codec/__pycache__/ProtocolCodec.cpython-310.pyc
index 4aa2eca..28bbd1b 100644
Binary files a/audio_ai_chat/audio_ai_chat/codec/__pycache__/ProtocolCodec.cpython-310.pyc and b/audio_ai_chat/audio_ai_chat/codec/__pycache__/ProtocolCodec.cpython-310.pyc differ
diff --git a/audio_ai_chat/audio_ai_chat/codec/__pycache__/__init__.cpython-310.pyc b/audio_ai_chat/audio_ai_chat/codec/__pycache__/__init__.cpython-310.pyc
index 8784a48..2e10ddf 100644
Binary files a/audio_ai_chat/audio_ai_chat/codec/__pycache__/__init__.cpython-310.pyc and b/audio_ai_chat/audio_ai_chat/codec/__pycache__/__init__.cpython-310.pyc differ
diff --git a/audio_ai_chat/audio_ai_chat/config/__pycache__/__init__.cpython-310.pyc b/audio_ai_chat/audio_ai_chat/config/__pycache__/__init__.cpython-310.pyc
index cafaf39..4a3dac3 100644
Binary files a/audio_ai_chat/audio_ai_chat/config/__pycache__/__init__.cpython-310.pyc and b/audio_ai_chat/audio_ai_chat/config/__pycache__/__init__.cpython-310.pyc differ
diff --git a/audio_ai_chat/audio_ai_chat/config/__pycache__/logger.cpython-310.pyc b/audio_ai_chat/audio_ai_chat/config/__pycache__/logger.cpython-310.pyc
index 76e9db8..3874682 100644
Binary files a/audio_ai_chat/audio_ai_chat/config/__pycache__/logger.cpython-310.pyc and b/audio_ai_chat/audio_ai_chat/config/__pycache__/logger.cpython-310.pyc differ
diff --git a/audio_ai_chat/audio_ai_chat/config/__pycache__/settings.cpython-310.pyc b/audio_ai_chat/audio_ai_chat/config/__pycache__/settings.cpython-310.pyc
index 63d59d2..1aacaa3 100644
Binary files a/audio_ai_chat/audio_ai_chat/config/__pycache__/settings.cpython-310.pyc and b/audio_ai_chat/audio_ai_chat/config/__pycache__/settings.cpython-310.pyc differ
diff --git a/audio_ai_chat/audio_ai_chat/core/__pycache__/__init__.cpython-310.pyc b/audio_ai_chat/audio_ai_chat/core/__pycache__/__init__.cpython-310.pyc
index 7afa194..f7ab12e 100644
Binary files a/audio_ai_chat/audio_ai_chat/core/__pycache__/__init__.cpython-310.pyc and b/audio_ai_chat/audio_ai_chat/core/__pycache__/__init__.cpython-310.pyc differ
diff --git a/audio_ai_chat/audio_ai_chat/core/__pycache__/connection.cpython-310.pyc b/audio_ai_chat/audio_ai_chat/core/__pycache__/connection.cpython-310.pyc
index 438fee4..c0d827d 100644
Binary files a/audio_ai_chat/audio_ai_chat/core/__pycache__/connection.cpython-310.pyc and b/audio_ai_chat/audio_ai_chat/core/__pycache__/connection.cpython-310.pyc differ
diff --git a/audio_ai_chat/audio_ai_chat/core/__pycache__/websocket_handler.cpython-310.pyc b/audio_ai_chat/audio_ai_chat/core/__pycache__/websocket_handler.cpython-310.pyc
index 5b2ed82..4cf0241 100644
Binary files a/audio_ai_chat/audio_ai_chat/core/__pycache__/websocket_handler.cpython-310.pyc and b/audio_ai_chat/audio_ai_chat/core/__pycache__/websocket_handler.cpython-310.pyc differ
diff --git a/audio_ai_chat/audio_ai_chat/core/asr/__pycache__/__init__.cpython-310.pyc b/audio_ai_chat/audio_ai_chat/core/asr/__pycache__/__init__.cpython-310.pyc
index 49c06d9..331d32e 100644
Binary files a/audio_ai_chat/audio_ai_chat/core/asr/__pycache__/__init__.cpython-310.pyc and b/audio_ai_chat/audio_ai_chat/core/asr/__pycache__/__init__.cpython-310.pyc differ
diff --git a/audio_ai_chat/audio_ai_chat/core/asr/__pycache__/asr_manager.cpython-310.pyc b/audio_ai_chat/audio_ai_chat/core/asr/__pycache__/asr_manager.cpython-310.pyc
index e6b904d..c92937f 100644
Binary files a/audio_ai_chat/audio_ai_chat/core/asr/__pycache__/asr_manager.cpython-310.pyc and b/audio_ai_chat/audio_ai_chat/core/asr/__pycache__/asr_manager.cpython-310.pyc differ
diff --git a/audio_ai_chat/audio_ai_chat/core/asr/__pycache__/base.cpython-310.pyc b/audio_ai_chat/audio_ai_chat/core/asr/__pycache__/base.cpython-310.pyc
index 1779971..ac54a70 100644
Binary files a/audio_ai_chat/audio_ai_chat/core/asr/__pycache__/base.cpython-310.pyc and b/audio_ai_chat/audio_ai_chat/core/asr/__pycache__/base.cpython-310.pyc differ
diff --git a/audio_ai_chat/audio_ai_chat/core/asr/__pycache__/factory.cpython-310.pyc b/audio_ai_chat/audio_ai_chat/core/asr/__pycache__/factory.cpython-310.pyc
index 67c6add..d748afc 100644
Binary files a/audio_ai_chat/audio_ai_chat/core/asr/__pycache__/factory.cpython-310.pyc and b/audio_ai_chat/audio_ai_chat/core/asr/__pycache__/factory.cpython-310.pyc differ
diff --git a/audio_ai_chat/audio_ai_chat/core/asr/fun_asr/__pycache__/__init__.cpython-310.pyc b/audio_ai_chat/audio_ai_chat/core/asr/fun_asr/__pycache__/__init__.cpython-310.pyc
index b1b0ec2..063b1d2 100644
Binary files a/audio_ai_chat/audio_ai_chat/core/asr/fun_asr/__pycache__/__init__.cpython-310.pyc and b/audio_ai_chat/audio_ai_chat/core/asr/fun_asr/__pycache__/__init__.cpython-310.pyc differ
diff --git a/audio_ai_chat/audio_ai_chat/core/asr/fun_asr/__pycache__/fun_asr.cpython-310.pyc b/audio_ai_chat/audio_ai_chat/core/asr/fun_asr/__pycache__/fun_asr.cpython-310.pyc
index 0fa7285..a68a452 100644
Binary files a/audio_ai_chat/audio_ai_chat/core/asr/fun_asr/__pycache__/fun_asr.cpython-310.pyc and b/audio_ai_chat/audio_ai_chat/core/asr/fun_asr/__pycache__/fun_asr.cpython-310.pyc differ
diff --git a/audio_ai_chat/audio_ai_chat/core/llm/__pycache__/__init__.cpython-310.pyc b/audio_ai_chat/audio_ai_chat/core/llm/__pycache__/__init__.cpython-310.pyc
index b9d3785..c2daf54 100644
Binary files a/audio_ai_chat/audio_ai_chat/core/llm/__pycache__/__init__.cpython-310.pyc and b/audio_ai_chat/audio_ai_chat/core/llm/__pycache__/__init__.cpython-310.pyc differ
diff --git a/audio_ai_chat/audio_ai_chat/core/llm/dify/__pycache__/__init__.cpython-310.pyc b/audio_ai_chat/audio_ai_chat/core/llm/dify/__pycache__/__init__.cpython-310.pyc
index ac9d767..36c5048 100644
Binary files a/audio_ai_chat/audio_ai_chat/core/llm/dify/__pycache__/__init__.cpython-310.pyc and b/audio_ai_chat/audio_ai_chat/core/llm/dify/__pycache__/__init__.cpython-310.pyc differ
diff --git a/audio_ai_chat/audio_ai_chat/core/llm/dify/__pycache__/dify.cpython-310.pyc b/audio_ai_chat/audio_ai_chat/core/llm/dify/__pycache__/dify.cpython-310.pyc
index df05a8a..cfa6dbd 100644
Binary files a/audio_ai_chat/audio_ai_chat/core/llm/dify/__pycache__/dify.cpython-310.pyc and b/audio_ai_chat/audio_ai_chat/core/llm/dify/__pycache__/dify.cpython-310.pyc differ
diff --git a/audio_ai_chat/audio_ai_chat/core/tts/__pycache__/__init__.cpython-310.pyc b/audio_ai_chat/audio_ai_chat/core/tts/__pycache__/__init__.cpython-310.pyc
index 133c8d5..57473b3 100644
Binary files a/audio_ai_chat/audio_ai_chat/core/tts/__pycache__/__init__.cpython-310.pyc and b/audio_ai_chat/audio_ai_chat/core/tts/__pycache__/__init__.cpython-310.pyc differ
diff --git a/audio_ai_chat/audio_ai_chat/core/tts/__pycache__/tts_client.cpython-310.pyc b/audio_ai_chat/audio_ai_chat/core/tts/__pycache__/tts_client.cpython-310.pyc
index ffba86d..113e491 100644
Binary files a/audio_ai_chat/audio_ai_chat/core/tts/__pycache__/tts_client.cpython-310.pyc and b/audio_ai_chat/audio_ai_chat/core/tts/__pycache__/tts_client.cpython-310.pyc differ
diff --git a/audio_ai_chat/audio_ai_chat/core/tts/tts_client.py b/audio_ai_chat/audio_ai_chat/core/tts/tts_client.py
index af6a009..d98b4fa 100644
--- a/audio_ai_chat/audio_ai_chat/core/tts/tts_client.py
+++ b/audio_ai_chat/audio_ai_chat/core/tts/tts_client.py
@@ -231,6 +231,8 @@ class ByteDanceTTSSocketClient:
"format": request.encoding,
"sample_rate": DEFAULT_SAMPLE_RATE,
"enable_timestamp": True,
+ "bit_rate":256000,
+ "speech_rate":20
},
"additions": json.dumps({"disable_markdown_filter": False}),
"speed": request.speed, # 语速参数(需服务端支持)
diff --git a/audio_ai_chat/audio_ai_chat/utils/__pycache__/__init__.cpython-310.pyc b/audio_ai_chat/audio_ai_chat/utils/__pycache__/__init__.cpython-310.pyc
index 714d647..ccec488 100644
Binary files a/audio_ai_chat/audio_ai_chat/utils/__pycache__/__init__.cpython-310.pyc and b/audio_ai_chat/audio_ai_chat/utils/__pycache__/__init__.cpython-310.pyc differ
diff --git a/audio_ai_chat/audio_ai_chat/utils/__pycache__/exceptions.cpython-310.pyc b/audio_ai_chat/audio_ai_chat/utils/__pycache__/exceptions.cpython-310.pyc
index 5b58a89..6a7230c 100644
Binary files a/audio_ai_chat/audio_ai_chat/utils/__pycache__/exceptions.cpython-310.pyc and b/audio_ai_chat/audio_ai_chat/utils/__pycache__/exceptions.cpython-310.pyc differ
diff --git a/audio_ai_chat/logs/app.log b/audio_ai_chat/logs/app.log
index a377e14..77dfd37 100644
--- a/audio_ai_chat/logs/app.log
+++ b/audio_ai_chat/logs/app.log
@@ -2839,3 +2839,285 @@
2025-12-04 02:09:16.678 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:129 - 客户端 1537542304096 发送协程已退出
2025-12-04 02:09:16.679 | INFO | audio_ai_chat.core.websocket_handler:_unregister_connection:68 - 客户端 1537542304096 注销成功,当前活跃连接数:0
2025-12-04 02:09:16.680 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:279 - 客户端 1537542304096 连接清理完成
+2025-12-04 08:31:06.041 | INFO | audio_ai_chat.core.websocket_handler:connect:134 - 连接 2202228893552 已接受,等待身份信息(5秒超时),当前连接数: 0
+2025-12-04 08:31:06.068 | INFO | audio_ai_chat.core.websocket_handler:connect:188 - 用户 1001(测试用户)身份校验通过(client_id: 2202228893552)
+2025-12-04 08:31:06.069 | INFO | audio_ai_chat.core.websocket_handler:_register_connection:58 - 客户端 2202228893552 注册成功,当前活跃连接数:1
+2025-12-04 08:31:06.834 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:224 - 客户端 2202228893552 连接就绪
+2025-12-04 08:31:06.835 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:79 - 客户端 2202228893552 发送协程启动
+2025-12-04 08:32:24.727 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:246 - 客户端 2202228893552 主动断开连接
+2025-12-04 08:32:24.727 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:252 - 客户端 2202228893552 开始清理连接
+2025-12-04 08:32:24.728 | ERROR | audio_ai_chat.core.websocket_handler:_send_worker:127 - 客户端 2202228893552 发送协程异常退出:type object 'WebSocket' has no attribute 'Disconnect'
+2025-12-04 08:32:24.728 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:129 - 客户端 2202228893552 发送协程已退出
+2025-12-04 08:32:24.728 | INFO | audio_ai_chat.core.websocket_handler:_unregister_connection:68 - 客户端 2202228893552 注销成功,当前活跃连接数:0
+2025-12-04 08:32:24.728 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:279 - 客户端 2202228893552 连接清理完成
+2025-12-04 08:53:35.101 | INFO | audio_ai_chat.core.websocket_handler:connect:134 - 连接 2821746141184 已接受,等待身份信息(5秒超时),当前连接数: 0
+2025-12-04 08:53:35.118 | INFO | audio_ai_chat.core.websocket_handler:connect:188 - 用户 1001(测试用户)身份校验通过(client_id: 2821746141184)
+2025-12-04 08:53:35.118 | INFO | audio_ai_chat.core.websocket_handler:_register_connection:58 - 客户端 2821746141184 注册成功,当前活跃连接数:1
+2025-12-04 08:53:35.291 | INFO | audio_ai_chat.core.websocket_handler:connect:134 - 连接 2821746437008 已接受,等待身份信息(5秒超时),当前连接数: 1
+2025-12-04 08:53:35.435 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:224 - 客户端 2821746141184 连接就绪
+2025-12-04 08:53:35.436 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:79 - 客户端 2821746141184 发送协程启动
+2025-12-04 08:53:35.436 | ERROR | audio_ai_chat.core.websocket_handler:handle_connection:248 - 客户端 2821746141184 处理异常:CONTROL
+2025-12-04 08:53:35.437 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:252 - 客户端 2821746141184 开始清理连接
+2025-12-04 08:53:35.437 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:129 - 客户端 2821746141184 发送协程已退出
+2025-12-04 08:53:35.438 | INFO | audio_ai_chat.core.websocket_handler:_unregister_connection:68 - 客户端 2821746141184 注销成功,当前活跃连接数:0
+2025-12-04 08:53:35.438 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:279 - 客户端 2821746141184 连接清理完成
+2025-12-04 08:53:37.514 | INFO | audio_ai_chat.core.websocket_handler:connect:134 - 连接 2821746427984 已接受,等待身份信息(5秒超时),当前连接数: 0
+2025-12-04 08:53:38.099 | INFO | audio_ai_chat.core.websocket_handler:connect:134 - 连接 2821746887072 已接受,等待身份信息(5秒超时),当前连接数: 0
+2025-12-04 08:53:40.286 | WARNING | audio_ai_chat.core.websocket_handler:connect:143 - 连接 2821746437008 身份校验超时
+2025-12-04 08:53:40.287 | ERROR | audio_ai_chat.core.websocket_handler:handle_connection:248 - 客户端 2821746437008 处理异常:连接 2821746437008 身份校验超时
+2025-12-04 08:53:40.287 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:252 - 客户端 2821746437008 开始清理连接
+2025-12-04 08:53:40.287 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:279 - 客户端 2821746437008 连接清理完成
+2025-12-04 08:53:42.510 | WARNING | audio_ai_chat.core.websocket_handler:connect:143 - 连接 2821746427984 身份校验超时
+2025-12-04 08:53:42.511 | ERROR | audio_ai_chat.core.websocket_handler:handle_connection:248 - 客户端 2821746427984 处理异常:连接 2821746427984 身份校验超时
+2025-12-04 08:53:42.511 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:252 - 客户端 2821746427984 开始清理连接
+2025-12-04 08:53:42.511 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:279 - 客户端 2821746427984 连接清理完成
+2025-12-04 08:53:43.122 | WARNING | audio_ai_chat.core.websocket_handler:connect:143 - 连接 2821746887072 身份校验超时
+2025-12-04 08:53:43.122 | ERROR | audio_ai_chat.core.websocket_handler:handle_connection:248 - 客户端 2821746887072 处理异常:连接 2821746887072 身份校验超时
+2025-12-04 08:53:43.123 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:252 - 客户端 2821746887072 开始清理连接
+2025-12-04 08:53:43.123 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:279 - 客户端 2821746887072 连接清理完成
+2025-12-04 08:53:46.628 | INFO | audio_ai_chat.core.websocket_handler:connect:134 - 连接 2821746428128 已接受,等待身份信息(5秒超时),当前连接数: 0
+2025-12-04 08:53:46.638 | INFO | audio_ai_chat.core.websocket_handler:connect:188 - 用户 1001(测试用户)身份校验通过(client_id: 2821746428128)
+2025-12-04 08:53:46.638 | INFO | audio_ai_chat.core.websocket_handler:_register_connection:58 - 客户端 2821746428128 注册成功,当前活跃连接数:1
+2025-12-04 08:53:46.813 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:224 - 客户端 2821746428128 连接就绪
+2025-12-04 08:53:46.813 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:79 - 客户端 2821746428128 发送协程启动
+2025-12-04 08:54:40.876 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:246 - 客户端 2821746428128 主动断开连接
+2025-12-04 08:54:40.876 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:252 - 客户端 2821746428128 开始清理连接
+2025-12-04 08:54:40.877 | ERROR | audio_ai_chat.core.websocket_handler:_send_worker:127 - 客户端 2821746428128 发送协程异常退出:type object 'WebSocket' has no attribute 'Disconnect'
+2025-12-04 08:54:40.877 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:129 - 客户端 2821746428128 发送协程已退出
+2025-12-04 08:54:40.877 | INFO | audio_ai_chat.core.websocket_handler:_unregister_connection:68 - 客户端 2821746428128 注销成功,当前活跃连接数:0
+2025-12-04 08:54:40.878 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:279 - 客户端 2821746428128 连接清理完成
+2025-12-04 09:23:35.454 | INFO | audio_ai_chat.core.websocket_handler:connect:134 - 连接 1566411270144 已接受,等待身份信息(5秒超时),当前连接数: 0
+2025-12-04 09:23:35.485 | INFO | audio_ai_chat.core.websocket_handler:connect:188 - 用户 1001(测试用户)身份校验通过(client_id: 1566411270144)
+2025-12-04 09:23:35.485 | INFO | audio_ai_chat.core.websocket_handler:_register_connection:58 - 客户端 1566411270144 注册成功,当前活跃连接数:1
+2025-12-04 09:23:36.147 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:224 - 客户端 1566411270144 连接就绪
+2025-12-04 09:23:36.148 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:79 - 客户端 1566411270144 发送协程启动
+2025-12-04 09:24:20.095 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:246 - 客户端 1566411270144 主动断开连接
+2025-12-04 09:24:20.095 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:252 - 客户端 1566411270144 开始清理连接
+2025-12-04 09:24:20.096 | ERROR | audio_ai_chat.core.websocket_handler:_send_worker:127 - 客户端 1566411270144 发送协程异常退出:type object 'WebSocket' has no attribute 'Disconnect'
+2025-12-04 09:24:20.096 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:129 - 客户端 1566411270144 发送协程已退出
+2025-12-04 09:24:20.096 | INFO | audio_ai_chat.core.websocket_handler:_unregister_connection:68 - 客户端 1566411270144 注销成功,当前活跃连接数:0
+2025-12-04 09:24:20.097 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:279 - 客户端 1566411270144 连接清理完成
+2025-12-04 09:28:44.990 | INFO | audio_ai_chat.core.websocket_handler:connect:134 - 连接 1566411568080 已接受,等待身份信息(5秒超时),当前连接数: 0
+2025-12-04 09:28:45.192 | INFO | audio_ai_chat.core.websocket_handler:connect:188 - 用户 1001(测试用户)身份校验通过(client_id: 1566411568080)
+2025-12-04 09:28:45.192 | INFO | audio_ai_chat.core.websocket_handler:_register_connection:58 - 客户端 1566411568080 注册成功,当前活跃连接数:1
+2025-12-04 09:28:46.073 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:224 - 客户端 1566411568080 连接就绪
+2025-12-04 09:28:46.074 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:79 - 客户端 1566411568080 发送协程启动
+2025-12-04 09:28:58.518 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:246 - 客户端 1566411568080 主动断开连接
+2025-12-04 09:28:58.518 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:252 - 客户端 1566411568080 开始清理连接
+2025-12-04 09:28:58.519 | ERROR | audio_ai_chat.core.websocket_handler:_send_worker:127 - 客户端 1566411568080 发送协程异常退出:type object 'WebSocket' has no attribute 'Disconnect'
+2025-12-04 09:28:58.519 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:129 - 客户端 1566411568080 发送协程已退出
+2025-12-04 09:28:58.520 | INFO | audio_ai_chat.core.websocket_handler:_unregister_connection:68 - 客户端 1566411568080 注销成功,当前活跃连接数:0
+2025-12-04 09:28:58.520 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:279 - 客户端 1566411568080 连接清理完成
+2025-12-04 09:33:54.199 | INFO | audio_ai_chat.core.websocket_handler:connect:134 - 连接 1566412083200 已接受,等待身份信息(5秒超时),当前连接数: 0
+2025-12-04 09:33:54.217 | INFO | audio_ai_chat.core.websocket_handler:connect:188 - 用户 1001(测试用户)身份校验通过(client_id: 1566412083200)
+2025-12-04 09:33:54.218 | INFO | audio_ai_chat.core.websocket_handler:_register_connection:58 - 客户端 1566412083200 注册成功,当前活跃连接数:1
+2025-12-04 09:33:54.218 | ERROR | audio_ai_chat.core.websocket_handler:handle_connection:248 - 客户端 1566412083200 处理异常:获取ASR连接失败
+2025-12-04 09:33:54.218 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:252 - 客户端 1566412083200 开始清理连接
+2025-12-04 09:33:54.219 | INFO | audio_ai_chat.core.websocket_handler:_unregister_connection:68 - 客户端 1566412083200 注销成功,当前活跃连接数:0
+2025-12-04 09:33:54.219 | INFO | audio_ai_chat.core.connection:close:316 - 连接上下文已关闭:client_id=1566412083200,user_id=1001,对话历史条数=0
+2025-12-04 09:33:54.219 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:279 - 客户端 1566412083200 连接清理完成
+2025-12-04 09:36:39.525 | INFO | audio_ai_chat.core.websocket_handler:connect:134 - 连接 1566412083152 已接受,等待身份信息(5秒超时),当前连接数: 0
+2025-12-04 09:36:39.716 | INFO | audio_ai_chat.core.websocket_handler:connect:188 - 用户 1001(测试用户)身份校验通过(client_id: 1566412083152)
+2025-12-04 09:36:39.749 | INFO | audio_ai_chat.core.websocket_handler:_register_connection:58 - 客户端 1566412083152 注册成功,当前活跃连接数:1
+2025-12-04 09:36:39.750 | ERROR | audio_ai_chat.core.websocket_handler:handle_connection:248 - 客户端 1566412083152 处理异常:获取ASR连接失败
+2025-12-04 09:36:39.752 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:252 - 客户端 1566412083152 开始清理连接
+2025-12-04 09:36:39.752 | INFO | audio_ai_chat.core.websocket_handler:_unregister_connection:68 - 客户端 1566412083152 注销成功,当前活跃连接数:0
+2025-12-04 09:36:39.752 | INFO | audio_ai_chat.core.connection:close:316 - 连接上下文已关闭:client_id=1566412083152,user_id=1001,对话历史条数=0
+2025-12-04 09:36:39.753 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:279 - 客户端 1566412083152 连接清理完成
+2025-12-04 09:36:59.488 | INFO | audio_ai_chat.core.websocket_handler:connect:134 - 连接 2691856082944 已接受,等待身份信息(5秒超时),当前连接数: 0
+2025-12-04 09:36:59.691 | INFO | audio_ai_chat.core.websocket_handler:connect:188 - 用户 1001(测试用户)身份校验通过(client_id: 2691856082944)
+2025-12-04 09:36:59.691 | INFO | audio_ai_chat.core.websocket_handler:_register_connection:58 - 客户端 2691856082944 注册成功,当前活跃连接数:1
+2025-12-04 09:37:00.010 | INFO | audio_ai_chat.core.websocket_handler:connect:134 - 连接 2691856378672 已接受,等待身份信息(5秒超时),当前连接数: 1
+2025-12-04 09:37:00.052 | INFO | audio_ai_chat.core.websocket_handler:connect:188 - 用户 1001(测试用户)身份校验通过(client_id: 2691856378672)
+2025-12-04 09:37:00.052 | INFO | audio_ai_chat.core.websocket_handler:_register_connection:58 - 客户端 2691856378672 注册成功,当前活跃连接数:2
+2025-12-04 09:37:00.325 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:224 - 客户端 2691856082944 连接就绪
+2025-12-04 09:37:00.326 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:79 - 客户端 2691856082944 发送协程启动
+2025-12-04 09:37:00.381 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:224 - 客户端 2691856378672 连接就绪
+2025-12-04 09:37:00.382 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:79 - 客户端 2691856378672 发送协程启动
+2025-12-04 09:37:25.777 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:246 - 客户端 2691856378672 主动断开连接
+2025-12-04 09:37:25.778 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:252 - 客户端 2691856378672 开始清理连接
+2025-12-04 09:37:25.778 | ERROR | audio_ai_chat.core.websocket_handler:_send_worker:127 - 客户端 2691856378672 发送协程异常退出:type object 'WebSocket' has no attribute 'Disconnect'
+2025-12-04 09:37:25.778 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:129 - 客户端 2691856378672 发送协程已退出
+2025-12-04 09:37:25.779 | INFO | audio_ai_chat.core.websocket_handler:_unregister_connection:68 - 客户端 2691856378672 注销成功,当前活跃连接数:1
+2025-12-04 09:37:25.779 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:279 - 客户端 2691856378672 连接清理完成
+2025-12-04 09:41:34.538 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:246 - 客户端 2691856082944 主动断开连接
+2025-12-04 09:41:34.538 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:252 - 客户端 2691856082944 开始清理连接
+2025-12-04 09:41:34.539 | ERROR | audio_ai_chat.core.websocket_handler:_send_worker:127 - 客户端 2691856082944 发送协程异常退出:type object 'WebSocket' has no attribute 'Disconnect'
+2025-12-04 09:41:34.539 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:129 - 客户端 2691856082944 发送协程已退出
+2025-12-04 09:41:34.540 | INFO | audio_ai_chat.core.websocket_handler:_unregister_connection:68 - 客户端 2691856082944 注销成功,当前活跃连接数:0
+2025-12-04 09:41:34.540 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:279 - 客户端 2691856082944 连接清理完成
+2025-12-04 09:41:38.695 | INFO | audio_ai_chat.core.websocket_handler:connect:134 - 连接 2691856368256 已接受,等待身份信息(5秒超时),当前连接数: 0
+2025-12-04 09:41:38.713 | INFO | audio_ai_chat.core.websocket_handler:connect:188 - 用户 1001(测试用户)身份校验通过(client_id: 2691856368256)
+2025-12-04 09:41:38.713 | INFO | audio_ai_chat.core.websocket_handler:_register_connection:58 - 客户端 2691856368256 注册成功,当前活跃连接数:1
+2025-12-04 09:41:38.713 | ERROR | audio_ai_chat.core.websocket_handler:handle_connection:248 - 客户端 2691856368256 处理异常:获取ASR连接失败
+2025-12-04 09:41:38.714 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:252 - 客户端 2691856368256 开始清理连接
+2025-12-04 09:41:38.714 | INFO | audio_ai_chat.core.websocket_handler:_unregister_connection:68 - 客户端 2691856368256 注销成功,当前活跃连接数:0
+2025-12-04 09:41:38.714 | INFO | audio_ai_chat.core.connection:close:316 - 连接上下文已关闭:client_id=2691856368256,user_id=1001,对话历史条数=0
+2025-12-04 09:41:38.715 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:279 - 客户端 2691856368256 连接清理完成
+2025-12-04 09:42:03.719 | INFO | audio_ai_chat.core.websocket_handler:connect:134 - 连接 2674482096128 已接受,等待身份信息(5秒超时),当前连接数: 0
+2025-12-04 09:42:03.783 | INFO | audio_ai_chat.core.websocket_handler:connect:188 - 用户 1001(测试用户)身份校验通过(client_id: 2674482096128)
+2025-12-04 09:42:03.783 | INFO | audio_ai_chat.core.websocket_handler:_register_connection:58 - 客户端 2674482096128 注册成功,当前活跃连接数:1
+2025-12-04 09:42:04.533 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:224 - 客户端 2674482096128 连接就绪
+2025-12-04 09:42:04.534 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:79 - 客户端 2674482096128 发送协程启动
+2025-12-04 09:42:21.083 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:246 - 客户端 2674482096128 主动断开连接
+2025-12-04 09:42:21.083 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:252 - 客户端 2674482096128 开始清理连接
+2025-12-04 09:42:21.084 | ERROR | audio_ai_chat.core.websocket_handler:_send_worker:127 - 客户端 2674482096128 发送协程异常退出:type object 'WebSocket' has no attribute 'Disconnect'
+2025-12-04 09:42:21.084 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:129 - 客户端 2674482096128 发送协程已退出
+2025-12-04 09:42:21.084 | INFO | audio_ai_chat.core.websocket_handler:_unregister_connection:68 - 客户端 2674482096128 注销成功,当前活跃连接数:0
+2025-12-04 09:42:21.085 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:279 - 客户端 2674482096128 连接清理完成
+2025-12-04 09:45:15.614 | INFO | audio_ai_chat.core.websocket_handler:connect:134 - 连接 2674482394928 已接受,等待身份信息(5秒超时),当前连接数: 0
+2025-12-04 09:45:15.791 | INFO | audio_ai_chat.core.websocket_handler:connect:188 - 用户 1001(测试用户)身份校验通过(client_id: 2674482394928)
+2025-12-04 09:45:15.791 | INFO | audio_ai_chat.core.websocket_handler:_register_connection:58 - 客户端 2674482394928 注册成功,当前活跃连接数:1
+2025-12-04 09:45:16.339 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:224 - 客户端 2674482394928 连接就绪
+2025-12-04 09:45:16.339 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:79 - 客户端 2674482394928 发送协程启动
+2025-12-04 09:45:39.432 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:246 - 客户端 2674482394928 主动断开连接
+2025-12-04 09:45:39.433 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:252 - 客户端 2674482394928 开始清理连接
+2025-12-04 09:45:39.434 | ERROR | audio_ai_chat.core.websocket_handler:_send_worker:127 - 客户端 2674482394928 发送协程异常退出:type object 'WebSocket' has no attribute 'Disconnect'
+2025-12-04 09:45:39.434 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:129 - 客户端 2674482394928 发送协程已退出
+2025-12-04 09:45:39.434 | INFO | audio_ai_chat.core.websocket_handler:_unregister_connection:68 - 客户端 2674482394928 注销成功,当前活跃连接数:0
+2025-12-04 09:45:39.435 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:279 - 客户端 2674482394928 连接清理完成
+2025-12-04 09:47:59.794 | INFO | audio_ai_chat.core.websocket_handler:connect:134 - 连接 2674482941808 已接受,等待身份信息(5秒超时),当前连接数: 0
+2025-12-04 09:47:59.814 | INFO | audio_ai_chat.core.websocket_handler:connect:188 - 用户 1001(测试用户)身份校验通过(client_id: 2674482941808)
+2025-12-04 09:47:59.814 | INFO | audio_ai_chat.core.websocket_handler:_register_connection:58 - 客户端 2674482941808 注册成功,当前活跃连接数:1
+2025-12-04 09:47:59.815 | ERROR | audio_ai_chat.core.websocket_handler:handle_connection:248 - 客户端 2674482941808 处理异常:获取ASR连接失败
+2025-12-04 09:47:59.815 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:252 - 客户端 2674482941808 开始清理连接
+2025-12-04 09:47:59.815 | INFO | audio_ai_chat.core.websocket_handler:_unregister_connection:68 - 客户端 2674482941808 注销成功,当前活跃连接数:0
+2025-12-04 09:47:59.815 | INFO | audio_ai_chat.core.connection:close:316 - 连接上下文已关闭:client_id=2674482941808,user_id=1001,对话历史条数=0
+2025-12-04 09:47:59.816 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:279 - 客户端 2674482941808 连接清理完成
+2025-12-04 09:48:30.283 | INFO | audio_ai_chat.core.websocket_handler:connect:134 - 连接 2674482941904 已接受,等待身份信息(5秒超时),当前连接数: 0
+2025-12-04 09:48:30.387 | INFO | audio_ai_chat.core.websocket_handler:connect:188 - 用户 1001(测试用户)身份校验通过(client_id: 2674482941904)
+2025-12-04 09:48:30.388 | INFO | audio_ai_chat.core.websocket_handler:_register_connection:58 - 客户端 2674482941904 注册成功,当前活跃连接数:1
+2025-12-04 09:48:30.388 | ERROR | audio_ai_chat.core.websocket_handler:handle_connection:248 - 客户端 2674482941904 处理异常:获取ASR连接失败
+2025-12-04 09:48:30.389 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:252 - 客户端 2674482941904 开始清理连接
+2025-12-04 09:48:30.389 | INFO | audio_ai_chat.core.websocket_handler:_unregister_connection:68 - 客户端 2674482941904 注销成功,当前活跃连接数:0
+2025-12-04 09:48:30.389 | INFO | audio_ai_chat.core.connection:close:316 - 连接上下文已关闭:client_id=2674482941904,user_id=1001,对话历史条数=0
+2025-12-04 09:48:30.390 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:279 - 客户端 2674482941904 连接清理完成
+2025-12-04 09:48:52.611 | INFO | audio_ai_chat.core.websocket_handler:connect:134 - 连接 2143937895424 已接受,等待身份信息(5秒超时),当前连接数: 0
+2025-12-04 09:48:52.639 | INFO | audio_ai_chat.core.websocket_handler:connect:188 - 用户 1001(测试用户)身份校验通过(client_id: 2143937895424)
+2025-12-04 09:48:52.639 | INFO | audio_ai_chat.core.websocket_handler:_register_connection:58 - 客户端 2143937895424 注册成功,当前活跃连接数:1
+2025-12-04 09:48:53.319 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:224 - 客户端 2143937895424 连接就绪
+2025-12-04 09:48:53.319 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:79 - 客户端 2143937895424 发送协程启动
+2025-12-04 09:49:19.366 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:246 - 客户端 2143937895424 主动断开连接
+2025-12-04 09:49:19.367 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:252 - 客户端 2143937895424 开始清理连接
+2025-12-04 09:49:19.367 | ERROR | audio_ai_chat.core.websocket_handler:_send_worker:127 - 客户端 2143937895424 发送协程异常退出:type object 'WebSocket' has no attribute 'Disconnect'
+2025-12-04 09:49:19.368 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:129 - 客户端 2143937895424 发送协程已退出
+2025-12-04 09:49:19.368 | INFO | audio_ai_chat.core.websocket_handler:_unregister_connection:68 - 客户端 2143937895424 注销成功,当前活跃连接数:0
+2025-12-04 09:49:19.369 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:279 - 客户端 2143937895424 连接清理完成
+2025-12-04 09:51:02.244 | INFO | audio_ai_chat.core.websocket_handler:connect:134 - 连接 2143938230400 已接受,等待身份信息(5秒超时),当前连接数: 0
+2025-12-04 09:51:02.353 | INFO | audio_ai_chat.core.websocket_handler:connect:188 - 用户 1001(测试用户)身份校验通过(client_id: 2143938230400)
+2025-12-04 09:51:02.354 | INFO | audio_ai_chat.core.websocket_handler:_register_connection:58 - 客户端 2143938230400 注册成功,当前活跃连接数:1
+2025-12-04 09:51:02.855 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:224 - 客户端 2143938230400 连接就绪
+2025-12-04 09:51:02.856 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:79 - 客户端 2143938230400 发送协程启动
+2025-12-04 09:51:20.228 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:246 - 客户端 2143938230400 主动断开连接
+2025-12-04 09:51:20.228 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:252 - 客户端 2143938230400 开始清理连接
+2025-12-04 09:51:20.229 | ERROR | audio_ai_chat.core.websocket_handler:_send_worker:127 - 客户端 2143938230400 发送协程异常退出:type object 'WebSocket' has no attribute 'Disconnect'
+2025-12-04 09:51:20.229 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:129 - 客户端 2143938230400 发送协程已退出
+2025-12-04 09:51:20.230 | INFO | audio_ai_chat.core.websocket_handler:_unregister_connection:68 - 客户端 2143938230400 注销成功,当前活跃连接数:0
+2025-12-04 09:51:20.230 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:279 - 客户端 2143938230400 连接清理完成
+2025-12-04 09:51:59.892 | INFO | audio_ai_chat.core.websocket_handler:connect:134 - 连接 2143938793328 已接受,等待身份信息(5秒超时),当前连接数: 0
+2025-12-04 09:51:59.922 | INFO | audio_ai_chat.core.websocket_handler:connect:188 - 用户 1001(测试用户)身份校验通过(client_id: 2143938793328)
+2025-12-04 09:51:59.922 | INFO | audio_ai_chat.core.websocket_handler:_register_connection:58 - 客户端 2143938793328 注册成功,当前活跃连接数:1
+2025-12-04 09:51:59.923 | ERROR | audio_ai_chat.core.websocket_handler:handle_connection:248 - 客户端 2143938793328 处理异常:获取ASR连接失败
+2025-12-04 09:51:59.923 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:252 - 客户端 2143938793328 开始清理连接
+2025-12-04 09:51:59.923 | INFO | audio_ai_chat.core.websocket_handler:_unregister_connection:68 - 客户端 2143938793328 注销成功,当前活跃连接数:0
+2025-12-04 09:51:59.924 | INFO | audio_ai_chat.core.connection:close:316 - 连接上下文已关闭:client_id=2143938793328,user_id=1001,对话历史条数=0
+2025-12-04 09:51:59.924 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:279 - 客户端 2143938793328 连接清理完成
+2025-12-04 09:55:49.386 | INFO | audio_ai_chat.core.websocket_handler:connect:134 - 连接 2463641888864 已接受,等待身份信息(5秒超时),当前连接数: 0
+2025-12-04 09:55:49.579 | INFO | audio_ai_chat.core.websocket_handler:connect:188 - 用户 1001(测试用户)身份校验通过(client_id: 2463641888864)
+2025-12-04 09:55:49.579 | INFO | audio_ai_chat.core.websocket_handler:_register_connection:58 - 客户端 2463641888864 注册成功,当前活跃连接数:1
+2025-12-04 09:55:50.097 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:224 - 客户端 2463641888864 连接就绪
+2025-12-04 09:55:50.098 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:79 - 客户端 2463641888864 发送协程启动
+2025-12-04 09:56:08.586 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:246 - 客户端 2463641888864 主动断开连接
+2025-12-04 09:56:08.586 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:252 - 客户端 2463641888864 开始清理连接
+2025-12-04 09:56:08.587 | ERROR | audio_ai_chat.core.websocket_handler:_send_worker:127 - 客户端 2463641888864 发送协程异常退出:type object 'WebSocket' has no attribute 'Disconnect'
+2025-12-04 09:56:08.588 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:129 - 客户端 2463641888864 发送协程已退出
+2025-12-04 09:56:08.588 | INFO | audio_ai_chat.core.websocket_handler:_unregister_connection:68 - 客户端 2463641888864 注销成功,当前活跃连接数:0
+2025-12-04 09:56:08.588 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:279 - 客户端 2463641888864 连接清理完成
+2025-12-04 09:56:50.202 | INFO | audio_ai_chat.core.websocket_handler:connect:134 - 连接 2463642190992 已接受,等待身份信息(5秒超时),当前连接数: 0
+2025-12-04 09:56:50.264 | INFO | audio_ai_chat.core.websocket_handler:connect:188 - 用户 1001(测试用户)身份校验通过(client_id: 2463642190992)
+2025-12-04 09:56:50.264 | INFO | audio_ai_chat.core.websocket_handler:_register_connection:58 - 客户端 2463642190992 注册成功,当前活跃连接数:1
+2025-12-04 09:56:50.835 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:224 - 客户端 2463642190992 连接就绪
+2025-12-04 09:56:50.836 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:79 - 客户端 2463642190992 发送协程启动
+2025-12-04 09:57:11.801 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:246 - 客户端 2463642190992 主动断开连接
+2025-12-04 09:57:11.801 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:252 - 客户端 2463642190992 开始清理连接
+2025-12-04 09:57:11.802 | ERROR | audio_ai_chat.core.websocket_handler:_send_worker:127 - 客户端 2463642190992 发送协程异常退出:type object 'WebSocket' has no attribute 'Disconnect'
+2025-12-04 09:57:11.802 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:129 - 客户端 2463642190992 发送协程已退出
+2025-12-04 09:57:11.803 | INFO | audio_ai_chat.core.websocket_handler:_unregister_connection:68 - 客户端 2463642190992 注销成功,当前活跃连接数:0
+2025-12-04 09:57:11.803 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:279 - 客户端 2463642190992 连接清理完成
+2025-12-04 10:04:03.057 | INFO | audio_ai_chat.core.websocket_handler:connect:134 - 连接 2076949754736 已接受,等待身份信息(5秒超时),当前连接数: 0
+2025-12-04 10:04:03.210 | INFO | audio_ai_chat.core.websocket_handler:connect:188 - 用户 1001(测试用户)身份校验通过(client_id: 2076949754736)
+2025-12-04 10:04:03.210 | INFO | audio_ai_chat.core.websocket_handler:_register_connection:58 - 客户端 2076949754736 注册成功,当前活跃连接数:1
+2025-12-04 10:04:03.872 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:224 - 客户端 2076949754736 连接就绪
+2025-12-04 10:04:03.872 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:79 - 客户端 2076949754736 发送协程启动
+2025-12-04 10:04:20.520 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:246 - 客户端 2076949754736 主动断开连接
+2025-12-04 10:04:20.520 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:252 - 客户端 2076949754736 开始清理连接
+2025-12-04 10:04:20.521 | ERROR | audio_ai_chat.core.websocket_handler:_send_worker:127 - 客户端 2076949754736 发送协程异常退出:type object 'WebSocket' has no attribute 'Disconnect'
+2025-12-04 10:04:20.522 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:129 - 客户端 2076949754736 发送协程已退出
+2025-12-04 10:04:20.522 | INFO | audio_ai_chat.core.websocket_handler:_unregister_connection:68 - 客户端 2076949754736 注销成功,当前活跃连接数:0
+2025-12-04 10:04:20.523 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:279 - 客户端 2076949754736 连接清理完成
+2025-12-04 10:04:37.874 | INFO | audio_ai_chat.core.websocket_handler:connect:134 - 连接 1970278115328 已接受,等待身份信息(5秒超时),当前连接数: 0
+2025-12-04 10:04:38.076 | INFO | audio_ai_chat.core.websocket_handler:connect:188 - 用户 1001(测试用户)身份校验通过(client_id: 1970278115328)
+2025-12-04 10:04:38.077 | INFO | audio_ai_chat.core.websocket_handler:_register_connection:58 - 客户端 1970278115328 注册成功,当前活跃连接数:1
+2025-12-04 10:04:38.856 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:224 - 客户端 1970278115328 连接就绪
+2025-12-04 10:04:38.856 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:79 - 客户端 1970278115328 发送协程启动
+2025-12-04 10:06:12.127 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:246 - 客户端 1970278115328 主动断开连接
+2025-12-04 10:06:12.127 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:252 - 客户端 1970278115328 开始清理连接
+2025-12-04 10:06:12.127 | ERROR | audio_ai_chat.core.websocket_handler:_send_worker:127 - 客户端 1970278115328 发送协程异常退出:type object 'WebSocket' has no attribute 'Disconnect'
+2025-12-04 10:06:12.128 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:129 - 客户端 1970278115328 发送协程已退出
+2025-12-04 10:06:12.128 | INFO | audio_ai_chat.core.websocket_handler:_unregister_connection:68 - 客户端 1970278115328 注销成功,当前活跃连接数:0
+2025-12-04 10:06:12.128 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:279 - 客户端 1970278115328 连接清理完成
+2025-12-04 10:06:57.226 | INFO | audio_ai_chat.core.websocket_handler:connect:134 - 连接 2002946566096 已接受,等待身份信息(5秒超时),当前连接数: 0
+2025-12-04 10:06:57.250 | INFO | audio_ai_chat.core.websocket_handler:connect:188 - 用户 1001(测试用户)身份校验通过(client_id: 2002946566096)
+2025-12-04 10:06:57.250 | INFO | audio_ai_chat.core.websocket_handler:_register_connection:58 - 客户端 2002946566096 注册成功,当前活跃连接数:1
+2025-12-04 10:06:57.953 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:224 - 客户端 2002946566096 连接就绪
+2025-12-04 10:06:57.953 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:79 - 客户端 2002946566096 发送协程启动
+2025-12-04 10:07:24.732 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:246 - 客户端 2002946566096 主动断开连接
+2025-12-04 10:07:24.732 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:252 - 客户端 2002946566096 开始清理连接
+2025-12-04 10:07:24.733 | ERROR | audio_ai_chat.core.websocket_handler:_send_worker:127 - 客户端 2002946566096 发送协程异常退出:type object 'WebSocket' has no attribute 'Disconnect'
+2025-12-04 10:07:24.733 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:129 - 客户端 2002946566096 发送协程已退出
+2025-12-04 10:07:24.733 | INFO | audio_ai_chat.core.websocket_handler:_unregister_connection:68 - 客户端 2002946566096 注销成功,当前活跃连接数:0
+2025-12-04 10:07:24.733 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:279 - 客户端 2002946566096 连接清理完成
+2025-12-04 10:08:37.900 | INFO | audio_ai_chat.core.websocket_handler:connect:134 - 连接 2634366068832 已接受,等待身份信息(5秒超时),当前连接数: 0
+2025-12-04 10:08:38.001 | INFO | audio_ai_chat.core.websocket_handler:connect:188 - 用户 1001(测试用户)身份校验通过(client_id: 2634366068832)
+2025-12-04 10:08:38.001 | INFO | audio_ai_chat.core.websocket_handler:_register_connection:58 - 客户端 2634366068832 注册成功,当前活跃连接数:1
+2025-12-04 10:08:38.609 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:224 - 客户端 2634366068832 连接就绪
+2025-12-04 10:08:38.609 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:79 - 客户端 2634366068832 发送协程启动
+2025-12-04 10:10:33.549 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:246 - 客户端 2634366068832 主动断开连接
+2025-12-04 10:10:33.549 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:252 - 客户端 2634366068832 开始清理连接
+2025-12-04 10:10:33.550 | ERROR | audio_ai_chat.core.websocket_handler:_send_worker:127 - 客户端 2634366068832 发送协程异常退出:type object 'WebSocket' has no attribute 'Disconnect'
+2025-12-04 10:10:33.550 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:129 - 客户端 2634366068832 发送协程已退出
+2025-12-04 10:10:33.550 | INFO | audio_ai_chat.core.websocket_handler:_unregister_connection:68 - 客户端 2634366068832 注销成功,当前活跃连接数:0
+2025-12-04 10:10:33.550 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:279 - 客户端 2634366068832 连接清理完成
+2025-12-04 10:14:31.284 | INFO | audio_ai_chat.core.websocket_handler:connect:134 - 连接 1918299616976 已接受,等待身份信息(5秒超时),当前连接数: 0
+2025-12-04 10:14:31.488 | INFO | audio_ai_chat.core.websocket_handler:connect:188 - 用户 1001(测试用户)身份校验通过(client_id: 1918299616976)
+2025-12-04 10:14:31.488 | INFO | audio_ai_chat.core.websocket_handler:_register_connection:58 - 客户端 1918299616976 注册成功,当前活跃连接数:1
+2025-12-04 10:14:32.210 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:224 - 客户端 1918299616976 连接就绪
+2025-12-04 10:14:32.210 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:79 - 客户端 1918299616976 发送协程启动
+2025-12-04 10:14:56.399 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:246 - 客户端 1918299616976 主动断开连接
+2025-12-04 10:14:56.400 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:252 - 客户端 1918299616976 开始清理连接
+2025-12-04 10:14:56.401 | ERROR | audio_ai_chat.core.websocket_handler:_send_worker:127 - 客户端 1918299616976 发送协程异常退出:type object 'WebSocket' has no attribute 'Disconnect'
+2025-12-04 10:14:56.401 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:129 - 客户端 1918299616976 发送协程已退出
+2025-12-04 10:14:56.401 | INFO | audio_ai_chat.core.websocket_handler:_unregister_connection:68 - 客户端 1918299616976 注销成功,当前活跃连接数:0
+2025-12-04 10:14:56.402 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:279 - 客户端 1918299616976 连接清理完成
+2025-12-04 10:15:18.544 | INFO | audio_ai_chat.core.websocket_handler:connect:134 - 连接 1682518255616 已接受,等待身份信息(5秒超时),当前连接数: 0
+2025-12-04 10:15:18.634 | INFO | audio_ai_chat.core.websocket_handler:connect:188 - 用户 1001(测试用户)身份校验通过(client_id: 1682518255616)
+2025-12-04 10:15:18.634 | INFO | audio_ai_chat.core.websocket_handler:_register_connection:58 - 客户端 1682518255616 注册成功,当前活跃连接数:1
+2025-12-04 10:15:19.377 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:224 - 客户端 1682518255616 连接就绪
+2025-12-04 10:15:19.377 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:79 - 客户端 1682518255616 发送协程启动
+2025-12-04 10:15:29.340 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:246 - 客户端 1682518255616 主动断开连接
+2025-12-04 10:15:29.341 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:252 - 客户端 1682518255616 开始清理连接
+2025-12-04 10:15:29.342 | ERROR | audio_ai_chat.core.websocket_handler:_send_worker:127 - 客户端 1682518255616 发送协程异常退出:type object 'WebSocket' has no attribute 'Disconnect'
+2025-12-04 10:15:29.342 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:129 - 客户端 1682518255616 发送协程已退出
+2025-12-04 10:15:29.342 | INFO | audio_ai_chat.core.websocket_handler:_unregister_connection:68 - 客户端 1682518255616 注销成功,当前活跃连接数:0
+2025-12-04 10:15:29.343 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:279 - 客户端 1682518255616 连接清理完成
+2025-12-04 10:17:27.213 | INFO | audio_ai_chat.core.websocket_handler:connect:134 - 连接 2156400945104 已接受,等待身份信息(5秒超时),当前连接数: 0
+2025-12-04 10:17:27.400 | INFO | audio_ai_chat.core.websocket_handler:connect:188 - 用户 1001(测试用户)身份校验通过(client_id: 2156400945104)
+2025-12-04 10:17:27.400 | INFO | audio_ai_chat.core.websocket_handler:_register_connection:58 - 客户端 2156400945104 注册成功,当前活跃连接数:1
+2025-12-04 10:17:27.995 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:224 - 客户端 2156400945104 连接就绪
+2025-12-04 10:17:27.995 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:79 - 客户端 2156400945104 发送协程启动
+2025-12-04 10:17:34.742 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:246 - 客户端 2156400945104 主动断开连接
+2025-12-04 10:17:34.742 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:252 - 客户端 2156400945104 开始清理连接
+2025-12-04 10:17:34.743 | ERROR | audio_ai_chat.core.websocket_handler:_send_worker:127 - 客户端 2156400945104 发送协程异常退出:type object 'WebSocket' has no attribute 'Disconnect'
+2025-12-04 10:17:34.743 | INFO | audio_ai_chat.core.websocket_handler:_send_worker:129 - 客户端 2156400945104 发送协程已退出
+2025-12-04 10:17:34.743 | INFO | audio_ai_chat.core.websocket_handler:_unregister_connection:68 - 客户端 2156400945104 注销成功,当前活跃连接数:0
+2025-12-04 10:17:34.743 | INFO | audio_ai_chat.core.websocket_handler:handle_connection:279 - 客户端 2156400945104 连接清理完成
diff --git a/python/__pycache__/asr_client.cpython-310.pyc b/python/__pycache__/asr_client.cpython-310.pyc
index 1063c08..81f2d09 100644
Binary files a/python/__pycache__/asr_client.cpython-310.pyc and b/python/__pycache__/asr_client.cpython-310.pyc differ
diff --git a/python/__pycache__/frontend_ws.cpython-310.pyc b/python/__pycache__/frontend_ws.cpython-310.pyc
index d09aa2f..04d16c0 100644
Binary files a/python/__pycache__/frontend_ws.cpython-310.pyc and b/python/__pycache__/frontend_ws.cpython-310.pyc differ
diff --git a/python/__pycache__/llm_client.cpython-310.pyc b/python/__pycache__/llm_client.cpython-310.pyc
index 2e051af..06200a1 100644
Binary files a/python/__pycache__/llm_client.cpython-310.pyc and b/python/__pycache__/llm_client.cpython-310.pyc differ
diff --git a/python/__pycache__/session_manager.cpython-310.pyc b/python/__pycache__/session_manager.cpython-310.pyc
index cc63190..76cf881 100644
Binary files a/python/__pycache__/session_manager.cpython-310.pyc and b/python/__pycache__/session_manager.cpython-310.pyc differ
diff --git a/python/__pycache__/tts_client.cpython-310.pyc b/python/__pycache__/tts_client.cpython-310.pyc
index b8d58e6..ba0f360 100644
Binary files a/python/__pycache__/tts_client.cpython-310.pyc and b/python/__pycache__/tts_client.cpython-310.pyc differ
diff --git a/python/__pycache__/ws_message_manager.cpython-310.pyc b/python/__pycache__/ws_message_manager.cpython-310.pyc
index a8a33e0..47faf8a 100644
Binary files a/python/__pycache__/ws_message_manager.cpython-310.pyc and b/python/__pycache__/ws_message_manager.cpython-310.pyc differ
diff --git a/python/protocols/__pycache__/__init__.cpython-310.pyc b/python/protocols/__pycache__/__init__.cpython-310.pyc
index eab35ec..171fa20 100644
Binary files a/python/protocols/__pycache__/__init__.cpython-310.pyc and b/python/protocols/__pycache__/__init__.cpython-310.pyc differ
diff --git a/python/protocols/__pycache__/protocols.cpython-310.pyc b/python/protocols/__pycache__/protocols.cpython-310.pyc
index 7489c85..39e4d03 100644
Binary files a/python/protocols/__pycache__/protocols.cpython-310.pyc and b/python/protocols/__pycache__/protocols.cpython-310.pyc differ
diff --git a/测试流式传输uniapp/pages/index/StreamPlayer.js b/测试流式传输uniapp/pages/index/StreamPlayer.js
new file mode 100644
index 0000000..f0340d6
--- /dev/null
+++ b/测试流式传输uniapp/pages/index/StreamPlayer.js
@@ -0,0 +1,201 @@
+/**
+ * 支持安卓、iOS、H5的pcm格式,
+ * 如果想支持mp3,需要增加mp3相关解码合并处理等,个人测试效果不太好,所以没有加
+ */
+export class StreamPlayer {
+ constructor({
+ inputSampleRate = 16000,
+ numChannels = 1,
+ bitDepth = 16,
+ littleEndian = true,
+ pcmType = 'int',
+ callback = ()=>{}
+ } = {}) {
+ // 参数校验
+ if (![16, 32].includes(bitDepth)) throw new Error('bitDepth 必须是 16 或 32');
+ if (inputSampleRate <= 0) throw new Error('采样率必须大于 0');
+ if (!['int', 'float'].includes(pcmType)) throw new Error('pcmType 必须是 int 或 float');
+
+ this.audioContext = new(window.AudioContext || window.webkitAudioContext)();
+ this.inputSampleRate = inputSampleRate;
+ this.numChannels = numChannels;
+ this.bitDepth = bitDepth;
+ this.littleEndian = littleEndian;
+ this.pcmType = pcmType;
+ this.audioQueue = [];
+ this.playbackEndTime = 0;
+ this.currentSource = null;
+ this.lastBlockTail = null; // 用于交叉淡入淡出
+ this.callback = callback;
+ }
+
+ appendChunk(audioData) {
+ console.log('this.audioQueue', this.audioQueue.length);
+ this.audioQueue.push(audioData);
+ this._processQueue();
+ }
+
+ destroy() {
+ this.audioQueue = [];
+ this.playbackEndTime = 0;
+ if (this.currentSource) {
+ this.currentSource.stop();
+ this.currentSource = null;
+ }
+ if (this.audioContext) {
+ this.audioContext.close();
+ this.audioContext = null;
+ }
+ }
+
+ async _processQueue() {
+ if(this.audioQueue.length === 0) {
+ this.callback('ended')
+ return
+ }
+ if (!this.audioContext || this.currentSource) return;
+ const buffer = this._mergeArrayBuffers(this.audioQueue)
+ this.audioQueue = []
+ try {
+ const audioBuffer = this._convertPCM(buffer);
+ await this._schedulePlay(audioBuffer);
+ this._processQueue();
+ } catch (err) {
+ console.error('音频处理失败:', err.name, err.message, err.stack);
+ }
+ }
+
+ _convertPCM(buffer) {
+ // 1. 数据对齐:确保长度是样本大小的整数倍
+ const bytesPerSample = this.bitDepth / 8;
+ const requiredBytes = bytesPerSample * this.numChannels;
+ const validByteLength = Math.floor(buffer.byteLength / requiredBytes) * requiredBytes;
+ const validBuffer = buffer.slice(0, validByteLength);
+ const dataView = new DataView(validBuffer);
+ const numSamples = validByteLength / requiredBytes;
+
+ // 2. 创建音频缓冲区
+ const audioBuffer = this.audioContext.createBuffer(
+ this.numChannels,
+ numSamples,
+ this.inputSampleRate
+ );
+
+ // 3. 解析PCM数据
+ for (let ch = 0; ch < this.numChannels; ch++) {
+ const channelData = audioBuffer.getChannelData(ch);
+ for (let i = 0; i < numSamples; i++) {
+ // 计算字节位置(修正后的多声道索引)
+ const pos = (i * this.numChannels * bytesPerSample) + (ch * bytesPerSample);
+ let value;
+
+ // 根据位深和数据类型解析
+ if (this.bitDepth === 16) {
+ value = dataView.getInt16(pos, this.littleEndian) / 32768;
+ } else {
+ if (this.pcmType === 'int') {
+ value = dataView.getInt32(pos, this.littleEndian) / 2147483648;
+ } else {
+ value = dataView.getFloat32(pos, this.littleEndian);
+ }
+ }
+ channelData[i] = value;
+ }
+
+ // 4. 消除直流偏移
+ let sum = 0;
+ for (let i = 0; i < channelData.length; i++) {
+ sum += channelData[i];
+ }
+ const dcOffset = sum / channelData.length;
+ for (let i = 0; i < channelData.length; i++) {
+ channelData[i] -= dcOffset;
+ }
+
+ // 5. 块内淡入淡出(减少边界突变)
+ const fadeLength = Math.min(100, channelData.length);
+ for (let i = 0; i < fadeLength; i++) {
+ channelData[i] *= (i / fadeLength);
+ }
+ const startFadeOut = Math.max(0, channelData.length - fadeLength);
+ for (let i = startFadeOut; i < channelData.length; i++) {
+ const factor = 1 - (i - startFadeOut) / fadeLength;
+ channelData[i] *= factor;
+ }
+ }
+
+ // 6. 块间交叉淡入淡出(解决重音关键点)
+ const crossfadeLength = 50;
+ if (this.lastBlockTail && this.lastBlockTail.length === this.numChannels) {
+ for (let ch = 0; ch < this.numChannels; ch++) {
+ const channelData = audioBuffer.getChannelData(ch);
+ const prevTail = this.lastBlockTail[ch];
+
+ // 只处理有足够长度交叉的情况
+ if (prevTail.length >= crossfadeLength && channelData.length >= crossfadeLength) {
+ for (let i = 0; i < crossfadeLength; i++) {
+ const prevWeight = (crossfadeLength - i) / crossfadeLength;
+ const currWeight = i / crossfadeLength;
+ channelData[i] = channelData[i] * currWeight + prevTail[i] * prevWeight;
+ }
+ }
+ }
+ }
+
+ // 7. 保存当前块尾部用于下一次交叉
+ this.lastBlockTail = [];
+ for (let ch = 0; ch < this.numChannels; ch++) {
+ const channelData = audioBuffer.getChannelData(ch);
+ const tailStart = Math.max(0, channelData.length - crossfadeLength);
+ this.lastBlockTail[ch] = channelData.slice(tailStart);
+ }
+
+ return audioBuffer;
+ }
+ _schedulePlay(audioBuffer) {
+ return new Promise(resolve => {
+ const source = this.audioContext.createBufferSource();
+ source.buffer = audioBuffer;
+ source.connect(this.audioContext.destination);
+
+ const plannedStartTime = this.playbackEndTime;
+ const now = this.audioContext.currentTime;
+ let startTime = Math.max(plannedStartTime, now);
+
+ // 动态速率调整(示例,需根据实际测试调整阈值)
+ const timeDrift = plannedStartTime - now;
+ if (timeDrift < -0.02) {
+ source.playbackRate.value = Math.min(1.04, 1 - (timeDrift / audioBuffer.duration));
+ } else if (timeDrift > 0.02) {
+ source.playbackRate.value = Math.max(0.96, 1 - (timeDrift / audioBuffer.duration));
+ } else {
+ source.playbackRate.value = 1.0;
+ }
+
+ source.start(startTime);
+ this.playbackEndTime = startTime + (audioBuffer.duration / source.playbackRate.value);
+
+ source.onended = () => {
+ this.currentSource = null;
+ resolve();
+ };
+ this.currentSource = source;
+ });
+ }
+
+ // 合并多个 ArrayBuffer 的辅助函数
+ _mergeArrayBuffers(buffers) {
+ let totalLength = 0;
+ for (let buffer of buffers) {
+ totalLength += buffer.byteLength;
+ }
+ const result = new Uint8Array(totalLength);
+ let offset = 0;
+ for (let buffer of buffers) {
+ const view = new Uint8Array(buffer);
+ result.set(view, offset);
+ offset += view.length;
+ }
+ return result.buffer;
+ }
+}
\ No newline at end of file
diff --git a/测试流式传输uniapp/pages/index/index.vue b/测试流式传输uniapp/pages/index/index.vue
index 91c37e5..7da3ef7 100644
--- a/测试流式传输uniapp/pages/index/index.vue
+++ b/测试流式传输uniapp/pages/index/index.vue
@@ -4,11 +4,23 @@
{{ status }}
当前分贝:{{ currentDecibels }}
-
-
- xx
+
+
+
@@ -19,12 +31,14 @@
SerializationType,
CompressionType,
ControlCommand,
- ProtocolConst,
- } from './ProtocolCodec';
+ ProtocolConst
+ } from './ProtocolCodec';
export default {
data() {
return {
- status: "未录音",
+ currentPCMChunk: null,
+ isStop: false, // 停止播放指令
+ status: '未录音',
currentDecibels: 0,
isRecording: false,
ws: null, // WebSocket 实例
@@ -32,9 +46,10 @@
scriptProcessor: null, // 音频处理节点
audioBufferSource: null, // 音频源节点
frameBufferList: [], // 缓存音频帧
- wsUrl: "ws://127.0.0.1:8000/ws/audio", // 替换为实际后端地址
- // wsUrl: "ws://172.16.89.58:8000/ws/audio", // 替换为实际后端地址
+ // wsUrl: "ws://127.0.0.1:8000/ws/audio", // 替换为实际后端地址
+ // wsUrl: 'ws://172.16.89.58:8000/ws/audio' // 替换为实际后端地址
// wsUrl: "ws://25.64.32.157:9603/trapractice/voiceCallSocket/voiceCall?summary=3D072C9D242C96EA3F0FD647CB14A6F4B4BEA4493BB2FAAB065935FB405071B8A903128E488B6D06BEB23FD4E3D15EE6", // 替换为实际后端地址
+ wsUrl: "wss://aitstest.jlbank.com.cn:7001/trapractice/voiceCallSocket/voiceCall?summary=3D072C9D242C96EA3F0FD647CB14A6F44A8F9EF1C3D9726612B7339B566489139850DF3BE002DF99495FD60B34A5899D", // 替换为实际后端地址
};
},
onUnload() {
@@ -53,7 +68,7 @@
},
fail: () => {
console.log('fail');
- },
+ }
});
this.ws.onOpen((res) => {
console.log('WebSocket连接已打开', res);
@@ -66,39 +81,41 @@
});
});
this.ws.onMessage((res) => {
- const {
- msgType,
- body
- } = ProtocolCodec.unpack(res.data)
-
+ const { msgType, body } = ProtocolCodec.unpack(res.data);
+
if (msgType === MessageType.IDENTITY) {
console.log('身份校验成功', body);
- this.onStartRecord()
+ this.onStartRecord();
} else if (msgType === MessageType.AUDIO_DATA) {
- this.$refs.aaa.appendBuffer(body)
- }else {
+ // this.$refs.aaa.appendBuffer(body)
+ // this.currentPCMChunk = body;
+ const buffer = body;
+ if (buffer.byteLength < 2) return;
+ // ArrayBuffer转数字数组
+ const uint8 = new Uint8Array(buffer);
+ const numArray = Array.from(uint8);
+ this.currentPCMChunk = numArray; // 传递数组
+ } else {
console.log('其他消息', body);
}
-
- })
-
+ });
},
// 申请录音权限
async applyRecordPermission() {
try {
const res = await uni.requestPermissions({
- scope: "scope.record"
+ scope: 'scope.record'
});
const isGranted = res[0].grantStatus === 1;
if (!isGranted) {
uni.showToast({
- title: "请授予录音权限",
- icon: "none"
+ title: '请授予录音权限',
+ icon: 'none'
});
}
return isGranted;
} catch (e) {
- console.error("申请权限失败:", e);
+ console.error('申请权限失败:', e);
return false;
}
},
@@ -124,25 +141,22 @@
sampleRate: 16000,
frameSize: 1024,
gain: 1.0,
- onFrameRecorded: ({
- isLastFrame,
- frameBuffer
- }) => {
- try{
+ onFrameRecorded: ({ isLastFrame, frameBuffer }) => {
+ try {
this.ws.send({
data: ProtocolCodec.pack(MessageType.AUDIO_DATA, frameBuffer)
});
- } catch(e){}
+ } catch (e) {}
},
onDecibels: (decibels) => {
this.currentDecibels = decibels;
}
});
this.isRecording = true;
- this.status = "录音中...";
+ this.status = '录音中...';
} catch (e) {
- console.error("启动录音失败:", e);
- this.status = "启动录音失败";
+ console.error('启动录音失败:', e);
+ this.status = '启动录音失败';
this.isRecording = false;
}
},
@@ -158,7 +172,7 @@
// 停止录音组件
this.$refs.recordFrame.stop();
this.isRecording = false;
- this.status = "已停止录音";
+ this.status = '已停止录音';
}
// 关闭 WebSocket
@@ -180,10 +194,7 @@
},
// 接收音频帧并处理
- frameRecorded({
- isLastFrame,
- frameBuffer
- }) {
+ frameRecorded({ isLastFrame, frameBuffer }) {
// console.log("收到音频帧:", isLastFrame, frameBuffer.length);
// 2. 通过 WebSocket 发送给后端
@@ -193,11 +204,9 @@
data: frameBuffer
});
} catch (e) {
- console.error("发送音频帧失败:", e);
+ console.error('发送音频帧失败:', e);
}
}
-
-
},
// 监听分贝值
@@ -209,9 +218,62 @@
// 录音停止回调
stopIt(base64) {
this.stopRecordAndClean();
- console.log("录音停止,最终音频Base64:", base64?.substring(0, 50) + "...");
- },
- },
+ console.log('录音停止,最终音频Base64:', base64?.substring(0, 50) + '...');
+ }
+ }
+ };
+
+
+
@@ -238,4 +300,4 @@
font-size: 28rpx;
color: #333;
}
-
\ No newline at end of file
+
diff --git a/测试流式传输uniapp/uni_modules/sdx-StreamPlayer/components/sdx-StreamPlayer/sdx-StreamPlayer.vue b/测试流式传输uniapp/uni_modules/sdx-StreamPlayer/components/sdx-StreamPlayer/sdx-StreamPlayer.vue
index b42e3f1..e0a4946 100644
--- a/测试流式传输uniapp/uni_modules/sdx-StreamPlayer/components/sdx-StreamPlayer/sdx-StreamPlayer.vue
+++ b/测试流式传输uniapp/uni_modules/sdx-StreamPlayer/components/sdx-StreamPlayer/sdx-StreamPlayer.vue
@@ -70,14 +70,6 @@
}