Fix: enable ollama api-key. (#6205)

### What problem does this PR solve?

#6189

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Kevin Hu
2025-03-18 13:37:34 +08:00
committed by GitHub
parent 1333d3c02a
commit e9a6675c40
3 changed files with 13 additions and 8 deletions

View File

@ -596,11 +596,12 @@ def delete(tenant_id, dataset_id):
pf_id = root_folder["id"]
FileService.init_knowledgebase_docs(pf_id, tenant_id)
errors = ""
not_found = []
for doc_id in doc_list:
try:
e, doc = DocumentService.get_by_id(doc_id)
if not e:
errors += f"Document({doc_id}) not found!"
not_found.append(doc_id)
continue
tenant_id = DocumentService.get_tenant_id(doc_id)
if not tenant_id:
@ -626,6 +627,9 @@ def delete(tenant_id, dataset_id):
except Exception as e:
errors += str(e)
if not_found:
return get_result(message=f"Documents not found: {not_found}", code=settings.RetCode.DATA_ERROR)
if errors:
return get_result(message=errors, code=settings.RetCode.SERVER_ERROR)