From efa7528275e65fd3fb30df0d981ed2a5ac9c24b4 Mon Sep 17 00:00:00 2001 From: twwu Date: Fri, 4 Sep 2026 14:40:50 +0800 Subject: [PATCH] fix(web): simplify builder conversation events --- .../__tests__/conversation.spec.tsx | 73 ++++++++++++++++++- .../conversation/conversation-card.tsx | 42 ++--------- .../conversation/execution-progress.tsx | 2 +- 3 files changed, 77 insertions(+), 40 deletions(-) diff --git a/web/app/components/workflow-app/components/dify-builder/__tests__/conversation.spec.tsx b/web/app/components/workflow-app/components/dify-builder/__tests__/conversation.spec.tsx index a4203daff53..dfe21a88557 100644 --- a/web/app/components/workflow-app/components/dify-builder/__tests__/conversation.spec.tsx +++ b/web/app/components/workflow-app/components/dify-builder/__tests__/conversation.spec.tsx @@ -442,6 +442,70 @@ describe('DifyBuilderConversation test data form', () => { expect(screen.getByText('The plan is ready.')).toBeInTheDocument() }) + it('hides challenge, change set, and checkpoint cards from the committed conversation', () => { + render( + , + ) + + expect(screen.getByText('The change is ready for review.')).toBeInTheDocument() + expect(screen.queryByText('High-impact rules')).not.toBeInTheDocument() + expect(screen.queryByText('Review these rules before applying.')).not.toBeInTheDocument() + expect(screen.queryByText('configuration')).not.toBeInTheDocument() + expect(screen.queryByText('Update answer configuration')).not.toBeInTheDocument() + expect(screen.queryByText('Pre-edit checkpoint')).not.toBeInTheDocument() + }) + it('does not render a Thinking section for execution progress alone', () => { const store = createStore() store.set(difyBuilderExecutionProgressAtom, { @@ -479,7 +543,7 @@ describe('DifyBuilderConversation test data form', () => { expect(screen.queryByText(/Thinking|Thought/)).not.toBeInTheDocument() }) - it('preserves the execution disclosure state while snapshots update', async () => { + it('keeps execution details collapsed by default and preserves user disclosure while snapshots update', async () => { const user = userEvent.setup() const store = createStore() store.set(difyBuilderExecutionProgressAtom, { @@ -516,9 +580,10 @@ describe('DifyBuilderConversation test data form', () => { const progressDetails = screen.getByRole('group', { name: 'Run the workflow' }) const progressToggle = progressDetails.querySelector('summary') expect(progressToggle).not.toBeNull() - expect(progressDetails).toHaveAttribute('open') - await user.click(progressToggle!) expect(progressDetails).not.toHaveAttribute('open') + expect(screen.getByRole('status')).toHaveTextContent('Run the workflow') + await user.click(progressToggle!) + expect(progressDetails).toHaveAttribute('open') act(() => { store.set(difyBuilderExecutionProgressAtom, { @@ -548,7 +613,7 @@ describe('DifyBuilderConversation test data form', () => { }) expect(screen.getByRole('group', { name: 'Generate answer' })).toBe(progressDetails) - expect(progressDetails).not.toHaveAttribute('open') + expect(progressDetails).toHaveAttribute('open') }) it('renders failed test results with the destructive card tone', () => { diff --git a/web/app/components/workflow-app/components/dify-builder/conversation/conversation-card.tsx b/web/app/components/workflow-app/components/dify-builder/conversation/conversation-card.tsx index 79c5ae7cab3..b38eabbe628 100644 --- a/web/app/components/workflow-app/components/dify-builder/conversation/conversation-card.tsx +++ b/web/app/components/workflow-app/components/dify-builder/conversation/conversation-card.tsx @@ -22,7 +22,6 @@ export const ConversationCard = memo( item, busy, interactive, - changesExpanded, invalidated, onActionPayloadChange, onActionValidityChange, @@ -37,6 +36,9 @@ export const ConversationCard = memo( }) => { const { t } = useTranslation() + if (item.kind === 'challenge' || item.kind === 'change_set' || item.kind === 'checkpoint') + return null + if (item.kind === 'user' || item.kind === 'decision') { return (
@@ -141,40 +143,15 @@ export const ConversationCard = memo( ) } - if (item.kind === 'challenge' || item.kind === 'error') { + if (item.kind === 'error') { return ( - +
{item.payload.title}
{item.payload.body}
) } - if (item.kind === 'change_set') { - return ( - -
- - {item.payload.scope || t(($) => $['difyBuilder.changes'], { ns: 'workflow' })} - - - {item.payload.count} - -
- {(changesExpanded || item.payload.full_diff_open) && ( -
    - {item.payload.changes.map((change) => ( -
  • {change}
  • - ))} -
- )} -
- ) - } - if (item.kind === 'test_result') { return ( ( ) export const ExecutionProgress = ({ execution }: { execution?: ExecutionProgressData | null }) => { - const [open, setOpen] = useState(execution?.status === 'running' || execution?.status === 'error') + const [open, setOpen] = useState(false) const activities = execution?.activities ?? [] if (!execution || activities.length === 0) return null