Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

💄 style(conversation): show running indicator after a settled inline tool while generating (#15528)

Arvin Xufc0daa76041b
diff --git a/src/features/Conversation/Messages/AssistantGroup/components/Group.test.tsx b/src/features/Conversation/Messages/AssistantGroup/components/Group.test.tsx
index 62802216502..69a1cb4e09d 100644
--- a/src/features/Conversation/Messages/AssistantGroup/components/Group.test.tsx
+++ b/src/features/Conversation/Messages/AssistantGroup/components/Group.test.tsx
@@ -115,6 +115,10 @@ vi.mock('./GroupItem', () => ({
),
}));
+vi.mock('@/features/Conversation/Messages/components/ContentLoading', () => ({
+ default: ({ id }: { id: string }) => <div data-id={id} data-testid="tail-running" />,
+}));
+
const blk = (p: Partial<AssistantContentBlock> & { id: string }): AssistantContentBlock =>
({ content: '', ...p }) as AssistantContentBlock;
@@ -351,6 +355,63 @@ describe('Group', () => {
]);
});
+ it('shows a running indicator below a settled single inline tool while still generating', () => {
+ mockIsGenerating = true;
+ render(
+ <Group
+ id="assistant-1"
+ messageIndex={0}
+ blocks={[
+ blk({
+ content: '',
+ id: 'block-1',
+ tools: [{ apiName: 'bash', id: 'tool-1', result: { content: 'done' } } as any],
+ }),
+ ]}
+ />,
+ );
+
+ expect(screen.getByTestId('tail-running')).toHaveAttribute('data-id', 'assistant-1');
+ });
+
+ it('hides the running indicator while the inline tool is still executing', () => {
+ mockIsGenerating = true;
+ render(
+ <Group
+ id="assistant-1"
+ messageIndex={0}
+ blocks={[
+ blk({
+ content: '',
+ id: 'block-1',
+ tools: [{ apiName: 'bash', id: 'tool-1' } as any],
+ }),
+ ]}
+ />,
+ );
+
+ expect(screen.queryByTestId('tail-running')).not.toBeInTheDocument();
+ });
+
+ it('hides the running indicator once generation has finished', () => {
+ mockIsGenerating = false;
+ render(
+ <Group
+ id="assistant-1"
+ messageIndex={0}
+ blocks={[
+ blk({
+ content: '',
+ id: 'block-1',
+ tools: [{ apiName: 'bash', id: 'tool-1', result: { content: 'done' } } as any],
+ }),
+ ]}
+ />,
+ );
+
+ expect(screen.queryByTestId('tail-running')).not.toBeInTheDocument();
+ });
+
it('only animates the last block in a multi-block group', () => {
const { container } = render(
<Group
diff --git a/src/features/Conversation/Messages/AssistantGroup/components/Group.tsx b/src/features/Conversation/Messages/AssistantGroup/components/Group.tsx
index 811aeb8b8aa..0654cc21d79 100644
--- a/src/features/Conversation/Messages/AssistantGroup/components/Group.tsx
+++ b/src/features/Conversation/Messages/AssistantGroup/components/Group.tsx
@@ -4,6 +4,7 @@ import isEqual from 'fast-deep-equal';
import { memo, useMemo } from 'react';
import { LOADING_FLAT } from '@/const/message';
+import ContentLoading from '@/features/Conversation/Messages/components/ContentLoading';
import { type AssistantContentBlock } from '@/types/index';
import { messageStateSelectors, useConversationStore } from '../../../store';
@@ -436,6 +437,20 @@ const Group = memo<GroupChildrenProps>(
const workflowChromeComplete = !isGenerating || postToolTailPromoted;
+ // When the turn ends on an inline single-tool segment whose tool already
+ // settled but the run is still generating (waiting on the next step), the
+ // inline path renders no working chrome — unlike WorkflowCollapse, which has
+ // its own streaming header. Without this the user sees a blank gap below the
+ // finished tool. Render the same "running" indicator used at turn start to
+ // fill it. Multi-tool segments keep their own chrome; a tool still executing
+ // is covered by its own loading placeholder (areWorkflowToolsComplete=false).
+ const lastSegment = segments.at(-1);
+ const showTailRunningIndicator =
+ isGenerating &&
+ lastSegment?.kind === 'workflow' &&
+ shouldInlineWorkflowSegment(lastSegment.blocks) &&
+ areWorkflowToolsComplete(lastSegment.blocks.flatMap((block) => block.tools ?? []));
+
if (isCollapsed) {
return (
content && (
@@ -499,6 +514,7 @@ const Group = memo<GroupChildrenProps>(
/>
);
})}
+ {showTailRunningIndicator && <ContentLoading id={id} />}
</Flexbox>
</MessageAggregationContext>
);