Files
Nexus/docs/changelog/2026-06-13-offline-alert-telegram-split.md
T
Nexus Agent 821cf12ade fix(terminal,alerts): quick-cmd enter on send and offline Telegram channel
Append CR when executing quick commands (fixes trim stripping saved \r) and
allow optional dedicated Telegram bot for server offline alerts only.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-13 01:45:55 +08:00

1.4 KiB
Raw Blame History

2026-06-13 子机离线告警独立 Telegram 通道

摘要

设置页「告警通知项目」下新增可选的离线专用 Bot:子机离线告警可发往另一 Telegram 机器人/群组,其它告警仍走默认 Bot。

动机

离线告警量大或受众不同,需与 CPU/内存等资源告警分流,避免主告警群被淹没。

变更

  • 新 settingstelegram_offline_bot_tokentelegram_offline_chat_id(二者均配置时离线告警专用;否则回退默认 Bot)。
  • resolve_offline_telegram_credentials() + send_telegram_offline_alert 路由。
  • APIPOST /settings/telegram/offline/testGET /settings/telegram/offline/chatsPOST /settings/telegram/offline/reveal-token
  • 设置页:「子机离线告警专用 Bot(可选)」配置区。

涉及文件

  • server/config.py
  • server/infrastructure/telegram/__init__.py
  • server/api/settings.py
  • frontend/src/pages/SettingsPage.vue
  • frontend/src/types/api.ts
  • tests/test_telegram_offline_channel.py

迁移 / 重启

  • 后端:拉取后 supervisorctl restart nexus(新 API 端点)。
  • 前端:重新 vite build 部署 web/app/
  • 无 DB 迁移;首次保存写入 settings 表。

验证

  1. 设置页配置离线专用 Token + Chat ID →「测试离线通道」收到消息。
  2. 仅配置默认 Bot、不填离线专用 → 子机离线仍走默认群。
  3. pytest tests/test_telegram_offline_channel.py 通过。