fix(web): conversation page not need login

This commit is contained in:
zhaoying
2026-01-14 19:00:38 +08:00
parent 0d9cdd5039
commit 58d82df327
4 changed files with 22 additions and 5 deletions

View File

@@ -30,15 +30,12 @@ import 'dayjs/plugin/utc'
import { cookieUtils } from './utils/request';
function App() {
const { t } = useTranslation();
const { locale, language, timeZone } = useI18n()
useEffect(() => {
const authToken = cookieUtils.get('authToken')
if (!authToken && !window.location.hash.includes('#/login')) {
if (!authToken && !window.location.hash.includes('#/login') && !window.location.hash.includes('#/conversation/')) {
window.location.href = `/#/login`;
}
}, [])

View File

@@ -0,0 +1,14 @@
import { Outlet } from 'react-router-dom';
import { type FC } from 'react';
// 基础布局组件,用于展示内容并保留用户信息获取功能
const NoAuthLayout: FC = () => {
return (
<div className="rb:relative rb:h-full rb:w-full">
<Outlet />
</div>
)
};
export default NoAuthLayout;

View File

@@ -34,6 +34,7 @@ const componentMap: Record<string, LazyExoticComponent<ComponentType<object>>> =
AuthSpaceLayout: lazy(() => import('@/components/Layout/AuthSpaceLayout')),
BasicLayout: lazy(() => import('@/components/Layout/BasicLayout')),
LoginLayout: lazy(() => import('@/components/Layout/LoginLayout')),
NoAuthLayout: lazy(() => import('@/components/Layout/NoAuthLayout')),
// 视图组件
Index: lazy(() => import('@/views/Index')),
Home: lazy(() => import('@/views/Home')),

View File

@@ -42,12 +42,17 @@
"element": "BasicLayout",
"children": [
{ "path": "/application/config/:id", "element": "ApplicationConfig" },
{ "path": "/conversation/:token", "element": "Conversation" },
{ "path": "/user-memory/neo4j/:id", "element": "Neo4jUserMemoryDetail" },
{ "path": "/statement/:id", "element": "StatementDetail" },
{ "path": "/user-memory/detail/:id/:type", "element": "MemoryNodeDetail" }
]
},
{
"element": "NoAuthLayout",
"children": [
{ "path": "/conversation/:token", "element": "Conversation" }
]
},
{
"element": "LoginLayout",
"children": [