mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-04-29 12:10:57 +00:00
document query QA fix
This commit is contained in:
parent
3d79fae266
commit
376092c63c
2 changed files with 6 additions and 4 deletions
|
|
@ -359,6 +359,7 @@ class DocumentQueryHelper:
|
|||
self.agent = agent
|
||||
self.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(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue