From a611045db232d1850f2a275db23fc1923a84dce0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B9=9B=E5=85=AE?= Date: Tue, 27 Oct 2026 10:25:51 +0800 Subject: [PATCH] =?UTF-8?q?feat(digital):=20=E6=96=B0=E5=A2=9E=E6=95=B0?= =?UTF-8?q?=E5=AD=97=E4=BA=BA=E5=86=85=E5=AE=B9=E5=BA=93=E5=92=8C=E5=AE=9E?= =?UTF-8?q?=E9=AA=8C=E8=BF=90=E8=90=A5=E5=90=8E=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 数字人内容库支持角色、世界书和预设管理;账号实验中心覆盖生命周期、指定用户、分组解释、漏斗和审计;更新星港品牌与默认导航,保留原兼容路由。 --- README.md | 15 +- public/logo.svg | 2 +- public/platform-config.json | 4 +- src/api/access.ts | 92 ++++ src/layout/types.ts | 69 +-- src/router/modules/digital.ts | 24 + src/router/modules/employees.ts | 3 + src/router/modules/home.ts | 4 +- src/views/digital/content.vue | 607 ++++++++++++++++++++++ src/views/digital/experiments.vue | 817 ++++++++++++++++++++++++++++++ src/views/login/index.vue | 5 +- 11 files changed, 1572 insertions(+), 70 deletions(-) create mode 100644 src/router/modules/digital.ts create mode 100644 src/views/digital/content.vue create mode 100644 src/views/digital/experiments.vue diff --git a/README.md b/README.md index bade4bc..cb0389d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # role-admin -门店员工权限管理后台,基于 `pure-admin-thin` 精简模板二次开发。当前业务聚焦门店、角色、员工三类基础数据管理,并通过 Vite 代理对接本地 `access-manage` 后端服务。 +星港数字人运营后台,基于现有 Vue 3 / Element Plus 管理端改造,角色、世界书、预设和账号实验统一由 `access-manage` 提供服务。原门店功能保留为兼容路由,默认进入数字人内容库。 ## 技术栈 @@ -67,7 +67,9 @@ http://localhost:8848/ │ ├── store/ # Pinia store,含用户、权限、标签页、主题等模块 │ ├── style/ # 全局样式、主题、暗色模式、侧边栏和过渡样式 │ ├── utils/ # 鉴权、HTTP、缓存、消息、进度条、树处理等工具 -│ └── views/ # 页面视图,当前业务页在 employees、roles、stores、permissions 和员工工作台运营模块 +│ └── views/ +│ ├── digital/ # 角色/世界书/预设内容库和账号实验中心 +│ └── ... # 原门店与员工业务兼容页面 ├── types/ # 全局类型声明、组件声明、路由声明和 Vue shim ├── AGENTS.md # Codex/Agent 入口规则,转到 RTK.md 并登记本地 skill ├── RTK.md # 本仓库协作规则与 README 同步要求 @@ -205,3 +207,12 @@ http://localhost:8848/ pnpm typecheck pnpm build ``` + +## 数字人运营 + +- `src/views/digital/content.vue`:角色卡、世界书、预设,草稿/发布/下架,JSON 导入导出。 +- `src/views/digital/experiments.vue`:账号实验全流程、指定用户、决策解释、曝光和审计。 +- `src/router/modules/digital.ts`:数字人菜单,只有超级管理员可见;接口仍集中在 `src/api/access.ts`,后端独立验证权限。 +- 保留既有员工管理模块和数据。沿用原 Vite 构建、域名与 Jenkins 发布。 + +管理端站内封面从 H5/Web 域名读取,可通过 `VITE_ROLE_USER_BASE_URL` 覆盖;默认按本地、develop、production 环境分别选择 localhost:3210、dev.mrzhan.top、mrzhan.top。 diff --git a/public/logo.svg b/public/logo.svg index a63d2b1..713b642 100644 --- a/public/logo.svg +++ b/public/logo.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/public/platform-config.json b/public/platform-config.json index d9905dc..bf65d52 100644 --- a/public/platform-config.json +++ b/public/platform-config.json @@ -1,6 +1,6 @@ { "Version": "6.2.0", - "Title": "门店权限后台", + "Title": "星港 · 数字人运营", "FixedHeader": true, "HiddenSideBar": false, "MultiTagsCache": false, @@ -15,7 +15,7 @@ "HideFooter": true, "Stretch": false, "SidebarStatus": true, - "EpThemeColor": "#2563EB", + "EpThemeColor": "#8b5d91", "ShowLogo": true, "ShowModel": "smart", "MenuArrowIconNoTransition": false, diff --git a/src/api/access.ts b/src/api/access.ts index ba96664..fdba03d 100644 --- a/src/api/access.ts +++ b/src/api/access.ts @@ -1,3 +1,4 @@ +/** 既有权限业务与数字人运营的统一后台接口。 */ import { http } from "@/utils/http"; /** @@ -1082,3 +1083,94 @@ export const listCredentialAudits = (params: CredentialAuditListParams) => { ) ); }; + +/** 数字人运营接口,管理配置不进入前台 BFF。 */ + +/** 统一响应结构。 */ +export type Result = { success: boolean; data: T }; +/** 数字人后台 API,复用已有 JWT 拦截器。 */ +export async function digital( + path: string, + method: "get" | "post" | "put" | "delete" = "get", + data?: unknown +): Promise { + try { + const result = await http.request>( + method, + `/api/digital-admin/${path}`, + data === undefined ? undefined : { data } + ); + return result.data; + } catch (error) { + const response = ( + error as { response?: { data?: { error?: { message?: string } } } } + ).response; + throw new Error( + response?.data?.error?.message ?? + (error instanceof Error ? error.message : "请求失败") + ); + } +} +/** 内容编辑表单,保留完整协议字段。 */ +export type Content = { + id: string; + kind: "character" | "worldbook" | "preset"; + name: string; + status: string; + version?: number; + body: { + description: string; + personality: string; + scenario: string; + greeting: string; + alternateGreetings: string[]; + examples: string; + systemPrompt: string; + gender: string; + age: number; + cover: string; + tags: string[]; + bookIds: string[]; + presetId?: string; + entries: Entry[]; + temperature: number; + maxTokens: number; + contextBudget: number; + worldBudget: number; + source: string; + }; +}; +/** 世界书条目。 */ +export type Entry = { + id: string; + name: string; + keys: string[]; + secondaryKeys: string[]; + content: string; + constant: boolean; + enabled: boolean; + priority: number; + position: string; + caseSensitive: boolean; + scanDepth: number; +}; +/** 账号实验:A/B 对应旧/新 UI 或两种后台预设。 */ +export type Experiment = { + id: string; + name: string; + scope: "ui" | "chat"; + state: "draft" | "running" | "paused" | "finished"; + revision?: number; + config: { + audience: "all" | "new" | "existing" | "specified"; + cutoff?: string; + accounts: string[]; + traffic: number; + weightB: number; + baseline: "A" | "B"; + winner?: "A" | "B"; + presetA?: string; + presetB?: string; + description: string; + }; +}; diff --git a/src/layout/types.ts b/src/layout/types.ts index 176a98c..5dfead4 100644 --- a/src/layout/types.ts +++ b/src/layout/types.ts @@ -3,73 +3,20 @@ import type { FunctionalComponent } from "vue"; /** * 登录后默认打开的标签页。 * - * 这里要和 `src/router/modules/employees.ts` 的业务页面保持一致, + * 这里要和 `src/router/modules/digital.ts` 的业务页面保持一致, * 否则登出重置标签页或首次进入后台时会出现空标签/错入口。 */ +/** 数字人后台默认标签,旧业务路由保留但不自动打开。 */ export const routerArrays: Array = [ { - path: "/stores", - name: "StoreManagement", - meta: { - title: "门店管理", - icon: "ep/shop" - } + path: "/digital/content", + name: "DigitalContent", + meta: { title: "角色与内容库", icon: "ep/collection" } }, { - path: "/roles", - name: "RoleManagement", - meta: { - title: "角色管理", - icon: "ep/key" - } - }, - { - path: "/employees", - name: "EmployeeManagement", - meta: { - title: "员工管理", - icon: "ep/user-filled" - } - }, - { - path: "/permissions", - name: "PermissionPolicies", - meta: { - title: "权限策略", - icon: "ep/key" - } - }, - { - path: "/announcements", - name: "AnnouncementManagement", - meta: { - title: "公告管理", - icon: "ep/bell" - } - }, - { - path: "/tasks", - name: "TaskManagement", - meta: { - title: "任务管理", - icon: "ep/tickets" - } - }, - { - path: "/shifts", - name: "ShiftManagement", - meta: { - title: "排班管理", - icon: "ep/calendar" - } - }, - { - path: "/credential-audits", - name: "CredentialAuditManagement", - meta: { - title: "凭据审计", - icon: "ep/document-checked" - } + path: "/digital/experiments", + name: "DigitalExperiments", + meta: { title: "账号实验中心", icon: "ep/data-analysis" } } ]; diff --git a/src/router/modules/digital.ts b/src/router/modules/digital.ts new file mode 100644 index 0000000..86b09be --- /dev/null +++ b/src/router/modules/digital.ts @@ -0,0 +1,24 @@ +/** 数字人运营菜单,只授予现有超级管理员,业务后端再次执行鉴权。 */ +const Layout = () => import("@/layout/index.vue"); +/** 内容库和实验中心复用原有后台壳。 */ +export default { + path: "/digital", + name: "DigitalOperations", + component: Layout, + redirect: "/digital/content", + meta: { title: "数字人运营", icon: "ep/chat-dot-round", rank: 0 }, + children: [ + { + path: "/digital/content", + name: "DigitalContent", + component: () => import("@/views/digital/content.vue"), + meta: { title: "角色与内容库", permission: "*" } + }, + { + path: "/digital/experiments", + name: "DigitalExperiments", + component: () => import("@/views/digital/experiments.vue"), + meta: { title: "账号实验中心", permission: "*" } + } + ] +} satisfies RouteConfigsTable; diff --git a/src/router/modules/employees.ts b/src/router/modules/employees.ts index aecf62d..03055d4 100644 --- a/src/router/modules/employees.ts +++ b/src/router/modules/employees.ts @@ -1,3 +1,4 @@ +/** 保留原门店业务路由,数字人改造后不占用主要导航。 */ const Layout = () => import("@/layout/index.vue"); /** @@ -15,6 +16,7 @@ export default [ meta: { icon: "ep/user-filled", title: "权限管理", + showLink: false, rank: 1 }, children: [ @@ -72,6 +74,7 @@ export default [ meta: { icon: "ep/operation", title: "员工工作台运营", + showLink: false, rank: 2 }, children: [ diff --git a/src/router/modules/home.ts b/src/router/modules/home.ts index 46b4ddd..c242bcd 100644 --- a/src/router/modules/home.ts +++ b/src/router/modules/home.ts @@ -3,14 +3,14 @@ const Layout = () => import("@/layout/index.vue"); /** * pure-admin 模板要求保留 Home 根路由。 * - * 当前业务首页是员工管理,所以根路径直接重定向到 `/employees`; + * 当前业务首页是数字人内容库,所以根路径直接重定向到 `/digital/content`; * `/welcome` 只作为隐藏工作台占位页保留。 */ export default { path: "/", name: "Home", component: Layout, - redirect: "/employees", + redirect: "/digital/content", meta: { icon: "ep/home-filled", title: "工作台", diff --git a/src/views/digital/content.vue b/src/views/digital/content.vue new file mode 100644 index 0000000..7bd295a --- /dev/null +++ b/src/views/digital/content.vue @@ -0,0 +1,607 @@ + + + diff --git a/src/views/digital/experiments.vue b/src/views/digital/experiments.vue new file mode 100644 index 0000000..b04e852 --- /dev/null +++ b/src/views/digital/experiments.vue @@ -0,0 +1,817 @@ + + + diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 79337f3..2066c91 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -1,4 +1,5 @@