From a7badf6258d88e1e029bbe52bd6739bf7e531f5f Mon Sep 17 00:00:00 2001 From: RockChinQ Date: Wed, 26 Aug 2026 23:07:02 +0800 Subject: [PATCH] fix(bots): move adapter debugger to configuration --- .../e2e/bot-event-routing-product-flow.mjs | 7 ++++- .../cases/bot-event-routing-product-flow.yaml | 4 +-- .../home/bots/components/bot-form/BotForm.tsx | 27 +++++++++++++++---- .../bot-form/EventBindingsEditor.tsx | 4 --- web/src/i18n/locales/en-US.ts | 3 +++ web/src/i18n/locales/ja-JP.ts | 3 +++ web/src/i18n/locales/zh-Hans.ts | 3 +++ web/tests/e2e/crud-smoke.spec.ts | 11 +++++++- 8 files changed, 49 insertions(+), 13 deletions(-) diff --git a/skills/scripts/e2e/bot-event-routing-product-flow.mjs b/skills/scripts/e2e/bot-event-routing-product-flow.mjs index d90aeeec1..d703ed3cd 100644 --- a/skills/scripts/e2e/bot-event-routing-product-flow.mjs +++ b/skills/scripts/e2e/bot-event-routing-product-flow.mjs @@ -233,7 +233,12 @@ try { .click(); await page.getByRole("dialog").waitFor({ state: "hidden" }); - await page + const adapterConfigCard = page.locator('[data-slot="card"]').filter({ + has: page.getByText(/Adapter Configuration|适配器配置|アダプター設定/, { + exact: true, + }), + }); + await adapterConfigCard .getByRole("button", { name: /Listen for platform events|监听平台事件|プラットフォームイベントを監視/, }) diff --git a/skills/skills/langbot-testing/cases/bot-event-routing-product-flow.yaml b/skills/skills/langbot-testing/cases/bot-event-routing-product-flow.yaml index e19c4802b..f863b5ead 100644 --- a/skills/skills/langbot-testing/cases/bot-event-routing-product-flow.yaml +++ b/skills/skills/langbot-testing/cases/bot-event-routing-product-flow.yaml @@ -33,14 +33,14 @@ steps: - "Confirm the adapter capability summary, friendly event name, target, and route status are visible." - "Confirm overlapping routes and unmatched-event fallback behavior are explained before save." - "Open Test event route and run a dry-run against the current form." - - "Open Platform event debugging and send a real inbound event through the HTTP Bot adapter." + - "Open Platform event debugging from Adapter Configuration and send a real inbound event through the HTTP Bot adapter." - "Confirm the normalized event, raw event code, payload, and latest discarded route status are visible." checks: - "UI: A user can choose a channel and add a scenario-labeled behavior during initial Bot creation." - "UI: Event routing uses user-facing labels and does not require the raw event name in the primary route card." - "UI: Definite route shadowing and unmatched-event fallback behavior are visible without opening raw logs." - "UI: Dry-run visibly reports that the route matched the discard processor." - - "UI: Adapter event debugging is clearly separate from route preview and starts listening only after the dialog opens." + - "UI: Adapter event debugging lives under Adapter Configuration, remains separate from route preview, and starts listening only after the dialog opens." - "UI: A real adapter event shows its friendly name, raw code, and normalized event data." - "UI: The route card updates to discarded after the real inbound event is handled." - "Console: No unexpected frontend errors appear during the flow." diff --git a/web/src/app/home/bots/components/bot-form/BotForm.tsx b/web/src/app/home/bots/components/bot-form/BotForm.tsx index 9c715b7da..7ebb143e1 100644 --- a/web/src/app/home/bots/components/bot-form/BotForm.tsx +++ b/web/src/app/home/bots/components/bot-form/BotForm.tsx @@ -22,6 +22,7 @@ import { Agent, Bot } from '@/app/infra/entities/api'; import { getAdapterDocUrl } from '@/app/infra/entities/adapter-docs'; import { ExternalLink, ChevronDown, ChevronRight } from 'lucide-react'; import EventBindingsEditor from './EventBindingsEditor'; +import AdapterEventDebugDialog from './AdapterEventDebugDialog'; import { zodResolver } from '@hookform/resolvers/zod'; import { useForm } from 'react-hook-form'; @@ -687,6 +688,27 @@ const BotForm = forwardRef(function BotForm( }} /> )} + + {currentAdapter && initBotId && ( +
+
+

+ {t('bots.adapterConfigurationTest')} +

+

+ {t('bots.adapterConfigurationTestDescription')} +

+
+ adapter.value === currentAdapter, + )?.label ?? currentAdapter + } + /> +
+ )} @@ -703,11 +725,6 @@ const BotForm = forwardRef(function BotForm( adapter.value === currentAdapter, - )?.label ?? currentAdapter - } supportedEvents={adapterSupportedEvents[currentAdapter] || []} agentOptions={agentNameList} /> diff --git a/web/src/app/home/bots/components/bot-form/EventBindingsEditor.tsx b/web/src/app/home/bots/components/bot-form/EventBindingsEditor.tsx index cc25691a8..2b01df6c0 100644 --- a/web/src/app/home/bots/components/bot-form/EventBindingsEditor.tsx +++ b/web/src/app/home/bots/components/bot-form/EventBindingsEditor.tsx @@ -120,7 +120,6 @@ import { groupEventPatterns, } from '@/app/home/components/event-patterns/event-pattern-groups'; import EventSelectOptionContent from '@/app/home/components/event-patterns/EventSelectOptionContent'; -import AdapterEventDebugDialog from './AdapterEventDebugDialog'; export const PIPELINE_DISCARD = '__discard__'; @@ -129,7 +128,6 @@ export const PIPELINE_DISCARD = '__discard__'; interface EventBindingsEditorProps { form: UseFormReturn; botId?: string; - adapterLabel: string; supportedEvents: string[]; agentOptions: Agent[]; } @@ -1428,7 +1426,6 @@ function SortableBindingCard({ export default function EventBindingsEditor({ form, botId, - adapterLabel, supportedEvents, agentOptions, }: EventBindingsEditorProps) { @@ -1800,7 +1797,6 @@ export default function EventBindingsEditor({ eventOptions={dryRunEventOptions} agentOptions={agentOptions} /> -