mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-08 05:39:13 +00:00
Handle file retrieval when agent is None
This commit is contained in:
@@ -1477,6 +1477,8 @@ class EntryAdapters:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
async def aagent_has_entries(agent: Agent):
|
async def aagent_has_entries(agent: Agent):
|
||||||
|
if agent is None:
|
||||||
|
return False
|
||||||
return await Entry.objects.filter(agent=agent).aexists()
|
return await Entry.objects.filter(agent=agent).aexists()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -1495,6 +1497,8 @@ class EntryAdapters:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
async def aget_agent_entry_filepaths(agent: Agent):
|
async def aget_agent_entry_filepaths(agent: Agent):
|
||||||
|
if agent is None:
|
||||||
|
return []
|
||||||
return await sync_to_async(set)(
|
return await sync_to_async(set)(
|
||||||
Entry.objects.filter(agent=agent).distinct("file_path").values_list("file_path", flat=True)
|
Entry.objects.filter(agent=agent).distinct("file_path").values_list("file_path", flat=True)
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user