mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-23 15:38:55 +01:00
Handle file retrieval when agent is None
This commit is contained in:
parent
e3ca52b7cb
commit
b6145df3be
1 changed files with 4 additions and 0 deletions
|
@ -1477,6 +1477,8 @@ class EntryAdapters:
|
|||
|
||||
@staticmethod
|
||||
async def aagent_has_entries(agent: Agent):
|
||||
if agent is None:
|
||||
return False
|
||||
return await Entry.objects.filter(agent=agent).aexists()
|
||||
|
||||
@staticmethod
|
||||
|
@ -1495,6 +1497,8 @@ class EntryAdapters:
|
|||
|
||||
@staticmethod
|
||||
async def aget_agent_entry_filepaths(agent: Agent):
|
||||
if agent is None:
|
||||
return []
|
||||
return await sync_to_async(set)(
|
||||
Entry.objects.filter(agent=agent).distinct("file_path").values_list("file_path", flat=True)
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue