From 17e31835981f2df93d2106e272e654708ccfe157 Mon Sep 17 00:00:00 2001 From: chengyongru <2755839590@qq.com> Date: Sun, 14 Jun 2026 00:32:53 +0800 Subject: [PATCH] fix(webui): simplify automation source display --- nanobot/webui/session_automations.py | 2 +- tests/channels/test_websocket_http_routes.py | 16 ++++- .../src/components/settings/SettingsView.tsx | 63 ++++++++++++------- webui/src/i18n/locales/en/common.json | 19 +++++- webui/src/i18n/locales/es/common.json | 19 +++++- webui/src/i18n/locales/fr/common.json | 19 +++++- webui/src/i18n/locales/id/common.json | 19 +++++- webui/src/i18n/locales/ja/common.json | 19 +++++- webui/src/i18n/locales/ko/common.json | 19 +++++- webui/src/i18n/locales/vi/common.json | 19 +++++- webui/src/i18n/locales/zh-CN/common.json | 19 +++++- webui/src/i18n/locales/zh-TW/common.json | 19 +++++- webui/src/tests/app-layout.test.tsx | 39 ++++++++++-- 13 files changed, 255 insertions(+), 36 deletions(-) diff --git a/nanobot/webui/session_automations.py b/nanobot/webui/session_automations.py index 19340856..a63cf4da 100644 --- a/nanobot/webui/session_automations.py +++ b/nanobot/webui/session_automations.py @@ -160,7 +160,7 @@ def _origin_payload( title = "" preview = "" - if session_manager is not None: + if channel == "websocket" and session_manager is not None: data = session_manager.read_session_file(session_key) if isinstance(data, dict): title = str(data.get("title") or "") diff --git a/tests/channels/test_websocket_http_routes.py b/tests/channels/test_websocket_http_routes.py index 4ee76da9..8cbbe80c 100644 --- a/tests/channels/test_websocket_http_routes.py +++ b/tests/channels/test_websocket_http_routes.py @@ -832,6 +832,14 @@ async def test_webui_automations_route_lists_all_jobs_and_allows_user_actions( message="Practice English", session_key="unified:default", ) + external_job = cron.add_job( + name="WeChat quiz", + schedule=CronSchedule(kind="every", every_ms=3_600_000), + message="Send a quiz", + session_key="weixin:wx-chat", + origin_channel="weixin", + origin_chat_id="wx-chat", + ) cron.register_system_job( CronJob( id="heartbeat", @@ -840,9 +848,13 @@ async def test_webui_automations_route_lists_all_jobs_and_allows_user_actions( payload=CronPayload(kind="system_event"), ) ) + session_manager = _seed_session(tmp_path, key="websocket:abc") + external_session = Session(key="weixin:wx-chat") + external_session.add_message("user", "Scheduled cron job triggered") + session_manager.save(external_session) channel = _ch( bus, - session_manager=_seed_session(tmp_path, key="websocket:abc"), + session_manager=session_manager, cron_service=cron, cron_pending_job_ids=lambda key: {user_job.id} if key == "websocket:abc" else set(), port=29932, @@ -870,6 +882,8 @@ async def test_webui_automations_route_lists_all_jobs_and_allows_user_actions( assert by_id[user_job.id]["origin"]["preview"] == "hi" assert by_id[legacy_job.id]["payload"]["session_key"] == "unified:default" assert by_id[legacy_job.id]["origin"] is None + assert by_id[external_job.id]["origin"]["session_key"] == "weixin:wx-chat" + assert by_id[external_job.id]["origin"]["preview"] == "" assert by_id["heartbeat"]["protected"] is True disabled = await _http_get( diff --git a/webui/src/components/settings/SettingsView.tsx b/webui/src/components/settings/SettingsView.tsx index c9b3ef9d..39e80249 100644 --- a/webui/src/components/settings/SettingsView.tsx +++ b/webui/src/components/settings/SettingsView.tsx @@ -13,7 +13,6 @@ import { ArrowUpCircle, Bot, Brain, - CalendarClock, Check, CircleAlert, ChevronDown, @@ -3390,23 +3389,14 @@ function AutomationsSettings({ return (
-
-
-
- - {tx("settings.automations.kicker", "Workspace automations")} -
-

- {tx("settings.automations.title", "Automations")} -

-

- {tx( - "settings.automations.description", - "Review cron reminders, recurring agent turns, one-time jobs, and protected system automations in one place.", - )} -

-
-
+
+

+ {tx( + "settings.automations.description", + "Review cron reminders, recurring agent turns, one-time jobs, and protected system jobs.", + )} +

+