From 010ff4efc4cb2d790fdf5ff57b236bd82afd4554 Mon Sep 17 00:00:00 2001 From: shaohuzhang1 Date: Mon, 16 Nov 2026 17:28:27 +0800 Subject: [PATCH] fix: [Portal] Dialogue: After logging into the portal, the user completes the conversation with the application that has enabled login authentication. After logging out, three no permission errors pop up --- .../left-sidebar/account-menu/index.vue | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/ui/src/conversation-panel/left-sidebar/account-menu/index.vue b/ui/src/conversation-panel/left-sidebar/account-menu/index.vue index a78da6162bd..3bfa72bea78 100644 --- a/ui/src/conversation-panel/left-sidebar/account-menu/index.vue +++ b/ui/src/conversation-panel/left-sidebar/account-menu/index.vue @@ -29,17 +29,18 @@ const userPwdDialogRef = useTemplateRef>('use const apiKeyDialogRef = useTemplateRef>('apiKeyDialogRef') // 退出对话账号后回到当前场景首页,不停留在上一用户的对话;由守卫决定匿名认证或跳转登录页。 -const handleLogout = () => { - return auth - .logout() - .then(() => - router.replace( - route.meta.portal - ? { name: 'portal-application-list', force: true } - : { name: 'chat-home', params: { accessToken: route.params.accessToken }, force: true }, - ), +// 必须先回到首页再退出:守卫签发匿名 token 时会立即重建对话面板,此时若仍在原地址, +// 面板会用匿名身份请求上一用户的智能体与会话,需要认证的智能体返回 403。 +const handleLogout = async () => { + try { + await router.replace( + route.meta.portal ? { name: 'portal-application-list' } : { name: 'chat-home', params: { accessToken: route.params.accessToken } }, ) - .catch(() => {}) + await auth.logout() + await router.replace({ path: router.currentRoute.value.fullPath, force: true }) + } catch { + // 接口错误由请求层提示 + } } // 匿名用户主动登录,登录成功后回到当前地址;透传钉钉客户端入口参数