feat: refactor sidebar and settings to include agents and models; update routing and i18n messages

This commit is contained in:
duanshuwen
2026-04-20 22:56:33 +08:00
parent 4f41eb380e
commit 35319e6a1d
6 changed files with 126 additions and 33 deletions

View File

@@ -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 />)} />