mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 09:20:22 +08:00
- Rust executor 新增流式 plan 支持,覆盖 openai/claude/gemini 的 chat/cli/video 格式 - Gateway 新增 finalize-sync、report-stream 端点及 stream report 模型 - 新增 video sync 操作(create/cancel/remix/delete)的 plan 构建 - 修正 OpenAI Responses(openai:cli) SSE 格式: 添加 event: 行、移除 [DONE] 哨兵 - 统一 OpenAI CLI normalizer 的 ID 生成方法
33 lines
981 B
Python
33 lines
981 B
Python
import json
|
|
|
|
from src.api.handlers.base.cli_sse_helpers import _format_converted_events_to_sse
|
|
|
|
|
|
def test_format_converted_events_to_sse_uses_event_lines_for_openai_cli() -> None:
|
|
events = [
|
|
{
|
|
"type": "response.output_text.delta",
|
|
"item_id": "msg_123",
|
|
"output_index": 0,
|
|
"content_index": 0,
|
|
"delta": "Hi",
|
|
"logprobs": [],
|
|
"sequence_number": 1,
|
|
}
|
|
]
|
|
|
|
lines = _format_converted_events_to_sse(events, "openai:cli")
|
|
|
|
assert lines == [
|
|
"event: response.output_text.delta\n"
|
|
f"data: {json.dumps(events[0], ensure_ascii=False)}\n"
|
|
]
|
|
|
|
|
|
def test_format_converted_events_to_sse_keeps_data_only_for_openai_chat() -> None:
|
|
events = [{"id": "chatcmpl-123", "object": "chat.completion.chunk", "choices": []}]
|
|
|
|
lines = _format_converted_events_to_sse(events, "openai:chat")
|
|
|
|
assert lines == [f"data: {json.dumps(events[0], ensure_ascii=False)}\n"]
|