Browse Source

feat: 添加会话迁移功能并优化登录流程

feat/ai-sdk-v6-upgrade
npmrun 8 hours ago
parent
commit
3486210305
  1. 14
      app/pages/auth/login.vue
  2. BIN
      packages/drizzle-pkg/db.sqlite

14
app/pages/auth/login.vue

@ -60,6 +60,11 @@ async function handleLogin() {
})
$toast.success('登录成功!')
await refresh(true)
try {
await $fetch('/api/agent/migrate', { method: 'POST' })
} catch (e) {
console.error('迁移临时会话失败', e)
}
await navigateTo(redirect.value)
} catch (e: any) {
$toast.error(e?.data?.statusMessage || e?.message || '登录失败')
@ -69,12 +74,17 @@ async function handleLogin() {
}
}
onMounted(() => {
onMounted(async () => {
fetchCaptcha()
const url = new URL(window.location.href)
if (url.searchParams.get('oauth_success') === '1') {
refresh(true)
await refresh(true)
try {
await $fetch('/api/agent/migrate', { method: 'POST' })
} catch (e) {
console.error('迁移临时会话失败', e)
}
router.push('/')
}
if (url.searchParams.get('oauth_error')) {

BIN
packages/drizzle-pkg/db.sqlite

Binary file not shown.
Loading…
Cancel
Save