fix: keep long conversation content scrollable
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: 修复偶发的长会话滚动条提前到底问题;包含较长推理、工具记录或正文时,现在可以直接滚动查看全部已加载内容,无需切换会话刷新。
This commit is contained in:
@@ -609,6 +609,9 @@ GoodBuddy 是可调整窗口大小的桌面应用。响应式设计优先保证
|
|||||||
- “Enter 发送 · Shift+Enter 换行 · Ctrl+V 粘贴图片或文本”等输入操作提示放在空输入框内部,作为主占位文案的次级行;不得在输入框下方单独占用第二行。输入框下方只保留一行当前模式、安全边界或全局快捷键说明。
|
- “Enter 发送 · Shift+Enter 换行 · Ctrl+V 粘贴图片或文本”等输入操作提示放在空输入框内部,作为主占位文案的次级行;不得在输入框下方单独占用第二行。输入框下方只保留一行当前模式、安全边界或全局快捷键说明。
|
||||||
- 输入操作提示不能替代表单的可访问名称,输入框始终保留持久的程序化标签。
|
- 输入操作提示不能替代表单的可访问名称,输入框始终保留持久的程序化标签。
|
||||||
- 空对话展示可执行的起始建议,发送失败保留输入并提供重试。
|
- 空对话展示可执行的起始建议,发送失败保留输入并提供重试。
|
||||||
|
- 消息流的滚动范围必须使用已渲染消息的真实高度。长会话可以按批次只挂载最近消息并由用户
|
||||||
|
加载更早内容,但不得用固定的消息占位高度替代实际布局,避免推理、工具列表或长正文被
|
||||||
|
排除在可滚动范围之外。
|
||||||
|
|
||||||
### 13.2 最近对话
|
### 13.2 最近对话
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import {
|
|||||||
screen,
|
screen,
|
||||||
within
|
within
|
||||||
} from '@testing-library/react'
|
} from '@testing-library/react'
|
||||||
|
import { readFileSync } from 'node:fs'
|
||||||
|
import { join } from 'node:path'
|
||||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||||
import {
|
import {
|
||||||
ChatTimeline,
|
ChatTimeline,
|
||||||
@@ -13,6 +15,10 @@ import {
|
|||||||
|
|
||||||
const markdownRenderProbe = vi.hoisted(() => vi.fn())
|
const markdownRenderProbe = vi.hoisted(() => vi.fn())
|
||||||
const htmlRenderProbe = 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', () => ({
|
vi.mock('./MarkdownRenderer', () => ({
|
||||||
MarkdownRenderer: ({
|
MarkdownRenderer: ({
|
||||||
@@ -60,6 +66,14 @@ describe('ChatTimeline', () => {
|
|||||||
vi.clearAllMocks()
|
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', () => {
|
it('enables HTML rendering only for completed Agent output', () => {
|
||||||
const messages: Message[] = [
|
const messages: Message[] = [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5281,8 +5281,6 @@ button > svg {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.message {
|
.message {
|
||||||
content-visibility: auto;
|
|
||||||
contain-intrinsic-block-size: auto 160px;
|
|
||||||
display: grid;
|
display: grid;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
padding: 17px 8px;
|
padding: 17px 8px;
|
||||||
|
|||||||
Reference in New Issue
Block a user