Agent Zero AI framework
document query QA fix
linkliti376092c63c89
diff --git a/python/helpers/document_query.py b/python/helpers/document_query.pyindex 6ba38855c..ff5575ec0 100644--- a/python/helpers/document_query.py+++ b/python/helpers/document_query.py@@ -359,6 +359,7 @@ class DocumentQueryHelper:self.agent = agentself.store = DocumentQueryStore.get(agent)self.progress_callback = progress_callback or (lambda x: None)+ self.store_lock = asyncio.Lock()async def document_qa(self, document_uris: List[str], questions: Sequence[str]@@ -527,9 +528,10 @@ class DocumentQueryHelper:if add_to_db:self.progress_callback(f"Indexing document")await self.agent.handle_intervention()- success, ids = await self.store.add_document(- document_content, document_uri_norm- )+ async with self.store_lock:+ success, ids = await self.store.add_document(+ document_content, document_uri_norm+ )if not success:self.progress_callback(f"Failed to index document")raise ValueError(diff --git a/python/helpers/vector_db.py b/python/helpers/vector_db.pyindex 8a813caba..e2e7731a3 100644--- a/python/helpers/vector_db.py+++ b/python/helpers/vector_db.py@@ -141,7 +141,7 @@ def cosine_normalizer(val: float) -> float:def get_comparator(condition: str):def comparator(data: dict[str, Any]):try:- result = simple_eval(condition, {}, data)+ result = simple_eval(condition, names=data)return resultexcept Exception as e:# PrintStyle.error(f"Error evaluating condition: {e}")