fix(db): fix database connection handling

This commit is contained in:
mengyonghao
2025-12-24 12:23:16 +08:00
parent 0a8c1be084
commit 1253bedcde

View File

@@ -20,7 +20,7 @@ class KnowledgeRetrievalNode(BaseNode):
async def execute(self, state: WorkflowState) -> Any:
query = self._render_template(self.typed_config.query, state)
with get_db_context():
with get_db_context() as db:
filters = [
knowledge_model.Knowledge.id.in_(self.typed_config.kb_ids),
knowledge_model.Knowledge.permission_id == knowledge_model.PermissionType.Private,