From 9f43097361c33eb1ca8c60a2268d657fa0dbbe86 Mon Sep 17 00:00:00 2001 From: WangCham <651122857@qq.com> Date: Sat, 12 Jul 2025 01:21:02 +0800 Subject: [PATCH] fix: ensure File.status is set correctly after storing data to avoid null values --- pkg/rag/knowledge/mgr.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/rag/knowledge/mgr.py b/pkg/rag/knowledge/mgr.py index 09023d03..a5d5f513 100644 --- a/pkg/rag/knowledge/mgr.py +++ b/pkg/rag/knowledge/mgr.py @@ -318,12 +318,12 @@ class RAGManager: self.ap.logger.error(f'Knowledge Base with UUID {knowledge_base_uuid} not found.') return - if not self.ap.storage_mgr.storage_provider.exists(file_id): + if not await self.ap.storage_mgr.storage_provider.exists(file_id): self.ap.logger.error(f'File with ID {file_id} does not exist.') return self.ap.logger.info(f'File with ID {file_id} exists, proceeding with association.') # add new file record - file_to_update = File(id=file_id, kb_id=kb.id) + file_to_update = File(id=file_id, kb_id=kb.id, file_name=file_id, path=os.path.join('data', 'storage', file_id), file_type=os.path.splitext(file_id)[1].lstrip('.'), status=0) session.add(file_to_update) session.commit() self.ap.logger.info(