fix(ui): stop pulsing completed stream segments · openclaw/openclaw@462e315
scotthuang
·
2026-05-30
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -194,6 +194,7 @@ describe("buildChatItems", () => {
|
194 | 194 | key: "stream:main:1", |
195 | 195 | text: "Visible reply", |
196 | 196 | startedAt: 1, |
| 197 | +isStreaming: true, |
197 | 198 | }, |
198 | 199 | ]); |
199 | 200 | }); |
@@ -389,6 +390,7 @@ describe("buildChatItems", () => {
|
389 | 390 | kind: "stream", |
390 | 391 | text: "Older streamed output.", |
391 | 392 | startedAt: 1_000, |
| 393 | +isStreaming: false, |
392 | 394 | }); |
393 | 395 | expect(requireGroup(items[1]).role).toBe("assistant"); |
394 | 396 | }); |
@@ -406,6 +408,7 @@ describe("buildChatItems", () => {
|
406 | 408 | kind: "stream", |
407 | 409 | text: "Timestamped stream.", |
408 | 410 | startedAt: Number.MAX_SAFE_INTEGER, |
| 411 | +isStreaming: false, |
409 | 412 | }); |
410 | 413 | expect(messageRecord(requireGroup(items[1])).content).toBe("Missing timestamp."); |
411 | 414 | }); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -572,6 +572,7 @@ export function buildChatItems(props: BuildChatItemsProps): Array<ChatItem | Mes
|
572 | 572 | key: `stream-seg:${props.sessionKey}:${i}`, |
573 | 573 | text: visibleText, |
574 | 574 | startedAt: segments[i].ts, |
| 575 | +isStreaming: false, |
575 | 576 | }); |
576 | 577 | } |
577 | 578 | } |
@@ -595,6 +596,7 @@ export function buildChatItems(props: BuildChatItemsProps): Array<ChatItem | Mes
|
595 | 596 | key, |
596 | 597 | text: visibleText, |
597 | 598 | startedAt: props.streamStartedAt ?? Date.now(), |
| 599 | +isStreaming: true, |
598 | 600 | }); |
599 | 601 | } |
600 | 602 | } else if (props.stream.trim().length === 0) { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -878,6 +878,15 @@ describe("grouped chat rendering", () => {
|
878 | 878 | expect(streamingTime?.textContent?.trim()).toBe(display.label); |
879 | 879 | }); |
880 | 880 | |
| 881 | +it("omits streaming bubble class for completed stream segments", () => { |
| 882 | +const container = document.createElement("div"); |
| 883 | + |
| 884 | +render(renderStreamingGroup("Completed segment", 1, false), container); |
| 885 | + |
| 886 | +const bubble = container.querySelector(".chat-bubble"); |
| 887 | +expect(bubble?.classList.contains("streaming")).toBe(false); |
| 888 | +}); |
| 889 | + |
881 | 890 | it("renders configured local user names", () => { |
882 | 891 | const renderUser = (opts: Partial<RenderMessageGroupOptions>) => { |
883 | 892 | const container = document.createElement("div"); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -347,6 +347,7 @@ export function renderReadingIndicatorGroup(
|
347 | 347 | export function renderStreamingGroup( |
348 | 348 | text: string, |
349 | 349 | startedAt: number, |
| 350 | +isStreaming = true, |
350 | 351 | onOpenSidebar?: (content: SidebarContent) => void, |
351 | 352 | assistant?: AssistantIdentity, |
352 | 353 | basePath?: string, |
@@ -365,7 +366,7 @@ export function renderStreamingGroup(
|
365 | 366 | timestamp: startedAt, |
366 | 367 | }, |
367 | 368 | `stream:${startedAt}`, |
368 | | - { isStreaming: true, showReasoning: false }, |
| 369 | + { isStreaming, showReasoning: false }, |
369 | 370 | onOpenSidebar, |
370 | 371 | )} |
371 | 372 | <div class="chat-group-footer"> |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -13,7 +13,7 @@ export type ChatItem =
|
13 | 13 | action?: { kind: "session-checkpoints"; label: string }; |
14 | 14 | timestamp: number; |
15 | 15 | } |
16 | | -| { kind: "stream"; key: string; text: string; startedAt: number } |
| 16 | +| { kind: "stream"; key: string; text: string; startedAt: number; isStreaming: boolean } |
17 | 17 | | { kind: "reading-indicator"; key: string }; |
18 | 18 | |
19 | 19 | /** A group of consecutive messages from the same role (Slack-style layout) */ |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -115,6 +115,7 @@ vi.mock("../chat/build-chat-items.ts", () => ({
|
115 | 115 | key: "stream:test", |
116 | 116 | text: props.stream, |
117 | 117 | startedAt: props.streamStartedAt ?? 1, |
| 118 | +isStreaming: true, |
118 | 119 | }, |
119 | 120 | ] |
120 | 121 | : [{ kind: "reading-indicator", key: "reading:test" }]; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1249,6 +1249,7 @@ export function renderChat(props: ChatProps) {
|
1249 | 1249 | return renderStreamingGroup( |
1250 | 1250 | item.text, |
1251 | 1251 | item.startedAt, |
| 1252 | + item.isStreaming, |
1252 | 1253 | props.onOpenSidebar, |
1253 | 1254 | assistantIdentity, |
1254 | 1255 | props.basePath, |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。