-
+
.pending-edge-overlay[data-solid-tone="card"][data-pending-edge-overlay="pending"]) { border-color: CanvasText; @@ -2193,6 +2308,14 @@ html[data-custom-background] .side-panel-surface { background-color: hsl(var(--settings-surface) / 0.78); backdrop-filter: blur(12px); } +html[data-custom-background] .user-message-stack:not([data-temporary="true"]) .user-message-stack-sheet-first { + background-color: hsl(var(--settings-surface) / 0.56); + backdrop-filter: blur(10px); +} +html[data-custom-background] .user-message-stack:not([data-temporary="true"]) .user-message-stack-sheet-second { + background-color: hsl(var(--settings-surface) / 0.38); + backdrop-filter: blur(10px); +} html[data-custom-background] aside.bg-settings-surface { background-color: hsl(var(--settings-surface) / 0.65); } diff --git a/webui/src/i18n/locales/en/common.json b/webui/src/i18n/locales/en/common.json index 5b60ca68e..ed2fe3d98 100644 --- a/webui/src/i18n/locales/en/common.json +++ b/webui/src/i18n/locales/en/common.json @@ -2576,6 +2576,8 @@ "fallbackResponse": "This reply switched to a fallback model, answered by {{preset}}.", "copyReply": "Copy", "copiedReply": "Copied", + "expandUserMessage": "Show more", + "collapseUserMessage": "Show less", "turnLatencyTitle": "Response time (end-to-end)", "fileEditViewDiff": "View changes", "fileEditViewLargeDiff": "Expand changes", diff --git a/webui/src/i18n/locales/es/common.json b/webui/src/i18n/locales/es/common.json index 847ecee04..bf982573b 100644 --- a/webui/src/i18n/locales/es/common.json +++ b/webui/src/i18n/locales/es/common.json @@ -2188,6 +2188,8 @@ "fallbackResponse": "Esta respuesta usa un modelo de respaldo: {{preset}}.", "copyReply": "Copiar", "copiedReply": "Copiado", + "expandUserMessage": "Mostrar más", + "collapseUserMessage": "Mostrar menos", "turnLatencyTitle": "Tiempo de respuesta (extremo a extremo)", "fileEditViewDiff": "Ver cambios", "fileEditViewLargeDiff": "Expandir cambios", diff --git a/webui/src/i18n/locales/fr/common.json b/webui/src/i18n/locales/fr/common.json index 84f5208d7..53031c1b7 100644 --- a/webui/src/i18n/locales/fr/common.json +++ b/webui/src/i18n/locales/fr/common.json @@ -2188,6 +2188,8 @@ "fallbackResponse": "Cette réponse utilise un modèle de secours : {{preset}}.", "copyReply": "Copier", "copiedReply": "Copié", + "expandUserMessage": "Afficher plus", + "collapseUserMessage": "Afficher moins", "turnLatencyTitle": "Temps de réponse (de bout en bout)", "fileEditViewDiff": "Voir les modifications", "fileEditViewLargeDiff": "Déplier les modifications", diff --git a/webui/src/i18n/locales/id/common.json b/webui/src/i18n/locales/id/common.json index 269c6db75..01a2b779d 100644 --- a/webui/src/i18n/locales/id/common.json +++ b/webui/src/i18n/locales/id/common.json @@ -2188,6 +2188,8 @@ "fallbackResponse": "Balasan ini beralih ke model cadangan dan dijawab oleh {{preset}}.", "copyReply": "Salin", "copiedReply": "Disalin", + "expandUserMessage": "Tampilkan lebih banyak", + "collapseUserMessage": "Tampilkan lebih sedikit", "turnLatencyTitle": "Waktu respons (ujung ke ujung)", "fileEditViewDiff": "Lihat perubahan", "fileEditViewLargeDiff": "Perluas perubahan", diff --git a/webui/src/i18n/locales/ja/common.json b/webui/src/i18n/locales/ja/common.json index acf74b047..f228ae2c5 100644 --- a/webui/src/i18n/locales/ja/common.json +++ b/webui/src/i18n/locales/ja/common.json @@ -2188,6 +2188,8 @@ "fallbackResponse": "この返信では代替モデルに切り替わり、{{preset}} が回答しています。", "copyReply": "コピー", "copiedReply": "コピー済み", + "expandUserMessage": "さらに表示", + "collapseUserMessage": "折りたたむ", "turnLatencyTitle": "応答時間(全行程)", "fileEditViewDiff": "変更を表示", "fileEditViewLargeDiff": "変更を展開", diff --git a/webui/src/i18n/locales/ko/common.json b/webui/src/i18n/locales/ko/common.json index 01a707111..57d220717 100644 --- a/webui/src/i18n/locales/ko/common.json +++ b/webui/src/i18n/locales/ko/common.json @@ -2188,6 +2188,8 @@ "fallbackResponse": "이 응답은 대체 모델로 전환되어 {{preset}}이(가) 답변합니다.", "copyReply": "복사", "copiedReply": "복사됨", + "expandUserMessage": "더 보기", + "collapseUserMessage": "접기", "turnLatencyTitle": "응답 시간(엔드투엔드)", "fileEditViewDiff": "변경 보기", "fileEditViewLargeDiff": "변경 펼치기", diff --git a/webui/src/i18n/locales/pt-BR/common.json b/webui/src/i18n/locales/pt-BR/common.json index 4c5c2a80c..5a92041e0 100644 --- a/webui/src/i18n/locales/pt-BR/common.json +++ b/webui/src/i18n/locales/pt-BR/common.json @@ -2396,6 +2396,8 @@ "fallbackResponse": "Esta resposta usa um modelo alternativo: {{preset}}.", "copyReply": "Copiar", "copiedReply": "Copiado", + "expandUserMessage": "Mostrar mais", + "collapseUserMessage": "Mostrar menos", "turnLatencyTitle": "Tempo de resposta (ponta a ponta)", "fileEditViewDiff": "Ver alterações", "fileEditViewLargeDiff": "Expandir alterações", diff --git a/webui/src/i18n/locales/vi/common.json b/webui/src/i18n/locales/vi/common.json index de96c7b0f..3349092e0 100644 --- a/webui/src/i18n/locales/vi/common.json +++ b/webui/src/i18n/locales/vi/common.json @@ -2188,6 +2188,8 @@ "fallbackResponse": "Phản hồi này đã chuyển sang mô hình dự phòng, do {{preset}} trả lời.", "copyReply": "Sao chép", "copiedReply": "Đã sao chép", + "expandUserMessage": "Hiển thị thêm", + "collapseUserMessage": "Thu gọn", "turnLatencyTitle": "Thời gian phản hồi (end-to-end)", "fileEditViewDiff": "Xem thay đổi", "fileEditViewLargeDiff": "Mở rộng thay đổi", diff --git a/webui/src/i18n/locales/zh-CN/common.json b/webui/src/i18n/locales/zh-CN/common.json index d8134609a..f09b18823 100644 --- a/webui/src/i18n/locales/zh-CN/common.json +++ b/webui/src/i18n/locales/zh-CN/common.json @@ -2576,6 +2576,8 @@ "fallbackResponse": "本条回复已切换至备用模型,由 {{preset}} 回答。", "copyReply": "复制", "copiedReply": "已复制", + "expandUserMessage": "展开", + "collapseUserMessage": "收起", "turnLatencyTitle": "回复耗时", "fileEditViewDiff": "查看修改", "fileEditViewLargeDiff": "展开修改", diff --git a/webui/src/i18n/locales/zh-TW/common.json b/webui/src/i18n/locales/zh-TW/common.json index f8ff1ead6..03a1aeb85 100644 --- a/webui/src/i18n/locales/zh-TW/common.json +++ b/webui/src/i18n/locales/zh-TW/common.json @@ -2187,6 +2187,8 @@ "fallbackResponse": "本則回覆已切換至備用模型,由 {{preset}} 回答。", "copyReply": "複製", "copiedReply": "已複製", + "expandUserMessage": "展開", + "collapseUserMessage": "收起", "turnLatencyTitle": "回覆耗時", "fileEditViewDiff": "檢視修改", "fileEditViewLargeDiff": "展開修改", diff --git a/webui/src/tests/message-bubble.test.tsx b/webui/src/tests/message-bubble.test.tsx index 23bc06208..c89f14c04 100644 --- a/webui/src/tests/message-bubble.test.tsx +++ b/webui/src/tests/message-bubble.test.tsx @@ -1509,4 +1509,65 @@ describe("MessageBubble", () => { expect(screen.queryByRole("link", { name: "Download growth.svg" })).not.toBeInTheDocument(); }); + it("collapses user messages taller than half the viewport and restores them on toggle or resize", () => { + let textHeight = 620; + let resize: ResizeObserverCallback | undefined; + const disconnect = vi.fn(); + vi.spyOn(window, "innerHeight", "get").mockReturnValue(800); + vi.spyOn(HTMLElement.prototype, "scrollHeight", "get").mockImplementation(function (this: HTMLElement) { + if (this.tagName === "P" || this.parentElement?.hasAttribute("data-user-message-clip")) { + return textHeight; + } + return 0; + }); + vi.stubGlobal("ResizeObserver", class { + constructor(callback: ResizeObserverCallback) { resize = callback; } + observe() {} + disconnect = disconnect; + }); + + try { + const content = Array.from({ length: 24 }, (_, i) => `Line ${i + 1}: detailed release log entry`).join("\n"); + const message: UIMessage = { + id: "u-long", + role: "user", + content, + createdAt: Date.now(), + }; + const { container, unmount } = render(); + + const wrapper = container.querySelector("[data-user-text-bubble]")!; + const toggle = screen.getByRole("button", { name: "Show more" }); + const clip = container.querySelector("[data-user-message-clip]") as HTMLElement; + expect(wrapper).toHaveAttribute("data-user-message-collapsible", "true"); + expect(wrapper).toHaveAttribute("data-user-message-collapsed", "true"); + expect(toggle).toHaveAttribute("aria-expanded", "false"); + expect(toggle).toHaveAttribute("data-thread-disclosure", ""); + expect(toggle.getAttribute("aria-controls")).toBe(container.querySelector("[data-user-text-bubble] > p")?.id); + expect(clip).toHaveClass("user-message-collapsible-masked"); + expect(clip.style.height).toBe("304px"); + + fireEvent.click(toggle); + expect(wrapper).not.toHaveAttribute("data-user-message-collapsed"); + expect(screen.getByRole("button", { name: "Show less" })).toHaveAttribute("aria-expanded", "true"); + expect(clip).not.toHaveClass("user-message-collapsible-masked"); + expect(clip.style.height).toBe("620px"); + + fireEvent.click(screen.getByRole("button", { name: "Show less" })); + expect(wrapper).toHaveAttribute("data-user-message-collapsed", "true"); + expect(clip.style.height).toBe("304px"); + + textHeight = 320; + act(() => { resize?.([], {} as ResizeObserver); }); + expect(wrapper).not.toHaveAttribute("data-user-message-collapsible"); + expect(screen.queryByRole("button", { name: "Show more" })).not.toBeInTheDocument(); + + unmount(); + expect(disconnect).toHaveBeenCalled(); + } finally { + vi.restoreAllMocks(); + vi.unstubAllGlobals(); + } + }); + });