Skip to content

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

Fix: Fixed the issue where swagger apidocs could not be opened properly(#9522) (#10461)

YngvarHuang2cdba3d1e6c0
diff --git a/api/apps/sdk/dify_retrieval.py b/api/apps/sdk/dify_retrieval.py
index dc5476f343..cbfb6e7481 100644
--- a/api/apps/sdk/dify_retrieval.py
+++ b/api/apps/sdk/dify_retrieval.py
@@ -31,6 +31,89 @@ from api.db.services.dialog_service import meta_filter, convert_conditions
@apikey_required
@validate_request("knowledge_id", "query")
def retrieval(tenant_id):
+ """
+ Dify-compatible retrieval API
+ ---
+ tags:
+ - SDK
+ security:
+ - ApiKeyAuth: []
+ parameters:
+ - in: body
+ name: body
+ required: true
+ schema:
+ type: object
+ required:
+ - knowledge_id
+ - query
+ properties:
+ knowledge_id:
+ type: string
+ description: Knowledge base ID
+ query:
+ type: string
+ description: Query text
+ use_kg:
+ type: boolean
+ description: Whether to use knowledge graph
+ default: false
+ retrieval_setting:
+ type: object
+ description: Retrieval configuration
+ properties:
+ score_threshold:
+ type: number
+ description: Similarity threshold
+ default: 0.0
+ top_k:
+ type: integer
+ description: Number of results to return
+ default: 1024
+ metadata_condition:
+ type: object
+ description: Metadata filter condition
+ properties:
+ conditions:
+ type: array
+ items:
+ type: object
+ properties:
+ name:
+ type: string
+ description: Field name
+ comparison_operator:
+ type: string
+ description: Comparison operator
+ value:
+ type: string
+ description: Field value
+ responses:
+ 200:
+ description: Retrieval succeeded
+ schema:
+ type: object
+ properties:
+ records:
+ type: array
+ items:
+ type: object
+ properties:
+ content:
+ type: string
+ description: Content text
+ score:
+ type: number
+ description: Similarity score
+ title:
+ type: string
+ description: Document title
+ metadata:
+ type: object
+ description: Metadata info
+ 404:
+ description: Knowledge base or document not found
+ """
req = request.json
question = req["query"]
kb_id = req["knowledge_id"]
diff --git a/api/apps/sdk/doc.py b/api/apps/sdk/doc.py
index 2cc2926df4..0c6405c145 100644
--- a/api/apps/sdk/doc.py
+++ b/api/apps/sdk/doc.py
@@ -458,7 +458,7 @@ def list_docs(dataset_id, tenant_id):
required: false
default: true
description: Order in descending.
- - in: query
+ - in: query
name: create_time_from
type: integer
required: false
diff --git a/api/apps/sdk/files.py b/api/apps/sdk/files.py
index 17af87dc00..d2a3de21f2 100644
--- a/api/apps/sdk/files.py
+++ b/api/apps/sdk/files.py
@@ -62,22 +62,22 @@ def upload(tenant_id):
type: object
properties:
data:
- type: array
- items:
- type: object
- properties:
- id:
- type: string
- description: File ID
- name:
- type: string
- description: File name
- size:
- type: integer
- description: File size in bytes
- type:
- type: string
- description: File type (e.g., document, folder)
+ type: array
+ items:
+ type: object
+ properties:
+ id:
+ type: string
+ description: File ID
+ name:
+ type: string
+ description: File name
+ size:
+ type: integer
+ description: File size in bytes
+ type:
+ type: string
+ description: File type (e.g., document, folder)
"""
pf_id = request.form.get("parent_id")