From 03eb7203ec470f903fa063a7317268814e394b0b Mon Sep 17 00:00:00 2001 From: fawney19 Date: Wed, 24 Dec 2025 01:13:35 +0800 Subject: [PATCH] =?UTF-8?q?fix(api):=20=E5=90=8C=E6=AD=A5=20chat=5Fhandler?= =?UTF-8?q?=5Fbase=20=E4=BD=BF=E7=94=A8=20aiter=5Fbytes=20=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E8=87=AA=E5=8A=A8=E8=A7=A3=E5=8E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/handlers/base/chat_handler_base.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/api/handlers/base/chat_handler_base.py b/src/api/handlers/base/chat_handler_base.py index 1051d93..76225ef 100644 --- a/src/api/handlers/base/chat_handler_base.py +++ b/src/api/handlers/base/chat_handler_base.py @@ -484,9 +484,8 @@ class ChatHandlerBase(BaseMessageHandler, ABC): stream_response.raise_for_status() - # 使用字节流迭代器(避免 aiter_lines 的性能问题) - # aiter_raw() 返回原始数据块,无缓冲,实现真正的流式传输 - byte_iterator = stream_response.aiter_raw() + # 使用字节流迭代器(避免 aiter_lines 的性能问题, aiter_bytes 会自动解压 gzip/deflate) + byte_iterator = stream_response.aiter_bytes() # 预读检测嵌套错误 prefetched_chunks = await stream_processor.prefetch_and_check_error(