test(场景): 按真实 AI 返回更新 SSE 示例

为 SSE 示例补充请求标识、连续序号和时间戳,使用多段简短文本模拟流式返回,并同步事件顺序断言。开始事件携带 conversation_id,完成事件携带成功状态。
This commit is contained in:
starrrLight committed 2026-10-16 14:12:17 +08:00
1 parent 7652641333
commit 48f7dfc59f
1 file changed
+61 -4
+61 -4
View File
@@ -16,14 +16,71 @@
"status": 200,
"headers": {"content-type": "text/event-stream"},
"events": [
{"event": "run_started", "id": "1", "data": {"data": {"status": "started"}}},
{"event": "text_delta", "id": "2", "data": {"data": {"content": "安全内容"}}},
{"event": "run_completed", "id": "3", "data": {"data": {"status": "success"}}}
{
"event": "run_started",
"id": "1",
"data": {
"request_id": "a1b2c3d4-1234-4567-89ab-1234567890ab",
"sequence": 1,
"timestamp": "2026-10-16T06:00:00.000000+00:00",
"data": {"conversation_id": null}
}
},
{
"event": "text_delta",
"id": "2",
"data": {
"request_id": "a1b2c3d4-1234-4567-89ab-1234567890ab",
"sequence": 2,
"timestamp": "2026-10-16T06:00:00.100000+00:00",
"data": {"content": "你好,"}
}
},
{
"event": "text_delta",
"id": "3",
"data": {
"request_id": "a1b2c3d4-1234-4567-89ab-1234567890ab",
"sequence": 3,
"timestamp": "2026-10-16T06:00:00.120000+00:00",
"data": {"content": "我可以帮助你"}
}
},
{
"event": "text_delta",
"id": "4",
"data": {
"request_id": "a1b2c3d4-1234-4567-89ab-1234567890ab",
"sequence": 4,
"timestamp": "2026-10-16T06:00:00.140000+00:00",
"data": {"content": "了解工具的用途。\n\n"}
}
},
{
"event": "text_delta",
"id": "5",
"data": {
"request_id": "a1b2c3d4-1234-4567-89ab-1234567890ab",
"sequence": 5,
"timestamp": "2026-10-16T06:00:00.160000+00:00",
"data": {"content": "请告诉我你想了解的内容。"}
}
},
{
"event": "run_completed",
"id": "6",
"data": {
"request_id": "a1b2c3d4-1234-4567-89ab-1234567890ab",
"sequence": 6,
"timestamp": "2026-10-16T06:00:00.180000+00:00",
"data": {"status": "success"}
}
}
]
},
"expect": {
"status": 200,
"events": ["run_started", "text_delta", "run_completed"],
"events": ["run_started", "text_delta", "text_delta", "text_delta", "text_delta", "run_completed"],
"upstream_path": "/chat/stream?trace=demo"
}
},