Files
starrrLight 7a46471d47 test(场景): 增加 DOCX 上传示例
在示例场景中加入 DOCX 附件上传用例,验证文件转发和上传响应。
2026-10-16 14:46:34 +08:00

152 lines
4.3 KiB
JSON

{
"scenarios": [
{
"id": "chat-stream",
"kind": "sse",
"path": "/chat/stream?trace=demo",
"headers": {
"content-type": "application/json",
"x-test": "sse"
},
"body": {
"message": "你好",
"messages": [{"role": "user", "content": "你好"}]
},
"response": {
"status": 200,
"headers": {"content-type": "text/event-stream"},
"events": [
{
"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", "text_delta", "text_delta", "text_delta", "run_completed"],
"upstream_path": "/chat/stream?trace=demo"
}
},
{
"id": "ordinary-post",
"kind": "post",
"path": "/api/echo",
"headers": {"content-type": "application/json"},
"body": {"message": "普通请求"},
"response": {
"status": 200,
"headers": {"content-type": "application/json"},
"body": {"ok": true}
},
"expect": {
"status": 200,
"body": {"ok": true},
"upstream_path": "/api/echo"
}
},
{
"id": "text-upload",
"kind": "file",
"path": "/upload?source=test",
"headers": {"x-test": "upload"},
"file": {
"field": "file",
"path": "fixtures/sample.txt",
"filename": "sample.txt",
"mime": "text/plain"
},
"response": {
"status": 200,
"headers": {"content-type": "application/json"},
"body": {"stored": true}
},
"expect": {
"status": 200,
"body": {"stored": true},
"upstream_path": "/upload?source=test",
"file_forwarded": true
}
},
{
"id": "docx-upload",
"kind": "file",
"path": "/upload?source=test",
"headers": {"x-test": "upload"},
"file": {
"field": "file",
"path": "fixtures/sample.docx",
"filename": "sample.docx",
"mime": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
},
"response": {
"status": 200,
"headers": {"content-type": "application/json"},
"body": {"stored": true}
},
"expect": {
"status": 200,
"body": {"stored": true},
"upstream_path": "/upload?source=test",
"file_forwarded": true
}
}
]
}