Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Add API to get doc info by doc ids (#1986)

wwwlll5a4e64e741a0
diff --git a/api/apps/api_app.py b/api/apps/api_app.py
index 47ca514d9f..a5243aea1c 100644
--- a/api/apps/api_app.py
+++ b/api/apps/api_app.py
@@ -571,6 +571,19 @@ def list_kb_docs():
except Exception as e:
return server_error_response(e)
[email protected]('/document/infos', methods=['POST'])
+@validate_request("doc_ids")
+def docinfos():
+ token = request.headers.get('Authorization').split()[1]
+ objs = APIToken.query(token=token)
+ if not objs:
+ return get_json_result(
+ data=False, retmsg='Token is not valid!"', retcode=RetCode.AUTHENTICATION_ERROR)
+ req = request.json
+ doc_ids = req["doc_ids"]
+ docs = DocumentService.get_by_ids(doc_ids)
+ return get_json_result(data=list(docs.dicts()))
+
@manager.route('/document', methods=['DELETE'])
# @login_required