65 lines
1.3 KiB
TypeScript
65 lines
1.3 KiB
TypeScript
|
|
|
|
import { createRouter, createWebHistory } from 'vue-router';
|
|
import WorkspaceView from '../views/WorkspaceView.vue';
|
|
import ChatView from '../views/ChatView.vue';
|
|
import AdminView from '../views/AdminView.vue';
|
|
import ProfileView from '../views/ProfileView.vue';
|
|
import ResetPasswordView from '../views/ResetPasswordView.vue';
|
|
import { config } from '../config';
|
|
|
|
const routes = [
|
|
{
|
|
path: '/',
|
|
redirect: '/workspace'
|
|
},
|
|
{
|
|
path: '/workspace',
|
|
name: 'Workspace',
|
|
component: WorkspaceView
|
|
},
|
|
{
|
|
path: '/casdoor-callback',
|
|
name: 'CasdoorCallback',
|
|
component: WorkspaceView
|
|
},
|
|
{
|
|
path: '/profile',
|
|
name: 'Profile',
|
|
component: ProfileView
|
|
},
|
|
{
|
|
path: '/reset-password',
|
|
name: 'ResetPassword',
|
|
component: ResetPasswordView
|
|
},
|
|
{
|
|
path: '/chat/:agentId',
|
|
name: 'Chat',
|
|
component: ChatView,
|
|
props: true
|
|
},
|
|
{
|
|
path: '/admin',
|
|
name: 'Admin',
|
|
component: AdminView
|
|
},
|
|
|
|
];
|
|
|
|
const router = createRouter({
|
|
history: createWebHistory(),
|
|
routes
|
|
});
|
|
|
|
router.afterEach((to) => {
|
|
const baseTitle = config.appTitle || 'AI工作台';
|
|
if (to.meta.title) {
|
|
document.title = `${to.meta.title} - ${baseTitle}`;
|
|
} else {
|
|
document.title = baseTitle;
|
|
}
|
|
});
|
|
|
|
export default router;
|