diff --git a/src/frontend/src/App.tsx b/src/frontend/src/App.tsx index ea7ea783b..19710cdc0 100644 --- a/src/frontend/src/App.tsx +++ b/src/frontend/src/App.tsx @@ -172,14 +172,14 @@ export default function App() { // 动态路由根据权限 const router = useMemo(() => { - if (['admin', 'group_admin'].includes(user.role)) return getAdminRouter() + if (user && ['admin', 'group_admin'].includes(user.role)) return getAdminRouter() return user?.user_id ? getPrivateRouter(user.web_menu) : null }, [user]) return ( //need parent component with width and height
- {(user?.user_id || noAuthPages.includes(path)) ? + {(user?.user_id || noAuthPages.includes(path)) && router ? : user ?
: }
diff --git a/src/frontend/src/pages/ChatAppPage/chatShare.tsx b/src/frontend/src/pages/ChatAppPage/chatShare.tsx index c7ac7955c..09508d6d0 100644 --- a/src/frontend/src/pages/ChatAppPage/chatShare.tsx +++ b/src/frontend/src/pages/ChatAppPage/chatShare.tsx @@ -15,7 +15,7 @@ export default function chatShare() { const params = []; if (libId) params.push(`knowledge_id=${libId}`); - if (tweak) params.push(`tweak=${tweak}`); + if (tweak) params.push(`tweak=${encodeURIComponent(tweak)}`); const paramStr = params.length > 0 ? `${params.join('&')}` : ''; diff --git a/src/frontend/src/routes.tsx b/src/frontend/src/routes.tsx index d757abe54..0526cf500 100755 --- a/src/frontend/src/routes.tsx +++ b/src/frontend/src/routes.tsx @@ -131,6 +131,7 @@ export const getAdminRouter = () => { export const publicRouter = createBrowserRouter([ { path: "/", element: }, { path: "/reset", element: }, + { path: "/chat/:id/", element: }, { path: "*", element: } ], baseConfig)