From d5fa0ec67c7a14ee7773f870163f43732dd06350 Mon Sep 17 00:00:00 2001 From: mesalogo Date: Sat, 5 Sep 2026 14:51:21 +0800 Subject: [PATCH] fix: keep long conversation content scrollable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Large messages containing reasoning, tool lists, or long replies could use an estimated off-screen height that left later content outside the reachable scroll range. Conversation messages now participate in layout with their actual height while the existing 80-message render window keeps long histories bounded. Release note: 修复偶发的长会话滚动条提前到底问题;包含较长推理、工具记录或正文时,现在可以直接滚动查看全部已加载内容,无需切换会话刷新。 --- UI-DESIGN.md | 3 +++ src/renderer/src/ChatTimeline.test.tsx | 14 ++++++++++++++ src/renderer/src/styles.css | 2 -- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/UI-DESIGN.md b/UI-DESIGN.md index f4a6d159..f218a8cb 100644 --- a/UI-DESIGN.md +++ b/UI-DESIGN.md @@ -609,6 +609,9 @@ GoodBuddy 是可调整窗口大小的桌面应用。响应式设计优先保证 - “Enter 发送 · Shift+Enter 换行 · Ctrl+V 粘贴图片或文本”等输入操作提示放在空输入框内部,作为主占位文案的次级行;不得在输入框下方单独占用第二行。输入框下方只保留一行当前模式、安全边界或全局快捷键说明。 - 输入操作提示不能替代表单的可访问名称,输入框始终保留持久的程序化标签。 - 空对话展示可执行的起始建议,发送失败保留输入并提供重试。 +- 消息流的滚动范围必须使用已渲染消息的真实高度。长会话可以按批次只挂载最近消息并由用户 + 加载更早内容,但不得用固定的消息占位高度替代实际布局,避免推理、工具列表或长正文被 + 排除在可滚动范围之外。 ### 13.2 最近对话 diff --git a/src/renderer/src/ChatTimeline.test.tsx b/src/renderer/src/ChatTimeline.test.tsx index 5b484f8d..fd2df220 100644 --- a/src/renderer/src/ChatTimeline.test.tsx +++ b/src/renderer/src/ChatTimeline.test.tsx @@ -5,6 +5,8 @@ import { screen, within } from '@testing-library/react' +import { readFileSync } from 'node:fs' +import { join } from 'node:path' import { afterEach, describe, expect, it, vi } from 'vitest' import { ChatTimeline, @@ -13,6 +15,10 @@ import { const markdownRenderProbe = vi.hoisted(() => vi.fn()) const htmlRenderProbe = vi.hoisted(() => vi.fn()) +const stylesheet = readFileSync( + join(process.cwd(), 'src', 'renderer', 'src', 'styles.css'), + 'utf8' +).replaceAll('\r\n', '\n') vi.mock('./MarkdownRenderer', () => ({ MarkdownRenderer: ({ @@ -60,6 +66,14 @@ describe('ChatTimeline', () => { vi.clearAllMocks() }) + it('uses actual message heights for the conversation scroll range', () => { + const rule = stylesheet.match(/\.message\s*\{([^}]*)\}/u)?.[1] + + expect(rule).toBeDefined() + expect(rule).not.toContain('content-visibility') + expect(rule).not.toContain('contain-intrinsic') + }) + it('enables HTML rendering only for completed Agent output', () => { const messages: Message[] = [ { diff --git a/src/renderer/src/styles.css b/src/renderer/src/styles.css index bf364614..2162ad6e 100644 --- a/src/renderer/src/styles.css +++ b/src/renderer/src/styles.css @@ -5281,8 +5281,6 @@ button > svg { } .message { - content-visibility: auto; - contain-intrinsic-block-size: auto 160px; display: grid; min-width: 0; padding: 17px 8px;