kongdeqiang
2026-10-12 ed3c2513c35efa714f2a377aef55501dd15d1fec
src/views/Chat.vue
@@ -84,11 +84,19 @@
// 兜底:路由指向不存在的会话时提示并清理
watch(chatId, async (id) => {
  if (!id) return
  const exists = chatStore.chats.some((chat) => chat.id === id)
  if (!exists && chatStore.chats.length > 0) {
  const inMain = chatStore.chats.some((chat) => chat.id === id)
  // 归档的会话不在主列表里,但仍然是有效会话 ——
  // 只看主列表会把「打开一个归档对话」误判成「对话已被删除」
  const inArchive = chatStore.archivedChats.some((chat) => chat.id === id)
  // 归档列表还没加载完时不做判定:宁可晚一点提示,也不要误报
  if (inMain || inArchive || !chatStore.archiveLoaded || chatStore.chats.length === 0) {
    return
  }
    message.warning('该对话不存在或已被删除')
    router.replace('/c')
  }
})
</script>