import { createRouter, createWebHistory } from 'vue-router'

const routes = [
  {
    path: '/',
    redirect: '/chat'
  },
  {
    path: '/management',
    name: 'SkillManagement',
    component: () => import('../views/SkillManagement.vue'),
    meta: { title: '技能管理' }
  },
  {
    path: '/skill/edit/:folderName',
    name: 'SkillEdit',
    component: () => import('../views/skill/SkillEdit.vue'),
    meta: { title: '编辑技能' }
  },
  {
    path: '/skill/generate',
    name: 'SkillGeneration',
    component: () => import('../views/skill/SkillGeneration.vue'),
    meta: { title: '技能生成' }
  },
  {
    path: '/orchestration',
    name: 'WorkflowList',
    component: () => import('../views/workflow/WorkflowList.vue'),
    meta: { title: '智能体编排' }
  },
  {
    path: '/orchestration/edit/:name?',
    name: 'WorkflowEditor',
    component: () => import('../views/workflow/WorkflowEditor.vue'),
    meta: { title: '编辑工作流' }
  },
  {
    path: '/templates',
    name: 'TemplateManagement',
    component: () => import('../views/workflow/TemplateManagement.vue'),
    meta: { title: '智能体模板' }
  },
  {
    path: '/tags',
    name: 'TagManagement',
    component: () => import('../views/TagManagement.vue'),
    meta: { title: '标签管理' }
  },
  {
    path: '/models',
    name: 'ModelManagement',
    component: () => import('../views/ModelManagement.vue'),
    meta: { title: '模型管理' }
  },
  {
    path: '/error-patterns',
    name: 'ErrorPatterns',
    component: () => import('../views/system/HermesErrorPatterns.vue'),
    meta: { title: '错误模式管理' }
  },
  {
    path: '/history',
    name: 'RunHistory',
    component: () => import('../views/workflow/RunHistory.vue'),
    meta: { title: '运行记录' }
  },
  {
    path: '/chat',
    name: 'AgentChat',
    component: () => import('../views/chat/ChatPage.vue'),
    meta: { title: 'Agent 对话' }
  },
  {
    path: '/kb/documents',
    name: 'KbDocumentManagement',
    component: () => import('../views/knowledge/DocumentManagement.vue'),
    meta: { title: '文档数据' }
  },
  {
    path: '/kb/datasources',
    name: 'DataSourceManagement',
    component: () => import('../views/knowledge/DataSourceManagement.vue'),
    meta: { title: '结构化数据' }
  },
  {
    path: '/kb/graphs',
    name: 'GraphSourceManagement',
    component: () => import('../views/knowledge/GraphSourceManagement.vue'),
    meta: { title: '知识图谱' }
  },
  {
    path: '/kb/rag-governance',
    name: 'RagGovernance',
    component: () => import('../views/knowledge/RagGovernance.vue'),
    meta: { title: '图谱治理' }
  },
  {
    path: '/kb/rag',
    name: 'RagWorkbench',
    component: () => import('../views/knowledge/RagWorkbench.vue'),
    meta: { title: 'RAG' }
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router
