mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-02-01 08:05:07 +08:00
### What problem does this PR solve? Fix: Fixed the issue where swagger apidocs could not be opened properly(#9522) ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) Co-authored-by: virgilwong <hyhvirgil@gmail.com>
This commit is contained in:
@ -31,6 +31,89 @@ from api.db.services.dialog_service import meta_filter, convert_conditions
|
|||||||
@apikey_required
|
@apikey_required
|
||||||
@validate_request("knowledge_id", "query")
|
@validate_request("knowledge_id", "query")
|
||||||
def retrieval(tenant_id):
|
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
|
req = request.json
|
||||||
question = req["query"]
|
question = req["query"]
|
||||||
kb_id = req["knowledge_id"]
|
kb_id = req["knowledge_id"]
|
||||||
|
|||||||
@ -458,7 +458,7 @@ def list_docs(dataset_id, tenant_id):
|
|||||||
required: false
|
required: false
|
||||||
default: true
|
default: true
|
||||||
description: Order in descending.
|
description: Order in descending.
|
||||||
- in: query
|
- in: query
|
||||||
name: create_time_from
|
name: create_time_from
|
||||||
type: integer
|
type: integer
|
||||||
required: false
|
required: false
|
||||||
|
|||||||
@ -62,22 +62,22 @@ def upload(tenant_id):
|
|||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
data:
|
data:
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
id:
|
id:
|
||||||
type: string
|
type: string
|
||||||
description: File ID
|
description: File ID
|
||||||
name:
|
name:
|
||||||
type: string
|
type: string
|
||||||
description: File name
|
description: File name
|
||||||
size:
|
size:
|
||||||
type: integer
|
type: integer
|
||||||
description: File size in bytes
|
description: File size in bytes
|
||||||
type:
|
type:
|
||||||
type: string
|
type: string
|
||||||
description: File type (e.g., document, folder)
|
description: File type (e.g., document, folder)
|
||||||
"""
|
"""
|
||||||
pf_id = request.form.get("parent_id")
|
pf_id = request.form.get("parent_id")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user