Fix: empty doc id validation. (#6064)

### What problem does this PR solve?

#6031

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Kevin Hu 2025-03-14 11:45:44 +08:00 committed by GitHub
parent c00def5b71
commit 7463241896
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View File

@ -363,6 +363,10 @@ def download(tenant_id, dataset_id, document_id):
schema:
type: object
"""
if not document_id:
return get_error_data_result(
message="Specify document_id please."
)
if not KnowledgebaseService.query(id=dataset_id, tenant_id=tenant_id):
return get_error_data_result(message=f"You do not own the dataset {dataset_id}.")
doc = DocumentService.query(kb_id=dataset_id, id=document_id)

View File

@ -105,9 +105,10 @@ def init_llm_factory():
factory_llm_infos = settings.FACTORY_LLM_INFOS
for factory_llm_info in factory_llm_infos:
llm_infos = factory_llm_info.pop("llm")
info = deepcopy(factory_llm_info)
llm_infos = info.pop("llm")
try:
LLMFactoriesService.save(**factory_llm_info)
LLMFactoriesService.save(**info)
except Exception:
pass
LLMService.filter_delete([LLM.fid == factory_llm_info["name"]])