Skip to content

Commit d0795a8

Browse files
committed
chore(dashboard): extract SSE heartbeat to constant
1 parent 64a2e09 commit d0795a8

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

astrbot/dashboard/routes/chat.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626

2727
from .route import Response, Route, RouteContext
2828

29+
# SSE heartbeat message to keep the connection alive during long-running operations
30+
SSE_HEARTBEAT = ": heartbeat\n\n"
31+
2932

3033
@asynccontextmanager
3134
async def track_conversation(convs: dict, conv_id: str):
@@ -371,7 +374,7 @@ async def stream():
371374
# doesn't time out during slow backend ops like
372375
# context compression with reasoning models (#6938).
373376
if not client_disconnected:
374-
yield ": heartbeat\n\n"
377+
yield SSE_HEARTBEAT
375378
continue
376379

377380
if (

0 commit comments

Comments
 (0)