fix(chat): stop plan in-progress spinner when agent is not streaming

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
xintaofei
2026-04-11 11:20:28 +08:00
parent 4ba74a06bd
commit 3901c40518
2 changed files with 12 additions and 3 deletions

View File

@@ -22,6 +22,7 @@ interface AgentPlanOverlayProps {
planKey?: string | null planKey?: string | null
visible?: boolean visible?: boolean
defaultExpanded?: boolean defaultExpanded?: boolean
isStreaming?: boolean
} }
function getLatestPlanEntries(message: LiveMessage | null): PlanEntryInfo[] { function getLatestPlanEntries(message: LiveMessage | null): PlanEntryInfo[] {
@@ -88,12 +89,18 @@ function getPriorityClassName(priority: string): string {
} }
} }
function StatusIcon({ status }: { status: string }) { function StatusIcon({
status,
isStreaming,
}: {
status: string
isStreaming: boolean
}) {
if (status === "completed") { if (status === "completed") {
return <CheckCircle2Icon className="h-3.5 w-3.5 text-emerald-500" /> return <CheckCircle2Icon className="h-3.5 w-3.5 text-emerald-500" />
} }
if (status === "in_progress") { if (status === "in_progress" && isStreaming) {
return <Loader2Icon className="h-3.5 w-3.5 text-blue-500 animate-spin" /> return <Loader2Icon className="h-3.5 w-3.5 text-blue-500 animate-spin" />
} }
@@ -106,6 +113,7 @@ export const AgentPlanOverlay = memo(function AgentPlanOverlay({
planKey, planKey,
visible = true, visible = true,
defaultExpanded = true, defaultExpanded = true,
isStreaming = false,
}: AgentPlanOverlayProps) { }: AgentPlanOverlayProps) {
const t = useTranslations("Folder.chat.agentPlanOverlay") const t = useTranslations("Folder.chat.agentPlanOverlay")
const liveEntries = useMemo( const liveEntries = useMemo(
@@ -207,7 +215,7 @@ export const AgentPlanOverlay = memo(function AgentPlanOverlay({
className="rounded-lg border bg-transparent px-2.5 py-2" className="rounded-lg border bg-transparent px-2.5 py-2"
> >
<div className="flex items-start gap-2"> <div className="flex items-start gap-2">
<StatusIcon status={entry.status} /> <StatusIcon status={entry.status} isStreaming={isStreaming} />
<p <p
className={cn( className={cn(
"min-w-0 flex-1 text-sm leading-5 break-words [overflow-wrap:anywhere]", "min-w-0 flex-1 text-sm leading-5 break-words [overflow-wrap:anywhere]",

View File

@@ -460,6 +460,7 @@ export function MessageListView({
entries={historicalPlanEntries} entries={historicalPlanEntries}
planKey={historicalPlanKey} planKey={historicalPlanKey}
defaultExpanded={connStatus === "prompting"} defaultExpanded={connStatus === "prompting"}
isStreaming={connStatus === "prompting"}
/> />
</div> </div>
) )