Web优化 1

This commit is contained in:
2026-06-12 14:01:55 +08:00
parent 17ca339c66
commit 7e9df04bf8
10 changed files with 138 additions and 73 deletions
+9 -3
View File
@@ -215,12 +215,18 @@ watch(
)
// 流式输出时 messages.length 不变,只 content 增长 —— 同时观察末消息内容长度。
let scrollPending = false
watch(
() => [chat.messages.length, chat.messages.at(-1)?.content?.length ?? 0],
() => {
nextTick(() => {
const el = scrollEl.value
if (el) el.scrollTo(0, el.scrollHeight)
if (scrollPending) return
scrollPending = true
requestAnimationFrame(() => {
scrollPending = false
nextTick(() => {
const el = scrollEl.value
if (el) el.scrollTo(0, el.scrollHeight)
})
})
},
)
@@ -82,9 +82,8 @@ function remove(id: string) {
}
watch(
attachments,
() => attachments.value.map((a) => a.id),
() => emit('change', attachments.value.map((a) => a.id)),
{ deep: true },
)
defineExpose({