feat: add document file download API and related features
1. add `/api/v1/documents/{doc_id}/file` endpoint for downloading original document files
2. add file field to document detail API response based on metadata
3. add comprehensive tests for file download API and metadata integration
4. update API documentation in CLAUDE.md
This commit is contained in:
@@ -204,11 +204,13 @@ class TestAdminClosedLoop:
|
||||
assert item_b["category"] == DOC_B_CATEGORY
|
||||
assert item_b["tags"] == []
|
||||
|
||||
# 2. 详情:l1/l2_nodes/l3_nodes/chunks_count 与写入一致
|
||||
# 2. 详情:l1/l2_nodes/l3_nodes/chunks_count/file 与写入一致
|
||||
resp = client.get(f"/api/v1/documents/{DOC_A}")
|
||||
assert resp.status_code == 200
|
||||
data = resp.json()["data"]
|
||||
assert set(data.keys()) == {"l1", "l2_nodes", "l3_nodes", "chunks_count"}
|
||||
assert set(data.keys()) == {"l1", "l2_nodes", "l3_nodes", "chunks_count", "file"}
|
||||
# 文本入库无 metadata → file=None
|
||||
assert data["file"] is None
|
||||
l1 = data["l1"]
|
||||
assert l1["doc_id"] == DOC_A
|
||||
assert l1["title"] == DOC_A_TITLE
|
||||
|
||||
Reference in New Issue
Block a user