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
@@ -247,12 +247,18 @@ function onSaveMessage(id: number) {
}
// 流式输出时自动滚到底部(同 ChatDetailView 的策略)。
let scrollPending = false
watch(
() => [session.messages.value.length, session.messages.value.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)
})
})
},
)
@@ -262,7 +268,10 @@ watch(
() => props.phase,
() => {
session.closeCurrent()
draft.value = ''
showCreateForm.value = false
newSystemPrompt.value = ''
newFirstMessage.value = DEFAULT_FIRST_MESSAGE
},
)