2026-03-21 10:13:35 +08:00
|
|
|
import { createRouter, createWebHistory } from 'vue-router'
|
|
|
|
|
import { useAuthStore } from '@/stores/auth'
|
Add log system with three log types (agent/system/chat)
Implemented a complete log system for tracking:
- Agent logs:智能体调用
- System logs: 系统运行
- Chat logs: 问答对话
Backend:
- Log model with type, level, user_id, message, source, duration_ms
- LogService with methods for logging and querying
- API endpoints: GET /api/logs, GET /api/logs/stats, GET /api/logs/recent
Frontend:
- LogView.vue with filters, stats, pagination, auto-refresh
- log.ts API client with TypeScript interfaces
- Added "运行日志" nav item to sidebar
2026-03-21 11:58:51 +08:00
|
|
|
import { Terminal } from 'lucide-vue-next'
|
2026-03-21 10:13:35 +08:00
|
|
|
|
|
|
|
|
const router = createRouter({
|
|
|
|
|
history: createWebHistory(),
|
|
|
|
|
routes: [
|
|
|
|
|
{
|
|
|
|
|
path: '/login',
|
|
|
|
|
name: 'login',
|
|
|
|
|
component: () => import('@/views/LoginView.vue'),
|
|
|
|
|
meta: { guest: true },
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: '/',
|
|
|
|
|
component: () => import('@/views/LayoutView.vue'),
|
|
|
|
|
meta: { requiresAuth: true },
|
|
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
path: '',
|
|
|
|
|
redirect: '/chat',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'chat',
|
|
|
|
|
name: 'chat',
|
|
|
|
|
component: () => import('@/views/ChatView.vue'),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'knowledge',
|
|
|
|
|
name: 'knowledge',
|
|
|
|
|
component: () => import('@/views/KnowledgeView.vue'),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'graph',
|
|
|
|
|
name: 'graph',
|
|
|
|
|
component: () => import('@/views/GraphView.vue'),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'kanban',
|
|
|
|
|
name: 'kanban',
|
|
|
|
|
component: () => import('@/views/KanbanView.vue'),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'forum',
|
|
|
|
|
name: 'forum',
|
|
|
|
|
component: () => import('@/views/ForumView.vue'),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'agents',
|
|
|
|
|
name: 'agents',
|
|
|
|
|
component: () => import('@/views/AgentView.vue'),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'stats',
|
|
|
|
|
name: 'stats',
|
|
|
|
|
component: () => import('@/views/StatsView.vue'),
|
|
|
|
|
},
|
2026-03-21 11:29:22 +08:00
|
|
|
{
|
|
|
|
|
path: 'skills',
|
|
|
|
|
name: 'skills',
|
|
|
|
|
component: () => import('@/views/SkillView.vue'),
|
|
|
|
|
},
|
2026-03-21 10:13:35 +08:00
|
|
|
{
|
|
|
|
|
path: 'todo',
|
|
|
|
|
name: 'todo',
|
|
|
|
|
component: () => import('@/views/TodoView.vue'),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'settings',
|
|
|
|
|
name: 'settings',
|
|
|
|
|
component: () => import('@/views/SettingsView.vue'),
|
|
|
|
|
},
|
Add log system with three log types (agent/system/chat)
Implemented a complete log system for tracking:
- Agent logs:智能体调用
- System logs: 系统运行
- Chat logs: 问答对话
Backend:
- Log model with type, level, user_id, message, source, duration_ms
- LogService with methods for logging and querying
- API endpoints: GET /api/logs, GET /api/logs/stats, GET /api/logs/recent
Frontend:
- LogView.vue with filters, stats, pagination, auto-refresh
- log.ts API client with TypeScript interfaces
- Added "运行日志" nav item to sidebar
2026-03-21 11:58:51 +08:00
|
|
|
{
|
|
|
|
|
path: 'logs',
|
|
|
|
|
name: 'logs',
|
|
|
|
|
component: () => import('@/views/LogView.vue'),
|
|
|
|
|
},
|
2026-03-21 10:13:35 +08:00
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
router.beforeEach((to, _from, next) => {
|
|
|
|
|
const auth = useAuthStore()
|
|
|
|
|
if (to.meta.requiresAuth && !auth.isAuthenticated) {
|
|
|
|
|
next('/login')
|
|
|
|
|
} else if (to.meta.guest && auth.isAuthenticated) {
|
|
|
|
|
next('/chat')
|
|
|
|
|
} else {
|
|
|
|
|
next()
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
export default router
|