From f645e21d472fb79b384e634122212ef578e722aa Mon Sep 17 00:00:00 2001 From: shaohuzhang1 Date: Wed, 11 Nov 2026 11:56:15 +0800 Subject: [PATCH] fix: Dialogue Routing Handling --- ui/src/router/chat/index.ts | 2 +- ui/src/router/chat/routes.ts | 6 ++++++ ui/src/views/application-detail/overview/index.vue | 9 +++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ui/src/router/chat/index.ts b/ui/src/router/chat/index.ts index e5c2dfc6258..a475903f7c4 100644 --- a/ui/src/router/chat/index.ts +++ b/ui/src/router/chat/index.ts @@ -6,7 +6,7 @@ import { chatRoutes } from './routes' const CHAT_BASE_PATH = window.MaxKB?.prefix || import.meta.env.VITE_BASE_PATH || '/chat/' -const chatRouter = createRouter({ history: createWebHistory(CHAT_BASE_PATH), routes: chatRoutes }) +const chatRouter = createRouter({ history: createWebHistory(CHAT_BASE_PATH), strict: true, routes: chatRoutes }) const LOGIN_ROUTE_NAMES = new Set(['portal-login', 'chat-login']) diff --git a/ui/src/router/chat/routes.ts b/ui/src/router/chat/routes.ts index 20f1ae15eb4..cb9c94a5208 100644 --- a/ui/src/router/chat/routes.ts +++ b/ui/src/router/chat/routes.ts @@ -40,6 +40,12 @@ const applicationRoutes: RouteRecordRaw[] = [ name: 'chat-login', component: () => import('@/views/chat/login/index.vue'), meta: { title: '登录' }, + }, + { + path: '/:accessToken', + redirect: (to) => { + return `/${to.params.accessToken}/` + }, }, { path: '/:accessToken/', diff --git a/ui/src/views/application-detail/overview/index.vue b/ui/src/views/application-detail/overview/index.vue index 3fbd3d89f6a..8af310f2010 100644 --- a/ui/src/views/application-detail/overview/index.vue +++ b/ui/src/views/application-detail/overview/index.vue @@ -50,12 +50,17 @@ const chatBasePath = CHAT_API_BASE_PATH.replace(/\/api$/, '') const apiDocUrl = new URL(`${CHAT_API_BASE_PATH}-doc/`, window.location.origin).href const apiQuery=computed(()=>{ -return application.value?.work_flow?.nodes?.find(n=>n.id==='base-node')?.properties?.api_input_field_list.map((f:any)=>{ +const query=application.value?.work_flow?.nodes?.find(n=>n.id==='base-node')?.properties?.api_input_field_list.map((f:any)=>{ return `${f.variable}=${f.default_value}` }).join('&') +if(query){ + return '?'+query +} +return '' + }) // TODO:访问链接还有问题 -const accessUrl = computed(() => (accessToken.value ? `${window.location.origin}${chatBasePath}/${accessToken.value}?${apiQuery.value}` : '')) +const accessUrl = computed(() => (accessToken.value ? `${window.location.origin}${chatBasePath}/${accessToken.value}/${apiQuery.value}` : '')) function toUrl(url?: string) { if (!url) return