feat: 优化WebSocket连接和心跳机制

- 在main.py和standalone.py中添加ws_ping_interval和ws_ping_timeout配置
- 调整ws.py中的心跳发送逻辑,先发送ping再等待
- 在host_client中优化消息处理,使用任务队列处理转发请求
- 更新WebTool以适配新的API格式并增加搜索结果限制
- 在agent.py中添加日期显示和web调用次数限制
- 修复bot/handler.py中的事件循环问题
This commit is contained in:
Yuyao Huang (Sam)
2026-03-28 15:53:44 +08:00
parent a3622ce26d
commit 80e4953cf9
7 changed files with 92 additions and 31 deletions
+1 -1
View File
@@ -53,11 +53,11 @@ async def ws_node_endpoint(websocket: WebSocket) -> None:
"""Send periodic pings to the host client."""
try:
while True:
await asyncio.sleep(30)
try:
await websocket.send_text(encode(Heartbeat(type="ping")))
except Exception:
break
await asyncio.sleep(30)
except asyncio.CancelledError:
pass