This commit is contained in:
Timothy Jaeryang Baek committed 2026-07-11 23:47:58 -05:00
1 parent eb2570b405
commit 9d9f5786cb
8 files changed
+143 -18

No files matched your search

+13 -3
View File
@@ -381,17 +381,23 @@ def start_task(
)
_tasks[message_id] = task
_task_chat[message_id] = chat_id
asyncio.create_task(
emit_to_user(
async def emit_active():
unread_counts = await Chat.unread_counts_by_workspace(
user_id, [workspace], get_active_chat_ids()
)
await emit_to_user(
user_id,
{
"type": "chat:active",
"chat_id": chat_id,
"workspace": workspace,
"active": True,
"workspace_unread_count": unread_counts.get(workspace, 0),
},
)
)
asyncio.create_task(emit_active())
async def cancel_task(message_id: str) -> bool:
@@ -2640,6 +2646,9 @@ async def run_chat_task(
try:
await Chat.touch(chat_id, now_ms())
chat = await Chat.get_by_id(chat_id)
unread_counts = await Chat.unread_counts_by_workspace(
user_id, [workspace], get_active_chat_ids()
)
await emit_to_user(
user_id,
{
@@ -2648,6 +2657,7 @@ async def run_chat_task(
"workspace": workspace,
"active": False,
"updated_at": chat.updated_at if chat else None,
"workspace_unread_count": unread_counts.get(workspace, 0),
},
)
except Exception: