mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 01:10:23 +08:00
feat: 增强 Gemini 流式响应兼容性,支持 JSON-array 格式解析
- 添加 Gemini JSON-array/chunks 格式的解析支持(兼容非 SSE 返回) - 在上游请求中添加 alt=sse 参数,优先使用 SSE 格式 - 为 OpenAI 客户端统一补齐 [DONE] 流结束标记 - 更新 Gemini finishReason 判断逻辑,采用更宽松的结束判定
This commit is contained in:
@@ -91,6 +91,8 @@ async def test_create_response_stream_converts_claude_to_openai() -> None:
|
||||
events = []
|
||||
for line in text.splitlines():
|
||||
if line.startswith("data: "):
|
||||
if line == "data: [DONE]":
|
||||
continue
|
||||
events.append(json.loads(line[6:]))
|
||||
|
||||
assert len(events) >= 2
|
||||
@@ -100,4 +102,3 @@ async def test_create_response_stream_converts_claude_to_openai() -> None:
|
||||
for e in events
|
||||
if isinstance(e, dict)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user