Fix:validate knowledge base association before document upload (#5373)
### What problem does this PR solve? fix this bug: https://github.com/infiniflow/ragflow/issues/5368 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) Co-authored-by: wenju.li <wenju.li@deepctr.cn>
This commit is contained in:
parent
4f40f685d9
commit
a9e4695b74
@ -504,6 +504,9 @@ def doc_upload_and_parse(conversation_id, file_objs, user_id):
|
||||
assert e, "Conversation not found!"
|
||||
|
||||
e, dia = DialogService.get_by_id(conv.dialog_id)
|
||||
if not dia.kb_ids:
|
||||
raise LookupError("No knowledge base associated with this conversation. "
|
||||
"Please add a knowledge base before uploading documents")
|
||||
kb_id = dia.kb_ids[0]
|
||||
e, kb = KnowledgebaseService.get_by_id(kb_id)
|
||||
if not e:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user