feat: add session message monitoring tab to bot detail dialog (#2005)

* feat: add session message monitoring tab to bot detail dialog

Add a new "Sessions" tab in the bot detail dialog that displays
sent & received messages grouped by sessions. Users can select
any session to view its messages in a chat-bubble style layout.

Backend changes:
- Add sessionId filter to monitoring messages endpoint
- Add role column to MonitoringMessage (user/assistant)
- Record bot responses in monitoring via record_query_response()
- Add DB migration (dbm019) for the new role column

Frontend changes:
- New BotSessionMonitor component with session list + message viewer
- Add Sessions sidebar tab to BotDetailDialog
- Add getBotSessions/getSessionMessages API methods to BackendClient
- Add i18n translations (en-US, zh-Hans, zh-Hant, ja-JP)

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>

* refactor: remove outdated version comment from PipelineManager class

* fix: bump required_database_version to 19 to trigger monitoring_messages.role migration

* fix: prevent session message auto-scroll from pushing dialog content out of view

Replace scrollIntoView (which scrolls all ancestor containers) with
direct scrollTop manipulation on the ScrollArea viewport. This keeps
the scroll contained within the messages panel only.

* ui: redesign BotSessionMonitor with polished chat UI

- Wider session list (w-72) with avatar circles and cleaner layout
- Richer chat header with avatar, platform info, and active indicator
- User messages now use blue-500 (solid) instead of blue-100 for
  clear visual distinction
- Metadata (time, runner) shown on hover below bubbles, not inside
- Proper empty state illustrations for both panels
- Better spacing, rounded corners, and shadow treatment
- Consistent dark mode styling

* fix: infinite re-render loop in DynamicFormComponent

The useEffect depended on onSubmit which was a new closure every
parent render. Calling onSubmit inside the effect triggered parent
state update → re-render → new onSubmit ref → effect re-runs → loop.

Fix: use useRef to hold a stable reference to onSubmit, removing it
from the useEffect dependency array.

Also add DialogDescription to BotDetailDialog to suppress Radix
aria-describedby warning.

* fix: remove .html suffix from docs.langbot.app links (Mintlify migration)

* style: fix prettier and ruff formatting

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Happy <yesreply@happy.engineering>
This commit is contained in:
Junyan Chin
2026-02-25 21:56:24 +08:00
committed by GitHub
parent b8df0dbd7f
commit d9a630b8c1
17 changed files with 798 additions and 20 deletions
+19
View File
@@ -280,6 +280,25 @@ const enUS = {
viewDetails: 'Details',
collapse: 'Collapse',
imagesAttached: 'image(s) attached',
sessionMonitor: {
title: 'Sessions',
sessions: 'Sessions',
noSessions: 'No sessions found',
selectSession: 'Select a session to view messages',
noMessages: 'No messages in this session',
messages: 'messages',
messageCount: '{{count}} messages',
loading: 'Loading...',
loadingSessions: 'Loading sessions...',
loadingMessages: 'Loading messages...',
user: 'User',
variables: 'Variables',
platform: 'Platform',
lastActive: 'Last active',
refresh: 'Refresh',
active: 'Active',
inactive: 'Inactive',
},
},
plugins: {
title: 'Extensions',
+19
View File
@@ -281,6 +281,25 @@ const jaJP = {
allLevels: 'すべてのレベル',
selectLevel: 'レベルを選択',
levelsSelected: 'レベル選択済み',
sessionMonitor: {
title: 'セッション監視',
sessions: 'セッション一覧',
noSessions: 'セッションが見つかりません',
selectSession: 'セッションを選択してメッセージを表示',
noMessages: 'このセッションにはメッセージがありません',
messages: '件のメッセージ',
messageCount: '{{count}} 件のメッセージ',
loading: '読み込み中...',
loadingSessions: 'セッションを読み込み中...',
loadingMessages: 'メッセージを読み込み中...',
user: 'ユーザー',
variables: '変数',
platform: 'プラットフォーム',
lastActive: '最終アクティブ',
refresh: '更新',
active: 'アクティブ',
inactive: '非アクティブ',
},
},
plugins: {
title: '拡張機能',
+19
View File
@@ -269,6 +269,25 @@ const zhHans = {
viewDetails: '详情',
collapse: '收起',
imagesAttached: '张图片',
sessionMonitor: {
title: '会话监控',
sessions: '会话列表',
noSessions: '暂无会话',
selectSession: '选择一个会话查看消息',
noMessages: '该会话暂无消息',
messages: '条消息',
messageCount: '{{count}} 条消息',
loading: '加载中...',
loadingSessions: '加载会话中...',
loadingMessages: '加载消息中...',
user: '用户',
variables: '变量',
platform: '平台',
lastActive: '最近活跃',
refresh: '刷新',
active: '活跃',
inactive: '不活跃',
},
},
plugins: {
title: '插件扩展',
+19
View File
@@ -264,6 +264,25 @@ const zhHant = {
allLevels: '全部級別',
selectLevel: '選擇級別',
levelsSelected: '個級別已選',
sessionMonitor: {
title: '會話監控',
sessions: '會話列表',
noSessions: '暫無會話',
selectSession: '選擇一個會話查看訊息',
noMessages: '該會話暫無訊息',
messages: '條訊息',
messageCount: '{{count}} 條訊息',
loading: '載入中...',
loadingSessions: '載入會話中...',
loadingMessages: '載入訊息中...',
user: '用戶',
variables: '變數',
platform: '平台',
lastActive: '最近活躍',
refresh: '重新整理',
active: '活躍',
inactive: '不活躍',
},
},
plugins: {
title: '外掛擴展',