document query QA fix

linkliti committed Jan 10, 2026 at 13:17 UTC 376092c63c89d54b3c1e7df24f7e210d8969d772
2 files changed +6 -4
python/helpers/document_query.py
+5 -3
@@ -359,6 +359,7 @@ class DocumentQueryHelper:
359 self.agent = agent
360 self.store = DocumentQueryStore.get(agent)
361 self.progress_callback = progress_callback or (lambda x: None)
362 + self.store_lock = asyncio.Lock()
363
364 async def document_qa(
365 self, document_uris: List[str], questions: Sequence[str]
@@ -527,9 +528,10 @@ class DocumentQueryHelper:
528 if add_to_db:
529 self.progress_callback(f"Indexing document")
530 await self.agent.handle_intervention()
530 - success, ids = await self.store.add_document(
531 - document_content, document_uri_norm
532 - )
531 + async with self.store_lock:
532 + success, ids = await self.store.add_document(
533 + document_content, document_uri_norm
534 + )
535 if not success:
536 self.progress_callback(f"Failed to index document")
537 raise ValueError(
python/helpers/vector_db.py
+1 -1
@@ -141,7 +141,7 @@ def cosine_normalizer(val: float) -> float:
141 def get_comparator(condition: str):
142 def comparator(data: dict[str, Any]):
143 try:
144 - result = simple_eval(condition, {}, data)
144 + result = simple_eval(condition, names=data)
145 return result
146 except Exception as e:
147 # PrintStyle.error(f"Error evaluating condition: {e}")