Files
zn-ai/src/router/routes.ts
duanshuwen 85d92b937f feat: add models management and usage history components
- Introduced RequestContentDialog for displaying request content details.
- Added UsageBarChart for visualizing token usage data.
- Implemented UsageHistorySection to manage and display usage history with filtering and pagination.
- Created provider-types for managing provider-related types.
- Developed ModelsPage to encapsulate models configuration, providers, and usage history.
- Defined usage-history types and utility functions for managing usage data.
- Updated routing to include models page and redirect agents to models.
- Refactored chat store to integrate models instead of agents.
- Established models store for managing model-related state and data fetching.
2026-04-18 09:41:59 +08:00

52 lines
1.2 KiB
TypeScript

export type AppPath =
| '/home'
| '/models'
| '/skills'
| '/cron'
| '/scripts'
| '/setting'
| '/knowledge'
| '/login';
export type WorkspacePath = Exclude<AppPath, '/login'>;
export type NavItem = {
path: WorkspacePath;
labelKey:
| 'sidebar.home'
| 'sidebar.knowledge'
| 'sidebar.models'
| 'sidebar.skills'
| 'sidebar.cron'
| 'sidebar.scripts'
| 'sidebar.settings';
};
export const DEFAULT_PATH: WorkspacePath = '/home';
export const NAV_ITEMS: NavItem[] = [
{ path: '/home', labelKey: 'sidebar.home' },
{ path: '/knowledge', labelKey: 'sidebar.knowledge' },
{ path: '/models', labelKey: 'sidebar.models' },
{ path: '/skills', labelKey: 'sidebar.skills' },
{ path: '/cron', labelKey: 'sidebar.cron' },
{ path: '/scripts', labelKey: 'sidebar.scripts' },
{ path: '/setting', labelKey: 'sidebar.settings' },
];
export function normalizeWorkspacePath(pathname: string): WorkspacePath {
switch (pathname) {
case '/knowledge':
case '/models':
case '/agents':
case '/skills':
case '/cron':
case '/scripts':
case '/setting':
return pathname === '/agents' ? '/models' : pathname;
case '/home':
default:
return DEFAULT_PATH;
}
}