feat: add avatar chat and knowledge workflow

This commit is contained in:
stefanfeng
2026-07-23 17:21:49 +08:00
parent 501f548bcc
commit 2d9f26a6f0
15 changed files with 3635 additions and 0 deletions
+106
View File
@@ -0,0 +1,106 @@
import { createRouter, createWebHashHistory } from 'vue-router'
import type { RouteRecordRaw } from 'vue-router'
const routes: RouteRecordRaw[] = [
{
path: '/',
name: 'AvatarCreate',
component: () => import('@/views/AvatarCreate.vue'),
meta: { title: '创建数字分身', requiresAuth: true }
},
{
path: '/avatar/manage',
name: 'AvatarManage',
component: () => import('@/views/AvatarManage.vue'),
meta: { title: '数字分身管理', requiresAuth: true }
},
{
path: '/avatar/edit/:id',
name: 'AvatarEdit',
component: () => import('@/views/AvatarEdit.vue'),
meta: { title: '形象微调编辑', requiresAuth: true }
},
{
path: '/avatar/chat/:id',
name: 'AvatarChat',
component: () => import('@/views/AvatarChat.vue'),
meta: { title: '和分身对话', requiresAuth: true }
},
{
path: '/authorization',
name: 'AuthorizationManage',
component: () => import('@/views/AuthorizationManage.vue'),
meta: { title: '授权管理', requiresAuth: true }
},
{
path: '/token/charge',
name: 'TokenCharge',
component: () => import('@/views/TokenCharge.vue'),
meta: { title: 'Token充值', requiresAuth: true }
},
{
path: '/avatar/card',
name: 'AvatarCard',
component: () => import('@/views/AvatarCard.vue'),
meta: { title: '分身名片', requiresAuth: true }
},
{
path: '/avatar/contacts',
name: 'AvatarContacts',
component: () => import('@/views/AvatarContacts.vue'),
meta: { title: '分身人脉', requiresAuth: true }
},
{
path: '/avatar/projects',
name: 'MyProjects',
component: () => import('@/views/MyProjects.vue'),
meta: { title: '我的项目', requiresAuth: true }
},
{
path: '/avatar/org/create',
name: 'CreateOrg',
component: () => import('@/views/CreateOrg.vue'),
meta: { title: '创建组织', requiresAuth: true }
},
{
path: '/knowledge',
name: 'KnowledgeManage',
component: () => import('@/views/KnowledgeManage.vue'),
meta: { title: '知识库管理', requiresAuth: true }
},
{
path: '/knowledge/qa/create',
name: 'QaPairCreate',
component: () => import('@/views/QaPairEdit.vue'),
meta: { title: '添加问答对', requiresAuth: true }
},
{
path: '/knowledge/qa/:qaId/edit',
name: 'QaPairEdit',
component: () => import('@/views/QaPairEdit.vue'),
meta: { title: '编辑问答对', requiresAuth: true }
},
{
path: '/login/sms',
name: 'SmsLogin',
component: () => import('@/views/SmsLogin.vue'),
meta: { title: '短信验证码登录' }
}
]
const router = createRouter({
// 混合架构下 web-view 内用 hash 模式,原生返回键与深链更稳
history: createWebHashHistory(),
routes
})
router.beforeEach((to, from, next) => {
document.title = to.meta.title as string || '会会数字分身'
if (to.meta.requiresAuth && !localStorage.getItem('hh_app_token')) {
next({ path: '/login/sms', query: { redirect: to.fullPath } })
return
}
next()
})
export default router