Skip to content

Commit a89888e

Browse files
committed
优化流式抗截断
1 parent d0c1bff commit a89888e

3 files changed

Lines changed: 3 additions & 5 deletions

File tree

src/router/geminicli/anthropic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ async def stream_request_wrapper(payload):
258258
stream_request_wrapper,
259259
anti_truncation_payload,
260260
max_attempts,
261-
enable_prefill_mode=("claude" not in str(api_request.get("model", "")).lower()),
261+
enable_prefill_mode=True,
262262
)
263263

264264
# 包装以确保是bytes流

src/router/geminicli/gemini.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
if str(project_root) not in sys.path:
1212
sys.path.insert(0, str(project_root))
1313

14-
# 标准库
15-
import asyncio
1614
import json
1715

1816
# 第三方库
@@ -263,7 +261,7 @@ async def stream_request_wrapper(payload):
263261
stream_request_wrapper,
264262
anti_truncation_payload,
265263
max_attempts,
266-
enable_prefill_mode=("claude" not in str(api_request.get("model", "")).lower()),
264+
enable_prefill_mode=True,
267265
)
268266

269267
# 迭代 process_stream() 生成器,并展开 response 包装

src/router/geminicli/openai.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ async def stream_request_wrapper(payload):
259259
stream_request_wrapper,
260260
anti_truncation_payload,
261261
max_attempts,
262-
enable_prefill_mode=("claude" not in str(api_request.get("model", "")).lower()),
262+
enable_prefill_mode=True,
263263
)
264264

265265
# 转换为 OpenAI 格式

0 commit comments

Comments
 (0)