diff --git a/frontend/src/views/chat/components/AgentStreamDisplay.style.test.mjs b/frontend/src/views/chat/components/AgentStreamDisplay.style.test.mjs index 896acd0f..ac86030b 100644 --- a/frontend/src/views/chat/components/AgentStreamDisplay.style.test.mjs +++ b/frontend/src/views/chat/components/AgentStreamDisplay.style.test.mjs @@ -91,9 +91,11 @@ test('pending tool rows do not render an extra axis dot', () => { assert.doesNotMatch(source, /&\.action-pending\s*\{[\s\S]*&::after/) }) -test('agent mode only shows a native timeline placeholder before visible activity', () => { +test('agent mode shows a native placeholder before answer whenever nothing is pending', () => { assert.match(source, /if \(isConversationDone\.value\) return false/) - assert.match(source, /return displayEvents\.value\.length === 0/) + assert.match(source, /return !hasPendingStreamingActivity\.value/) + assert.match(source, /const hasPendingStreamingActivity = computed/) + assert.match(source, /event\.type === 'tool_approval_required' \|\| event\.type === 'mcp_oauth_required'/) assert.match(source, /class="action-card action-pending"/) assert.match(source, /t\('chat\.thinkingAlt'\)/) assert.match(source, /chat-timeline-loading\.less/) diff --git a/frontend/src/views/chat/components/AgentStreamDisplay.vue b/frontend/src/views/chat/components/AgentStreamDisplay.vue index aa4e3a56..5178eadd 100644 --- a/frontend/src/views/chat/components/AgentStreamDisplay.vue +++ b/frontend/src/views/chat/components/AgentStreamDisplay.vue @@ -1267,13 +1267,27 @@ watch(answerFullyRendered, (ready) => { }); }); -// Only render a placeholder before the agent has produced any visible step or -// answer. Once real activity exists it carries its own pending state, and once -// answer text starts the stream itself is sufficient feedback. +// Whether any currently visible step is actively pending (a running tool, or a +// blocking approval/OAuth prompt). A pending step shimmers on its own, so we +// don't stack a placeholder on top of it. +const hasPendingStreamingActivity = computed(() => { + return displayEvents.value.some((event: any) => { + if (!event) return false; + if (event.pending === true) return true; + return event.type === 'tool_approval_required' || event.type === 'mcp_oauth_required'; + }); +}); + +// Before any answer text appears, keep a native timeline placeholder whenever +// nothing is currently pending. This covers both the initial wait (no events +// yet) and the gap between rounds — the previous tool finished but the model +// has not emitted the next step/answer — which would otherwise show a static, +// feedback-less timeline. Once a real pending step exists it carries its own +// shimmer, and once answer text starts the stream itself is enough feedback. const showAgentActivityIndicator = computed(() => { if (isConversationDone.value) return false; if (props.ragMode || hasAnswerStarted.value) return false; - return displayEvents.value.length === 0; + return !hasPendingStreamingActivity.value; }); const isStreamingTimelineEvent = (event: any): boolean => { @@ -2624,6 +2638,13 @@ const handleAddToKnowledge = (answerEvent: any) => { } } +// While streaming, the last timeline step is `tree-child-last` (margin-bottom: 0) +// and the answer streams in directly beneath it. Give the answer breathing room +// so it does not collide with the final tool row. +.event-item.tree-child + .event-item.event-answer { + margin-top: 16px; +} + // ============ Tree View ============ .tree-container { margin: 0 0 16px; @@ -2974,16 +2995,6 @@ const handleAddToKnowledge = (answerEvent: any) => { } } -@keyframes spin { - 0% { - transform: rotate(0deg); - } - - 100% { - transform: rotate(360deg); - } -} - @keyframes pulse { 0%, @@ -3274,12 +3285,6 @@ const handleAddToKnowledge = (answerEvent: any) => { } } -@keyframes spin { - to { - transform: rotate(360deg); - } -} - // Final step layout override: keep agent reasoning/tool output visually close to // Claude's compact timeline instead of boxed cards. .agent-stream-display { diff --git a/frontend/src/views/chat/components/RagPipelineProgress.style.test.mjs b/frontend/src/views/chat/components/RagPipelineProgress.style.test.mjs index b5712af1..75594e2d 100644 --- a/frontend/src/views/chat/components/RagPipelineProgress.style.test.mjs +++ b/frontend/src/views/chat/components/RagPipelineProgress.style.test.mjs @@ -47,13 +47,14 @@ test('rag pipeline opens references from search steps and the drawer composable' assert.match(source, /handleStepClick/) }) -test('rag pipeline uses a native pending step and keeps later loading inside the thinking step', () => { +test('rag pipeline uses a native pending step and lets the thinking title shimmer while pending', () => { assert.match(source, /showPrePipelineWait/) assert.match(source, /class="action-card action-pending"/) assert.match(source, /t\('chat\.thinkingAlt'\)/) assert.match(source, /showThinkingStep/) - assert.match(source, /thinking-loading/) + assert.match(source, /'action-pending': thinkingPending/) assert.match(source, /hasThinkingEvent/) + assert.doesNotMatch(source, /thinking-loading/) assert.doesNotMatch(source, /showActivityIndicator/) }) diff --git a/frontend/src/views/chat/components/RagPipelineProgress.vue b/frontend/src/views/chat/components/RagPipelineProgress.vue index b5fa99d7..1f704344 100644 --- a/frontend/src/views/chat/components/RagPipelineProgress.vue +++ b/frontend/src/views/chat/components/RagPipelineProgress.vue @@ -64,14 +64,7 @@ {{ t('agent.think') }} -