backend fixes

This commit is contained in:
debu-2 2026-10-06 01:57:15 +05:30
parent 36a55930f9
commit aabb63f947
4 changed files with 11 additions and 6 deletions

View file

@ -255,7 +255,8 @@ async def get_handoff_conversation(
}, },
{"$unwind": "$message"}, {"$unwind": "$message"},
] ]
rows = [row async for row in database.mailbox_entries.aggregate(pipeline)] cursor = await database.mailbox_entries.aggregate(pipeline)
rows = [row async for row in cursor]
human_email = handoff.get("human_email", "").lower() human_email = handoff.get("human_email", "").lower()
messages: list[HandoffMessageRead] = [] messages: list[HandoffMessageRead] = []
for row in rows: for row in rows:

View file

@ -214,7 +214,8 @@ async def list_threads(
} }
} }
) )
rows = [row async for row in database.mailbox_entries.aggregate(pipeline)] cursor = await database.mailbox_entries.aggregate(pipeline)
rows = [row async for row in cursor]
has_more = len(rows) > limit has_more = len(rows) > limit
rows = rows[:limit] rows = rows[:limit]
items = [thread_summary_from_group(row, mailbox) for row in rows] items = [thread_summary_from_group(row, mailbox) for row in rows]
@ -298,7 +299,8 @@ async def get_thread(
}, },
{"$unwind": "$message"}, {"$unwind": "$message"},
] ]
rows = [row async for row in database.mailbox_entries.aggregate(pipeline)] cursor = await database.mailbox_entries.aggregate(pipeline)
rows = [row async for row in cursor]
if not rows: if not rows:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Thread not found.") raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Thread not found.")

View file

@ -136,7 +136,8 @@ async def _latest_external_message(database, account_id: str, external_thread_id
}, },
{"$unwind": "$message"}, {"$unwind": "$message"},
] ]
rows = [row async for row in database.mailbox_entries.aggregate(pipeline)] cursor = await database.mailbox_entries.aggregate(pipeline)
rows = [row async for row in cursor]
return rows[0]["message"] if rows else None return rows[0]["message"] if rows else None
@ -161,7 +162,8 @@ async def _latest_handoff_message(database, account_id: str, handoff_thread_id:
}, },
{"$unwind": "$message"}, {"$unwind": "$message"},
] ]
rows = [row async for row in database.mailbox_entries.aggregate(pipeline)] cursor = await database.mailbox_entries.aggregate(pipeline)
rows = [row async for row in cursor]
return rows[0]["message"] if rows else None return rows[0]["message"] if rows else None

View file

@ -62,10 +62,10 @@ const labels = [
]; ];
const agentItems = [ const agentItems = [
[HandHelping, "Human Handoff", "handoff"],
[Sparkles, "Ask Agent", "ask"], [Sparkles, "Ask Agent", "ask"],
[ListChecks, "Action Items", "actions"], [ListChecks, "Action Items", "actions"],
[Sparkles, "Summaries", "summaries"], [Sparkles, "Summaries", "summaries"],
[HandHelping, "Human Handoff", "handoff"],
[Plug, "Integrations", "integrations"], [Plug, "Integrations", "integrations"],
]; ];