feat: refactor sidebar and settings to include agents and models; update routing and i18n messages
This commit is contained in:
@@ -8,8 +8,6 @@ import { onAuthLogout } from './auth-session';
|
||||
|
||||
const HomePage = lazy(() => import('../pages/Home'));
|
||||
const ChannelsPage = lazy(() => import('../pages/Channels'));
|
||||
const AgentsPage = lazy(() => import('../pages/Agents'));
|
||||
const ModelsPage = lazy(() => import('../pages/Models'));
|
||||
const SkillsPage = lazy(() => import('../pages/Skills'));
|
||||
const CronPage = lazy(() => import('../pages/Cron'));
|
||||
const ScriptsPage = lazy(() => import('../pages/Scripts'));
|
||||
@@ -32,6 +30,10 @@ function renderLazyPage(element: ReactNode) {
|
||||
);
|
||||
}
|
||||
|
||||
function renderSettingViewRedirect(view: 'agents' | 'models') {
|
||||
return <Navigate to={`/setting?view=${view}`} replace />;
|
||||
}
|
||||
|
||||
function AuthLogoutRedirector() {
|
||||
const location = useLocation();
|
||||
const navigate = useNavigate();
|
||||
@@ -65,8 +67,8 @@ export function AppRouter() {
|
||||
<Route element={<MainLayout />}>
|
||||
<Route path="/home" element={renderLazyPage(<HomePage />)} />
|
||||
<Route path="/channels" element={renderLazyPage(<ChannelsPage />)} />
|
||||
<Route path="/agents" element={renderLazyPage(<AgentsPage />)} />
|
||||
<Route path="/models" element={renderLazyPage(<ModelsPage />)} />
|
||||
<Route path="/agents" element={renderSettingViewRedirect('agents')} />
|
||||
<Route path="/models" element={renderSettingViewRedirect('models')} />
|
||||
<Route path="/skills" element={renderLazyPage(<SkillsPage />)} />
|
||||
<Route path="/cron" element={renderLazyPage(<CronPage />)} />
|
||||
<Route path="/scripts" element={renderLazyPage(<ScriptsPage />)} />
|
||||
|
||||
@@ -32,8 +32,6 @@ export const NAV_ITEMS: NavItem[] = [
|
||||
{ path: '/home', labelKey: 'sidebar.home' },
|
||||
{ path: '/knowledge', labelKey: 'sidebar.knowledge' },
|
||||
{ path: '/channels', labelKey: 'sidebar.channels' },
|
||||
{ path: '/agents', labelKey: 'sidebar.agents' },
|
||||
{ path: '/models', labelKey: 'sidebar.models' },
|
||||
{ path: '/skills', labelKey: 'sidebar.skills' },
|
||||
{ path: '/cron', labelKey: 'sidebar.cron' },
|
||||
// { path: '/scripts', labelKey: 'sidebar.scripts' },
|
||||
@@ -44,13 +42,14 @@ export function normalizeWorkspacePath(pathname: string): WorkspacePath {
|
||||
switch (pathname) {
|
||||
case '/knowledge':
|
||||
case '/channels':
|
||||
case '/agents':
|
||||
case '/models':
|
||||
case '/skills':
|
||||
case '/cron':
|
||||
case '/scripts':
|
||||
case '/setting':
|
||||
return pathname;
|
||||
case '/agents':
|
||||
case '/models':
|
||||
return '/setting';
|
||||
case '/home':
|
||||
default:
|
||||
return DEFAULT_PATH;
|
||||
|
||||
Reference in New Issue
Block a user