Skip to content

Commit

Permalink
fix: DocumentAddByFileApi miss data_source_type field but there is a …
Browse files Browse the repository at this point in the history
…mandatory value check (#12273)
  • Loading branch information
lyfuci authored Jan 2, 2025
1 parent 5b01eb9 commit f71af7c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions api/controllers/service_api/dataset/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,10 @@ def post(self, tenant_id, dataset_id):
user=current_user,
source="datasets",
)
data_source = {"type": "upload_file", "info_list": {"file_info_list": {"file_ids": [upload_file.id]}}}
data_source = {
"type": "upload_file",
"info_list": {"data_source_type": "upload_file", "file_info_list": {"file_ids": [upload_file.id]}},
}
args["data_source"] = data_source
# validate args
knowledge_config = KnowledgeConfig(**args)
Expand Down Expand Up @@ -254,7 +257,10 @@ def post(self, tenant_id, dataset_id, document_id):
raise FileTooLargeError(file_too_large_error.description)
except services.errors.file.UnsupportedFileTypeError:
raise UnsupportedFileTypeError()
data_source = {"type": "upload_file", "info_list": {"file_info_list": {"file_ids": [upload_file.id]}}}
data_source = {
"type": "upload_file",
"info_list": {"data_source_type": "upload_file", "file_info_list": {"file_ids": [upload_file.id]}},
}
args["data_source"] = data_source
# validate args
args["original_document_id"] = str(document_id)
Expand Down

0 comments on commit f71af7c

Please sign in to comment.