mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-08-08 13:28:43 +03:00
fix: clear heartbeat session to prevent token overflow
This commit is contained in:
@@ -621,6 +621,12 @@ def gateway(
|
|||||||
chat_id=chat_id,
|
chat_id=chat_id,
|
||||||
on_progress=_silent,
|
on_progress=_silent,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Clear the heartbeat session to prevent token overflow from accumulated tasks
|
||||||
|
session = agent.sessions.get_or_create("heartbeat")
|
||||||
|
session.clear()
|
||||||
|
agent.sessions.save(session)
|
||||||
|
|
||||||
return resp.content if resp else ""
|
return resp.content if resp else ""
|
||||||
|
|
||||||
async def on_heartbeat_notify(response: str) -> None:
|
async def on_heartbeat_notify(response: str) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user