Closed zolgear closed 4 weeks ago
To fix the issue with the records
field in the Dify-test.openapi.json
file, you need to modify the schema to ensure records
is an array. Here's how you can update it:
Change the records
field definition from an object to an array of objects:
"records": {
"type": "array",
"items": {
"type": "object",
"properties": {
"content": {
"type": "string",
"description": "Contains a chunk of text from a data source in the knowledge base."
},
"score": {
"type": "number",
"format": "float",
"description": "The score of relevance of the result to the query, scope: 0~1"
},
"title": {
"type": "string",
"description": "Document title"
},
"metadata": {
"type": "string",
"description": "Contains metadata attributes and their values for the document in the data source."
}
},
"required": ["content", "score", "title"]
},
"title": "A list of records from querying the knowledge base."
}
This change will ensure that the records
field is correctly formatted as an array, preventing the "500 Internal Server Error" [1].
To continue talking to Dosu, mention @dosu.
Thank you for making these changes.
https://docs.dify.ai/guides/knowledge-base/external-knowledge-api-documentation
en\guides\knowledge-base\external-knowledge-api-documentation.md
There is an issue with the JSON response generated by Swagger.
The
records
should be an array, but it is represented with{ }
. If implemented as is, it will result in a "500 Internal Server Error: 'str' object has no attribute 'get'" during the hit test in/app/api/controllers/console/datasets/external.py
.Fix:
Can you modify
en\.gitbook\assets\Dify-test.openapi.json
to fix it?