fix(web): code review pass — scroll watch, SSE same-origin, store concurrency, modal reset, admin validation

This commit is contained in:
2026-05-04 20:58:48 +08:00
parent ff283013da
commit b8d29d8ea7
11 changed files with 145 additions and 85 deletions
+16 -1
View File
@@ -150,8 +150,23 @@ onMounted(async () => {
}
})
// 路由 conversationId 切换:在 /chat ↔ /chat/:id 同组件复用时同步状态。
watch(
() => chat.messages.length,
() => route.params.conversationId,
async (cid) => {
if (typeof cid === 'string' && cid !== '') {
if (chat.currentConversation?.id !== cid) {
await chat.openConversation(cid)
}
} else {
chat.closeCurrent()
}
},
)
// 流式输出时 messages.length 不变,只 content 增长 —— 同时观察末消息内容长度。
watch(
() => [chat.messages.length, chat.messages.at(-1)?.content?.length ?? 0],
() => {
nextTick(() => {
const el = scrollEl.value