import state from '../store/state.js';
// 开发环境不使用懒加载, 因为懒加载页面太多的话会造成webpack热更新太慢
const _import = require('./import-' + process.env.NODE_ENV)

function getProps (route) {
  return route.query;
}

// 系统生成路由
const routers = [
  { path: '/login', component: _import('login/index'), name: 'login', props: getProps, desc: '登录' },
  {
    path: '/',
    component: _import('login/index'),
    name: 'root'
  },
  // {path: '/aggregate', component: _import('welcome/index'), name: 'aggregate', meta: { title: '集群' }},
  {
    path: '/main',
    component: _import('layout/index'),
    name: 'main',
    props: getProps,
    redirect: {
      name: 'welcome'
    },
    meta: {
      title: '主页',
      showOnly: true
    },
    children: [
      { path: 'welcome', component: _import('welcome/index'), name: 'welcome', meta: { title: '欢迎' } },
      { path: 'formSysUser', component: _import('upms/formSysUser/index'), name: 'formSysUser', meta: { title: '用户管理' } },
      { path: 'formSysDept', component: _import('upms/formSysDept/index'), name: 'formSysDept', meta: { title: '部门管理' } },
      { path: 'formSysRole', component: _import('upms/formSysRole/index'), name: 'formSysRole', meta: { title: '角色管理' } },
      { path: 'formSysDataPerm', component: _import('upms/formSysDataPerm/index'), name: 'formSysDataPerm', meta: { title: '数据权限管理' } },
      { path: 'formSysMenu', component: _import(state.supportColumn ? 'upms/formSysMenu/formSysColumnMenu' : 'upms/formSysMenu/index'), name: 'formSysMenu', meta: { title: '菜单列表' } },
      { path: 'formSysDict', component: _import('upms/formDictManagement/index'), name: 'formSysDict', meta: { title: '字典管理' } },
      { path: 'formSysPermCode', component: _import('upms/formSysPermCode/index'), name: 'formSysPermCode', meta: { title: '权限字管理' } },
      { path: 'formSysPerm', component: _import('upms/formSysPerm/index'), name: 'formSysPerm', meta: { title: '权限资源管理' } },
      { path: 'formSysOperationLog', component: _import('upms/formSysOperationLog/index'), name: 'formSysOperationLog', meta: { title: '操作日志' } },
      { path: 'formSysLoginUser', component: _import('upms/formSysLoginUser/index'), name: 'formSysLoginUser', meta: { title: '在线用户' } },
      // 岗位模块路由配置
      { path: 'formSysPost', component: _import('upms/formSysPost/index'), name: 'formSysPost', meta: { title: '岗位管理' } },
      { path: 'formSysDeptPost', component: _import('upms/formSysDeptPost/index'), name: 'formSysDeptPost', props: getProps, meta: { title: '设置部门岗位' } },
      // 数据服务
      { path: 'myDataSet', component: _import('gptTraining/dataServices/myDataSet/index'), name: 'myDataSet', props: getProps, meta: { title: '我的数据集' } },
      // { path: 'presetDataSet', component: _import('gptTraining/dataServices/presetDataSet/index'), name: 'presetDataSet', props: getProps, meta: { title: '预制数据集' } },
      { path: 'onlineAnnotation', component: _import('gptTraining/dataServices/onlineAnnotation/index'), name: 'onlineAnnotation', props: getProps, meta: { title: '数据标注' } },
      { path: 'dataCleansing', component: _import('gptTraining/dataServices/dataCleansing/index'), name: 'dataCleansing', props: getProps, meta: { title: '数据清洗' } },
      { path: 'dataEnhancement', component: _import('gptTraining/dataServices/dataEnhancement/index'), name: 'dataEnhancement', props: getProps, meta: { title: '数据增强' } },
      // 模型管理
      { path: 'myModel', component: _import('gptTraining/modelManagement/myModel/index'), name: 'myModel', props: getProps, meta: { title: '我的模型' } },
      { path: 'modelSquare', component: _import('gptTraining/modelManagement/modelSquare/index'), name: 'modelSquare', props: getProps, meta: { title: '模型广场' } },
      { path: 'modelEvaluation', component: _import('gptTraining/modelManagement/modelEvaluation/index'), name: 'modelEvaluation', props: getProps, meta: { title: '模型评估' } },
      { path: 'modelCompression', component: _import('gptTraining/modelManagement/modelCompression/index'), name: 'modelCompression', props: getProps, meta: { title: '模型压缩' } },
      { path: 'modelDeployment', component: _import('gptTraining/modelManagement/modelDeployment/index'), name: 'modelDeployment', props: getProps, meta: { title: '模型部署' } },
      // 模型服务
      { path: 'serviceManagement', component: _import('gptTraining/modelService/serviceManagement/index'), name: 'serviceManagement', props: getProps, meta: { title: '在线服务' } },
      { path: 'applicationAccess', component: _import('gptTraining/modelService/applicationAccess/index'), name: 'applicationAccess', props: getProps, meta: { title: '应用接入' } },
      { path: 'testOnline', component: _import('gptTraining/modelService/testOnline/index'), name: 'testOnline', props: getProps, meta: { title: '在线测试' } },
      { path: 'callStatistics', component: _import('gptTraining/modelService/callStatistics/index'), name: 'callStatistics', props: getProps, meta: { title: '调用统计' } },
      // Prompt工程
      { path: 'promptTemplate', component: _import('gptTraining/promptProject/promptTemplate/index'), name: 'promptTemplate', props: getProps, meta: { title: 'Prompt模板' } },
      // { path: 'presetTemplate', component: _import('gptTraining/promptProject/presetTemplate/index'), name: 'presetTemplate', props: getProps, meta: { title: '预置模板' } },
      // { path: 'homemadeTemplate', component: _import('gptTraining/promptProject/homemadeTemplate/index'), name: 'homemadeTemplate', props: getProps, meta: { title: '自制模板' } },
      // { path: 'myCollection', component: _import('gptTraining/promptProject/myCollection/index'), name: 'myCollection', props: getProps, meta: { title: '我的收藏' } },
      // 模型精调
      { path: 'sft', component: _import('gptTraining/modelFineTuning/sft/index'), name: 'sft', props: getProps, meta: { title: 'SFT' } },
      {
        path: 'promptOptimization',
        component: _import('gptTraining/promptProject/promptOptimization/index'),
        name: 'promptOptimization',
        props: getProps,
        meta: { title: 'Prompt优化' },
        children: [
          {
            path: 'onLineOptimization',
            name: 'onLineOptimization',
            props: getProps,
            component: _import('gptTraining/promptProject/promptOptimization/onLineOptimization/index')
          }, {
            path: 'batchOptimization',
            name: 'batchOptimization',
            props: getProps,
            component: _import('gptTraining/promptProject/promptOptimization/batchOptimization/index')
          }

        ]
      },

      // { path: 'onLineOptimization', component: _import('gptTraining/promptProject/onLineOptimization/index'), name: 'onLineOptimization', props: getProps, meta: { title: '在线优化' } },
      // { path: 'batchOptimization', component: _import('gptTraining/promptProject/batchOptimization/index'), name: 'batchOptimization', props: getProps, meta: { title: '批量优化' } },
      // 知识库
      { path: 'knowledgeBase', component: _import('gptTraining/knowledgeBase/index'), name: 'knowledgeBase', props: getProps, meta: { title: '知识库' } },
      { path: 'knowledgeGraph', component: _import('gptTraining/knowledgeGraph/index'), name: 'knowledgeGraph', props: getProps, meta: { title: '知识图谱管理' } },
      { path: 'hitTest', component: _import('gptTraining/hitTest/index'), name: 'hitTest', props: getProps, meta: { title: '命中测试' } }
    ]
  }
];

export default routers;
