mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-15 20:27:20 +08:00
Fix: Correct the API path (#15204)
Follow on PR #15146 to reslove the backwad compatability issue. 1. /agents/<attachment_id>/download -> /agents/attachments/<attachment_id>/download ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@@ -37,8 +37,8 @@ Deprecated APIs and their replacements:
|
||||
- GET /api/v1/file/* -> GET /api/v1/files*
|
||||
- POST /api/v1/file/* -> POST /api/v1/files*
|
||||
- GET /api/v1/document/get/{doc_id} -> GET /api/v1/documents/{doc_id}/preview
|
||||
- GET /api/v1/document/download/{doc_id} -> GET /api/v1/documents/{doc_id}/download
|
||||
- GET /v1/document/download/{attachment_id} -> GET /api/v1/documents/{attachment_id}/download
|
||||
- GET /api/v1/document/download/{doc_id} -> GET /api/v1/agents/attachments/{doc_id}/download
|
||||
- GET /v1/document/download/{attachment_id} -> GET /api/v1/agents/attachments/{attachment_id}/download
|
||||
- GET /v1/system/healthz -> GET /api/v1/system/healthz
|
||||
- POST /api/v1/sessions/related_questions -> POST /api/v1/chat/recommandation
|
||||
- PUT (chunk update) -> PATCH (chunk update)
|
||||
@@ -606,17 +606,17 @@ async def deprecated_document_get(doc_id):
|
||||
@login_required
|
||||
async def deprecated_document_download(doc_id):
|
||||
"""
|
||||
Deprecated: Use GET /api/v1/documents/{doc_id}/download instead.
|
||||
Deprecated: Use GET /api/v1/agents/attachments/{attachment_id}/download instead.
|
||||
|
||||
Old path: GET /api/v1/document/download/{doc_id}
|
||||
New path: GET /api/v1/documents/{doc_id}/download
|
||||
New path: GET /api/v1/agents/attachments/{doc_id}/download
|
||||
"""
|
||||
logging.warning(
|
||||
"API endpoint /api/v1/document/download/%s is deprecated. "
|
||||
"Please use /api/v1/documents/%s/download instead.",
|
||||
"Please use /api/v1/agents/attachments/%s/download instead.",
|
||||
doc_id, doc_id,
|
||||
)
|
||||
return await document_api.download_attachment(doc_id=doc_id)
|
||||
return await agent_api.download_attachment(attachment_id=doc_id)
|
||||
|
||||
|
||||
@legacy_v1_manager.route("/document/download/<attachment_id>", methods=["GET"])
|
||||
@@ -626,14 +626,14 @@ async def document_download_v1(attachment_id):
|
||||
Compatibility alias for document download under /v1.
|
||||
|
||||
Old path: GET /v1/document/download/{attachment_id}
|
||||
New path: GET /api/v1/documents/{attachment_id}/download
|
||||
New path: GET /api/v1/agents/attachments/{attachment_id}/download
|
||||
"""
|
||||
logging.warning(
|
||||
"API endpoint /v1/document/download/%s is deprecated. "
|
||||
"Please use /api/v1/documents/%s/download instead.",
|
||||
"Please use /api/v1/agents/attachments/%s/download instead.",
|
||||
attachment_id, attachment_id,
|
||||
)
|
||||
return await document_api.download_attachment(attachment_id=attachment_id)
|
||||
return await agent_api.download_attachment(attachment_id=attachment_id)
|
||||
|
||||
# =============================================================================
|
||||
# Agent Chat API
|
||||
|
||||
@@ -2269,7 +2269,7 @@ async def webhook_trace(agent_id: str):
|
||||
}
|
||||
)
|
||||
|
||||
@manager.route("/agents/<attachment_id>/download", methods=["GET"]) # noqa: F821
|
||||
@manager.route("/agents/attachments/<attachment_id>/download", methods=["GET"]) # noqa: F821
|
||||
@login_required
|
||||
@add_tenant_id_to_kwargs
|
||||
async def download_attachment(tenant_id=None, attachment_id=None):
|
||||
|
||||
Reference in New Issue
Block a user