152 Commits

Author SHA1 Message Date
0344ff2862 cicd
All checks were successful
自动部署 / 部署应用 (push) Successful in 5s
2026-06-02 23:40:31 +08:00
17bae862ed cicd
All checks were successful
自动部署 / 部署应用 (push) Successful in 6s
2026-06-02 23:04:38 +08:00
fb64b1a768 cicd
Some checks failed
自动部署 / 部署应用 (push) Failing after 6s
2026-06-02 23:03:08 +08:00
05c1f339e6 cicd
Some checks failed
自动部署 / 部署应用 (push) Failing after 1s
2026-06-02 23:00:25 +08:00
f822e319ba cicd 2026-06-02 23:00:03 +08:00
2962865857 cicd
Some checks failed
自动部署 / 部署应用 (push) Failing after 1s
2026-06-02 22:59:07 +08:00
5415da5b6c cicd
Some checks failed
自动部署 / 部署应用 (push) Failing after 1s
2026-06-02 22:55:39 +08:00
5149b68237 cicd
Some checks failed
自动部署 / 部署应用 (push) Failing after 1s
2026-06-02 22:52:45 +08:00
a6e7cca92b cicd 2026-06-02 22:52:36 +08:00
2c3700f4f8 cicd
Some checks failed
自动部署 / 部署应用 (push) Failing after 1m31s
2026-06-02 22:49:41 +08:00
1bcc63d5de cicd
Some checks failed
自动部署 / 部署应用 (push) Failing after 1s
2026-06-02 22:48:10 +08:00
9db3dfe675 cicd
Some checks failed
自动部署 / 部署应用 (push) Failing after 1s
2026-06-02 22:45:43 +08:00
9ee93bea60 cicd 2026-06-02 22:44:55 +08:00
04fd9f8c0e cicd
Some checks failed
自动部署 / 部署应用 (push) Failing after 1s
2026-06-02 22:44:03 +08:00
5f8e55a3a3 cicd
Some checks failed
自动部署 / 部署应用 (push) Failing after 1s
2026-06-02 22:41:52 +08:00
01ae26e869 cicd
Some checks failed
自动部署 / 部署应用 (push) Failing after 1s
2026-06-02 22:39:26 +08:00
bf61c4af4e cicd
Some checks failed
自动部署 / 部署应用 (push) Failing after 1s
2026-06-02 22:36:36 +08:00
f566a33865 cicd
Some checks failed
自动部署 / 部署应用 (push) Failing after 1s
2026-06-02 22:35:05 +08:00
d96fac324b cicd
Some checks failed
自动部署 / 部署应用 (push) Failing after 31s
2026-06-02 22:32:46 +08:00
c8129ce658 cicd
Some checks are pending
自动部署 / 部署应用 (push) Waiting to run
2026-06-02 22:31:23 +08:00
5b0783097d cicd
Some checks failed
自动部署 / 部署应用 (push) Has been cancelled
2026-06-02 22:29:18 +08:00
9cde482dfe cicd
Some checks failed
自动部署 / 部署应用 (push) Failing after 17m15s
2026-06-02 22:10:14 +08:00
8e793ea37f cicd
Some checks failed
自动部署 / deploy (push) Failing after 38s
2026-06-02 22:03:08 +08:00
dde1212a57 cicd
Some checks failed
自动部署 / deploy (push) Failing after 24s
2026-06-02 22:00:36 +08:00
6527eec133 https证书替换 2026-06-02 21:59:45 +08:00
2109903ba2 https证书替换 2026-06-02 21:58:10 +08:00
46dc2d4682 https证书替换
Some checks failed
部署 admin-ui 到 K3s / deploy (push) Failing after 22s
2026-06-02 21:54:58 +08:00
3c9d0dae22 https证书替换
Some checks failed
部署 admin-ui 到 K3s / deploy (push) Failing after 4s
2026-06-02 21:53:48 +08:00
b6a81848ea https证书替换
Some checks failed
部署 admin-ui 到 K3s / deploy (push) Failing after 4s
2026-06-02 21:52:57 +08:00
096fbb661d https证书替换
Some checks failed
部署 admin-ui 到 K3s / deploy (push) Failing after 5s
2026-06-02 21:51:45 +08:00
035c4ab000 https证书替换
Some checks failed
部署 admin-ui 到 K3s / deploy (push) Failing after 26s
2026-06-02 21:47:26 +08:00
1efff107f9 https证书替换
Some checks failed
部署 admin-ui 到 K3s / deploy (push) Failing after 23s
2026-06-02 21:44:45 +08:00
1795cd73c7 https证书替换
Some checks failed
部署 admin-ui 到 K3s / deploy (push) Failing after 43s
2026-06-02 21:36:43 +08:00
5f21126a62 https证书替换
Some checks failed
部署 admin-ui 到 K3s / deploy (push) Has been cancelled
2026-06-02 18:22:25 +08:00
2085588556 https证书替换
Some checks failed
部署 admin-ui 到 K3s / deploy (push) Failing after 0s
2026-06-02 18:18:35 +08:00
025a67ce45 https证书替换 2026-06-02 18:17:26 +08:00
cb806e19b1 https证书替换
Some checks failed
部署 admin-ui 到 K3s / deploy (push) Failing after 31s
2026-06-02 18:11:36 +08:00
d4680d258c https证书替换
Some checks failed
部署 admin-ui 到 K3s / deploy (push) Failing after 5s
2026-06-02 18:09:49 +08:00
a832883f17 https证书替换
Some checks failed
部署 admin-ui 到 K3s / deploy (push) Failing after 3s
2026-06-02 18:08:34 +08:00
c086285340 https证书替换
Some checks failed
部署 admin-ui 到 K3s / deploy (push) Failing after 22s
2026-06-02 18:05:30 +08:00
7fa05b0004 https证书替换
Some checks failed
部署 admin-ui 到 K3s / deploy (push) Failing after 36s
2026-06-02 18:03:09 +08:00
65cf893a5f https证书替换
Some checks failed
部署 admin-ui 到 K3s / deploy (push) Has been cancelled
2026-06-02 18:00:52 +08:00
e20ee8e065 https证书替换
Some checks failed
部署 admin-ui 到 K3s / deploy (push) Failing after 7s
2026-06-02 17:58:50 +08:00
7d8723715c https证书替换
Some checks failed
部署 admin-ui 到 K3s / deploy (push) Failing after 5s
2026-06-02 17:57:57 +08:00
49bb348707 https证书替换 2026-06-02 17:57:26 +08:00
ef6de1d12b https证书替换
Some checks failed
部署 admin-ui 到 K3s / deploy (push) Failing after 5s
2026-06-02 17:41:19 +08:00
c76a4e2018 ci/cd调整
Some checks failed
部署 admin-ui 到 K3s / deploy (push) Failing after 6s
2026-06-02 15:48:27 +08:00
e504f806a9 ci/cd调整 2026-06-02 15:46:05 +08:00
68d9767bd8 ci/cd调整 2026-06-02 15:43:16 +08:00
ccbf6de863 新增提示词管理 2026-06-02 14:52:01 +08:00
d3a315525e 自定义表单相关 2026-06-02 11:38:56 +08:00
38e15ed562 环境相关 2026-06-02 11:35:39 +08:00
c7fba23e3b 模型配置自定义表单 2026-06-02 11:35:00 +08:00
b60583008b 增强节点数据处理逻辑,支持整体输出选项的添加和引用字段的回显,优化 HTTP 请求体配置的参数处理。 2026-05-29 18:07:09 +08:00
542895c61c 新增工作空间面板,支持树形结构展示和文件预览功能;重构输入栏以集成常用工作流选择,优化用户交互体验;更新侧边栏以简化历史记录管理。 2026-05-29 16:56:09 +08:00
538e153473 更新模型选择器以支持更多模型类型,重构输入栏以移除快捷指令和工作流功能,新增工作空间功能以支持文件预览和下载,优化工作流组件以增强节点数据处理的可选性和安全性。 2026-05-29 14:20:27 +08:00
78d1fd93c8 优化工作流组件,增强节点数据处理的可选性和安全性,修复潜在的空值引用问题。 2026-05-29 10:19:53 +08:00
032f258912 重构工作流绘制 2026-05-28 17:55:49 +08:00
9bd4a44ab6 首页样式优化 2026-05-28 11:10:03 +08:00
4174c424fc 知识库相关 2026-05-27 15:29:18 +08:00
0d946c050e 优化修改 2026-05-27 11:24:51 +08:00
95f020047d 首页优化 2026-05-26 17:58:23 +08:00
7fe519df28 Merge branch 'feature/workflow' of http://116.204.74.41:3000/red-future/admin-ui into feature/workflow 2026-05-26 16:01:16 +08:00
f0e36381d3 重构首页 2026-05-26 16:01:13 +08:00
2c4d52ef63 https证书替换 2026-05-26 11:28:45 +08:00
ded04de609 Merge branch 'feature/workflow' of http://116.204.74.41:3000/red-future/admin-ui into feature/workflow 2026-05-26 10:11:26 +08:00
5152121c33 fix: 更新开发环境 API 地址并增强 editModule.vue 表单验证
- 在 editModule.vue 中添加响应字段和请求映射的验证逻辑,确保用户输入有效性,提升表单提交的可靠性。
2026-05-26 10:11:21 +08:00
470474c189 http自动跳转到https 2026-05-26 09:17:26 +08:00
bf5635f8e3 增加密码策略配置 2026-05-26 09:04:32 +08:00
7903c0c133 Merge remote-tracking branch 'origin/master' into feature/workflow 2026-05-25 12:27:54 +08:00
694577f2a6 增加密码策略配置
Some checks failed
全局K3s部署 / deploy (push) Failing after 2s
2026-05-25 12:27:34 +08:00
6db7f5ed8c dockerfile
Some checks failed
全局K3s部署 / deploy (push) Failing after 31s
2026-05-23 18:01:03 +08:00
3bf2732906 dockerfile
Some checks failed
全局K3s部署 / deploy (push) Failing after 31s
2026-05-23 17:57:59 +08:00
4cade1ab94 Merge branch 'feature/workflow' of http://116.204.74.41:3000/red-future/admin-ui into feature/workflow 2026-05-23 17:56:56 +08:00
27de8213f2 feat: 添加 queryConfig 字段及相关配置功能
- 在 CreateModelParams 接口中新增 queryConfig 字段,支持更灵活的查询配置。
- 更新 ModelSelector 组件,优化模型选择界面,增强用户体验。
- 在 editModule.vue 中添加响应类型选择及主动拉取配置功能,提升配置灵活性与可用性。
2026-05-23 17:56:52 +08:00
a48924d27c dockerfile
Some checks failed
全局K3s部署 / deploy (push) Failing after 1m43s
2026-05-23 17:51:32 +08:00
a64dd22538 dockerfile
Some checks failed
全局K3s部署 / deploy (push) Has been cancelled
2026-05-23 17:49:18 +08:00
2c435446c4 dockerfile
Some checks failed
全局K3s部署 / deploy (push) Has been cancelled
2026-05-23 17:46:21 +08:00
d6d5cba95a dockerfile
Some checks failed
全局K3s部署 / deploy (push) Has been cancelled
2026-05-23 17:43:49 +08:00
885ea3e743 dockerfile
Some checks failed
全局K3s部署 / deploy (push) Has been cancelled
2026-05-23 17:42:28 +08:00
b941ab73ed dockerfile
Some checks failed
全局K3s部署 / deploy (push) Has been cancelled
2026-05-23 17:41:16 +08:00
72134d6004 dockerfile
Some checks failed
全局K3s部署 / deploy (push) Has been cancelled
2026-05-23 17:40:38 +08:00
f5ff8164a9 dockerfile
Some checks failed
全局K3s部署 / deploy (push) Has been cancelled
2026-05-23 17:39:20 +08:00
12d091d366 dockerfile
Some checks failed
全局K3s部署 / deploy (push) Has been cancelled
2026-05-23 17:38:36 +08:00
5771e196f9 dockerfile
Some checks failed
全局K3s部署 / deploy (push) Has been cancelled
2026-05-23 17:26:24 +08:00
5e9553d43b dockerfile
Some checks failed
全局K3s部署 / deploy (push) Failing after 5s
2026-05-23 17:22:25 +08:00
3370dde8cb dockerfile
Some checks failed
全局K3s部署 / deploy (push) Failing after 4s
2026-05-23 17:21:17 +08:00
5ec36b5b15 dockerfile
Some checks failed
全局K3s部署 / deploy (push) Failing after 4s
2026-05-23 17:19:55 +08:00
dedabb332e dockerfile
Some checks failed
全局K3s部署 / deploy (push) Failing after 5s
2026-05-23 17:18:52 +08:00
61a6c143ad dockerfile
All checks were successful
全局K3s部署 / deploy (push) Successful in 6s
2026-05-23 17:12:26 +08:00
a8fb18a3e5 dockerfile
Some checks failed
全局K3s部署 / deploy (push) Failing after 1s
2026-05-23 17:11:40 +08:00
172659369c dockerfile
Some checks failed
全局K3s部署 / deploy (push) Failing after 1s
2026-05-23 17:06:02 +08:00
c327ad6c1d dockerfile
Some checks failed
全局K3s部署 / deploy (push) Failing after 2s
2026-05-23 17:05:03 +08:00
354ab26232 dockerfile
Some checks failed
全局K3s部署 / deploy (push) Failing after 2s
2026-05-23 17:04:05 +08:00
274b921b9a dockerfile
Some checks failed
全局K3s部署 / deploy (push) Failing after 31s
2026-05-23 17:02:04 +08:00
9cab1b2fcf dockerfile
Some checks failed
全局K3s部署 / deploy (push) Failing after 30s
2026-05-23 17:00:51 +08:00
887d681bbf dockerfile
Some checks failed
全局K3s部署 / deploy (push) Failing after 5s
2026-05-23 16:59:53 +08:00
c93f651bf4 dockerfile
All checks were successful
全局K3s部署 / deploy (push) Successful in 7s
2026-05-23 16:55:02 +08:00
cda75d1e6d dockerfile
All checks were successful
全局K3s部署 / deploy (push) Successful in 7s
2026-05-23 16:53:26 +08:00
7316d551ce dockerfile
Some checks failed
全局K3s部署 / deploy (push) Has been cancelled
2026-05-23 16:47:35 +08:00
301b03e97f dockerfile
Some checks are pending
全局K3s部署 / deploy (push) Waiting to run
2026-05-23 16:34:08 +08:00
cd6e56e09d dockerfile
All checks were successful
全局K3s部署 / deploy (push) Successful in 5s
2026-05-23 16:32:14 +08:00
aa3a609783 dockerfile 2026-05-23 16:31:39 +08:00
bcef0f9bc1 dockerfile 2026-05-23 16:31:17 +08:00
e9d088fa8d dockerfile 2026-05-23 16:30:03 +08:00
86a7ff1573 Merge remote-tracking branch 'origin/feature/workflow'
# Conflicts:
#	.gitea/workflows/deploy.yml
2026-05-23 16:29:03 +08:00
cb7e36ad03 封版 2026-05-23 16:28:44 +08:00
7c60e34de0 模型配置字段相关修改 2026-05-23 15:04:59 +08:00
38166cb0b8 feat: 添加删除选中元素功能与保存工作流对话框组件
- 新增删除选中元素的按钮,支持对节点的删除操作,并处理下级节点引用的清理。
- 将保存工作流对话框重构为独立组件,提升代码可读性与复用性。
- 优化了预览功能的代码结构,确保视频展示的样式一致性。
2026-05-23 10:22:25 +08:00
ce70f86000 feat: 增强预览功能与文件下载逻辑
- 更新预览弹窗,支持图片、视频和音频格式的展示。
- 添加 fileType 字段以支持不同文件类型的处理。
- 优化下载逻辑,根据文件类型自动设置默认扩展名,并在下载成功提示中显示文件类型。
2026-05-22 18:44:34 +08:00
e357f93779 Merge branch 'feature/workflow' of http://116.204.74.41:3000/red-future/admin-ui into feature/workflow 2026-05-22 18:20:42 +08:00
010db1e7bc refactor: 优化创作页面文件上传逻辑与样式
- 调整了文件上传按钮的样式和结构,提升了可读性。
- 规范化了文件上传状态管理,确保用户体验一致性。
- 更新了动态表单值处理逻辑,支持更灵活的字段扩展管理。
- 清理了动态表单值,确保在节点切换时正确重置相关字段。
2026-05-22 18:20:39 +08:00
f4626987f1 封版
All checks were successful
全局K3s部署 / deploy (push) Successful in 6s
2026-05-22 14:35:30 +08:00
b1ba7f9e13 dockerfile
All checks were successful
全局K3s部署 / deploy (push) Successful in 9s
2026-05-22 14:21:06 +08:00
672258d486 dockerfile
Some checks failed
全局K3s部署 / deploy (push) Failing after 25s
2026-05-22 14:15:27 +08:00
3b1e6ac061 dockerfile
Some checks failed
全局K3s部署 / deploy (push) Failing after 2s
2026-05-22 14:13:52 +08:00
d3322323ac dockerfile
Some checks failed
全局K3s部署 / deploy (push) Failing after 31s
2026-05-22 13:59:07 +08:00
324d47891f Merge remote-tracking branch 'origin/master' into feature/workflow 2026-05-22 13:43:57 +08:00
ff643b6ed0 dockerfile
Some checks failed
全局K3s部署 / deploy (push) Failing after 22m5s
2026-05-22 13:34:42 +08:00
d507112829 feat: 更新 Nginx 配置以支持新的网页和后台管理端路径
- 修改根路径重定向至网页端的 index.html。
- 新增网页端和后台管理端的路径配置,确保静态资源正确加载。
- 优化了静态文件查找和代理逻辑,提升了请求处理效率。
2026-05-22 13:34:10 +08:00
c095b81e7b dockerfile
Some checks failed
全局K3s部署 / deploy (push) Has been cancelled
2026-05-22 13:27:09 +08:00
01e5343e02 dockerfile
Some checks failed
全局K3s部署 / deploy (push) Has been cancelled
2026-05-22 13:24:12 +08:00
020368324c dockerfile
Some checks failed
全局K3s部署 / deploy (push) Has been cancelled
2026-05-22 13:23:57 +08:00
e32b01337a feat: 增强模型配置与创建表单功能
- 在 NodeLibraryFormItem 和 WorkflowItem 接口中添加了新的字段,如 value、options、expand 和 outputParams,以支持更复杂的表单配置。
- 新增 getOperatorList 函数以获取服务商列表,并在 editModule.vue 中集成了运营商选择功能。
- 更新了模型创建和编辑逻辑,支持 tokenConfig 的 JSON 格式配置,确保更灵活的模型设置。
- 优化了文件上传处理,增加了上传状态管理,提升用户体验。
2026-05-22 13:22:45 +08:00
70c9ced4ff dockerfile 2026-05-22 13:14:33 +08:00
8f7c25c5e0 dockerfile 2026-05-22 12:01:30 +08:00
8b5eedb308 nginx部署相关 2026-05-22 09:33:40 +08:00
016fc821de feat: 优化创作模式表单与上传样式 2026-05-21 23:56:29 +08:00
07efaf9cc3 dockerfile 2026-05-20 17:55:34 +08:00
97d6921b11 https节点表单更改 2026-05-19 16:57:34 +08:00
727e9fa9c0 增加单个上传和多个上传 2026-05-19 14:52:17 +08:00
f64d6334e2 针对https节点改动 2026-05-19 13:55:11 +08:00
7f28b3fd5d 腾讯广告样式滚动条调整 2026-05-18 17:14:59 +08:00
c527c32a63 新增resultUrl执行传参 2026-05-18 11:37:15 +08:00
4baf6946a3 refactor(settings/creation): 调整模型配置和响应数据的存储结构
重构了节点数据中模型配置和响应的处理逻辑,将modelResponse整合到modelConfig内部,移除平级的modelResponse字段,统一数据存储结构,同时简化了响应数据的获取逻辑。
2026-05-15 15:55:28 +08:00
04188aae83 feat(ads/compliance/tencent): 优化视频预览展示效果
将原先的播放图标预览替换为视频缩略图预览,添加播放遮罩层并优化 hover 交互效果,无预览地址时仍显示原播放图标
2026-05-15 15:04:36 +08:00
f1cfa21118 feat(ads/compliance): add account select filter and optimize csv export
1. 新增获取广告账户列表的API接口
2. 将搜索表单的账户ID输入框改为下拉选择器
3. 优化CSV导出的表头和日期格式处理,避免Excel解析问题
2026-05-15 14:48:33 +08:00
1991f74b7e feat(ads/compliance/tencent): 新增导出失败素材接口并优化校验页面功能
1. 新增导出驳回素材的API接口和前端导出逻辑,统一处理图片/视频素材导出
2. 移除旧的批量校验、刷新、手动送检功能,重构日志查看逻辑
3. 优化预览弹窗样式,调整表格列宽和日志表格展示字段
4. 替换旧的本地导出实现为后端接口导出方式
2026-05-15 14:35:19 +08:00
c70bf33260 1. 增加校验日志弹窗组件,支持查看素材校验详情
2. 调整预览列和操作列宽度优化页面布局
3. 新增日志状态样式类,适配不同类型日志展示
4. 移除冗余的页面头部标题和描述文本
2026-05-15 13:15:24 +08:00
ba85a35c88 refactor(ads/compliance/tencent): 重构腾讯素材校验页面布局与逻辑
1.  移除统计卡片组件,调整页面整体结构为卡片式布局
2.  移除校验日志相关页面、逻辑与接口调用
3.  优化表格列配置与工具栏样式
4.  简化筛选表单结构,统一组件样式
5.  更新页面类名与全局样式适配新布局
2026-05-15 13:07:38 +08:00
aca0fda28a fix(ads/compliance/tencent): 调整导出按钮功能与文案,仅导出失败素材
修改了图片和视频导出按钮的文本与导出逻辑,现在只会导出审核状态为REJECTED的失败素材,同时更新了对应的提示信息和导出文件名
2026-05-15 11:22:30 +08:00
4d23052e66 feat: 新增腾讯广告素材合规校验管理页面及接口
新增了腾讯图片/视频素材自动校验的完整业务页面,包含统计看板、素材列表管理、校验日志查询等功能,同时封装了对应的后端请求接口。
2026-05-15 10:51:06 +08:00
061ab6b303 fix(modelModule): add enabled 2026-05-15 09:28:33 +08:00
49995dfbc2 fix(model): 将接口参数status改为enabled
统一将两处列表查询的参数从status改为enabled,匹配后端接口参数定义
2026-05-15 09:26:42 +08:00
a835f54c67 fix(model,settings): 给模型查询接口添加上status=1参数
在两个模型列表查询的请求参数中新增status=1,仅查询启用状态的模型数据
2026-05-15 09:23:36 +08:00
6ac6cc4659 优化创作模式表单界面
- 将创作表单面板的类名更改为 `creation-main-panel`,提升代码可读性。
- 新增表单折叠功能,允许用户展开或收起表单,改善用户体验。
- 调整表单项的显示逻辑,确保在没有配置时显示占位信息。
- 更新历史对话区域的样式和内容展示,增强界面友好性。
2026-05-14 14:00:07 +08:00
caa5cc71c7 更新模型选择和设置功能
- 修改模型选择器,调整内置模型的标识逻辑,使用 `isOwner` 属性替代 `apiKey` 判断。
- 新增内置模型 API Key 输入弹窗,支持用户为内置模型配置 API Key 并创建模型副本。
- 更新模型配置页面,优化内置模型的 API Key 配置逻辑,确保用户体验流畅。
2026-05-14 11:36:41 +08:00
812b11bb68 删除不再使用的数字人创作和模型配置相关文件,优化项目结构,提升代码可维护性。 2026-05-13 16:00:52 +08:00
bd2195ee06 移除设置对话模型,和工作流刷新按钮 2026-05-13 13:46:13 +08:00
5735eabe04 增强文件上传功能
- 在创作模式中,支持从工作空间获取文件 URL,提升文件处理的灵活性。
- 处理 API 返回的文件 URL,确保正确构建文件链接,优化用户体验。
2026-05-13 13:18:52 +08:00
b6b2dfa2d9 优化用户技能管理功能
- 在技能 API 中新增 `getUserSkillDetail` 和 `updateUserSkill` 函数,支持获取和更新用户技能。
- 更新技能列表页面,改进搜索栏和技能表格展示,提升用户体验。
- 修改文件上传提示,明确支持的文件格式和要求。
2026-05-13 11:14:42 +08:00
ba4bf7cd7f 新增用户技能管理功能
- 在技能 API 中新增 `getUserSkillDetail` 和 `updateUserSkill` 函数,支持获取用户技能详情和更新用户技能。
- 更新技能列表页面,优化搜索栏和技能表格展示,提升用户体验。
- 修改文件上传提示,明确支持的文件格式和要求。
2026-05-13 10:45:12 +08:00
53 changed files with 11078 additions and 2183 deletions

View File

@@ -38,10 +38,10 @@ module.exports = {
'@typescript-eslint/no-redeclare': 'error',
'@typescript-eslint/no-non-null-asserted-optional-chain': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
'warn',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
varsIgnorePattern: '^_|props|watch',
caughtErrorsIgnorePattern: '^_',
},
],
@@ -64,6 +64,11 @@ module.exports = {
'vue/no-parsing-error': 'off',
'vue/no-deprecated-v-on-native-modifier': 'off',
'vue/multi-word-component-names': 'off',
'vue/no-reserved-component-names': 'off',
'vue/no-v-for-template-key': 'off',
'vue/no-unused-vars': 'off',
'vue/no-mutating-props': 'off',
'no-mixed-spaces-and-tabs': 'off',
'no-useless-escape': 'off',
'no-sparse-arrays': 'off',
'no-prototype-builtins': 'off',
@@ -77,8 +82,8 @@ module.exports = {
'no-unused-vars': 'off',
'no-v-model-argument': 'off',
'no-case-declarations': 'off',
'no-console': 'error',
'no-debugger': 'error',
'no-console': 'off',
'no-debugger': 'warn',
'no-redeclare': 'off',
},
};

View File

@@ -0,0 +1,11 @@
name: 自动部署
on:
push:
branches: [ master ]
jobs:
部署应用:
runs-on: ubuntu-latest
steps:
- name: 启动部署
run: |
docker exec gitea-runner /opt/deploy.sh

110
CLAUDE.md Normal file
View File

@@ -0,0 +1,110 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Project Overview
This is the **GFast UI** project (`gfast-ui`), a Vue 3 admin management system based on the vue-next-admin template, customized for a digital advertising/trading platform.
## Commands
- `npm install` - Install dependencies (use `npm install --registry=https://registry.npmmirror.com` for China mainland)
- `npm run dev` - Start development server
- `npm run build` - Build for production
- `npm run lint` - Run ESLint check
- `npm run lint-fix` - Fix ESLint issues automatically
- `npm run type-check` - Run TypeScript type checking
- `npm run quality` - Run both lint and type-check
## Architecture Overview
**Tech Stack:**
- Vue 3 with Composition API (script setup)
- TypeScript
- Vite
- Element Plus (UI framework)
- Pinia (state management)
- Vue Router (with hash mode)
- Axios (HTTP client)
- i18n (internationalization)
- mitt (event bus)
**Directory Structure:**
- `src/api/` - API client methods organized by business domain (ads, assets, cid, customerService, digitalHuman, knowledge, login, menu, settings, system, etc.)
- `src/components/` - Reusable Vue components
- `src/directives/` - Custom Vue directives
- `src/i18n/` - Internationalization configuration
- `src/layout/` - Main layout components
- `src/router/` - Route configuration
- `index.ts` - Router setup and guard
- `backEnd.ts` - Backend-controlled route initialization
- `frontEnd.ts` - Frontend-controlled route initialization
- `route.ts` - Static route definitions
- `src/stores/` - Pinia state stores
- `themeConfig.ts` - Theme and global configuration
- `userInfo.ts` - User information
- `routesList.ts` - Dynamic route management
- `keepAliveNames.ts` - keep-alive cache management
- `src/theme/` - Theme related styles
- `src/types/` - TypeScript type definitions
- `src/utils/` - Utility functions
- `request.ts` - Axios instance with interceptors, error handling, and token management
- `storage.ts` - Session storage wrapper
- `gfast.ts` - GFast-specific helpers (file URL construction, tree building, date formatting)
- `diffUtils.ts` - Field change detection for PUT requests
- `src/views/` - Page components organized by business module
**Key Patterns:**
1. **Routing**: Supports both frontend and backend controlled routing. When backend control is enabled (`isRequestRoutes: true` in themeConfig), routes are fetched from the backend and dynamically added.
2. **API Requests**:
- API methods are organized by domain in `src/api/` (each subdomain has its own directory structure)
- The Axios instance in `src/utils/request.ts` is pre-configured with:
- 50 second request timeout
- `qs` serialization of query parameters with dot notation for nested objects
- Automatically adds Bearer token (from cookies via Session utility) to all requests
- Automatically sends only changed fields for PUT requests (diff comparison with original data via `_originalData` field)
- Handles token expiration globally with redirect to login (prevents multiple overlapping popups)
- Provides error message extraction from multiple response formats (`message`, `msg`, `error`, `detail`)
- Error throttling: maximum one error message every 2 seconds
- Supports error mode configuration via `requestOptions.errorMode`:
- `global`: (default) Global error popup with backend message
- `page`: No automatic popup, reject the error for page-level handling
- `silent`: Completely silent, no error display
- Special handling for `code === 402`: Triggers module not enabled subscription flow (except for specific asset endpoints)
- Response format expects `code`, `message`/`msg`, and data. Known success codes: `0`, `200`.
- Use `getApiErrorMessage(error)` from `/@/utils/request` to extract user-friendly error messages in catch blocks when using `page` or `silent` mode.
3. **Global Properties & Components**:
- Helpers registered globally for template use:
- `getUpFileUrl`, `handleTree`, `useDict`, `selectDictLabel`, `parseTime`, `getItems`, `setItems`, `getOptionValue`, `isEmpty`
- Global components:
- `pagination` - Reusable pagination component
- Global plugins registered:
- `vue-simple-uploader` - Large file upload component
- Global event bus via mitt: `app.config.globalProperties.mittBus`
4. **Authentication**:
- Token is stored in cookies via `js-cookie` (through the `Session` utility). Other user session data is stored in `sessionStorage`.
- The `Session.clearAuth()` method only clears authentication-related keys (`token`, `userInfo`, `userMenu`, `permissions`), preserving other local preferences.
- 401 responses (HTTP or business code) containing token expiration signals trigger automatic logout with a single confirmation popup.
5. **Keep-alive**: Route components can be cached via keep-alive, managed by the `useKeepALiveNames` store.
## Environment Variables
- `.env.development` - Development environment settings
- `.env.production` - Production environment settings
- `VITE_API_URL` - Backend API base URL
- `VITE_PORT` - Dev server port
- `VITE_PUBLIC_PATH` - Public base path for production build
- `VITE_OPEN_CDN` - Enable CDN for external dependencies
## Development Notes
- The project uses `/@` alias for `src/`
- Components use the Composition API with `<script setup lang="ts">`
- Styling is done with SCSS
- ESLint enforces code quality
- Node version requirement: `>=16.0.0` (supported: v16.x ~ v20.x)

View File

@@ -1,9 +1,8 @@
FROM node:18-alpine
# 配置Alpine国内镜像源加速apk
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
# ==================== 第一阶段:构建前端 ====================
FROM node:18-alpine AS builder
WORKDIR /app
# 配置Alpine国内镜像源
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
COPY package*.json ./
@@ -11,6 +10,20 @@ RUN npm install --registry=https://registry.npmmirror.com
COPY . .
EXPOSE 8080
RUN npm run build
CMD ["npm", "run", "dev"]
# ==================== 第二阶段部署到Nginx ====================
FROM nginx:alpine
# 复制构建产物
COPY --from=builder /app/dist/ /usr/share/nginx/html/
# 复制nginx配置文件
COPY ngnix.conf /etc/nginx/conf.d/default.conf
# 复制SSL证书
COPY ssl/* /etc/nginx/ssl/
EXPOSE 80 443
CMD ["nginx", "-g", "daemon off;"]

16
Dockerfile.bak Normal file
View File

@@ -0,0 +1,16 @@
FROM node:18-alpine
# 配置Alpine国内镜像源加速apk
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
WORKDIR /app
COPY package*.json ./
RUN npm install --registry=https://registry.npmmirror.com
COPY . .
EXPOSE 8080
CMD ["npm", "run", "dev"]

26
k8s/deployment.yaml Normal file
View File

@@ -0,0 +1,26 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: admin-ui
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: admin-ui
template:
metadata:
labels:
app: admin-ui
spec:
containers:
- name: admin-ui
image: 116.204.74.41:3000/red-future/admin-ui:latest
imagePullPolicy: Always
ports:
- containerPort: 80
- containerPort: 443
resources:
limits:
memory: "512Mi"
cpu: "500m"

20
k8s/ingress.yaml Normal file
View File

@@ -0,0 +1,20 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: admin-ui
annotations:
nginx.ingress.kubernetes.io/ssl-redirect: "true"
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
spec:
tls:
- secretName: admin-ui-tls
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: admin-ui
port:
number: 443

15
k8s/service.yaml Normal file
View File

@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: admin-ui
spec:
selector:
app: admin-ui
ports:
- name: http
port: 80
targetPort: 80
- name: https
port: 443
targetPort: 443
type: ClusterIP

62
ngnix.conf Normal file
View File

@@ -0,0 +1,62 @@
# Nginx 静态文件服务 + 智能代理
# HTTP 重定向到 HTTPS
server {
listen 80;
server_name _;
return 301 https://$host$request_uri;
}
server {
# 静态资源根目录dist
root /usr/share/nginx/html;
index index.html;
# SSL 配置
listen 443 ssl;
ssl_certificate /etc/nginx/ssl/scs1779764972146_redpowerfuture.com_server.crt;
ssl_certificate_key /etc/nginx/ssl/scs1779764972146_redpowerfuture.com_server.key;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
# 根路径默认进入网页端
location = / {
return 302 /web/index.html;
}
# 网页端public/web/index.html -> dist/web/index.html
location /web/ {
alias /usr/share/nginx/html/web/;
try_files $uri $uri/ /web/index.html;
}
# 后台管理端dist/index.html前缀 /sys/
location /sys/ {
alias /usr/share/nginx/html/;
try_files $uri $uri/ /sys/index.html;
}
# 1. 先尝试作为静态文件查找
location / {
try_files $uri $uri/ @proxy;
}
# 2. 无法找到的请求API路径代理到后端
location @proxy {
# 判断 URI 最后一段是否有扩展名
# 有扩展名返回 404无扩展名则代理
if ($uri ~ \.[^./]+$) {
return 404;
}
proxy_pass http://116.204.74.41:8000;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_connect_timeout 30s;
proxy_send_timeout 30s;
proxy_read_timeout 30s;
}
}

260
package-lock.json generated
View File

@@ -14,6 +14,10 @@
"@element-plus/icons-vue": "^2.3.1",
"@logicflow/core": "^2.2.1",
"@logicflow/extension": "^2.2.1",
"@vue-flow/background": "^1.3.2",
"@vue-flow/controls": "^1.1.3",
"@vue-flow/core": "^1.48.2",
"@vue-flow/minimap": "^1.5.4",
"@wangeditor/editor": "^5.1.23",
"axios": "1.8.2",
"codemirror": "^6.0.1",
@@ -923,7 +927,6 @@
"resolved": "https://registry.npmjs.org/@interactjs/core/-/core-1.10.27.tgz",
"integrity": "sha512-SliUr/3ZbLAdED8LokzYzWHWMdCB5Cq+UnpXuRy+BIod1j97m4IUFf/D1iIKUBBjBcucgXbz28z96WnenVCB7Q==",
"license": "MIT",
"peer": true,
"peerDependencies": {
"@interactjs/utils": "1.10.27"
}
@@ -994,7 +997,6 @@
"resolved": "https://registry.npmjs.org/@interactjs/modifiers/-/modifiers-1.10.27.tgz",
"integrity": "sha512-ei/qfoQ+9/8k6WzNzdNqHI6cWkIV576N4Ap16r5CoqOWwhA6Xzj3OMHf1g0t1O4eSq2HdJsVJn3eLNfw9HsbeQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"@interactjs/snappers": "1.10.27"
},
@@ -1061,8 +1063,7 @@
"version": "1.10.27",
"resolved": "https://registry.npmjs.org/@interactjs/utils/-/utils-1.10.27.tgz",
"integrity": "sha512-+qfLOio2OxQqg1cXSnRaCl+N8MQDQLDS9w+aOGxH8YLAhIMyt7Asxx/46//sT8orgsi16pmlBPtngPHT9s8zKw==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/@intlify/core-base": {
"version": "11.1.2",
@@ -1154,7 +1155,6 @@
"resolved": "https://registry.npmjs.org/@logicflow/core/-/core-2.2.1.tgz",
"integrity": "sha512-VzLPrCrT4eXnOLjoGQ5v4GUSay3+6rd3YNZD0qOJw4vME5e4WjQ5fd+hKK2zlIzgdRI4D54dXiEFJrS6xdV6yQ==",
"license": "Apache-2.0",
"peer": true,
"dependencies": {
"classnames": "^2.3.2",
"lodash-es": "^4.17.21",
@@ -1908,7 +1908,6 @@
"resolved": "https://registry.npmjs.org/@types/lodash-es/-/lodash-es-4.17.12.tgz",
"integrity": "sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"@types/lodash": "*"
}
@@ -1919,7 +1918,6 @@
"integrity": "sha512-ZsJzA5thDQMSQO788d7IocwwQbI8B5OPzmqNvpf3NY/+MHDAS759Wo0gd2WQeXYt5AAAQjzcrTVC6SKCuYgoCQ==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"undici-types": "~6.21.0"
}
@@ -1991,7 +1989,6 @@
"integrity": "sha512-4Z+L8I2OqhZV8qA132M4wNL30ypZGYOQVBfMgxDH/K5UX0PNqTu1c6za9ST5r9+tavvHiTWmBnKzpCJ/GlVFtg==",
"dev": true,
"license": "BSD-2-Clause",
"peer": true,
"dependencies": {
"@typescript-eslint/scope-manager": "7.18.0",
"@typescript-eslint/types": "7.18.0",
@@ -2167,7 +2164,6 @@
"resolved": "https://registry.npmjs.org/@uppy/core/-/core-2.3.4.tgz",
"integrity": "sha512-iWAqppC8FD8mMVqewavCz+TNaet6HPXitmGXpGGREGrakZ4FeuWytVdrelydzTdXx6vVKkOmI2FLztGg73sENQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"@transloadit/prettier-bytes": "0.0.7",
"@uppy/store-default": "^2.1.1",
@@ -2199,7 +2195,6 @@
"resolved": "https://registry.npmjs.org/@uppy/xhr-upload/-/xhr-upload-2.1.3.tgz",
"integrity": "sha512-YWOQ6myBVPs+mhNjfdWsQyMRWUlrDLMoaG7nvf/G6Y3GKZf8AyjFDjvvJ49XWQ+DaZOftGkHmF1uh/DBeGivJQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"@uppy/companion-client": "^2.2.2",
"@uppy/utils": "^4.1.2",
@@ -2252,6 +2247,98 @@
"vscode-uri": "^3.0.8"
}
},
"node_modules/@vue-flow/background": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/@vue-flow/background/-/background-1.3.2.tgz",
"integrity": "sha512-eJPhDcLj1wEo45bBoqTXw1uhl0yK2RaQGnEINqvvBsAFKh/camHJd5NPmOdS1w+M9lggc9igUewxaEd3iCQX2w==",
"license": "MIT",
"peerDependencies": {
"@vue-flow/core": "^1.23.0",
"vue": "^3.3.0"
}
},
"node_modules/@vue-flow/controls": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/@vue-flow/controls/-/controls-1.1.3.tgz",
"integrity": "sha512-XCf+G+jCvaWURdFlZmOjifZGw3XMhN5hHlfMGkWh9xot+9nH9gdTZtn+ldIJKtarg3B21iyHU8JjKDhYcB6JMw==",
"license": "MIT",
"peerDependencies": {
"@vue-flow/core": "^1.23.0",
"vue": "^3.3.0"
}
},
"node_modules/@vue-flow/core": {
"version": "1.48.2",
"resolved": "https://registry.npmjs.org/@vue-flow/core/-/core-1.48.2.tgz",
"integrity": "sha512-raxhgKWE+G/mcEvXJjGFUDYW9rAI3GOtiHR3ZkNpwBWuIaCC1EYiBmKGwJOoNzVFgwO7COgErnK7i08i287AFA==",
"license": "MIT",
"dependencies": {
"@vueuse/core": "^10.5.0",
"d3-drag": "^3.0.0",
"d3-interpolate": "^3.0.1",
"d3-selection": "^3.0.0",
"d3-zoom": "^3.0.0"
},
"peerDependencies": {
"vue": "^3.3.0"
}
},
"node_modules/@vue-flow/core/node_modules/@types/web-bluetooth": {
"version": "0.0.20",
"resolved": "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.20.tgz",
"integrity": "sha512-g9gZnnXVq7gM7v3tJCWV/qw7w+KeOlSHAhgF9RytFyifW6AF61hdT2ucrYhPq9hLs5JIryeupHV3qGk95dH9ow==",
"license": "MIT"
},
"node_modules/@vue-flow/core/node_modules/@vueuse/core": {
"version": "10.11.1",
"resolved": "https://registry.npmjs.org/@vueuse/core/-/core-10.11.1.tgz",
"integrity": "sha512-guoy26JQktXPcz+0n3GukWIy/JDNKti9v6VEMu6kV2sYBsWuGiTU8OWdg+ADfUbHg3/3DlqySDe7JmdHrktiww==",
"license": "MIT",
"dependencies": {
"@types/web-bluetooth": "^0.0.20",
"@vueuse/metadata": "10.11.1",
"@vueuse/shared": "10.11.1",
"vue-demi": ">=0.14.8"
},
"funding": {
"url": "https://github.com/sponsors/antfu"
}
},
"node_modules/@vue-flow/core/node_modules/@vueuse/metadata": {
"version": "10.11.1",
"resolved": "https://registry.npmjs.org/@vueuse/metadata/-/metadata-10.11.1.tgz",
"integrity": "sha512-IGa5FXd003Ug1qAZmyE8wF3sJ81xGLSqTqtQ6jaVfkeZ4i5kS2mwQF61yhVqojRnenVew5PldLyRgvdl4YYuSw==",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/antfu"
}
},
"node_modules/@vue-flow/core/node_modules/@vueuse/shared": {
"version": "10.11.1",
"resolved": "https://registry.npmjs.org/@vueuse/shared/-/shared-10.11.1.tgz",
"integrity": "sha512-LHpC8711VFZlDaYUXEBbFBCQ7GS3dVU9mjOhhMhXP6txTV4EhYQg/KGnQuvt/sPAtoUKq7VVUnL6mVtFoL42sA==",
"license": "MIT",
"dependencies": {
"vue-demi": ">=0.14.8"
},
"funding": {
"url": "https://github.com/sponsors/antfu"
}
},
"node_modules/@vue-flow/minimap": {
"version": "1.5.4",
"resolved": "https://registry.npmjs.org/@vue-flow/minimap/-/minimap-1.5.4.tgz",
"integrity": "sha512-l4C+XTAXnRxsRpUdN7cAVFBennC1sVRzq4bDSpVK+ag7tdMczAnhFYGgbLkUw3v3sY6gokyWwMl8CDonp8eB2g==",
"license": "MIT",
"dependencies": {
"d3-selection": "^3.0.0",
"d3-zoom": "^3.0.0"
},
"peerDependencies": {
"@vue-flow/core": "^1.23.0",
"vue": "^3.3.0"
}
},
"node_modules/@vue/compiler-core": {
"version": "3.5.25",
"resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.5.25.tgz",
@@ -2428,7 +2515,6 @@
"resolved": "https://registry.npmjs.org/@wangeditor/basic-modules/-/basic-modules-1.1.7.tgz",
"integrity": "sha512-cY9CPkLJaqF05STqfpZKWG4LpxTMeGSIIF1fHvfm/mz+JXatCagjdkbxdikOuKYlxDdeqvOeBmsUBItufDLXZg==",
"license": "MIT",
"peer": true,
"dependencies": {
"is-url": "^1.2.4"
},
@@ -2461,7 +2547,6 @@
"resolved": "https://registry.npmjs.org/@wangeditor/core/-/core-1.1.19.tgz",
"integrity": "sha512-KevkB47+7GhVszyYF2pKGKtCSj/YzmClsD03C3zTt+9SR2XWT5T0e3yQqg8baZpcMvkjs1D8Dv4fk8ok/UaS2Q==",
"license": "MIT",
"peer": true,
"dependencies": {
"@types/event-emitter": "^0.3.3",
"event-emitter": "^0.3.5",
@@ -2580,7 +2665,6 @@
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
"dev": true,
"license": "MIT",
"peer": true,
"bin": {
"acorn": "bin/acorn"
},
@@ -2836,7 +2920,6 @@
"resolved": "https://registry.npmjs.org/codemirror/-/codemirror-6.0.2.tgz",
"integrity": "sha512-VhydHotNW5w1UGK0Qj96BwSk/Zqbp9WbnyK2W/eVMv4QyF41INRGpjUhFJY7/uDNuudSc33a/PKr4iDqRduvHw==",
"license": "MIT",
"peer": true,
"dependencies": {
"@codemirror/autocomplete": "^6.0.0",
"@codemirror/commands": "^6.0.0",
@@ -2963,6 +3046,111 @@
"node": ">=0.12"
}
},
"node_modules/d3-color": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.1.0.tgz",
"integrity": "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==",
"license": "ISC",
"engines": {
"node": ">=12"
}
},
"node_modules/d3-dispatch": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/d3-dispatch/-/d3-dispatch-3.0.1.tgz",
"integrity": "sha512-rzUyPU/S7rwUflMyLc1ETDeBj0NRuHKKAcvukozwhshr6g6c5d8zh4c2gQjY2bZ0dXeGLWc1PF174P2tVvKhfg==",
"license": "ISC",
"engines": {
"node": ">=12"
}
},
"node_modules/d3-drag": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/d3-drag/-/d3-drag-3.0.0.tgz",
"integrity": "sha512-pWbUJLdETVA8lQNJecMxoXfH6x+mO2UQo8rSmZ+QqxcbyA3hfeprFgIT//HW2nlHChWeIIMwS2Fq+gEARkhTkg==",
"license": "ISC",
"dependencies": {
"d3-dispatch": "1 - 3",
"d3-selection": "3"
},
"engines": {
"node": ">=12"
}
},
"node_modules/d3-ease": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-3.0.1.tgz",
"integrity": "sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==",
"license": "BSD-3-Clause",
"engines": {
"node": ">=12"
}
},
"node_modules/d3-interpolate": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz",
"integrity": "sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==",
"license": "ISC",
"dependencies": {
"d3-color": "1 - 3"
},
"engines": {
"node": ">=12"
}
},
"node_modules/d3-selection": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/d3-selection/-/d3-selection-3.0.0.tgz",
"integrity": "sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ==",
"license": "ISC",
"engines": {
"node": ">=12"
}
},
"node_modules/d3-timer": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-3.0.1.tgz",
"integrity": "sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==",
"license": "ISC",
"engines": {
"node": ">=12"
}
},
"node_modules/d3-transition": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/d3-transition/-/d3-transition-3.0.1.tgz",
"integrity": "sha512-ApKvfjsSR6tg06xrL434C0WydLr7JewBB3V+/39RMHsaXTOG0zmt/OAXeng5M5LBm0ojmxJrpomQVZ1aPvBL4w==",
"license": "ISC",
"dependencies": {
"d3-color": "1 - 3",
"d3-dispatch": "1 - 3",
"d3-ease": "1 - 3",
"d3-interpolate": "1 - 3",
"d3-timer": "1 - 3"
},
"engines": {
"node": ">=12"
},
"peerDependencies": {
"d3-selection": "2 - 3"
}
},
"node_modules/d3-zoom": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/d3-zoom/-/d3-zoom-3.0.0.tgz",
"integrity": "sha512-b8AmV3kfQaqWAuacbPuNbL6vahnOJflOhexLzMMNLga62+/nh0JzvJ0aO/5a5MVgUFGS7Hu1P9P03o3fJkDCyw==",
"license": "ISC",
"dependencies": {
"d3-dispatch": "1 - 3",
"d3-drag": "2 - 3",
"d3-interpolate": "1 - 3",
"d3-selection": "2 - 3",
"d3-transition": "2 - 3"
},
"engines": {
"node": ">=12"
}
},
"node_modules/dayjs": {
"version": "1.11.19",
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.19.tgz",
@@ -3054,7 +3242,6 @@
"resolved": "https://registry.npmjs.org/dom7/-/dom7-3.0.0.tgz",
"integrity": "sha512-oNlcUdHsC4zb7Msx7JN3K0Nro1dzJ48knvBOnDPKJ2GV9wl1i5vydJZUSyOfrkKFDZEud/jBsTk92S/VGSAe/g==",
"license": "MIT",
"peer": true,
"dependencies": {
"ssr-window": "^3.0.0-alpha.1"
}
@@ -3091,7 +3278,6 @@
"resolved": "https://registry.npmjs.org/echarts/-/echarts-5.6.0.tgz",
"integrity": "sha512-oTbVTsXfKuEhxftHqL5xprgLoc0k7uScAwtryCgWF6hPYFLRwOUHiFmHGCBKP5NPFNkDVopOieyUqYGH8Fa3kA==",
"license": "Apache-2.0",
"peer": true,
"dependencies": {
"tslib": "2.3.0",
"zrender": "5.6.1"
@@ -3320,7 +3506,6 @@
"deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.2.0",
"@eslint-community/regexpp": "^4.6.1",
@@ -4113,8 +4298,7 @@
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/is-hotkey/-/is-hotkey-0.2.0.tgz",
"integrity": "sha512-UknnZK4RakDmTgz4PI1wIph5yxSs/mvChWs9ifnlXsKuXgWmOkY/hAE0H/k2MIqH0RlRye0i1oC07MCRSD28Mw==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/is-number": {
"version": "7.0.0",
@@ -4301,15 +4485,13 @@
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/lodash-es": {
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz",
"integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/lodash-unified": {
"version": "1.0.3",
@@ -4326,37 +4508,32 @@
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz",
"integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/lodash.clonedeep": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz",
"integrity": "sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/lodash.debounce": {
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz",
"integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/lodash.foreach": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/lodash.foreach/-/lodash.foreach-4.5.0.tgz",
"integrity": "sha512-aEXTF4d+m05rVOAUG3z4vZZ4xVexLKZGF0lIxuHZ1Hplpk/3B6Z1+/ICICYRLm7c41Z2xiejbkCkJoTlypoXhQ==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/lodash.isequal": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz",
"integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==",
"deprecated": "This package is deprecated. Use require('node:util').isDeepStrictEqual instead.",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/lodash.merge": {
"version": "4.6.2",
@@ -4369,15 +4546,13 @@
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/lodash.throttle/-/lodash.throttle-4.1.1.tgz",
"integrity": "sha512-wIkUCfVKpVsWo3JSZlc+8MB5it+2AN5W8J7YVMST30UrvcQNZ1Okbj+rbVniijTWE6FGYy4XJq/rHkas8qJMLQ==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/lodash.toarray": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/lodash.toarray/-/lodash.toarray-4.4.0.tgz",
"integrity": "sha512-QyffEA3i5dma5q2490+SgCvDN0pXLmRGSyAANuVi0HQ01Pkfr9fuoKQW8wm1wGBnJITs/mS7wQvS6VshUEBFCw==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/magic-string": {
"version": "0.30.21",
@@ -4490,7 +4665,6 @@
"resolved": "https://registry.npmjs.org/mobx/-/mobx-5.15.7.tgz",
"integrity": "sha512-wyM3FghTkhmC+hQjyPGGFdpehrcX1KOXsDuERhfK2YbJemkUhEB+6wzEN639T21onxlfYBmriA1PFnvxTUhcKw==",
"license": "MIT",
"peer": true,
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/mobx"
@@ -4555,7 +4729,6 @@
}
],
"license": "MIT",
"peer": true,
"bin": {
"nanoid": "bin/nanoid.cjs"
},
@@ -4842,7 +5015,6 @@
"resolved": "https://registry.npmjs.org/preact/-/preact-10.27.2.tgz",
"integrity": "sha512-5SYSgFKSyhCbk6SrXyMpqjb5+MQBgfvEKE/OC+PujcY34sOpqtr+0AZQtPYx5IA6VxynQ7rUPCtKzyovpj9Bpg==",
"license": "MIT",
"peer": true,
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/preact"
@@ -5103,7 +5275,6 @@
"integrity": "sha512-N+7WK20/wOr7CzA2snJcUSSNTCzeCGUTFY3OgeQP3mZ1aj9NMQ0mSTXwlrnd89j33zzQJGqIN52GIOmYrfq46A==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"chokidar": "^4.0.0",
"immutable": "^5.0.2",
@@ -5322,7 +5493,6 @@
"resolved": "https://registry.npmjs.org/slate/-/slate-0.72.8.tgz",
"integrity": "sha512-/nJwTswQgnRurpK+bGJFH1oM7naD5qDmHd89JyiKNT2oOKD8marW0QSBtuFnwEbL5aGCS8AmrhXQgNOsn4osAw==",
"license": "MIT",
"peer": true,
"dependencies": {
"immer": "^9.0.6",
"is-plain-object": "^5.0.0",
@@ -5346,7 +5516,6 @@
"resolved": "https://registry.npmjs.org/snabbdom/-/snabbdom-3.6.3.tgz",
"integrity": "sha512-W2lHLLw2qR2Vv0DcMmcxXqcfdBaIcoN+y/86SmHv8fn4DazEQSH6KN3TjZcWvwujW56OHiiirsbHWZb4vx/0fg==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=12.17.0"
}
@@ -5512,7 +5681,6 @@
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=12"
},
@@ -5590,7 +5758,6 @@
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
"devOptional": true,
"license": "Apache-2.0",
"peer": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
@@ -5660,7 +5827,6 @@
"integrity": "sha512-BiReIiMS2fyFqbqNT/Qqt4CVITDU9M9vE+DKcVAsB+ZV0wvTKd+3hMbkpxz1b+NmEDMegpVbisKiAZOnvO92Sw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"esbuild": "^0.25.0",
"fdir": "^6.4.4",
@@ -5829,7 +5995,6 @@
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=12"
},
@@ -5849,7 +6014,6 @@
"resolved": "https://registry.npmjs.org/vue/-/vue-3.5.25.tgz",
"integrity": "sha512-YLVdgv2K13WJ6n+kD5owehKtEXwdwXuj2TTyJMsO7pSeKw2bfRNZGjhB7YzrpbMYj5b5QsUebHpOqR3R3ziy/g==",
"license": "MIT",
"peer": true,
"dependencies": {
"@vue/compiler-dom": "3.5.25",
"@vue/compiler-sfc": "3.5.25",

View File

@@ -19,6 +19,10 @@
"@element-plus/icons-vue": "^2.3.1",
"@logicflow/core": "^2.2.1",
"@logicflow/extension": "^2.2.1",
"@vue-flow/background": "^1.3.2",
"@vue-flow/controls": "^1.1.3",
"@vue-flow/core": "^1.48.2",
"@vue-flow/minimap": "^1.5.4",
"@wangeditor/editor": "^5.1.23",
"axios": "1.8.2",
"codemirror": "^6.0.1",

View File

@@ -0,0 +1,185 @@
import request, { type RequestOptions } from '/@/utils/request';
export interface StatsParams {
pending?: number;
verified?: number;
rejected?: number;
}
export interface ImageMaterialItem {
id: number;
imageId: string;
accountId: string;
imageUsage?: string;
previewUrl?: string;
verifyStatus: string;
description?: string;
}
export interface VideoMaterialItem {
id: number;
videoId: string;
accountId: string;
previewUrl?: string;
verifyStatus: string;
description?: string;
}
export interface VerifyLogItem {
id: number;
materialType: string;
materialId: string;
accountId: string;
taskId?: string;
verifyStatus: string;
suggestion?: number;
requestParams?: string;
responseResult?: string;
errorMsg?: string;
createdAt: string;
}
export interface PageParams {
page: number;
pageSize: number;
status?: string;
accountId?: string;
materialType?: string;
verifyStatus?: string;
materialId?: string;
}
export interface ListResponse<T> {
code: number;
message: string;
data: {
list: T[];
total: number;
};
}
export interface StatsResponse {
code: number;
message: string;
data: StatsParams;
}
export function getImageStats(requestOptions?: RequestOptions) {
return request({
url: '/cid/material/verify/controller/stats-image',
method: 'get',
requestOptions,
}) as Promise<StatsResponse>;
}
export function getVideoStats(requestOptions?: RequestOptions) {
return request({
url: '/cid/material/verify/controller/stats-video',
method: 'get',
requestOptions,
}) as Promise<StatsResponse>;
}
export function getImageList(params: PageParams, requestOptions?: RequestOptions) {
return request({
url: '/cid/material/verify/controller/list-image',
method: 'get',
params,
requestOptions,
}) as Promise<ListResponse<ImageMaterialItem>>;
}
export function getVideoList(params: PageParams, requestOptions?: RequestOptions) {
return request({
url: '/cid/material/verify/controller/list-video',
method: 'get',
params,
requestOptions,
}) as Promise<ListResponse<VideoMaterialItem>>;
}
export function getVerifyLogList(params: PageParams, requestOptions?: RequestOptions) {
return request({
url: '/cid/material/verify/controller/list-log',
method: 'get',
params,
requestOptions,
}) as Promise<ListResponse<VerifyLogItem>>;
}
export function manualVerifyImage(data: { materialId: string }, requestOptions?: RequestOptions) {
return request({
url: '/cid/material/verify/controller/manual-verify-image',
method: 'post',
data,
requestOptions,
});
}
export function manualVerifyVideo(data: { materialId: string }, requestOptions?: RequestOptions) {
return request({
url: '/cid/material/verify/controller/manual-verify-video',
method: 'post',
data,
requestOptions,
});
}
export function pollImageResults(requestOptions?: RequestOptions) {
return request({
url: '/cid/yidun/callback/controller/poll-image-results',
method: 'post',
requestOptions,
});
}
export function pollVideoResults(requestOptions?: RequestOptions) {
return request({
url: '/cid/yidun/callback/controller/poll-video-results',
method: 'post',
requestOptions,
});
}
export function batchVerifyImage(requestOptions?: RequestOptions) {
return request({
url: '/cid/material/verify/controller/batch-verify-image',
method: 'post',
requestOptions,
});
}
export function batchVerifyVideo(requestOptions?: RequestOptions) {
return request({
url: '/cid/material/verify/controller/batch-verify-video',
method: 'post',
requestOptions,
});
}
export interface ExportParams {
materialType?: 'IMAGE' | 'VIDEO';
}
export function exportRejectedMaterials(data: ExportParams = {}, requestOptions?: RequestOptions) {
return request({
url: '/cid/material/verify/controller/export-rejected',
method: 'post',
data,
requestOptions,
});
}
export interface AccountItem {
accountId: number;
corporationName: string;
}
export function getAccountList(requestOptions?: RequestOptions) {
return request({
url: '/cid/material/verify/controller/list-accounts',
method: 'post',
data: {},
requestOptions,
});
}

View File

@@ -5,30 +5,42 @@ export interface knowledgeQueryParams {
keyword?: string;
pageNum: number;
pageSize: number;
datasetType?: number; // 1=文本2=视频
}
// 创建知识库参数
export interface CreateknowledgeParams {
name: string; // 必传
datasetType: number; // 1=文本2=视频
description?: string; // 可选
embeddingModel?: string; // 向量模型
status?: string; // 状态
}
// 更新知识库参数
export interface UpdateknowledgeParams {
id: string; // 必传
name?: string; // 可选
datasetType?: number; // 1=文本2=视频
description?: string; // 可选
embeddingModel?: string; // 向量模型
status?: string; // 状态
}
// 数据集信息
export interface knowledgeInfo {
id?: string;
name: string;
datasetType?: number; // 1=文本2=视频
description?: string;
fileCount?: number;
totalSize?: number;
createdAt?: string;
updatedAt?: string;
embeddingModel?: string; // 向量模型
documentCount?: number; // 文档数量
charCount?: number; // 字符数量
status?: string; // 状态
}
// 获取知识库列表
@@ -66,3 +78,21 @@ export function deleteknowledge(id: string) {
params: { id },
});
}
// 获取知识库详情
export function getknowledge(id: string) {
return request({
url: '/rag/dataset/detail',
method: 'get',
params: { id },
});
}
// 更新知识库状态
export function updateknowledgeStatus(data: { id: string; status: string }) {
return request({
url: '/rag/dataset/updateStatus',
method: 'put',
data,
});
}

View File

@@ -12,6 +12,19 @@ export interface NodeLibraryFormItem {
type: 'input' | 'number' | 'textarea' | 'switch' | string;
required: boolean;
default?: string | number | boolean;
value?: unknown;
options?: Array<{ label: string; value: string | number }> | null;
expand?: NodeLibraryFormItem[] | Record<string, unknown> | null;
fieldConstraint?: {
fileTypes?: string;
maxFileSize?: number;
maxFileCount?: number;
minLength?: number;
maxLength?: number;
numberType?: 'integer' | 'decimal' | string;
minValue?: number;
maxValue?: number;
} | null;
}
export interface NodeLibraryModelConfig {
@@ -188,6 +201,11 @@ export interface WorkflowItem {
description: string;
flowContent: any;
nodeInputParams?: any[];
outputParams?: Array<Record<string, string>>;
imgAddressPrefix?: string;
fileUrls?: string[];
resultUrl?: string;
sessionId?: string;
}
export interface WorkflowListResponse {
@@ -313,6 +331,7 @@ export interface ExecuteFlowParams {
nodeInputParams?: FlowNode[];
sessionId?: string;
skillName?: string;
resultUrl?: string;
}
export function executeFlow(data: ExecuteFlowParams | FormData, requestOptions?: RequestOptions) {

View File

@@ -5,6 +5,7 @@ export interface ModelModuleListParams {
pageSize?: number;
modelName?: string;
modelType?: number | string;
enabled?: number;
}
export interface ModelFormItem {
@@ -19,6 +20,41 @@ export interface ModelFormEntry {
value: string;
}
// 提示词管理接口类型
export interface PromptItem {
id: number | string;
tenantId?: number;
creator?: string;
createdAt?: string;
updater?: string;
updatedAt?: string;
deletedAt?: string | null;
nodeType: string;
prompt: string;
sourceType: number; // 0-自定义 1-公共
}
export interface PromptListResponse {
list: PromptItem[];
total: number;
}
export interface PromptListParams {
pageNum?: number;
pageSize?: number;
keyword?: string;
}
export interface CreatePromptParams {
nodeType: string;
prompt: string;
sourceType: number;
}
export interface UpdatePromptParams extends CreatePromptParams {
id: number | string;
}
/** 模型类型listType 接口项,字段名以后端为准,前端做兼容解析) */
export interface ModelTypeListItem {
id?: number | string;
@@ -111,6 +147,7 @@ export interface CreateModelParams {
modelName: string;
/** 与 listType 返回的类型 id 一致,可能为数字或字符串 */
modelType: number | string;
operatorName?: string;
baseUrl: string;
httpMethod?: string;
headMsg?: string;
@@ -121,6 +158,11 @@ export interface CreateModelParams {
form: ModelFormEntry[];
requestMapping?: Record<string, unknown>;
responseMapping?: Record<string, unknown>;
responseBody?: Record<string, unknown>;
extendMapping?: Record<string, unknown>;
responseTokenField?: string;
tokenConfig?: Record<string, unknown>;
queryConfig?: Record<string, unknown>;
maxConcurrency?: number;
queueLimit?: number;
timeoutSeconds: number;
@@ -234,3 +276,56 @@ export function getIsChatModel() {
method: 'get',
});
}
/**
*
*/
export function getOperatorList() {
return request({
url: '/model-gateway/model/listOperator',
method: 'get',
});
}
/**
*
*/
export function getMyPromptList(params: PromptListParams) {
return request<PromptListResponse>({
url: '/node/prompt/listMy',
method: 'get',
params,
});
}
/**
*
*/
export function createPrompt(data: CreatePromptParams) {
return request({
url: '/node/prompt/create',
method: 'post',
data,
});
}
/**
*
*/
export function updatePrompt(data: UpdatePromptParams) {
return request({
url: '/node/prompt/update',
method: 'put',
data,
});
}
/**
*
*/
export function deletePrompt(id: number | string) {
return request({
url: `/node/prompt/delete/${id}`,
method: 'delete',
});
}

View File

@@ -0,0 +1,110 @@
import request from '/@/utils/request';
// 提示词管理接口类型
export interface PromptItem {
id: number | string;
tenantId?: number;
creator?: string;
createdAt?: string;
updater?: string;
updatedAt?: string;
deletedAt?: string | null;
nodeType: string;
prompt: string;
sourceType: number; // 0-自定义 1-公共
}
export interface PromptListResponse {
list: PromptItem[];
total: number;
}
export interface PromptListParams {
pageNum?: number;
pageSize?: number;
keyword?: string;
}
export interface CreatePromptParams {
nodeType: string;
prompt: string;
sourceType: number;
}
export interface UpdatePromptParams extends CreatePromptParams {
id: number | string;
}
// 节点库项接口类型
export interface NodeLibraryNode {
nodeId: string;
nodeCode: string;
modelType: number;
nodeName: string;
skillOption: boolean;
promptOption: boolean;
}
export interface NodeLibraryGroup {
group: string;
label: string;
items: NodeLibraryNode[];
}
export interface NodeLibraryResponse {
groups: NodeLibraryGroup[];
}
/**
* 获取节点类型列表(节点库)
*/
export function getNodeLibraryList() {
return request<NodeLibraryResponse>({
url: '/ai-agent/node/library/list',
method: 'get',
});
}
/**
* 获取当前用户提示词列表
*/
export function getMyPromptList(params: PromptListParams) {
return request<PromptListResponse>({
url: '/ai-agent/node/prompt/listMy',
method: 'get',
params,
});
}
/**
* 创建提示词
*/
export function createPrompt(data: CreatePromptParams) {
return request({
url: '/ai-agent/node/prompt/create',
method: 'post',
data,
});
}
/**
* 修改提示词
*/
export function updatePrompt(data: UpdatePromptParams) {
return request({
url: '/ai-agent/node/prompt/update',
method: 'put',
data,
});
}
/**
* 删除提示词
*/
export function deletePrompt(id: number | string) {
return request({
url: '/ai-agent/node/prompt/delete',
method: 'delete',
data: { id },
});
}

View File

@@ -126,3 +126,27 @@ export function deleteUserSkill(id: number, config?: any) {
...config,
});
}
/**
* Skill
*/
export function getUserSkillDetail(id: number, config?: any) {
return request<SkillItem>({
url: '/ai-agent/skill/user/get',
method: 'get',
params: { id },
...config,
});
}
/**
* Skill
*/
export function updateUserSkill(data: CreateSkillParams & { id: number }, config?: any) {
return request({
url: '/ai-agent/skill/user/update',
method: 'put',
data,
...config,
});
}

View File

@@ -0,0 +1,16 @@
import request from '/@/utils/request';
export function getPwConfig() {
return request({
url: '/admin-go/api/v1/system/pwconfig/get',
method: 'get',
});
}
export function savePwConfig(data: any) {
return request({
url: '/admin-go/api/v1/system/pwconfig/save',
method: 'post',
data: data,
});
}

View File

@@ -4,7 +4,7 @@
<div class="search-bar">
<el-input v-model="searchParams.modelName" placeholder="搜索模型名称" clearable @clear="handleSearch">
<template #prefix
><el-icon><Search /></el-icon
><el-icon> <Search /> </el-icon
></template>
</el-input>
<el-button type="primary" @click="handleSearch">搜索</el-button>
@@ -19,14 +19,16 @@
v-for="model in modelList"
:key="model.id"
class="model-card"
:class="{ selected: selectedModel?.id === model.id, 'builtin-model': !model.apiKey }"
:class="{ selected: selectedModel?.id === model.id }"
@click="handleSelectModel(model)"
>
<div class="model-card-header">
<div class="model-type">{{ getModelTypeName(model.modelType) }}</div>
<div class="model-badges">
<el-tag v-if="!model.apiKey" type="warning" size="small">内置模型</el-tag>
<el-icon v-if="selectedModel?.id === model.id" class="check-icon" color="#67c23a"><CircleCheck /></el-icon>
<el-tag v-if="model.isOwner === 0" type="warning" size="small">内置模型</el-tag>
<el-icon v-if="selectedModel?.id === model.id" class="check-icon" color="#67c23a">
<CircleCheck />
</el-icon>
</div>
</div>
<div class="model-card-body">
@@ -60,7 +62,7 @@
</template>
<!-- 新建模型弹窗 -->
<EditModule ref="editModuleRef" @refresh="handleRefresh" />
<EditModule ref="editModuleRef" :model-types="modelTypes" :is-super-admin="isSuperAdmin" @refresh="handleRefresh" />
<!-- 内置模型 API Key 输入弹窗 -->
<el-dialog v-model="apiKeyDialogVisible" title="配置内置模型" width="500px" :close-on-click-modal="false" append-to-body>
@@ -92,16 +94,23 @@
import { ref, reactive, watch, onMounted } from 'vue';
import { ElMessage, type FormInstance, type FormRules } from 'element-plus';
import { Search, CircleCheck } from '@element-plus/icons-vue';
import { getModelModuleList, addModelModule } from '/@/api/digitalHuman/modelConfig/modelModule';
import {
getModelModuleList,
addModelModule,
getModelTypeList,
normalizeModelTypeOptions,
type CreateModelParams,
type ModelFormEntry,
} from '/@/api/settings/modelConfig/modelModule';
import { checkIsSuperAdmin } from '/@/api/system/user/index';
import { getApiErrorMessage } from '/@/utils/request';
import EditModule from '/@/views/digitalHuman/modelConfig/modelModule/component/editModule.vue';
import EditModule from '/@/views/settings/modelConfig/modelModule/component/editModule.vue';
interface ModelItem {
id: string;
tenantId?: number;
modelName: string;
modelType: number;
modelType: number | string;
baseUrl: string;
route: string;
httpMethod: string;
@@ -110,9 +119,14 @@ interface ModelItem {
isPrivate?: number;
isChatModel?: number;
headMsg?: string;
form?: any;
requestMapping?: any;
responseMapping?: any;
operatorName?: string;
responseBody?: Record<string, unknown>;
tokenConfig?: Record<string, unknown> | string;
extendMapping?: Record<string, unknown> | string;
queryConfig?: Record<string, unknown>;
form?: ModelFormEntry[] | Record<string, unknown>;
requestMapping?: Record<string, unknown>;
responseMapping?: Record<string, unknown>;
maxConcurrency?: number;
queueLimit?: number;
timeoutSeconds?: number;
@@ -150,7 +164,8 @@ const modelList = ref<ModelItem[]>([]);
const loading = ref(false);
const selectedModel = ref<ModelItem | null>(null);
const editModuleRef = ref();
const isSuperAdmin = ref(false); // 是否为管理员
const isSuperAdmin = ref(false);
const modelTypes = ref<Array<{ id: number | string; label: string }>>([]);
// 内置模型 API Key 配置
const apiKeyDialogVisible = ref(false);
@@ -164,7 +179,7 @@ const apiKeyRules: FormRules = {
apiKey: [{ required: true, message: '请输入 API Key', trigger: 'blur' }],
};
const creatingModel = ref(false);
const systemModelToClone = ref<ModelItem | null>(null);
const builtInModelToClone = ref<ModelItem | null>(null);
// 检查是否为管理员
const checkAdminStatus = async () => {
@@ -193,13 +208,137 @@ watch(visible, (val) => {
}
});
const getModelTypeName = (type: number) => {
watch(
() => props.modelType,
() => {
if (!visible.value) return;
pagination.pageNum = 1;
fetchModelList();
}
);
const getModelTypeName = (type: number | string) => {
const typeMap: Record<number, string> = {
1: '推理模型',
2: '图片模型',
3: '音频模型',
100: '推理模型',
200: '图片模型',
201: '图片模型-文生图',
202: '图片模型-图生图',
203: '图片模型-图片编辑',
204: '图片模型-图片变体',
300: '音频模型',
301: '音频模型-文生音',
302: '音频模型-音生文',
303: '音频模型-音生音',
400: '向量化模型',
401: '向量化模型-文本嵌入',
402: '向量化模型-重排序',
500: '全模态模型',
501: '全模态模型-文图音',
502: '全模态模型-视觉理解',
600: '视频模型',
601: '视频模型-文生视频',
602: '视频模型-图生视频',
603: '视频模型-图文生视频',
604: '视频模型-视频生视频',
605: '视频模型-视频编辑',
};
return typeMap[type] || '未知类型';
return typeMap[Number(type)] || '未知类型';
};
const parseJsonObjectField = (raw: unknown): Record<string, unknown> => {
if (raw && typeof raw === 'object' && !Array.isArray(raw)) {
return raw as Record<string, unknown>;
}
if (typeof raw === 'string') {
try {
const parsed = JSON.parse(raw || '{}');
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
return parsed as Record<string, unknown>;
}
} catch {
return {};
}
}
return {};
};
const fieldsToUnknownObject = (fields: Array<{ key: string; value: string }>) => {
const obj: Record<string, unknown> = {};
fields.forEach((f) => {
const k = String(f.key || '').trim();
if (!k) return;
obj[k] = String(f.value ?? '');
});
return obj;
};
const flattenNestedObject = (obj: Record<string, unknown>, prefix = ''): Array<{ key: string; value: string }> => {
const rows: Array<{ key: string; value: string }> = [];
Object.entries(obj || {}).forEach(([k, v]) => {
const fk = prefix ? `${prefix}.${k}` : k;
if (v && typeof v === 'object' && !Array.isArray(v)) {
rows.push(...flattenNestedObject(v as Record<string, unknown>, fk));
return;
}
rows.push({ key: fk, value: String(v ?? '') });
});
return rows;
};
const nestFieldsToObject = (fields: Array<{ key: string; value: string }>) => {
const root: Record<string, unknown> = {};
fields.forEach((f) => {
const path = String(f.key || '').trim();
if (!path) return;
const parts = path
.split('.')
.map((p) => p.trim())
.filter(Boolean);
if (!parts.length) return;
let cur: Record<string, unknown> = root;
parts.forEach((part, idx) => {
if (idx === parts.length - 1) {
cur[part] = String(f.value ?? '');
return;
}
if (!cur[part] || typeof cur[part] !== 'object' || Array.isArray(cur[part])) {
cur[part] = {};
}
cur = cur[part] as Record<string, unknown>;
});
});
return root;
};
const buildQueryConfigFromRaw = (rawQc: Record<string, unknown> | null): Record<string, unknown> => {
if (!rawQc) return { responseType: 'sync', callbackUrl: '' };
const rt = String(rawQc.responseType || 'sync');
if (rt === 'callback') return { responseType: 'callback', callbackUrl: String(rawQc.callbackUrl || '') };
if (rt === 'pull') {
const hFields = Object.entries((rawQc.headers as Record<string, unknown>) || {}).map(([k, v]) => ({ key: k, value: String(v ?? '') }));
const bFields = flattenNestedObject((rawQc.body as Record<string, unknown>) || {});
return {
responseType: 'pull',
callbackUrl: '',
method: String(rawQc.method || 'GET'),
url: String(rawQc.url || ''),
headers: fieldsToUnknownObject(hFields),
body: nestFieldsToObject(bFields),
response: ((rawQc.response as unknown[]) || [])
.map((item) => {
if (typeof item === 'string') {
return { value: item, isTokenField: false, isMainBody: false };
}
const row = item as Record<string, unknown>;
return {
value: String(row.value ?? ''),
isTokenField: Boolean(row.isTokenField),
isMainBody: Boolean(row.isMainBody),
};
})
.filter((row) => row.value !== ''),
};
}
return { responseType: 'sync', callbackUrl: '' };
};
const fetchModelList = async () => {
@@ -209,13 +348,13 @@ const fetchModelList = async () => {
pageNum: pagination.pageNum,
pageSize: pagination.pageSize,
modelName: searchParams.modelName || undefined,
modelType: props.modelType, // 使用传入的 modelType
modelType: props.modelType,
enabled: 1,
};
const res: any = await getModelModuleList(params);
modelList.value = res.data?.list || [];
pagination.total = res.data?.total || 0;
} catch {
// 接口错误由 request 全局提示后端 message
modelList.value = [];
pagination.total = 0;
} finally {
@@ -233,69 +372,78 @@ const handlePageChange = () => {
};
const handleSelectModel = (model: ModelItem) => {
// 如果是管理员,直接选中任何模型,不需要配置 API Key
if (isSuperAdmin.value) {
selectedModel.value = model;
return;
}
// 非管理员判断是否是内置模型apiKey 为空)
if (!model.apiKey) {
// 内置模型,需要用户配置 API Key
systemModelToClone.value = model;
if (model.isOwner === 0) {
builtInModelToClone.value = model;
apiKeyForm.modelName = model.modelName;
apiKeyForm.apiKey = '';
apiKeyDialogVisible.value = true;
} else {
// 用户模型,直接选中
selectedModel.value = model;
}
};
const handleCreatePrivateModel = async () => {
if (!apiKeyFormRef.value || !systemModelToClone.value) return;
if (!apiKeyFormRef.value || !builtInModelToClone.value) return;
try {
await apiKeyFormRef.value.validate();
creatingModel.value = true;
// 基于内置模型创建新模型(继承原模型的所有配置,只替换 apiKey
const systemModel = systemModelToClone.value;
const createParams = {
const builtInModel = builtInModelToClone.value;
const formList: ModelFormEntry[] = Array.isArray(builtInModel.form)
? (builtInModel.form as ModelFormEntry[])
: Object.entries((builtInModel.form as Record<string, unknown>) || {}).map(([key, value]) => ({
key: String(key),
value: String(value ?? ''),
}));
const createParams: CreateModelParams = {
modelName: apiKeyForm.modelName,
modelType: systemModel.modelType,
baseUrl: systemModel.baseUrl,
httpMethod: systemModel.httpMethod || 'POST',
headMsg: systemModel.headMsg || '',
isPrivate: systemModel.isPrivate ?? 1, // 继承原模型的公有/私有属性
enabled: systemModel.enabled ?? 1,
isChatModel: systemModel.isChatModel || 0,
apiKey: apiKeyForm.apiKey, // 使用用户输入的新 API Key
form: systemModel.form || {},
requestMapping: systemModel.requestMapping || {},
responseMapping: systemModel.responseMapping || {},
maxConcurrency: systemModel.maxConcurrency || 10,
queueLimit: systemModel.queueLimit || 100,
timeoutSeconds: systemModel.timeoutSeconds || 30,
expectedSeconds: systemModel.expectedSeconds || 15,
retryTimes: systemModel.retryTimes || 3,
retryQueueMaxSeconds: systemModel.retryQueueMaxSeconds || 60,
autoCleanSeconds: systemModel.autoCleanSeconds || 300,
remark: systemModel.remark || '',
modelType: builtInModel.modelType,
operatorName: builtInModel.operatorName || '',
baseUrl: builtInModel.baseUrl,
httpMethod: builtInModel.httpMethod || 'POST',
headMsg: builtInModel.headMsg || '',
isPrivate: builtInModel.isPrivate ?? 1,
enabled: builtInModel.enabled ?? 1,
isChatModel: builtInModel.isChatModel || 0,
apiKey: apiKeyForm.apiKey,
form: formList,
requestMapping: (builtInModel.requestMapping as Record<string, unknown>) || {},
responseMapping: (builtInModel.responseMapping as Record<string, unknown>) || {},
responseBody: builtInModel.responseBody || {},
maxConcurrency: builtInModel.maxConcurrency || 10,
queueLimit: builtInModel.queueLimit || 100,
timeoutSeconds: builtInModel.timeoutSeconds || 30,
expectedSeconds: builtInModel.expectedSeconds || 15,
retryTimes: builtInModel.retryTimes || 3,
retryQueueMaxSeconds: builtInModel.retryQueueMaxSeconds || 60,
autoCleanSeconds: builtInModel.autoCleanSeconds || 300,
remark: builtInModel.remark || '',
extendMapping: fieldsToUnknownObject(
Object.entries(parseJsonObjectField(builtInModel.extendMapping)).map(([k, v]) => ({ key: k, value: String(v ?? '') }))
),
tokenConfig: fieldsToUnknownObject(
Object.entries(parseJsonObjectField(builtInModel.tokenConfig)).map(([k, v]) => ({ key: k, value: String(v ?? '') }))
),
queryConfig: buildQueryConfigFromRaw(
builtInModel.queryConfig && typeof builtInModel.queryConfig === 'object' && !Array.isArray(builtInModel.queryConfig)
? (builtInModel.queryConfig as Record<string, unknown>)
: null
),
};
const res: any = await addModelModule(createParams);
ElMessage.success('模型创建成功');
// 关闭对话框
apiKeyDialogVisible.value = false;
// 刷新列表
await fetchModelList();
// 选中新创建的模型
const newModelId = res.data?.id || res.data;
if (newModelId) {
const newModel = modelList.value.find((m) => m.id === String(newModelId));
@@ -331,11 +479,22 @@ const handleClose = () => {
visible.value = false;
selectedModel.value = null;
apiKeyDialogVisible.value = false;
systemModelToClone.value = null;
builtInModelToClone.value = null;
};
const loadModelTypes = async () => {
try {
const res: any = await getModelTypeList();
if (res.code === 0) {
modelTypes.value = normalizeModelTypeOptions(res);
}
} catch {
// 接口错误由 request 全局提示后端 message
}
};
onMounted(() => {
checkAdminStatus();
loadModelTypes();
});
</script>

View File

@@ -96,7 +96,7 @@
<script setup lang="ts">
import { ref, reactive, watch } from 'vue';
import { Search, CircleCheck } from '@element-plus/icons-vue';
import { getSkillList, getUserSkilllistUser, type SkillItem } from '/@/api/digitalHuman/skill';
import { getSkillList, getUserSkilllistUser, type SkillItem } from '/@/api/settings/skill';
interface Props {
modelValue: boolean;

View File

@@ -50,7 +50,7 @@
<script setup lang="ts">
import { ref, reactive, watch } from 'vue';
import { Search, CircleCheck } from '@element-plus/icons-vue';
import { getUserSkilllistUser, type SkillItem } from '/@/api/digitalHuman/skill';
import { getUserSkilllistUser, type SkillItem } from '/@/api/settings/skill';
interface Props {
modelValue: boolean;

View File

@@ -0,0 +1,968 @@
<template>
<div class="ads-compliance-tencent">
<el-card shadow="hover" class="main-card">
<!-- Tabs -->
<el-tabs v-model="activeTab" class="main-tabs">
<el-tab-pane label="图片素材" name="image">
<!-- 图片素材内容区域 -->
<div class="tab-content">
<!-- 工具栏区域 -->
<div class="toolbar">
<!-- 左侧筛选表单 -->
<el-form :model="imageFilters" :inline="true" class="search-form">
<el-form-item label="状态">
<el-select v-model="imageFilters.status" placeholder="全部" clearable style="width: 120px">
<el-option label="全部" value=""></el-option>
<el-option label="待校验" value="PENDING"></el-option>
<el-option label="送检中" value="SUBMITTING"></el-option>
<el-option label="校验通过" value="VERIFIED"></el-option>
<el-option label="校验不通过" value="REJECTED"></el-option>
</el-select>
</el-form-item>
<el-form-item label="账户">
<el-select v-model="imageFilters.accountId" placeholder="请选择账户" style="width: 220px" clearable>
<el-option
v-for="account in accountList"
:key="account.accountId"
:label="`${account.accountId} - ${account.corporationName}`"
:value="String(account.accountId)"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="searchImage">搜索</el-button>
<el-button @click="resetImageFilter">重置</el-button>
</el-form-item>
</el-form>
<!-- 右侧操作按钮 -->
<div class="action-buttons">
<!-- <el-button type="success" @click="batchVerifyImage" :loading="batchLoading"> 批量校验图片 </el-button> -->
<!-- <el-button type="primary" plain @click="pollImageResults" :loading="pollLoading">
<el-icon><Refresh /></el-icon> 刷新检测结果
</el-button> -->
<el-button type="warning" plain @click="exportImageUrls">
<el-icon><Download /></el-icon> 导出失败素材
</el-button>
</div>
</div>
<!-- 表格区域 -->
<div class="table-wrapper">
<el-table :data="imageList" border style="width: 100%" v-loading="imageLoading">
<el-table-column prop="accountId" label="账户ID" width="120"></el-table-column>
<el-table-column prop="imageUsage" label="用途" width="120"></el-table-column>
<el-table-column label="预览" width="180">
<template #default="scope">
<img
v-if="scope.row.previewUrl"
:src="scope.row.previewUrl"
class="media-preview"
@click="previewMedia(scope.row.previewUrl, 'image')"
/>
</template>
</el-table-column>
<el-table-column prop="verifyStatus" label="校验状态" width="120">
<template #default="scope">
<span :class="'table-status status-' + (scope.row.verifyStatus || 'pending').toLowerCase()">
{{ getStatusText(scope.row.verifyStatus) }}
</span>
</template>
</el-table-column>
<el-table-column prop="description" label="描述" min-width="200"></el-table-column>
<el-table-column label="操作" width="160" fixed="right">
<template #default="scope">
<el-button size="small" type="text" @click="viewLog(scope.row)">查看日志</el-button>
</template>
</el-table-column>
</el-table>
</div>
<!-- 分页区域 -->
<div class="pagination-container">
<el-pagination
@current-change="handleImagePageChange"
v-model:current-page="imagePage"
v-model:page-size="imagePageSize"
:page-sizes="[10, 20, 50, 100]"
layout="total, sizes, prev, pager, next, jumper"
:total="imageTotal"
background
>
</el-pagination>
</div>
</div>
</el-tab-pane>
<el-tab-pane label="视频素材" name="video">
<!-- 视频素材内容区域 -->
<div class="tab-content">
<!-- 工具栏区域 -->
<div class="toolbar">
<!-- 左侧筛选表单 -->
<el-form :model="videoFilters" :inline="true" class="search-form">
<el-form-item label="状态">
<el-select v-model="videoFilters.status" placeholder="全部" clearable style="width: 120px">
<el-option label="全部" value=""></el-option>
<el-option label="待校验" value="PENDING"></el-option>
<el-option label="送检中" value="SUBMITTING"></el-option>
<el-option label="校验通过" value="VERIFIED"></el-option>
<el-option label="校验不通过" value="REJECTED"></el-option>
</el-select>
</el-form-item>
<el-form-item label="账户">
<el-select v-model="videoFilters.accountId" placeholder="请选择账户" style="width: 220px" clearable>
<el-option
v-for="account in accountList"
:key="account.accountId"
:label="`${account.accountId} - ${account.corporationName}`"
:value="String(account.accountId)"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="searchVideo">搜索</el-button>
<el-button @click="resetVideoFilter">重置</el-button>
</el-form-item>
</el-form>
<!-- 右侧操作按钮 -->
<div class="action-buttons">
<!-- <el-button type="success" @click="batchVerifyVideo" :loading="batchLoading"> 批量校验视频 </el-button>
<el-button type="primary" plain @click="pollVideoResults" :loading="pollLoading">
<el-icon><Refresh /></el-icon> 刷新检测结果
</el-button> -->
<el-button type="warning" plain @click="exportVideoUrls">
<el-icon><Download /></el-icon> 导出失败素材
</el-button>
</div>
</div>
<!-- 表格区域 -->
<div class="table-wrapper">
<el-table :data="videoList" border style="width: 100%" v-loading="videoLoading">
<el-table-column prop="accountId" label="账户ID" width="120"></el-table-column>
<el-table-column label="预览" width="220">
<template #default="scope">
<div class="video-preview" @click="previewMedia(scope.row.previewUrl, 'video')">
<video
v-if="scope.row.previewUrl"
:src="scope.row.previewUrl"
class="video-thumbnail"
poster="data:image/gif;base64,R0lGODlhAQABAIAAAMLCwgAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=="
preload="metadata"
@loadedmetadata="(e) => ((e.target as HTMLVideoElement).currentTime = 0)"
></video>
<el-icon v-else><VideoPlay style="font-size: 32px" /></el-icon>
<div class="play-overlay">
<el-icon><VideoPlay style="font-size: 24px" /></el-icon>
</div>
</div>
</template>
</el-table-column>
<el-table-column prop="verifyStatus" label="校验状态" width="120">
<template #default="scope">
<span :class="'table-status status-' + (scope.row.verifyStatus || 'pending').toLowerCase()">
{{ getStatusText(scope.row.verifyStatus) }}
</span>
</template>
</el-table-column>
<el-table-column prop="description" label="描述" min-width="200"></el-table-column>
<el-table-column label="操作" width="160" fixed="right">
<template #default="scope">
<el-button size="small" type="text" @click="viewLog(scope.row)">查看日志</el-button>
</template>
</el-table-column>
</el-table>
</div>
<!-- 分页区域 -->
<div class="pagination-container">
<el-pagination
@current-change="handleVideoPageChange"
v-model:current-page="videoPage"
v-model:page-size="videoPageSize"
:page-sizes="[10, 20, 50, 100]"
layout="total, sizes, prev, pager, next, jumper"
:total="videoTotal"
background
>
</el-pagination>
</div>
</div>
</el-tab-pane>
</el-tabs>
</el-card>
<!-- 预览对话框 -->
<el-dialog title="媒体预览" v-model="previewVisible" width="60%" class="preview-dialog">
<div class="preview-content">
<img v-if="previewType === 'image'" :src="previewUrl" />
<video v-if="previewType === 'video'" :src="previewUrl" controls></video>
</div>
</el-dialog>
<!-- 日志对话框 -->
<el-dialog title="校验日志" v-model="logVisible" width="70%">
<el-table :data="currentLogList" border style="width: 100%">
<el-table-column prop="time" label="时间" width="180"></el-table-column>
<!-- <el-table-column prop="type" label="类型" width="120">
<template #default="scope">
<span :class="'table-status status-' + (scope.row.type || 'info').toLowerCase()">
{{ getLogTypeText(scope.row.type) }}
</span>
</template>
</el-table-column> -->
<el-table-column prop="status" label="状态" width="120">
<template #default="scope">
<span :class="'table-status status-' + (scope.row.status || 'info').toLowerCase()">
{{ getStatusText(scope.row.status) }}
</span>
</template>
</el-table-column>
<el-table-column prop="suggestion" label="建议" width="120">
<template #default="scope">
<span :class="'table-status status-' + getSuggestionClass(scope.row.suggestion)">
{{ getSuggestionText(scope.row.suggestion) }}
</span>
</template>
</el-table-column>
<el-table-column prop="errorMsg" label="错误信息" min-width="200"></el-table-column>
<el-table-column prop="message" label="日志内容" min-width="200"></el-table-column>
</el-table>
<div v-if="!currentLogList.length" style="text-align: center; color: #909399; padding: 40px">暂无日志记录</div>
</el-dialog>
</div>
</template>
<script setup lang="ts">
import { ref, reactive, onMounted, watch } from 'vue';
import { ElMessage } from 'element-plus';
import { Download, VideoPlay } from '@element-plus/icons-vue';
import {
getImageStats,
getVideoStats,
getImageList,
getVideoList,
getVerifyLogList,
exportRejectedMaterials,
getAccountList,
// manualVerifyImage,
// manualVerifyVideo,
// pollImageResults as pollImageResultsApi,
// pollVideoResults as pollVideoResultsApi,
// batchVerifyImage as batchVerifyImageApi,
// batchVerifyVideo as batchVerifyVideoApi,
} from '/@/api/ads/compliance/tencent/materialVerify';
// 响应式状态
const activeTab = ref('image');
// const pollLoading = ref(false);
// const batchLoading = ref(false);
// 账户列表
const accountList = ref<any[]>([]);
// 图片统计
const imageStats = reactive({ pending: 0, verified: 0, rejected: 0 });
// 视频统计
const videoStats = reactive({ pending: 0, verified: 0, rejected: 0 });
// 图片列表
const imageList = ref<any[]>([]);
const imageLoading = ref(false);
const imagePage = ref(1);
const imagePageSize = ref(10);
const imageTotal = ref(0);
const imageFilters = reactive({ status: '', accountId: '' });
// 视频列表
const videoList = ref<any[]>([]);
const videoLoading = ref(false);
const videoPage = ref(1);
const videoPageSize = ref(10);
const videoTotal = ref(0);
const videoFilters = reactive({ status: '', accountId: '' });
// 对话框
const previewVisible = ref(false);
const previewUrl = ref('');
const previewType = ref('image');
// 日志对话框
const logVisible = ref(false);
const currentLogList = ref<any[]>([]);
// 加载统计
const loadStats = async () => {
try {
const [imgRes, vidRes] = await Promise.all([getImageStats(), getVideoStats()]);
const imgStats = imgRes.data || {};
const vidStats = vidRes.data || {};
Object.assign(imageStats, {
pending: imgStats.pending || 0,
verified: imgStats.verified || 0,
rejected: imgStats.rejected || 0,
});
Object.assign(videoStats, {
pending: vidStats.pending || 0,
verified: vidStats.verified || 0,
rejected: vidStats.rejected || 0,
});
} catch (err) {
ElMessage.error('加载统计失败');
}
};
// 加载图片列表
const loadImageList = () => {
imageLoading.value = true;
getImageList({
page: imagePage.value,
pageSize: imagePageSize.value,
status: imageFilters.status,
accountId: imageFilters.accountId,
})
.then((res) => {
imageList.value = res.data?.list || [];
imageTotal.value = res.data?.total || 0;
})
.catch(() => {
ElMessage.error('加载图片列表失败');
})
.finally(() => {
imageLoading.value = false;
});
};
// 加载视频列表
const loadVideoList = () => {
videoLoading.value = true;
getVideoList({
page: videoPage.value,
pageSize: videoPageSize.value,
status: videoFilters.status,
accountId: videoFilters.accountId,
})
.then((res) => {
videoList.value = res.data?.list || [];
videoTotal.value = res.data?.total || 0;
})
.catch(() => {
ElMessage.error('加载视频列表失败');
})
.finally(() => {
videoLoading.value = false;
});
};
// Tab 切换监听
watch(activeTab, (newTab) => {
if (newTab === 'image') {
loadImageList();
} else if (newTab === 'video') {
loadVideoList();
}
});
// 搜索
const searchImage = () => {
imagePage.value = 1;
loadImageList();
};
const searchVideo = () => {
videoPage.value = 1;
loadVideoList();
};
// 重置筛选
const resetImageFilter = () => {
Object.assign(imageFilters, { status: '', accountId: '' });
searchImage();
};
const resetVideoFilter = () => {
Object.assign(videoFilters, { status: '', accountId: '' });
searchVideo();
};
// 分页
const handleImagePageChange = (page: number) => {
imagePage.value = page;
loadImageList();
};
const handleVideoPageChange = (page: number) => {
videoPage.value = page;
loadVideoList();
};
// 手动送检
// const verifyImage = (imageId: string) => {
// ElMessageBox.confirm('确认提交图片 ' + imageId + ' 进行校验?', '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning',
// })
// .then(() => {
// manualVerifyImage({ materialId: imageId })
// .then(() => {
// ElMessage.success('提交成功');
// loadImageList();
// loadStats();
// })
// .catch(() => {});
// })
// .catch(() => {});
// };
// const verifyVideo = (videoId: string) => {
// ElMessageBox.confirm('确认提交视频 ' + videoId + ' 进行校验?', '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning',
// })
// .then(() => {
// manualVerifyVideo({ materialId: videoId })
// .then(() => {
// ElMessage.success('提交成功');
// loadVideoList();
// loadStats();
// })
// .catch(() => {});
// })
// .catch(() => {});
// };
// // 刷新检测结果
// const pollImageResults = () => {
// pollLoading.value = true;
// pollImageResultsApi()
// .then((res: any) => {
// ElMessage.success(res?.msg || '刷新完成');
// loadImageList();
// loadStats();
// })
// .catch(() => {})
// .finally(() => {
// pollLoading.value = false;
// });
// };
// const pollVideoResults = () => {
// pollLoading.value = true;
// pollVideoResultsApi()
// .then((res: any) => {
// ElMessage.success(res?.msg || '刷新完成');
// loadVideoList();
// loadStats();
// })
// .catch(() => {})
// .finally(() => {
// pollLoading.value = false;
// });
// };
// 导出失败素材
const exportImageUrls = () => {
ElMessage.info('正在导出图片失败素材...');
exportRejectedMaterials({ materialType: 'IMAGE' })
.then((res: any) => {
if (res.data && res.data.items && res.data.items.length > 0) {
downloadJsonAsCsv('图片失败素材.csv', res.data.items);
ElMessage.success('导出成功');
} else {
ElMessage.warning('没有失败的图片素材');
}
})
.catch(() => {
ElMessage.error('导出失败');
});
};
const exportVideoUrls = () => {
ElMessage.info('正在导出视频失败素材...');
exportRejectedMaterials({ materialType: 'VIDEO' })
.then((res: any) => {
if (res.data && res.data.items && res.data.items.length > 0) {
downloadJsonAsCsv('视频失败素材.csv', res.data.items);
ElMessage.success('导出成功');
} else {
ElMessage.warning('没有失败的视频素材');
}
})
.catch(() => {
ElMessage.error('导出失败');
});
};
const downloadJsonAsCsv = (filename: string, items: any[]) => {
const headers = ['序号', '账户(名称)', '预览URL', '描述', '失败原因', '检测时间'];
const rows = [headers];
items.forEach((item, index) => {
// 将日期转换为 Excel 可识别的格式,添加等号前缀强制作为文本处理
const formattedDate = item.createdAt ? `="${item.createdAt}"` : '-';
rows.push([
index + 1,
`${item.accountId} - ${item.corporationName || ''}`,
(item.previewUrl || '').trim(),
item.description || '-',
item.errorMsg || '-',
formattedDate,
]);
});
const csv = rows
.map((r) =>
r
.map((v) => {
// 如果值以 "=" 开头,需要特殊处理避免被 Excel 当作公式
if (String(v).startsWith('=')) {
return v;
}
return `"${String(v).replace(/"/g, '""')}"`;
})
.join(',')
)
.join('\n');
const blob = new Blob(['\uFEFF' + csv], { type: 'text/csv;charset=utf-8;' });
const link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = filename;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
URL.revokeObjectURL(link.href);
};
// 批量送检
// const batchVerifyImage = () => {
// ElMessageBox.confirm('确认批量校验待处理的图片?', '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning',
// })
// .then(() => {
// batchLoading.value = true;
// batchVerifyImageApi()
// .then((res: any) => {
// ElMessage.success(res?.msg || '批量校验完成');
// loadImageList();
// loadStats();
// })
// .catch(() => {})
// .finally(() => {
// batchLoading.value = false;
// });
// })
// .catch(() => {});
// };
// const batchVerifyVideo = () => {
// ElMessageBox.confirm('确认批量校验待处理的视频?', '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning',
// })
// .then(() => {
// batchLoading.value = true;
// batchVerifyVideoApi()
// .then((res: any) => {
// ElMessage.success(res?.msg || '批量校验完成');
// loadVideoList();
// loadStats();
// })
// .catch(() => {})
// .finally(() => {
// batchLoading.value = false;
// });
// })
// .catch(() => {});
// };
// 预览
const previewMedia = (url: string, type: string) => {
if (!url) {
ElMessage.warning('无预览地址');
return;
}
previewUrl.value = url;
previewType.value = type;
previewVisible.value = true;
};
// 工具方法
const getStatusText = (status: string) => {
const map: Record<string, string> = {
PENDING: '待校验',
SUBMITTING: '送检中',
VERIFIED: '校验通过',
REJECTED: '校验不通过',
};
return map[status] || status || '待校验';
};
// 解析响应结果
const parseResponseResult = (responseResult: string) => {
try {
const result = JSON.parse(responseResult);
if (result.antispam && result.antispam.riskDescription) {
return result.antispam.riskDescription;
}
if (result.riskDescription) {
return result.riskDescription;
}
} catch (e) {
// 解析失败,返回原始字符串
}
return '';
};
// 查看日志
const viewLog = (row: any) => {
const materialId = row.imageId || row.videoId;
const materialType = row.imageId ? 'IMAGE' : 'VIDEO';
getVerifyLogList({
page: 1,
pageSize: 100,
materialId,
materialType,
})
.then((res: any) => {
if (res.data && res.data.list && res.data.list.length > 0) {
currentLogList.value = res.data.list.map((item: any) => {
const riskDesc = parseResponseResult(item.responseResult);
return {
time: item.createdAt || '-',
type: item.verifyStatus === 'REJECTED' ? 'ERROR' : 'SUCCESS',
status: item.verifyStatus,
suggestion: item.suggestion,
errorMsg: item.errorMsg || '-',
message: riskDesc || `校验状态:${getStatusText(item.verifyStatus)}`,
};
});
} else {
currentLogList.value = [
{
time: row.createdAt || new Date().toLocaleString('zh-CN'),
type: row.verifyStatus === 'REJECTED' ? 'ERROR' : 'SUCCESS',
status: row.verifyStatus,
suggestion: row.suggestion,
errorMsg: row.errorMsg || '-',
message: `结果:${getStatusText(row.verifyStatus)}`,
},
];
}
})
.catch(() => {
currentLogList.value = [
{
time: row.createdAt || new Date().toLocaleString('zh-CN'),
type: row.verifyStatus === 'REJECTED' ? 'ERROR' : 'SUCCESS',
status: row.verifyStatus,
suggestion: row.suggestion,
errorMsg: row.errorMsg || '-',
message: `结果:${getStatusText(row.verifyStatus)}`,
},
];
});
logVisible.value = true;
};
// 获取建议文本
const getSuggestionText = (suggestion: number) => {
const map: Record<number, string> = {
0: '通过',
1: '建议通过',
2: '建议删除',
3: '建议删除',
};
return map[suggestion] ?? '-';
};
// 获取建议样式类
const getSuggestionClass = (suggestion: number) => {
if (suggestion === 0) return 'success';
if (suggestion === 1) return 'info';
if (suggestion === 2 || suggestion === 3) return 'rejected';
return 'info';
};
// 获取日志类型文本
const getLogTypeText = (type: string) => {
const map: Record<string, string> = {
INFO: '信息',
SUCCESS: '成功',
WARN: '警告',
ERROR: '错误',
};
return map[type] || type || '信息';
};
// 加载账户列表
const loadAccountList = () => {
getAccountList()
.then((res: any) => {
if (res.data && res.data.list) {
accountList.value = res.data.list;
}
})
.catch(() => {
ElMessage.error('获取账户列表失败');
});
};
// 组件挂载时加载数据
onMounted(() => {
loadAccountList();
loadStats();
loadImageList();
});
</script>
<style scoped lang="scss">
.ads-compliance-tencent {
background: #f5f7fa;
}
.main-card {
background: #fff;
border-radius: 8px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}
.card-header {
display: flex;
align-items: center;
justify-content: space-between;
font-size: 18px;
font-weight: 600;
color: #303133;
}
.card-description {
color: #909399;
font-size: 14px;
margin: 12px 0 20px 0;
line-height: 1.6;
padding-bottom: 16px;
border-bottom: 1px solid #ebeeef;
}
.main-tabs {
margin-top: -12px;
}
.tab-content {
padding: 20px;
display: flex;
flex-direction: column;
max-height: calc(100vh - 280px);
}
.toolbar {
display: flex;
align-items: center;
justify-content: space-between;
padding: 16px 20px;
background: #fafafa;
border-radius: 8px;
margin-bottom: 20px;
flex-wrap: wrap;
gap: 16px;
}
.search-form {
display: flex;
align-items: center;
}
.search-form :deep(.el-form-item) {
margin-right: 16px;
margin-bottom: 0;
}
.search-form :deep(.el-form-item__label) {
font-size: 14px;
color: #606266;
padding-right: 8px;
}
.search-form :deep(.el-button) {
margin-left: 8px;
}
.action-buttons {
display: flex;
gap: 12px;
}
.action-buttons :deep(.el-button) {
padding: 8px 20px;
font-size: 14px;
}
.table-wrapper {
background: #fff;
border-radius: 8px;
border: 1px solid #ebeef5;
overflow: hidden;
flex: 1;
min-height: 0;
overflow-y: auto;
}
.table-wrapper :deep(.el-table) {
border: none;
}
.table-wrapper :deep(.el-table__header th) {
background: #fafafa;
font-weight: 600;
color: #606266;
}
.table-status {
display: inline-block;
padding: 4px 12px;
border-radius: 4px;
font-size: 12px;
&.status-pending {
background: #fdf6ec;
color: #e6a23c;
}
&.status-submitting {
background: #e8f4fd;
color: #409eff;
}
&.status-verified {
background: #f0f9eb;
color: #67c23a;
}
&.status-rejected {
background: #fef0f0;
color: #f56c6c;
}
&.status-info {
background: #e8f4fd;
color: #409eff;
}
&.status-success {
background: #f0f9eb;
color: #67c23a;
}
&.status-warn {
background: #fdf6ec;
color: #e6a23c;
}
&.status-error {
background: #fef0f0;
color: #f56c6c;
}
}
.pagination-container {
margin-top: 16px;
text-align: right;
flex-shrink: 0;
padding-top: 16px;
border-top: 1px solid #ebeef5;
background: #fff;
}
.media-preview {
max-width: 200px;
max-height: 150px;
border-radius: 4px;
cursor: pointer;
}
.video-preview {
width: 200px;
height: 120px;
background: #000;
display: flex;
align-items: center;
justify-content: center;
border-radius: 4px;
color: #fff;
cursor: pointer;
position: relative;
overflow: hidden;
}
.video-thumbnail {
width: 100%;
height: 100%;
object-fit: cover;
}
.play-overlay {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 44px;
height: 44px;
background: rgba(0, 0, 0, 0.6);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
transition: opacity 0.3s;
}
.video-preview:hover .play-overlay {
opacity: 1;
}
.video-preview:not(:hover) .play-overlay {
opacity: 0.7;
}
.description-text {
max-width: 200px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
word-break: break-all;
font-size: 13px;
line-height: 1.6;
color: #606266;
margin: 0;
}
.preview-dialog {
:deep(.el-dialog__body) {
padding: 16px;
overflow: hidden;
}
.preview-content {
display: flex;
align-items: center;
justify-content: center;
max-height: calc(80vh - 120px);
overflow: hidden;
img,
video {
max-width: 100%;
max-height: calc(80vh - 120px);
object-fit: contain;
}
}
}
</style>

View File

@@ -32,22 +32,12 @@
<div class="table-body">
<div v-for="(attr, index) in ruleForm.attrs" :key="index" class="table-row">
<div class="col col-name">
<el-input
v-if="!isDictType(attr.type)"
v-model="attr.name"
placeholder="请输入属性名称"
clearable
/>
<el-input v-if="!isDictType(attr.type)" v-model="attr.name" placeholder="请输入属性名称" clearable />
<span v-else class="dict-name">{{ attr.name || '请选择字典' }}</span>
</div>
<div class="col col-type">
<el-select v-model="attr.type" placeholder="属性类型" class="w100" @change="onAttrTypeChange(attr)">
<el-option
v-for="item in attrTypeOptions"
:key="item.key"
:label="item.value"
:value="item.key"
/>
<el-option v-for="item in attrTypeOptions" :key="item.key" :label="item.value" :value="item.key" />
</el-select>
</div>
<div class="col col-required">
@@ -155,13 +145,6 @@ interface DictInfo {
remark: string;
}
interface DictValue {
key: string;
value: string;
isDefault: number;
remark: string;
}
interface RuleForm {
id: string | '';
parentId: string;
@@ -219,15 +202,11 @@ const fetchDictTypeOptions = () => {
.then((res: any) => {
const list = res.data?.list ?? [];
// 提取所有字典类型信息
dictTypeOptions.value = list
.map((item: any) => item.info)
.filter((info: DictInfo) => info && info.name);
dictTypeOptions.value = list.map((item: any) => item.info).filter((info: DictInfo) => info && info.name);
// 保存完整的字典数据列表包含info和values
dictValueOptions.value = list;
})
.catch((err: any) => {
dictTypeOptions.value = [];
dictValueOptions.value = [];
})
@@ -270,7 +249,9 @@ const isDictOptionDisabled = (dictName: string, currentAttr: CustomAttr) => {
const dictInfo = dictTypeOptions.value.find((item) => item.name === dictName);
const dictType = dictInfo?.type || '';
// 检查该字典是否已被其他属性使用(使用 dictType 判断)
return ruleForm.attrs.some((attr) => attr !== currentAttr && isDictType(attr.type) && (attr.dictType === dictType || (!attr.dictType && attr.name === dictName)));
return ruleForm.attrs.some(
(attr) => attr !== currentAttr && isDictType(attr.type) && (attr.dictType === dictType || (!attr.dictType && attr.name === dictName))
);
};
// 添加自定义属性
@@ -325,16 +306,16 @@ const openDialog = (row?: CategoryRow | string, edit?: boolean) => {
// 获取分类树数据
getCategoryTree().then((res: any) => {
const tree = res.data?.tree ?? [];
// 递归函数将所有id字段转换为字符串
const convertIdsToString = (items: any[]): any[] => {
return items.map(item => ({
return items.map((item) => ({
...item,
id: item.id?.toString(),
children: item.children && item.children.length > 0 ? convertIdsToString(item.children) : []
children: item.children && item.children.length > 0 ? convertIdsToString(item.children) : [],
}));
};
categoryData.value = convertIdsToString(tree);
});
@@ -472,7 +453,7 @@ const onSubmit = () => {
...submitData,
_originalData: originalData,
};
updateCategory(requestData)
.then(() => {
ElMessage.success('修改成功');

View File

@@ -1,779 +0,0 @@
<template>
<div class="system-edit-module-container">
<el-dialog :title="state.dialog.title" v-model="state.dialog.isShowDialog" width="900px">
<el-form
ref="editModuleFormRef"
v-loading="state.dialog.detailLoading"
:model="state.ruleForm"
:rules="state.rules"
size="default"
label-width="140px"
>
<!-- 基础配置 -->
<el-row :gutter="20">
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="模型名称" prop="modelName">
<el-input v-model="state.ruleForm.modelName" placeholder="请输入模型名称" clearable></el-input>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="模型类型" prop="modelType" required>
<el-select v-model="state.ruleForm.modelType" placeholder="请选择模型类型" clearable style="width: 100%">
<el-option v-for="t in modelTypeOptions" :key="String(t.id)" :label="t.label" :value="typeOptionValue(t.id)"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="模型服务地址" prop="baseUrl">
<el-input v-model="state.ruleForm.baseUrl" placeholder="请输入模型服务地址" clearable></el-input>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="请求方式" prop="httpMethod">
<el-select v-model="state.ruleForm.httpMethod" placeholder="请选择请求方式" clearable style="width: 100%">
<el-option label="GET" value="GET"></el-option>
<el-option label="POST" value="POST"></el-option>
<el-option label="PUT" value="PUT"></el-option>
<el-option label="DELETE" value="DELETE"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col v-if="!props.isSuperAdmin" :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="访问类型" prop="isPrivate">
<el-radio-group v-model="state.ruleForm.isPrivate" @change="onIsPrivateChange">
<el-radio :label="0">本地模型</el-radio>
<el-radio :label="1">服务商模型</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col v-if="!props.isSuperAdmin && state.ruleForm.isPrivate === 1" :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
<el-form-item label="API 密钥" prop="apiKey" required>
<el-input v-model="state.ruleForm.apiKey" type="password" show-password placeholder="请输入 API 密钥字符串" clearable></el-input>
</el-form-item>
</el-col>
<el-col v-if="!props.isSuperAdmin" :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="是否对话模型" prop="isChatModel">
<el-radio-group v-model="state.ruleForm.isChatModel">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="请求头绑定" prop="headMsg">
<el-button @click="showHeaderDialog = true" style="width: 100%"> 配置请求头 ({{ state.headers.length }}) </el-button>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="自定义字段" prop="form">
<el-button @click="showFormDialog = true" style="width: 100%"> 配置表单字段 ({{ state.formFields.length }}) </el-button>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="是否启用" prop="enabled">
<el-radio-group v-model="state.ruleForm.enabled">
<el-radio :label="1">启用</el-radio>
<el-radio :label="0">禁用</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
<el-form-item label="备注说明" prop="remark">
<el-input v-model="state.ruleForm.remark" type="textarea" placeholder="请输入备注说明" :rows="3" clearable></el-input>
</el-form-item>
</el-col>
</el-row>
<!-- 高级配置折叠区域 -->
<el-divider content-position="left">
<el-button link type="primary" @click="state.showAdvanced = !state.showAdvanced">
{{ state.showAdvanced ? '收起高级配置' : '展开高级配置' }}
<el-icon class="ml5">
<component :is="state.showAdvanced ? 'ArrowUp' : 'ArrowDown'" />
</el-icon>
</el-button>
</el-divider>
<el-collapse-transition>
<el-row v-show="state.showAdvanced" :gutter="20">
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="最大并发数" prop="maxConcurrency">
<el-input-number v-model="state.ruleForm.maxConcurrency" :min="1" :max="1000" style="width: 100%"></el-input-number>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="排队队列上限" prop="queueLimit">
<el-input-number v-model="state.ruleForm.queueLimit" :min="1" :max="10000" style="width: 100%"></el-input-number>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="请求超时时间(秒)" prop="timeoutSeconds">
<el-input-number v-model="state.ruleForm.timeoutSeconds" :min="1" :max="3600" style="width: 100%"></el-input-number>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="预计执行时间(秒)" prop="expectedSeconds">
<el-input-number v-model="state.ruleForm.expectedSeconds" :min="1" :max="3600" style="width: 100%"></el-input-number>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="失败重试次数" prop="retryTimes">
<el-input-number v-model="state.ruleForm.retryTimes" :min="0" :max="10" style="width: 100%"></el-input-number>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="重试最大排队时间" prop="retryQueueMaxSeconds">
<el-input-number v-model="state.ruleForm.retryQueueMaxSeconds" :min="0" :max="3600" style="width: 100%"></el-input-number>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="自动清理间隔(秒)" prop="autoCleanSeconds">
<el-input-number v-model="state.ruleForm.autoCleanSeconds" :min="0" :max="86400" style="width: 100%"> </el-input-number>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="请求映射" prop="requestMapping">
<el-button @click="showRequestMappingDialog = true" style="width: 100%">
配置请求映射 ({{ state.requestMappingFields.length }})
</el-button>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="响应映射" prop="responseMapping">
<el-button @click="showResponseMappingDialog = true" style="width: 100%">
配置响应映射 ({{ state.responseMappingFields.length }})
</el-button>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="Token映射" prop="tokenMapping">
<el-input v-model="state.ruleForm.tokenMapping" placeholder="请输入Token映射" clearable></el-input>
</el-form-item>
</el-col>
</el-row>
</el-collapse-transition>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="onCancel" size="default"> </el-button>
<el-button type="primary" @click="onSubmit" size="default" :loading="state.dialog.loading" :disabled="state.dialog.detailLoading">
{{ state.dialog.submitTxt }}
</el-button>
</span>
</template>
</el-dialog>
<!-- 请求头配置弹窗 -->
<el-dialog v-model="showHeaderDialog" title="配置请求头" width="600px" :close-on-click-modal="false">
<div class="header-config-container">
<div v-for="(header, index) in state.headers" :key="index" class="header-item">
<el-input v-model="header.key" placeholder="请输入 Key" style="width: 40%" clearable></el-input>
<span class="separator">:</span>
<el-input v-model="header.value" placeholder="请输入 Value" style="width: 40%" clearable></el-input>
<el-button type="danger" link @click="removeHeader(index)">删除</el-button>
</div>
<el-button type="primary" link @click="addHeader" style="margin-top: 10px">+ 添加请求头</el-button>
</div>
<template #footer>
<span class="dialog-footer">
<el-button @click="showHeaderDialog = false" size="default"> </el-button>
<el-button type="primary" @click="confirmHeaders" size="default"> </el-button>
</span>
</template>
</el-dialog>
<!-- 自定义字段配置弹窗 -->
<el-dialog v-model="showFormDialog" title="配置表单字段" width="600px" :close-on-click-modal="false">
<div class="form-config-container">
<div v-for="(field, index) in state.formFields" :key="index" class="form-field-item">
<el-input v-model="field.key" placeholder="请输入字段名 (Key)" style="width: 40%" clearable></el-input>
<span class="separator">=</span>
<el-input v-model="field.value" placeholder="请输入字段值 (Value)" style="width: 40%" clearable></el-input>
<el-button type="danger" link @click="removeFormField(index)">删除</el-button>
</div>
<el-button type="primary" link @click="addFormField" style="margin-top: 10px">+ 添加字段</el-button>
</div>
<template #footer>
<span class="dialog-footer">
<el-button @click="showFormDialog = false" size="default"> </el-button>
<el-button type="primary" @click="confirmFormFields" size="default"> </el-button>
</span>
</template>
</el-dialog>
<!-- 请求映射配置弹窗 -->
<el-dialog v-model="showRequestMappingDialog" title="配置请求映射" width="600px" :close-on-click-modal="false">
<div class="mapping-config-container">
<div v-for="(field, index) in state.requestMappingFields" :key="index" class="mapping-field-item">
<el-input v-model="field.key" placeholder="请输入字段名 (Key)" style="width: 40%" clearable></el-input>
<span class="separator">=</span>
<el-input v-model="field.value" placeholder="请输入字段值 (Value)" style="width: 40%" clearable></el-input>
<el-button type="danger" link @click="removeRequestMappingField(index)">删除</el-button>
</div>
<el-button type="primary" link @click="addRequestMappingField" style="margin-top: 10px">+ 添加字段</el-button>
</div>
<template #footer>
<span class="dialog-footer">
<el-button @click="showRequestMappingDialog = false" size="default"> </el-button>
<el-button type="primary" @click="confirmRequestMappingFields" size="default"> </el-button>
</span>
</template>
</el-dialog>
<!-- 响应映射配置弹窗 -->
<el-dialog v-model="showResponseMappingDialog" title="配置响应映射" width="700px" :close-on-click-modal="false">
<div class="mapping-config-container">
<div v-for="(field, index) in state.responseMappingFields" :key="index" class="mapping-field-item">
<el-input v-model="field.key" placeholder="请输入字段名 (Key)" style="width: 30%" clearable></el-input>
<span class="separator">=</span>
<el-input v-model="field.value" placeholder="请输入字段值 (Value)" style="width: 30%" clearable></el-input>
<el-button :type="field.isMainBody ? 'success' : 'primary'" :plain="!field.isMainBody" @click="setMainBody(index)" size="small">
{{ field.isMainBody ? '✓ 返回主体' : '设置返回主体' }}
</el-button>
<el-button type="danger" link @click="removeResponseMappingField(index)">删除</el-button>
</div>
<el-button type="primary" link @click="addResponseMappingField" style="margin-top: 10px">+ 添加字段</el-button>
</div>
<template #footer>
<span class="dialog-footer">
<el-button @click="showResponseMappingDialog = false" size="default"> </el-button>
<el-button type="primary" @click="confirmResponseMappingFields" size="default"> </el-button>
</span>
</template>
</el-dialog>
</div>
</template>
<script setup lang="ts" name="systemEditModule">
import { reactive, ref, computed } from 'vue';
import { ElMessage } from 'element-plus';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { ArrowUp, ArrowDown } from '@element-plus/icons-vue';
import { addModelModule, updateModelModule, getModelModuleDetail, type ModelFormEntry } from '/@/api/digitalHuman/modelConfig/modelModule/index';
export type ModelTypeOption = { id: number | string; label: string };
const props = withDefaults(
defineProps<{
modelTypes?: ModelTypeOption[];
isSuperAdmin?: boolean;
}>(),
{
modelTypes: () => [] as ModelTypeOption[],
isSuperAdmin: false,
}
);
const modelTypeOptions = computed(() => props.modelTypes);
const typeOptionValue = (id: number | string): number | string => {
const n = Number(id);
return Number.isNaN(n) ? id : n;
};
const editModuleFormRef = ref();
const emit = defineEmits(['refresh']);
const showHeaderDialog = ref(false);
const showFormDialog = ref(false);
const showRequestMappingDialog = ref(false);
const showResponseMappingDialog = ref(false);
const state = reactive({
ruleForm: {
id: '',
modelName: '',
modelType: null as number | string | null,
baseUrl: '',
httpMethod: 'POST',
headMsg: '',
isPrivate: 0,
apiKey: '',
enabled: 1,
isChatModel: 0,
maxConcurrency: 10,
queueLimit: 100,
timeoutSeconds: 30,
expectedSeconds: 15,
retryTimes: 3,
retryQueueMaxSeconds: 60,
autoCleanSeconds: 300,
remark: '',
tokenMapping: '',
},
rules: {
modelName: [{ required: true, message: '请输入模型名称', trigger: 'blur' }],
modelType: [
{
validator: (_rule: unknown, value: unknown, callback: (e?: Error) => void) => {
if (value === null || value === undefined || value === '') {
callback(new Error('请选择模型类型'));
} else {
callback();
}
},
trigger: 'change',
},
],
baseUrl: [{ required: true, message: '请输入模型服务地址', trigger: 'blur' }],
httpMethod: [{ required: true, message: '请选择请求方式', trigger: 'change' }],
apiKey: [
{
validator: (_rule: unknown, value: unknown, callback: (e?: Error) => void) => {
// 管理员不需要验证 apiKey
if (props.isSuperAdmin) {
callback();
return;
}
// 普通用户如果是服务商模型isPrivate = 1apiKey 必填
if (state.ruleForm.isPrivate === 1) {
if (!value || String(value).trim() === '') {
callback(new Error('服务商模型必须输入 API 密钥'));
} else {
callback();
}
} else {
callback();
}
},
trigger: 'blur',
},
],
maxConcurrency: [{ required: true, message: '请输入最大并发数', trigger: 'blur' }],
queueLimit: [{ required: true, message: '请输入排队队列上限', trigger: 'blur' }],
timeoutSeconds: [{ required: true, message: '请输入请求超时时间', trigger: 'blur' }],
expectedSeconds: [{ required: true, message: '请输入预计执行时间', trigger: 'blur' }],
},
dialog: {
isShowDialog: false,
type: '',
title: '',
submitTxt: '',
loading: false,
detailLoading: false,
},
showAdvanced: false,
headers: [] as Array<{ key: string; value: string }>,
formFields: [] as Array<{ key: string; value: string }>,
requestMappingFields: [] as Array<{ key: string; value: string }>,
responseMappingFields: [] as Array<{ key: string; value: string; isMainBody?: boolean }>,
mainBodyIndex: -1, // 记录哪一行被设置为返回主体
});
// 将数组转换为对象
const fieldsToObject = (fields: Array<{ key: string; value: string }>) => {
const obj: Record<string, string> = {};
fields.forEach((f) => {
if (f.key && f.key.trim()) {
obj[f.key.trim()] = f.value || '';
}
});
return obj;
};
const parseHeaders = (headMsg: string) => parseKeyValueString(headMsg);
// 解析 form支持数组 [{ key, value }] 或历史对象 { k: { value } }
const parseFormFields = (form: unknown) => {
if (!form) return [];
if (Array.isArray(form)) {
return (form as ModelFormEntry[])
.filter((item) => item && (item.key !== undefined || item.value !== undefined))
.map((item) => ({
key: String(item.key ?? '').trim(),
value: String(item.value ?? '').trim(),
}));
}
if (typeof form === 'object') {
const fields: Array<{ key: string; value: string }> = [];
Object.keys(form as Record<string, unknown>).forEach((key) => {
const v = (form as Record<string, unknown>)[key];
const value = String(v || '');
fields.push({ key, value });
});
return fields;
}
return [];
};
// 解析 requestMapping 对象为数组
const parseRequestMappingFields = (mapping: unknown) => {
if (!mapping || typeof mapping !== 'object' || Array.isArray(mapping)) return [];
return Object.entries(mapping).map(([key, value]) => ({ key, value: String(value) }));
};
// 解析 responseMapping 对象为数组
const parseResponseMappingFields = (mapping: unknown) => {
if (!mapping || typeof mapping !== 'object' || Array.isArray(mapping)) return [];
return Object.entries(mapping).map(([key, value]) => ({ key, value: String(value) }));
};
const buildFormArray = (): ModelFormEntry[] => {
return state.formFields
.filter((field) => field.key?.trim() && field.value?.trim())
.map((field) => ({ key: field.key.trim(), value: field.value.trim() }));
};
const parseKeyValueString = (raw: string) => {
if (!raw) return [];
const headers: Array<{ key: string; value: string }> = [];
const pairs = raw.split(',');
pairs.forEach((pair) => {
const idx = pair.indexOf(':');
if (idx === -1) return;
const key = pair.slice(0, idx).trim();
const value = pair.slice(idx + 1).trim();
if (key) {
headers.push({ key, value });
}
});
return headers;
};
const stringifyHeaders = () => {
return state.headers
.filter((h) => h.key?.trim() && h.value?.trim())
.map((h) => `${h.key.trim()}:${h.value.trim()}`)
.join(',');
};
const onIsPrivateChange = (val: string | number | boolean | undefined) => {
if (val === 0 || val === '0') {
state.ruleForm.apiKey = '';
}
};
const parseJsonObjectField = (raw: string, fallback: Record<string, unknown>) => {
try {
const o = JSON.parse(raw || '{}');
if (o && typeof o === 'object' && !Array.isArray(o)) {
return o as Record<string, unknown>;
}
} catch {
/* ignore */
}
return fallback;
};
// 添加请求头
const addHeader = () => {
state.headers.push({ key: '', value: '' });
};
// 删除请求头
const removeHeader = (index: number) => {
state.headers.splice(index, 1);
};
// 确认请求头配置
const confirmHeaders = () => {
state.ruleForm.headMsg = stringifyHeaders();
showHeaderDialog.value = false;
};
// 添加表单字段
const addFormField = () => {
state.formFields.push({ key: '', value: '' });
};
// 删除表单字段
const removeFormField = (index: number) => {
state.formFields.splice(index, 1);
};
// 确认表单字段配置
const confirmFormFields = () => {
showFormDialog.value = false;
};
// 请求映射字段操作
const addRequestMappingField = () => {
state.requestMappingFields.push({ key: '', value: '' });
};
const removeRequestMappingField = (index: number) => {
state.requestMappingFields.splice(index, 1);
};
const confirmRequestMappingFields = () => {
showRequestMappingDialog.value = false;
};
// 响应映射字段操作
const addResponseMappingField = () => {
state.responseMappingFields.push({ key: '', value: '', isMainBody: false });
};
const removeResponseMappingField = (index: number) => {
state.responseMappingFields.splice(index, 1);
};
// 设置返回主体(单选)
const setMainBody = (index: number) => {
// 清除所有字段的返回主体标记
state.responseMappingFields.forEach((field, i) => {
field.isMainBody = i === index;
});
state.mainBodyIndex = index;
};
const confirmResponseMappingFields = () => {
showResponseMappingDialog.value = false;
};
const ensureKeyValueRows = (rows: Array<{ key: string; value: string }>) => (rows.length ? rows : [{ key: '', value: '' }]);
const ensureResponseMappingRows = (rows: Array<{ key: string; value: string; isMainBody?: boolean }>) => {
if (!rows.length) return [{ key: '', value: '', isMainBody: false }];
return rows.map((row) => ({ ...row, isMainBody: row.isMainBody || false }));
};
/** 从 getModel 返回的 data 中取出单条模型对象 */
const unwrapModelDetailPayload = (data: unknown): Record<string, unknown> | null => {
if (data == null) return null;
if (Array.isArray(data)) return null;
if (typeof data !== 'object') return null;
const o = data as Record<string, unknown>;
if (typeof o.modelName === 'string') return o;
if (o.model && typeof o.model === 'object' && !Array.isArray(o.model)) {
return o.model as Record<string, unknown>;
}
if (o.detail && typeof o.detail === 'object' && !Array.isArray(o.detail)) {
return o.detail as Record<string, unknown>;
}
if (o.info && typeof o.info === 'object' && !Array.isArray(o.info)) {
return o.info as Record<string, unknown>;
}
return o;
};
const fillFormFromDetailRow = (row: Record<string, unknown>) => {
const timeoutSeconds =
row.timeoutSeconds != null && row.timeoutSeconds !== ''
? Number(row.timeoutSeconds)
: row.timeoutMs != null
? Math.floor(Number(row.timeoutMs) / 1000)
: 30;
const isPrivate = row.isPrivate !== undefined && row.isPrivate !== null ? Number(row.isPrivate) : 0;
state.ruleForm = {
id: row.id as string,
modelName: String(row.modelName ?? ''),
modelType: row.modelType !== undefined && row.modelType !== null ? typeOptionValue(row.modelType as number | string) : null,
baseUrl: String(row.baseUrl ?? ''),
httpMethod: String(row.httpMethod || 'POST'),
headMsg: String(row.headMsg || ''),
isPrivate,
apiKey: isPrivate === 1 ? String(row.apiKey ?? '') : '',
enabled: Number(row.enabled ?? 1),
isChatModel: row.isChatModel !== undefined && row.isChatModel !== null ? Number(row.isChatModel) : 0,
maxConcurrency: Number(row.maxConcurrency ?? 10),
queueLimit: Number(row.queueLimit ?? 100),
timeoutSeconds,
expectedSeconds: Number(row.expectedSeconds ?? 15),
retryTimes: Number(row.retryTimes ?? 3),
retryQueueMaxSeconds: Number(row.retryQueueMaxSeconds ?? 60),
autoCleanSeconds: Number(row.autoCleanSeconds ?? 300),
remark: String(row.remark || ''),
tokenMapping: String(row.tokenMapping || ''),
};
state.headers = ensureKeyValueRows(parseHeaders(String(row.headMsg || '')));
state.formFields = ensureKeyValueRows(parseFormFields(row.form));
// 解析请求映射和响应映射
state.requestMappingFields = ensureKeyValueRows(parseRequestMappingFields(row.requestMapping));
state.responseMappingFields = ensureResponseMappingRows(parseResponseMappingFields(row.responseMapping));
// 根据 responseBody 字段设置返回主体标记 (responseBody 是对象 {key: value})
if (row.responseBody && typeof row.responseBody === 'object') {
const responseBodyKey = Object.keys(row.responseBody)[0];
if (responseBodyKey) {
const mainBodyIndex = state.responseMappingFields.findIndex((f) => f.key === responseBodyKey);
if (mainBodyIndex !== -1) {
state.responseMappingFields[mainBodyIndex].isMainBody = true;
state.mainBodyIndex = mainBodyIndex;
}
}
}
};
// 打开弹窗(编辑时会请求 /model/getModel 详情)
const openDialog = async (type: string, row?: Record<string, unknown>) => {
state.dialog.type = type;
state.dialog.isShowDialog = true;
state.showAdvanced = false;
state.dialog.detailLoading = false;
if (type === 'edit') {
const listRowId = row?.id;
if (listRowId === undefined || listRowId === null || listRowId === '') {
ElMessage.error('缺少模型 ID');
state.dialog.isShowDialog = false;
return;
}
state.dialog.title = '修改模型配置';
state.dialog.submitTxt = '修 改';
state.dialog.detailLoading = true;
try {
const res: any = await getModelModuleDetail(listRowId as string | number);
if (res.code !== 0) {
ElMessage.error(res.message || '获取模型详情失败');
state.dialog.isShowDialog = false;
return;
}
const detail = unwrapModelDetailPayload(res.data) ?? row ?? null;
if (!detail || typeof detail !== 'object') {
ElMessage.error('获取模型详情失败');
state.dialog.isShowDialog = false;
return;
}
fillFormFromDetailRow(detail as Record<string, unknown>);
} catch {
// 接口错误由 request 全局提示后端 message
state.dialog.isShowDialog = false;
} finally {
state.dialog.detailLoading = false;
}
} else {
state.ruleForm = {
id: '',
modelName: '',
modelType: null,
baseUrl: '',
httpMethod: 'POST',
headMsg: '',
isPrivate: props.isSuperAdmin ? 1 : 0,
apiKey: '',
enabled: 1,
isChatModel: 0,
maxConcurrency: 10,
queueLimit: 100,
timeoutSeconds: 30,
expectedSeconds: 15,
retryTimes: 3,
retryQueueMaxSeconds: 60,
autoCleanSeconds: 300,
remark: '',
tokenMapping: '',
};
state.headers = [{ key: '', value: '' }];
state.formFields = [{ key: '', value: '' }];
state.requestMappingFields = [{ key: '', value: '' }];
state.responseMappingFields = [{ key: '', value: '', isMainBody: false }];
state.dialog.title = '新增模型配置';
state.dialog.submitTxt = '新 增';
}
};
// 关闭弹窗
const closeDialog = () => {
state.dialog.isShowDialog = false;
state.dialog.detailLoading = false;
editModuleFormRef.value?.resetFields();
};
// 取消
const onCancel = () => {
closeDialog();
};
// 提交
const onSubmit = () => {
editModuleFormRef.value.validate(async (valid: boolean) => {
if (!valid) return;
state.dialog.loading = true;
try {
state.ruleForm.headMsg = stringifyHeaders();
const requestMapping = fieldsToObject(state.requestMappingFields);
const responseMapping = fieldsToObject(state.responseMappingFields);
// 获取被设置为返回主体的字段 {key: value}
const responseBodyField = state.responseMappingFields.find((f) => f.isMainBody);
const responseBody = responseBodyField ? { [responseBodyField.key.trim()]: responseBodyField.value } : {};
const submitData = {
modelName: state.ruleForm.modelName,
modelType: state.ruleForm.modelType as number | string,
baseUrl: state.ruleForm.baseUrl,
httpMethod: state.ruleForm.httpMethod || 'POST',
headMsg: state.ruleForm.headMsg,
isPrivate: state.ruleForm.isPrivate,
enabled: state.ruleForm.enabled,
isChatModel: state.ruleForm.isChatModel,
apiKey: state.ruleForm.isPrivate === 1 ? String(state.ruleForm.apiKey ?? '').trim() : '',
form: fieldsToObject(state.formFields),
requestMapping,
responseMapping,
responseBody,
maxConcurrency: state.ruleForm.maxConcurrency,
queueLimit: state.ruleForm.queueLimit,
timeoutSeconds: state.ruleForm.timeoutSeconds,
expectedSeconds: state.ruleForm.expectedSeconds,
retryTimes: state.ruleForm.retryTimes,
retryQueueMaxSeconds: state.ruleForm.retryQueueMaxSeconds,
autoCleanSeconds: state.ruleForm.autoCleanSeconds,
remark: state.ruleForm.remark || '',
tokenMapping: state.ruleForm.tokenMapping || '',
};
if (state.dialog.type === 'edit') {
await updateModelModule({ ...submitData, id: state.ruleForm.id });
ElMessage.success('修改成功');
} else {
await addModelModule(submitData);
ElMessage.success('新增成功');
}
closeDialog();
emit('refresh');
} catch {
// 接口错误由 request 全局提示后端 message
} finally {
state.dialog.loading = false;
}
});
};
// 暴露变量
defineExpose({
openDialog,
});
</script>
<style scoped lang="scss">
.mapping-config-container {
.mapping-field-item {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 10px;
.separator {
font-weight: bold;
color: #606266;
}
}
}
.form-config-container {
max-height: 400px;
overflow-y: auto;
}
.form-field-item {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 12px;
}
.ml5 {
margin-left: 5px;
}
.header-config-container {
max-height: 400px;
overflow-y: auto;
}
.header-item {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 12px;
}
.separator {
font-weight: bold;
color: #606266;
}
</style>

View File

@@ -0,0 +1,121 @@
<template>
<div class="chat-list">
<div class="chat-divider">今天 15:14</div>
<div v-for="msg in messages" :key="msg.id" class="message-row" :class="{ 'is-user': msg.isUser }">
<div class="bubble-wrap">
<div class="bubble">{{ msg.content }}</div>
<div class="time">{{ msg.time }}</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
interface Message {
id: number;
content: string;
time: string;
isUser: boolean;
}
const messages = ref<Message[]>([
{
id: 1,
content: '你好!我叫知子,很高兴为您服务。您今天想聊些什么呢?',
time: '09:30',
isUser: false,
},
{
id: 2,
content: '你好!我想了解下这个系统都能做什么。',
time: '09:31',
isUser: true,
},
{
id: 3,
content: '当然可以,这个系统提供了多种功能:日记、文件、快捷指令、快捷回复,以及技能管理和模型管理入口。你想先看哪一块?',
time: '09:31',
isUser: false,
},
]);
</script>
<style scoped lang="scss">
.chat-list {
height: 100%;
display: flex;
flex-direction: column;
justify-content: flex-start;
gap: 16px;
padding: 28px 0 10px;
}
.chat-divider {
align-self: center;
font-size: 12px;
color: #64748b;
line-height: 1;
padding: 4px 16px;
background: rgba(255, 255, 255, 0.7);
border-radius: 999px;
border: 1px solid rgba(226, 233, 244, 0.8);
letter-spacing: 0.2px;
box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}
.message-row {
display: flex;
align-items: flex-start;
gap: 12px;
max-width: 100%;
&.is-user {
justify-content: flex-end;
}
}
.bubble-wrap {
display: flex;
flex-direction: column;
gap: 5px;
max-width: min(84%, 1120px);
}
.bubble {
font-size: 14px;
line-height: 1.75;
padding: 14px 16px;
border-radius: 16px;
word-break: break-word;
color: #1f2937;
background: linear-gradient(135deg, rgba(255, 255, 255, 0.96) 0%, rgba(248, 250, 255, 0.92) 100%);
border: 1px solid rgba(226, 233, 244, 0.95);
backdrop-filter: blur(8px);
box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
transition: all 0.2s ease;
.message-row.is-user & {
background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 50%, #2563eb 100%);
border-color: rgba(59, 130, 246, 0.4);
color: #fff;
box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35);
}
}
.time {
font-size: 11px;
color: #8f9aae;
padding: 4px 6px;
.message-row.is-user & {
text-align: right;
color: rgba(148, 163, 184, 0.9);
}
.message-row:not(.is-user) & {
padding-left: 2px;
}
}
</style>

View File

@@ -0,0 +1,164 @@
<template>
<div class="command-list">
<div v-for="command in commandList" :key="command.id" class="command-card" @click="handleCommandClick(command)">
<div class="command-icon">
<el-icon :size="32" color="#3b82f6">
<Lightning />
</el-icon>
</div>
<div class="command-content">
<h3 class="command-name">{{ command.name }}</h3>
<p class="command-desc">{{ command.description }}</p>
<div class="command-trigger">
<el-tag size="small" type="info">{{ command.trigger }}</el-tag>
</div>
</div>
<div class="command-actions">
<el-button text size="small" @click.stop="handleEdit(command)">
<el-icon><Edit /></el-icon>
</el-button>
<el-button text size="small" type="danger" @click.stop="handleDelete(command)">
<el-icon><Delete /></el-icon>
</el-button>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { Lightning, Edit, Delete } from '@element-plus/icons-vue';
import { ElMessage } from 'element-plus';
interface Command {
id: number;
name: string;
description: string;
trigger: string;
action: string;
}
const commandList = ref<Command[]>([
{
id: 1,
name: '快速创建组件',
description: '快速创建一个 Vue 组件模板,包含基础结构和样式',
trigger: '/component',
action: 'create_component',
},
{
id: 2,
name: '生成 API 接口',
description: '根据接口文档快速生成 API 请求函数',
trigger: '/api',
action: 'generate_api',
},
{
id: 3,
name: '代码格式化',
description: '格式化当前文件的代码,统一代码风格',
trigger: '/format',
action: 'format_code',
},
{
id: 4,
name: '添加类型定义',
description: '为 JavaScript 代码添加 TypeScript 类型定义',
trigger: '/types',
action: 'add_types',
},
{
id: 5,
name: '生成测试用例',
description: '为当前组件或函数生成单元测试代码',
trigger: '/test',
action: 'generate_test',
},
{
id: 6,
name: '优化性能',
description: '分析代码并提供性能优化建议',
trigger: '/optimize',
action: 'optimize_code',
},
]);
const handleCommandClick = (command: Command) => {
ElMessage.success(`执行指令: ${command.name}`);
};
const handleEdit = (command: Command) => {
ElMessage.info(`编辑指令: ${command.name}`);
};
const handleDelete = (command: Command) => {
ElMessage.warning(`删除指令: ${command.name}`);
};
</script>
<style scoped lang="scss">
.command-list {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
gap: 16px;
}
.command-card {
background: #ffffff;
border-radius: 12px;
padding: 20px;
border: 1px solid #e5e7eb;
cursor: pointer;
transition: all 0.3s ease;
display: flex;
gap: 16px;
align-items: flex-start;
&:hover {
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
transform: translateY(-2px);
border-color: #3b82f6;
background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%);
}
}
.command-icon {
flex-shrink: 0;
width: 56px;
height: 56px;
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
border-radius: 12px;
}
.command-content {
flex: 1;
min-width: 0;
}
.command-name {
font-size: 16px;
font-weight: 600;
color: #1f2937;
margin: 0 0 8px 0;
}
.command-desc {
font-size: 13px;
color: #6b7280;
line-height: 1.5;
margin: 0 0 12px 0;
}
.command-trigger {
display: inline-block;
}
.command-actions {
display: flex;
flex-direction: column;
gap: 4px;
}
</style>

View File

@@ -0,0 +1,171 @@
<template>
<div class="diary-list">
<div v-for="diary in diaryList" :key="diary.id" class="diary-card" @click="handleDiaryClick(diary)">
<div class="diary-header">
<div class="diary-date">
<el-icon><Calendar /></el-icon>
{{ diary.date }}
</div>
<el-tag :type="diary.mood === 'happy' ? 'success' : diary.mood === 'sad' ? 'danger' : 'warning'" size="small">
{{ getMoodText(diary.mood) }}
</el-tag>
</div>
<h3 class="diary-title">{{ diary.title }}</h3>
<p class="diary-content">{{ diary.content }}</p>
<div class="diary-footer">
<div class="diary-tags">
<el-tag v-for="tag in diary.tags" :key="tag" size="small" effect="plain">{{ tag }}</el-tag>
</div>
<div class="diary-actions">
<el-button text size="small" @click.stop="handleEdit(diary)">
<el-icon><Edit /></el-icon>
</el-button>
<el-button text size="small" type="danger" @click.stop="handleDelete(diary)">
<el-icon><Delete /></el-icon>
</el-button>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { Calendar, Edit, Delete } from '@element-plus/icons-vue';
import { ElMessage } from 'element-plus';
interface Diary {
id: number;
title: string;
content: string;
date: string;
mood: 'happy' | 'sad' | 'normal';
tags: string[];
}
const diaryList = ref<Diary[]>([
{
id: 1,
title: '今天学习了 Vue 3 新特性',
content: '今天深入学习了 Vue 3 的 Composition API感觉比 Options API 更加灵活和强大。特别是 setup 函数和响应式系统的改进,让代码组织更加清晰...',
date: '2026-05-26',
mood: 'happy',
tags: ['学习', 'Vue3', '前端'],
},
{
id: 2,
title: '项目进度顺利',
content: '今天完成了首页重构的基础布局,整体效果不错。明天继续完善功能模块和样式细节...',
date: '2026-05-25',
mood: 'happy',
tags: ['工作', '项目'],
},
{
id: 3,
title: '遇到了一些技术难题',
content: '在处理复杂组件通信时遇到了一些问题,花了不少时间调试。最后通过重新设计数据流解决了...',
date: '2026-05-24',
mood: 'normal',
tags: ['技术', '调试'],
},
]);
const getMoodText = (mood: string) => {
const moodMap: Record<string, string> = {
happy: '😊 开心',
sad: '😢 难过',
normal: '😐 平静',
};
return moodMap[mood] || '平静';
};
const handleDiaryClick = (diary: Diary) => {
ElMessage.info(`查看日记: ${diary.title}`);
};
const handleEdit = (diary: Diary) => {
ElMessage.info(`编辑日记: ${diary.title}`);
};
const handleDelete = (diary: Diary) => {
ElMessage.warning(`删除日记: ${diary.title}`);
};
</script>
<style scoped lang="scss">
.diary-list {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
gap: 16px;
}
.diary-card {
background: #ffffff;
border-radius: 12px;
padding: 20px;
border: 1px solid #e5e7eb;
cursor: pointer;
transition: all 0.3s ease;
&:hover {
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
transform: translateY(-2px);
border-color: #3b82f6;
}
}
.diary-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 12px;
}
.diary-date {
display: flex;
align-items: center;
gap: 6px;
font-size: 13px;
color: #6b7280;
}
.diary-title {
font-size: 16px;
font-weight: 600;
color: #1f2937;
margin: 0 0 12px 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.diary-content {
font-size: 14px;
color: #6b7280;
line-height: 1.6;
margin: 0 0 16px 0;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
}
.diary-footer {
display: flex;
justify-content: space-between;
align-items: center;
padding-top: 12px;
border-top: 1px solid #f3f4f6;
}
.diary-tags {
display: flex;
gap: 6px;
flex-wrap: wrap;
}
.diary-actions {
display: flex;
gap: 4px;
}
</style>

View File

@@ -0,0 +1,199 @@
<template>
<div class="file-list">
<div v-for="file in fileList" :key="file.id" class="file-card" @click="handleFileClick(file)">
<div class="file-icon">
<el-icon :size="40" :color="getFileColor(file.type)">
<component :is="getFileIcon(file.type)" />
</el-icon>
</div>
<div class="file-info">
<h3 class="file-name">{{ file.name }}</h3>
<div class="file-meta">
<span class="file-size">{{ file.size }}</span>
<span class="file-date">{{ file.date }}</span>
</div>
<div class="file-tags">
<el-tag v-for="tag in file.tags" :key="tag" size="small" effect="plain">{{ tag }}</el-tag>
</div>
</div>
<div class="file-actions">
<el-button text size="small" @click.stop="handleDownload(file)">
<el-icon><Download /></el-icon>
</el-button>
<el-button text size="small" type="danger" @click.stop="handleDelete(file)">
<el-icon><Delete /></el-icon>
</el-button>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { Document, Picture, VideoPlay, Folder, Download, Delete } from '@element-plus/icons-vue';
import { ElMessage } from 'element-plus';
interface FileItem {
id: number;
name: string;
type: 'document' | 'image' | 'video' | 'folder';
size: string;
date: string;
tags: string[];
}
const fileList = ref<FileItem[]>([
{
id: 1,
name: 'Vue3 学习笔记.pdf',
type: 'document',
size: '2.5 MB',
date: '2026-05-26',
tags: ['学习', '文档'],
},
{
id: 2,
name: '项目截图.png',
type: 'image',
size: '856 KB',
date: '2026-05-25',
tags: ['截图', '项目'],
},
{
id: 3,
name: '演示视频.mp4',
type: 'video',
size: '15.3 MB',
date: '2026-05-24',
tags: ['视频', '演示'],
},
{
id: 4,
name: '项目文档',
type: 'folder',
size: '12 个文件',
date: '2026-05-23',
tags: ['文件夹'],
},
{
id: 5,
name: 'API 接口文档.docx',
type: 'document',
size: '1.2 MB',
date: '2026-05-22',
tags: ['文档', 'API'],
},
{
id: 6,
name: 'UI 设计稿.sketch',
type: 'image',
size: '4.8 MB',
date: '2026-05-21',
tags: ['设计', 'UI'],
},
]);
const getFileIcon = (type: string) => {
const iconMap: Record<string, any> = {
document: Document,
image: Picture,
video: VideoPlay,
folder: Folder,
};
return iconMap[type] || Document;
};
const getFileColor = (type: string) => {
const colorMap: Record<string, string> = {
document: '#3b82f6',
image: '#10b981',
video: '#f59e0b',
folder: '#8b5cf6',
};
return colorMap[type] || '#6b7280';
};
const handleFileClick = (file: FileItem) => {
ElMessage.info(`打开文件: ${file.name}`);
};
const handleDownload = (file: FileItem) => {
ElMessage.success(`下载文件: ${file.name}`);
};
const handleDelete = (file: FileItem) => {
ElMessage.warning(`删除文件: ${file.name}`);
};
</script>
<style scoped lang="scss">
.file-list {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 16px;
}
.file-card {
background: #ffffff;
border-radius: 12px;
padding: 20px;
border: 1px solid #e5e7eb;
cursor: pointer;
transition: all 0.3s ease;
display: flex;
gap: 16px;
align-items: flex-start;
&:hover {
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
transform: translateY(-2px);
border-color: #3b82f6;
}
}
.file-icon {
flex-shrink: 0;
width: 60px;
height: 60px;
display: flex;
align-items: center;
justify-content: center;
background: #f3f4f6;
border-radius: 8px;
}
.file-info {
flex: 1;
min-width: 0;
}
.file-name {
font-size: 15px;
font-weight: 600;
color: #1f2937;
margin: 0 0 8px 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.file-meta {
display: flex;
gap: 12px;
font-size: 13px;
color: #6b7280;
margin-bottom: 8px;
}
.file-tags {
display: flex;
gap: 6px;
flex-wrap: wrap;
}
.file-actions {
display: flex;
flex-direction: column;
gap: 4px;
}
</style>

View File

@@ -0,0 +1,332 @@
<template>
<div class="input-shell">
<div class="input-card">
<el-input
v-model="message"
type="textarea"
:rows="1"
:autosize="{ minRows: 2, maxRows: 5 }"
placeholder="多说说你的偏好和要求,我会越用越懂你"
class="message-input"
@keydown.enter.exact="handleSend"
/>
<div class="input-toolbar">
<div class="toolbar-left">
<el-button circle class="tool-btn" @click="handleAttachment">
<el-icon><Plus /></el-icon>
</el-button>
<el-dropdown trigger="click" @command="handleSkillSelect">
<el-button class="pill-btn">
{{ currentSkillDisplay }}
</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="default">默认对话</el-dropdown-item>
<el-dropdown-item command="code-review">代码审查</el-dropdown-item>
<el-dropdown-item command="refactor">代码重构</el-dropdown-item>
<el-dropdown-item command="writing">内容写作</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
<div class="toolbar-right">
<el-button circle class="send-btn" :disabled="!message.trim()" @click="handleSend">
<el-icon><Top /></el-icon>
</el-button>
</div>
</div>
<!-- 常用工作流胶囊 -->
<div class="workflow-pills" v-if="commonWorkflows.length > 0">
<div
v-for="wf in commonWorkflows"
:key="wf.id"
class="workflow-pill"
:class="{ active: selectedWorkflowId === wf.id }"
@click="selectWorkflow(wf)"
>
<el-icon class="pill-icon">
<component :is="wf.icon" />
</el-icon>
<span class="pill-text">{{ wf.name }}</span>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, computed } from 'vue';
import { useRouter } from 'vue-router';
import { Top, Plus, MagicStick, Document, CircleCheck } from '@element-plus/icons-vue';
import { ElMessage } from 'element-plus';
interface Emits {
(e: 'send', message: string): void;
}
interface Workflow {
id: number;
name: string;
icon: any;
prefix: string;
editPath: string;
}
const emit = defineEmits<Emits>();
const router = useRouter();
const message = ref('');
const selectedSkill = ref('default');
const selectedWorkflowId = ref<number | null>(null);
const skillLabels: Record<string, string> = {
default: '选择技能',
'code-review': '代码审查',
refactor: '代码重构',
writing: '内容写作',
};
const currentSkillDisplay = computed(() => {
return selectedSkill.value === 'default' ? '选择技能' : skillLabels[selectedSkill.value];
});
const skills: Record<string, string> = {
default: '',
'code-review': '[技能:代码审查] 请帮我审查下面这段代码,找出潜在问题并给出改进建议:\n',
refactor: '[技能:代码重构] 请帮我重构下面这段代码,提升可读性和可维护性:\n',
writing: '[技能:内容写作] 请根据下面的需求帮我创作内容:\n',
};
// 常用工作流列表
const commonWorkflows: Workflow[] = [
{
id: 1,
name: '审查+测试',
icon: Document,
prefix: '[工作流:审查+测试] 完成后请自动生成单元测试:\n',
editPath: '/settings/workflow',
},
{
id: 2,
name: '文档再编码',
icon: Document,
prefix: '[工作流:文档再编码] 请先编写接口文档,再实现代码:\n',
editPath: '/settings/workflow',
},
{
id: 3,
name: '代码重构',
icon: Document,
prefix: '[工作流:代码重构] 请帮我重构这段代码:\n',
editPath: '/settings/workflow',
},
{
id: 4,
name: '需求分析',
icon: Document,
prefix: '[工作流:需求分析] 请帮我分析这个需求并拆解任务:\n',
editPath: '/settings/workflow',
},
];
const handleSend = (event?: KeyboardEvent) => {
if (event) event.preventDefault();
const msg = message.value.trim();
if (!msg) return;
const skillPrefix = skills[selectedSkill.value] || '';
const workflowPrefix = selectedWorkflowId.value !== null ? commonWorkflows.find((w) => w.id === selectedWorkflowId.value)?.prefix || '' : '';
const finalMessage = (skillPrefix + workflowPrefix + msg).trim();
emit('send', finalMessage);
message.value = '';
// 发送后清空选择
selectedWorkflowId.value = null;
};
const handleAttachment = () => {
ElMessage.info('附件上传功能开发中...');
};
const handleSkillSelect = (key: string | number | object) => {
selectedSkill.value = String(key);
if (selectedSkill.value !== 'default') {
ElMessage.success(`已选择技能:${skillLabels[selectedSkill.value]}`);
}
};
const selectWorkflow = (wf: Workflow) => {
if (selectedWorkflowId.value === wf.id) {
selectedWorkflowId.value = null;
ElMessage.info('已取消工作流');
} else {
selectedWorkflowId.value = wf.id;
ElMessage.success(`已选择工作流:${wf.name}`);
}
};
</script>
<style scoped lang="scss">
.input-shell {
position: relative;
z-index: 12;
margin-top: -20px;
padding: 0 0 50px;
background: transparent;
}
.input-card {
width: min(1060px, 82%);
margin: 0 auto;
background:
linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.94) 100%),
radial-gradient(120% 180% at 0% 0%, rgba(59, 130, 246, 0.15) 0%, rgba(59, 130, 246, 0) 38%),
radial-gradient(80% 120% at 100% 100%, rgba(168, 85, 247, 0.08) 0%, rgba(168, 85, 247, 0) 38%);
border: 1px solid rgba(59, 130, 246, 0.28);
border-radius: 20px;
box-shadow:
0 24px 48px rgba(15, 23, 42, 0.12),
0 0 0 1px rgba(59, 130, 246, 0.08) inset,
0 8px 16px rgba(37, 99, 235, 0.1);
padding: 16px 18px 18px;
backdrop-filter: blur(16px);
}
.message-input {
:deep(.el-textarea__inner) {
border: none;
box-shadow: none;
resize: none;
padding: 8px 6px 14px;
font-size: 15px;
line-height: 1.65;
color: #0f172a;
background: transparent;
min-height: 50px;
font-weight: 500;
&::placeholder {
color: #90a1b7;
font-weight: 400;
}
}
}
.input-toolbar {
display: flex;
justify-content: space-between;
align-items: center;
gap: 10px;
padding-top: 2px;
}
.toolbar-left,
.toolbar-right {
display: flex;
align-items: center;
gap: 10px;
}
.tool-btn {
width: 32px;
height: 32px;
border: 1px solid #d9e4f5;
color: #5b6b84;
background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
transition: all 0.2s ease;
&:hover {
color: #2b4d8f;
background: linear-gradient(135deg, #f0f7ff 0%, #e0edff 100%);
border-color: #bfdbfe;
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}
}
.pill-btn {
height: 32px;
padding: 0 14px;
border-radius: 999px;
border: 1px solid #dbe7f7;
color: #30435f;
background: linear-gradient(180deg, #ffffff 0%, #f6f9ff 100%);
font-size: 12px;
font-weight: 600;
transition: all 0.2s ease;
&:hover {
background: linear-gradient(135deg, #f0f7ff 0%, #e0edff 100%);
border-color: #bfdbfe;
color: #1d4ed8;
}
}
.send-btn {
width: 32px;
height: 32px;
border: none;
background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 50%, #2563eb 100%);
color: #fff;
box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
transition: all 0.2s ease;
&:hover:not(:disabled) {
filter: brightness(1.08);
transform: translateY(-1px);
box-shadow: 0 8px 20px rgba(59, 130, 246, 0.5);
}
&:disabled {
opacity: 0.5;
box-shadow: none;
background: linear-gradient(135deg, #cbd5e1 0%, #94a3b8 100%);
}
}
/* 工作流胶囊样式 */
.workflow-pills {
margin-top: 12px;
padding-top: 12px;
border-top: 1px solid rgba(59, 130, 246, 0.15);
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.workflow-pill {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 4px 10px;
border-radius: 999px;
border: 1px solid rgba(59, 130, 246, 0.3);
background: rgba(255, 255, 255, 0.6);
cursor: pointer;
transition: all 0.2s ease;
color: #475569;
&:hover {
border-color: #3b82f6;
background: rgba(59, 130, 246, 0.08);
transform: translateY(-1px);
}
&.active {
border-color: #3b82f6;
background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
color: #ffffff;
box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}
.pill-icon {
font-size: 14px;
}
.pill-text {
font-size: 12px;
font-weight: 500;
line-height: 1.2;
}
}
</style>

View File

@@ -0,0 +1,88 @@
<template>
<div class="main-content">
<div v-if="activeMenu !== 'chat'" class="content-header">
<h2 class="content-title">{{ currentTitle }}</h2>
<div class="content-actions">
</div>
</div>
<div class="content-body">
<div class="chat-container" v-if="activeMenu === 'chat'">
<ChatList />
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { computed } from 'vue';
import ChatList from './ChatList.vue';
interface Props {
activeMenu: string;
}
const props = defineProps<Props>();
const menuTitles: Record<string, string> = {
chat: '对话',
models: '模型管理',
creation: '内容创作',
};
const currentTitle = computed(() => menuTitles[props.activeMenu] || '首页');
</script>
<style scoped lang="scss">
.main-content {
flex: 1;
display: flex;
flex-direction: column;
background: #ffffff;
overflow: hidden;
}
.content-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20px 24px;
border-bottom: 1px solid #e5e7eb;
background: #ffffff;
}
.content-title {
font-size: 20px;
font-weight: 600;
color: #1f2937;
margin: 0;
}
.content-actions {
display: flex;
gap: 12px;
}
.content-body {
flex: 1;
overflow-y: auto;
background:
radial-gradient(1200px 420px at 58% -120px, rgba(59, 130, 246, 0.1) 0%, rgba(59, 130, 246, 0) 65%),
radial-gradient(900px 320px at 20% 120%, rgba(99, 102, 241, 0.08) 0%, rgba(99, 102, 241, 0) 68%),
linear-gradient(180deg, #f8fbff 0%, #f5f7fb 100%);
/* 隐藏滚动条但保持滚动功能 */
scrollbar-width: none;
-ms-overflow-style: none;
&::-webkit-scrollbar {
display: none;
}
}
.chat-container {
width: min(1060px, 82%);
margin: 0 auto;
padding: 20px 0 130px;
}
</style>

View File

@@ -0,0 +1,207 @@
<template>
<div class="reply-list">
<div v-for="reply in replyList" :key="reply.id" class="reply-card" @click="handleReplyClick(reply)">
<div class="reply-header">
<div class="reply-category">
<el-tag :type="getCategoryType(reply.category)" size="small">{{ reply.category }}</el-tag>
</div>
<div class="reply-usage">
<el-icon><ChatDotRound /></el-icon>
<span>{{ reply.usageCount }} 次使用</span>
</div>
</div>
<h3 class="reply-title">{{ reply.title }}</h3>
<p class="reply-content">{{ reply.content }}</p>
<div class="reply-footer">
<div class="reply-tags">
<el-tag v-for="tag in reply.tags" :key="tag" size="small" effect="plain">{{ tag }}</el-tag>
</div>
<div class="reply-actions">
<el-button text size="small" @click.stop="handleCopy(reply)">
<el-icon><CopyDocument /></el-icon>
</el-button>
<el-button text size="small" @click.stop="handleEdit(reply)">
<el-icon><Edit /></el-icon>
</el-button>
<el-button text size="small" type="danger" @click.stop="handleDelete(reply)">
<el-icon><Delete /></el-icon>
</el-button>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { ChatDotRound, CopyDocument, Edit, Delete } from '@element-plus/icons-vue';
import { ElMessage } from 'element-plus';
interface Reply {
id: number;
title: string;
content: string;
category: string;
tags: string[];
usageCount: number;
}
const replyList = ref<Reply[]>([
{
id: 1,
title: '欢迎语',
content: '您好!很高兴为您服务。请问有什么可以帮助您的吗?',
category: '问候',
tags: ['欢迎', '问候'],
usageCount: 156,
},
{
id: 2,
title: '感谢回复',
content: '非常感谢您的反馈!我们会继续努力为您提供更好的服务。',
category: '感谢',
tags: ['感谢', '反馈'],
usageCount: 89,
},
{
id: 3,
title: '技术支持',
content: '我已经收到您的问题,正在为您查询相关信息。请稍等片刻,我会尽快回复您。',
category: '支持',
tags: ['技术', '支持'],
usageCount: 234,
},
{
id: 4,
title: '道歉回复',
content: '非常抱歉给您带来不便。我们会立即处理这个问题,并尽快给您一个满意的答复。',
category: '道歉',
tags: ['道歉', '问题'],
usageCount: 45,
},
{
id: 5,
title: '结束语',
content: '如果您还有其他问题,随时欢迎联系我们。祝您生活愉快!',
category: '结束',
tags: ['结束', '祝福'],
usageCount: 178,
},
{
id: 6,
title: '产品介绍',
content: '我们的产品采用最新技术,为您提供高效、稳定、安全的服务体验。',
category: '介绍',
tags: ['产品', '介绍'],
usageCount: 67,
},
]);
const getCategoryType = (category: string) => {
const typeMap: Record<string, any> = {
问候: 'success',
感谢: 'primary',
支持: 'warning',
道歉: 'danger',
结束: 'info',
介绍: '',
};
return typeMap[category] || '';
};
const handleReplyClick = (reply: Reply) => {
ElMessage.success(`使用快捷回复: ${reply.title}`);
};
const handleCopy = (reply: Reply) => {
navigator.clipboard.writeText(reply.content);
ElMessage.success('已复制到剪贴板');
};
const handleEdit = (reply: Reply) => {
ElMessage.info(`编辑回复: ${reply.title}`);
};
const handleDelete = (reply: Reply) => {
ElMessage.warning(`删除回复: ${reply.title}`);
};
</script>
<style scoped lang="scss">
.reply-list {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
gap: 16px;
}
.reply-card {
background: #ffffff;
border-radius: 12px;
padding: 20px;
border: 1px solid #e5e7eb;
cursor: pointer;
transition: all 0.3s ease;
&:hover {
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
transform: translateY(-2px);
border-color: #3b82f6;
}
}
.reply-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 12px;
}
.reply-category {
flex-shrink: 0;
}
.reply-usage {
display: flex;
align-items: center;
gap: 4px;
font-size: 12px;
color: #6b7280;
}
.reply-title {
font-size: 16px;
font-weight: 600;
color: #1f2937;
margin: 0 0 12px 0;
}
.reply-content {
font-size: 14px;
color: #6b7280;
line-height: 1.6;
margin: 0 0 16px 0;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
}
.reply-footer {
display: flex;
justify-content: space-between;
align-items: center;
padding-top: 12px;
border-top: 1px solid #f3f4f6;
}
.reply-tags {
display: flex;
gap: 6px;
flex-wrap: wrap;
}
.reply-actions {
display: flex;
gap: 4px;
}
</style>

View File

@@ -0,0 +1,207 @@
<template>
<div class="sidebar">
<div class="sidebar-header">
<el-button class="new-chat-btn" @click="handleNewChat">
<el-icon>
<Plus />
</el-icon>
新增对话
</el-button>
</div>
<div v-if="historyList.length" class="history-section">
<div class="history-title">历史对话</div>
<div class="history-list">
<div
v-for="item in historyList"
:key="item.id"
class="history-item"
:class="{ active: activeHistoryId === item.id }"
@click="handleSelectHistory(item.id)"
>
<div class="history-main">
<div class="history-name">{{ item.title }}</div>
<div class="history-time">{{ item.time }}</div>
</div>
<el-button text class="delete-btn" @click.stop="handleDeleteHistory(item.id)">
<el-icon>
<Delete />
</el-icon>
</el-button>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { Plus, Delete } from '@element-plus/icons-vue';
interface HistoryItem {
id: number;
title: string;
time: string;
}
interface Props {
activeMenu: string;
activeHistoryId: number;
historyList: HistoryItem[];
}
interface Emits {
(e: 'menu-change', key: string): void;
(e: 'new-chat'): void;
(e: 'select-history', id: number): void;
(e: 'delete-history', id: number): void;
}
defineProps<Props>();
const emit = defineEmits<Emits>();
const handleNewChat = () => {
emit('new-chat');
};
const handleSelectHistory = (id: number) => {
emit('select-history', id);
};
const handleDeleteHistory = (id: number) => {
emit('delete-history', id);
};
</script>
<style scoped lang="scss">
.sidebar {
width: 252px;
background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(249, 251, 255, 0.92) 100%);
border-right: 1px solid #e7edf7;
display: flex;
flex-direction: column;
height: 100%;
box-shadow: 8px 0 30px rgba(15, 23, 42, 0.06);
backdrop-filter: blur(10px);
}
.sidebar-header {
padding: 18px 16px 14px;
border-bottom: 1px solid #e9eef7;
position: relative;
}
.new-chat-btn {
margin-top: 0;
width: 100%;
height: 40px;
border-radius: 12px;
border: 1px solid rgba(59, 130, 246, 0.28);
background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
color: #ffffff;
font-weight: 600;
letter-spacing: 0.2px;
box-shadow: 0 4px 12px rgba(37, 99, 235, 0.26);
transition: all 0.2s ease;
&:hover {
transform: translateY(-1px);
color: #ffffff;
border-color: rgba(59, 130, 246, 0.4);
background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
box-shadow: 0 6px 16px rgba(37, 99, 235, 0.32);
}
}
.history-section {
flex: 1;
display: flex;
flex-direction: column;
margin-top: 8px;
min-height: 0;
background: linear-gradient(180deg, rgba(249, 251, 255, 0.5) 0%, rgba(249, 251, 255, 0.9) 100%);
}
.history-title {
padding: 12px 12px 8px;
font-size: 11px;
font-weight: 600;
color: #64748b;
text-transform: uppercase;
letter-spacing: 0.8px;
}
.history-list {
flex: 1;
padding: 0 8px 10px;
overflow-y: auto;
scrollbar-width: none;
-ms-overflow-style: none;
&::-webkit-scrollbar {
display: none;
}
}
.history-item {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
padding: 10px 10px;
margin-bottom: 6px;
border-radius: 10px;
border: 1px solid transparent;
cursor: pointer;
transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
background: rgba(255, 255, 255, 0.6);
&:hover {
border-color: #bfdbfe;
background: linear-gradient(135deg, rgba(239, 246, 255, 0.9) 0%, rgba(219, 234, 254, 0.7) 100%);
transform: translateX(2px);
}
&.active {
border-color: #3b82f6;
background: linear-gradient(135deg, rgba(59, 130, 246, 0.12) 0%, rgba(59, 130, 246, 0.04) 100%);
box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}
.delete-btn {
opacity: 0;
color: #94a3b8;
transition: all 0.2s ease;
padding: 4px;
&:hover {
color: #ef4444;
background: rgba(239, 68, 68, 0.1);
border-radius: 4px;
}
}
&:hover .delete-btn {
opacity: 1;
}
}
.history-main {
min-width: 0;
flex: 1;
}
.history-name {
font-size: 12px;
font-weight: 500;
color: #1e293b;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-bottom: 2px;
}
.history-time {
font-size: 11px;
color: #94a3b8;
}
</style>

File diff suppressed because one or more lines are too long

View File

@@ -1,62 +1,61 @@
<template>
<el-dialog :title="isEdit ? '编辑数据集' : '新增数据集'" v-model="isShowDialog" width="600px" :close-on-click-modal="false" @close="onCancel">
<el-form ref="formRef" :model="ruleForm" :rules="rules" label-width="100px">
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="数据集名称" prop="name">
<el-input v-model="ruleForm.name" placeholder="请输入数据集名称" clearable />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="数据集类型" prop="type">
<el-select v-model="ruleForm.type" placeholder="请选择类型" clearable style="width: 100%">
<el-option label="文本" value="text" />
<el-option label="问答" value="qa" />
<el-option label="表格" value="table" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="向量模型" prop="embeddingModel">
<el-select v-model="ruleForm.embeddingModel" placeholder="请选择向量模型" clearable style="width: 100%">
<el-option label="text-embedding-ada-002" value="text-embedding-ada-002" />
<el-option label="text-embedding-3-small" value="text-embedding-3-small" />
<el-option label="text-embedding-3-large" value="text-embedding-3-large" />
<el-option label="bge-large-zh" value="bge-large-zh" />
<el-option label="m3e-base" value="m3e-base" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="描述" prop="description">
<el-input v-model="ruleForm.description" type="textarea" :rows="4" placeholder="请输入数据集描述" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" v-if="isEdit">
<el-col :span="12">
<el-form-item label="文档数量">
<el-input :value="ruleForm.documentCount" disabled />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="字符数量">
<el-input :value="ruleForm.charCount" disabled />
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="onCancel"> </el-button>
<el-button type="primary" @click="onSubmit" :loading="submitLoading">{{ isEdit ? '保 存' : '创 建' }}</el-button>
</span>
</template>
</el-dialog>
<el-dialog :title="isEdit ? '编辑数据集' : '新增数据集'" v-model="isShowDialog" width="600px" :close-on-click-modal="false" @close="onCancel">
<el-form ref="formRef" :model="ruleForm" :rules="rules" label-width="100px">
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="数据集名称" prop="name">
<el-input v-model="ruleForm.name" placeholder="请输入数据集名称" clearable />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="数据集类型" prop="datasetType">
<el-select v-model="ruleForm.datasetType" placeholder="请选择类型" clearable style="width: 100%">
<el-option label="文本" :value="1" />
<el-option label="视频" :value="2" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="向量模型" prop="embeddingModel">
<el-select v-model="ruleForm.embeddingModel" placeholder="请选择向量模型" clearable style="width: 100%">
<el-option label="text-embedding-ada-002" value="text-embedding-ada-002" />
<el-option label="text-embedding-3-small" value="text-embedding-3-small" />
<el-option label="text-embedding-3-large" value="text-embedding-3-large" />
<el-option label="bge-large-zh" value="bge-large-zh" />
<el-option label="m3e-base" value="m3e-base" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="描述" prop="description">
<el-input v-model="ruleForm.description" type="textarea" :rows="4" placeholder="请输入数据集描述" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" v-if="isEdit">
<el-col :span="12">
<el-form-item label="文档数量">
<el-input :value="ruleForm.documentCount" disabled />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="字符数量">
<el-input :value="ruleForm.charCount" disabled />
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="onCancel"> </el-button>
<el-button type="primary" @click="onSubmit" :loading="submitLoading">{{ isEdit ? '保 存' : '创 建' }}</el-button>
</span>
</template>
</el-dialog>
</template>
<script lang="ts">
@@ -69,7 +68,7 @@ export default {
import { ref, reactive } from 'vue';
import { ElMessage } from 'element-plus';
import type { FormInstance, FormRules } from 'element-plus';
import { createknowledge, updateknowledge, getknowledge } from '/@/api/knowledge/knowledge';
import { createknowledge, updateknowledge, getknowledge } from '/@/api/knowledge/dataset';
// 定义事件
const emit = defineEmits(['getknowledgeList']);
@@ -86,7 +85,7 @@ const submitLoading = ref(false);
const ruleForm = reactive({
id: '',
name: '',
type: 'text',
datasetType: 1 as number,
description: '',
embeddingModel: 'text-embedding-ada-002',
documentCount: 0,
@@ -96,7 +95,7 @@ const ruleForm = reactive({
// 表单验证规则
const rules = reactive<FormRules>({
name: [{ required: true, message: '请输入数据集名称', trigger: 'blur' }],
type: [{ required: true, message: '请选择数据集类型', trigger: 'change' }],
datasetType: [{ required: true, message: '请选择数据集类型', trigger: 'change' }],
embeddingModel: [{ required: true, message: '请选择向量模型', trigger: 'change' }],
});
@@ -104,7 +103,7 @@ const rules = reactive<FormRules>({
const resetForm = () => {
ruleForm.id = '';
ruleForm.name = '';
ruleForm.type = 'text';
ruleForm.datasetType = 1;
ruleForm.description = '';
ruleForm.embeddingModel = 'text-embedding-ada-002';
ruleForm.documentCount = 0;
@@ -122,7 +121,7 @@ const openDialog = async (row?: any) => {
const data = res.data || row;
ruleForm.id = data.id || '';
ruleForm.name = data.name || '';
ruleForm.type = data.type || 'text';
ruleForm.datasetType = data.datasetType || 1;
ruleForm.description = data.description || '';
ruleForm.embeddingModel = data.embeddingModel || 'text-embedding-ada-002';
ruleForm.documentCount = data.documentCount || 0;
@@ -132,7 +131,7 @@ const openDialog = async (row?: any) => {
// 使用传入的row数据
ruleForm.id = row.id || '';
ruleForm.name = row.name || '';
ruleForm.type = row.type || 'text';
ruleForm.datasetType = row.datasetType || 1;
ruleForm.description = row.description || '';
ruleForm.embeddingModel = row.embeddingModel || 'text-embedding-ada-002';
ruleForm.documentCount = row.documentCount || 0;
@@ -161,7 +160,7 @@ const onSubmit = async () => {
const data = {
id: ruleForm.id || undefined,
name: ruleForm.name,
type: ruleForm.type,
datasetType: ruleForm.datasetType,
description: ruleForm.description,
embeddingModel: ruleForm.embeddingModel,
status: 'enable',

View File

@@ -1,112 +1,111 @@
<template>
<div class="knowledge-knowledge-page">
<div class="knowledge-knowledge-container">
<el-card shadow="hover">
<div class="knowledge-knowledge-search mb15">
<el-form :inline="true">
<el-form-item label="数据集名称">
<el-input size="default" v-model="tableData.param.keyword" placeholder="请输入数据集名称" clearable style="width: 200px" />
</el-form-item>
<el-form-item label="数据集类型">
<el-select size="default" v-model="tableData.param.type" placeholder="请选择类型" clearable style="width: 150px">
<el-option label="文本" value="text" />
<el-option label="问答" value="qa" />
<el-option label="表格" value="table" />
</el-select>
</el-form-item>
<el-form-item label="状态">
<el-select size="default" v-model="tableData.param.status" placeholder="请选择状态" clearable style="width: 120px">
<el-option label="用" value="enable" />
<el-option label="禁用" value="disable" />
</el-select>
</el-form-item>
<el-form-item>
<el-button size="default" type="primary" @click="getknowledgeList">
<el-icon><ele-Search /></el-icon>
查询
</el-button>
<el-button size="default" @click="onResetQuery">
<el-icon><ele-Refresh /></el-icon>
重置
</el-button>
<el-button size="default" type="success" @click="onOpenAdd" v-auth="'api/v1/knowledge/knowledge/create'">
<el-icon><ele-Plus /></el-icon>
新增
</el-button>
</el-form-item>
</el-form>
</div>
<el-table :data="tableData.data" style="width: 100%" v-loading="tableData.loading" border>
<el-table-column type="index" label="序号" width="60" align="center" />
<el-table-column prop="name" label="数据集名称" min-width="180" show-overflow-tooltip>
<template #default="scope">
<el-link type="primary" @click="onViewDetail(scope.row)">{{ scope.row.name }}</el-link>
</template>
</el-table-column>
<el-table-column prop="type" label="类型" width="100" align="center">
<template #default="scope">
<el-tag :type="getTypeTagType(scope.row.type)">{{ getTypeText(scope.row.type) }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="documentCount" label="文档数" width="100" align="center" />
<el-table-column prop="charCount" label="字符数" width="120" align="center">
<template #default="scope">
{{ formatCharCount(scope.row.charCount) }}
</template>
</el-table-column>
<el-table-column prop="embeddingModel" label="向量模型" width="150" show-overflow-tooltip />
<el-table-column prop="status" label="状态" width="80" align="center">
<template #default="scope">
<el-switch
v-model="scope.row.statusEnabled"
inline-prompt
active-text=""
inactive-text=""
@change="onStatusChange(scope.row)"
v-auth="'api/v1/knowledge/knowledge/updateStatus'"
/>
</template>
</el-table-column>
<el-table-column prop="createdAt" label="创建时间" width="170" show-overflow-tooltip />
<el-table-column prop="updatedAt" label="更新时间" width="170" show-overflow-tooltip />
<el-table-column label="操作" width="200" fixed="right" align="center">
<template #default="scope">
<el-button size="small" text type="primary" @click="onEdit(scope.row)" v-auth="'api/v1/knowledge/knowledge/update'">编辑</el-button>
<el-button size="small" text type="success" @click="onManageDocuments(scope.row)">文档</el-button>
<el-button size="small" text type="danger" @click="onRowDel(scope.row)" v-auth="'api/v1/knowledge/knowledge/delete'">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<div class="mt15" style="text-align: right">
<el-pagination
v-model:current-page="tableData.param.pageNum"
v-model:page-size="tableData.param.pageSize"
:page-sizes="[10, 20, 50, 100]"
:total="tableData.total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="onSizeChange"
@current-change="onCurrentChange"
/>
</div>
</el-card>
<div class="knowledge-knowledge-page">
<div class="knowledge-knowledge-container">
<el-card shadow="hover">
<div class="knowledge-knowledge-search mb15">
<el-form :inline="true">
<el-form-item label="数据集名称">
<el-input size="default" v-model="tableData.param.keyword" placeholder="请输入数据集名称" clearable style="width: 200px" />
</el-form-item>
<el-form-item label="数据集类型">
<el-select size="default" v-model="tableData.param.datasetType" placeholder="请选择类型" clearable style="width: 150px">
<el-option label="文本" :value="1" />
<el-option label="视频" :value="2" />
</el-select>
</el-form-item>
<el-form-item label="状态">
<el-select size="default" v-model="tableData.param.status" placeholder="请选择状态" clearable style="width: 120px">
<el-option label="启用" value="enable" />
<el-option label="用" value="disable" />
</el-select>
</el-form-item>
<el-form-item>
<el-button size="default" type="primary" @click="getknowledgeList">
<el-icon><ele-Search /></el-icon>
查询
</el-button>
<el-button size="default" @click="onResetQuery">
<el-icon><ele-Refresh /></el-icon>
重置
</el-button>
<el-button size="default" type="success" @click="onOpenAdd" v-auth="'api/v1/knowledge/knowledge/create'">
<el-icon><ele-Plus /></el-icon>
新增
</el-button>
</el-form-item>
</el-form>
</div>
<el-table :data="tableData.data" style="width: 100%" v-loading="tableData.loading" border>
<el-table-column type="index" label="序号" width="60" align="center" />
<el-table-column prop="name" label="数据集名称" min-width="180" show-overflow-tooltip>
<template #default="scope">
<el-link type="primary" @click="onViewDetail(scope.row)">{{ scope.row.name }}</el-link>
</template>
</el-table-column>
<el-table-column prop="datasetType" label="类型" width="100" align="center">
<template #default="scope">
<el-tag :type="getTypeTagType(scope.row.datasetType)">{{ getTypeText(scope.row.datasetType) }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="documentCount" label="文档数" width="100" align="center" />
<el-table-column prop="charCount" label="字符数" width="120" align="center">
<template #default="scope">
{{ formatCharCount(scope.row.charCount) }}
</template>
</el-table-column>
<el-table-column prop="embeddingModel" label="向量模型" width="150" show-overflow-tooltip />
<el-table-column prop="status" label="状态" width="80" align="center">
<template #default="scope">
<el-switch
v-model="scope.row.statusEnabled"
inline-prompt
active-text=""
inactive-text=""
@change="onStatusChange(scope.row)"
v-auth="'api/v1/knowledge/knowledge/updateStatus'"
/>
</template>
</el-table-column>
<el-table-column prop="createdAt" label="创建时间" width="170" show-overflow-tooltip />
<el-table-column prop="updatedAt" label="更新时间" width="170" show-overflow-tooltip />
<el-table-column label="操作" width="200" fixed="right" align="center">
<template #default="scope">
<el-button size="small" text type="primary" @click="onEdit(scope.row)" v-auth="'api/v1/knowledge/knowledge/update'">编辑</el-button>
<el-button size="small" text type="success" @click="onManageDocuments(scope.row)">文档</el-button>
<el-button size="small" text type="danger" @click="onRowDel(scope.row)" v-auth="'api/v1/knowledge/knowledge/delete'">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<div class="mt15" style="text-align: right">
<el-pagination
v-model:current-page="tableData.param.pageNum"
v-model:page-size="tableData.param.pageSize"
:page-sizes="[10, 20, 50, 100]"
:total="tableData.total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="onSizeChange"
@current-change="onCurrentChange"
/>
</div>
</el-card>
</div>
<Editknowledge ref="editknowledgeRef" @getknowledgeList="getknowledgeList" />
</div>
<Editknowledge ref="editknowledgeRef" @getknowledgeList="getknowledgeList" />
</div>
</template>
</template>
<script lang="ts">
<script lang="ts">
export default {
name: 'knowledgeknowledge',
};
</script>
</script>
<script setup lang="ts">
<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue';
import { useRouter } from 'vue-router';
import { ElMessage, ElMessageBox } from 'element-plus';
import { listknowledges, deleteknowledge, updateknowledgeStatus } from '/@/api/knowledge/knowledge';
import Editknowledge from './component/editknowledge.vue';
import { listknowledges, deleteknowledge, updateknowledgeStatus } from '/@/api/knowledge/dataset';
import Editknowledge from './component/editDataset.vue';
const router = useRouter();
@@ -117,7 +116,7 @@ const tableData = reactive({
loading: false,
param: {
keyword: '',
type: '',
datasetType: undefined as number | undefined,
status: undefined as string | undefined,
pageNum: 1,
pageSize: 10,
@@ -148,30 +147,26 @@ const getknowledgeList = async () => {
};
// 获取类型标签类型
const getTypeTagType = (type: string) => {
switch (type) {
case 'text':
const getTypeTagType = (datasetType: number) => {
switch (datasetType) {
case 1:
return 'primary';
case 'qa':
case 2:
return 'success';
case 'table':
return 'warning';
default:
return 'info';
}
};
// 获取类型文本
const getTypeText = (type: string) => {
switch (type) {
case 'text':
const getTypeText = (datasetType: number) => {
switch (datasetType) {
case 1:
return '文本';
case 'qa':
return '问答';
case 'table':
return '表格';
case 2:
return '视频';
default:
return type;
return String(datasetType);
}
};
@@ -187,7 +182,7 @@ const formatCharCount = (count: number) => {
// 重置查询
const onResetQuery = () => {
tableData.param.keyword = '';
tableData.param.type = '';
tableData.param.datasetType = undefined;
tableData.param.status = undefined;
tableData.param.pageNum = 1;
getknowledgeList();
@@ -261,9 +256,9 @@ const onCurrentChange = (page: number) => {
onMounted(() => {
getknowledgeList();
});
</script>
</script>
<style scoped lang="scss">
<style scoped lang="scss">
.knowledge-knowledge-page {
padding: 15px;
.knowledge-knowledge-container {
@@ -274,4 +269,4 @@ onMounted(() => {
}
}
}
</style>
</style>

View File

@@ -156,7 +156,7 @@
<template #default="{ row }">
<el-button text size="small" v-debounce @click="onPreviewFile(row)">预览</el-button>
<el-button v-if="row.vectorStatus === 1" text size="small" type="primary" v-debounce @click="onGenerateVector(row)"
>生成向量</el-button
>生成向量</el-button
>
<el-button v-else text size="small" type="primary" v-debounce @click="onViewTaskList(row)">查看任务</el-button>
<el-button text size="small" type="danger" v-debounce @click="onDeleteFile(row)">删除</el-button>
@@ -233,6 +233,12 @@
<el-form-item label="名称" prop="name">
<el-input v-model="knowledgeForm.name" placeholder="请输入知识库名称" />
</el-form-item>
<el-form-item label="数据集类型" prop="datasetType">
<el-select v-model="knowledgeForm.datasetType" placeholder="请选择类型" clearable style="width: 100%">
<el-option label="文本" :value="1" />
<el-option label="视频" :value="2" />
</el-select>
</el-form-item>
<el-form-item label="描述" prop="description">
<el-input v-model="knowledgeForm.description" type="textarea" :rows="3" placeholder="请输入描述" />
</el-form-item>
@@ -469,10 +475,12 @@ const knowledgeFormRef = ref<FormInstance>();
const knowledgeForm = reactive({
id: '',
name: '',
datasetType: undefined as number | undefined,
description: '',
});
const knowledgeRules = reactive<FormRules>({
name: [{ required: true, message: '请输入知识库名称', trigger: 'blur' }],
datasetType: [{ required: true, message: '请选择数据集类型', trigger: 'change' }],
});
// 文件列表含OSS上传结果
@@ -555,6 +563,7 @@ const getknowledgeList = async () => {
const response = await listknowledges({
pageNum: 1,
pageSize: 100,
datasetType: 1,
});
knowledgeList.value = response.data.list || [];
} catch (_error) {
@@ -576,6 +585,7 @@ const onSelectknowledge = (item: any) => {
const onAddknowledge = () => {
knowledgeForm.id = '';
knowledgeForm.name = '';
knowledgeForm.datasetType = undefined;
knowledgeForm.description = '';
showknowledgeDialog.value = true;
};
@@ -594,6 +604,7 @@ const onCardContextMenu = (event: MouseEvent, item: any) => {
const onRenameknowledge = (item: any) => {
knowledgeForm.id = item.id;
knowledgeForm.name = item.name;
knowledgeForm.datasetType = item.datasetType;
knowledgeForm.description = item.description || '';
showknowledgeDialog.value = true;
};
@@ -634,14 +645,17 @@ const onSaveknowledge = async () => {
await updateknowledge({
id: knowledgeForm.id,
name: knowledgeForm.name,
datasetType: knowledgeForm.datasetType,
description: knowledgeForm.description,
});
} else {
// 创建知识库
await createknowledge({
const params = {
name: knowledgeForm.name,
datasetType: knowledgeForm.datasetType as number,
description: knowledgeForm.description,
});
};
await createknowledge(params);
}
ElMessage.success(knowledgeForm.id ? '保存成功' : '创建成功');
@@ -988,7 +1002,7 @@ const onSaveModelConfig = async () => {
// 构建请求数据,只传递接口需要的字段
const data = {
modelType: selectedModelType.value,
configType: selectedConfigType.value,
configType: selectedConfigType,
modelName: modelFormData.value.modelName,
modelDesc: modelFormData.value.modelDesc,
configContent: {} as Record<string, any>,

View File

@@ -0,0 +1,40 @@
<template>
<el-dialog v-model="dialogVisible" :title="dialogTitle" width="500px" :close-on-click-modal="false">
<el-form :model="saveForm" label-position="top">
<el-form-item label="工作流名称" required>
<el-input v-model="saveForm.flowName" placeholder="请输入工作流名称" maxlength="50" show-word-limit />
</el-form-item>
<el-form-item label="工作流描述">
<el-input v-model="saveForm.description" type="textarea" :rows="4" placeholder="请输入工作流描述(选填)" maxlength="200" show-word-limit />
</el-form-item>
</el-form>
<template #footer>
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" :loading="saving" @click="emit('confirm')">{{ confirmText }}</el-button>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { computed } from 'vue';
const props = defineProps<{
modelValue: boolean;
saveForm: { flowName: string; description: string };
currentEditingWorkflowId: string | null;
saving: boolean;
}>();
const emit = defineEmits<{
(e: 'update:modelValue', value: boolean): void;
(e: 'confirm'): void;
}>();
const dialogVisible = computed({
get: () => props.modelValue,
set: (value: boolean) => emit('update:modelValue', value),
});
const dialogTitle = computed(() => (props.currentEditingWorkflowId ? '编辑工作流' : '保存工作流'));
const confirmText = computed(() => (props.currentEditingWorkflowId ? '确定更新' : '确定保存'));
</script>

File diff suppressed because it is too large Load Diff

View File

@@ -36,9 +36,14 @@
</template>
</el-table-column>
<!-- <el-table-column prop="baseUrl" label="模型服务地址" show-overflow-tooltip width="200"></el-table-column> -->
<el-table-column prop="isOwner" label="模型归属" width="100">
<template #default="scope">
<el-tag :type="scope.row.isOwner === 0 ? 'warning' : 'success'">{{ scope.row.isOwner === 0 ? '内置模型' : '用户模型' }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="isPrivate" label="访问类型" width="100">
<template #default="scope">
<el-tag :type="scope.row.isPrivate === 1 ? 'primary' : 'info'">{{ scope.row.isPrivate === 1 ? '本地模型' : '服务商模型' }}</el-tag>
<el-tag :type="scope.row.isPrivate === 1 ? 'primary' : 'info'">{{ scope.row.isPrivate === 1 ? '服务商模型' : '本地模型' }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="httpMethod" label="请求方式" width="100"></el-table-column>
@@ -97,12 +102,12 @@
</el-card>
<EditModule ref="editModuleRef" :model-types="state.modelTypes" :is-super-admin="isSuperAdmin" @refresh="getTableData()" />
<!-- 系统模型 API Key 输入弹窗 -->
<el-dialog v-model="apiKeyDialogVisible" title="配置系统模型" width="500px" :close-on-click-modal="false">
<!-- 内置模型 API Key 输入弹窗 -->
<el-dialog v-model="apiKeyDialogVisible" title="配置内置模型" width="500px" :close-on-click-modal="false">
<el-alert type="info" :closable="false" style="margin-bottom: 16px">
<template #title>
<div style="line-height: 1.6">
您选择的是系统模型需要配置您自己的 API Key<br />
您选择的是内置模型需要配置您自己的 API Key<br />
系统将为您创建一个模型副本并设置为会话模型
</div>
</template>
@@ -133,11 +138,11 @@ import {
normalizeModelTypeOptions,
updateChatModel,
addModelModule,
} from '/@/api/digitalHuman/modelConfig/modelModule/index';
} from '/@/api/settings/modelConfig/modelModule/index';
import { checkIsSuperAdmin } from '/@/api/system/user/index';
import { getApiErrorMessage } from '/@/utils/request';
const EditModule = defineAsyncComponent(() => import('/@/views/digitalHuman/modelConfig/modelModule/component/editModule.vue'));
const EditModule = defineAsyncComponent(() => import('/@/views/settings/modelConfig/modelModule/component/editModule.vue'));
const editModuleRef = ref();
const isSuperAdmin = ref(false); //
@@ -156,7 +161,7 @@ const state = reactive({
},
});
// API Key
// API Key
const apiKeyDialogVisible = ref(false);
const apiKeyFormRef = ref<FormInstance>();
const apiKeyForm = reactive({
@@ -168,7 +173,7 @@ const apiKeyRules: FormRules = {
apiKey: [{ required: true, message: '请输入 API Key', trigger: 'blur' }],
};
const creatingModel = ref(false);
const systemModelToClone = ref<any>(null);
const builtInModelToClone = ref<any>(null);
//
const checkAdminStatus = async () => {
@@ -181,26 +186,36 @@ const checkAdminStatus = async () => {
};
//
const normalizeModelTypeKey = (modelType: number | string | undefined | null) => {
if (modelType === undefined || modelType === null || modelType === '') {
return '';
}
const raw = String(modelType).trim();
const n = Number(raw);
return Number.isNaN(n) ? raw : String(n);
};
const isInferenceModel = (modelType: number | string | undefined | null) => {
if (modelType === undefined || modelType === null || modelType === '') {
return false;
}
// ""
const typeInfo = state.modelTypes.find((t) => String(t.id) === String(modelType));
return typeInfo?.label === '推理模型' || String(modelType) === '1';
const modelTypeKey = normalizeModelTypeKey(modelType);
const typeInfo = state.modelTypes.find((t) => normalizeModelTypeKey(t.id) === modelTypeKey);
return typeInfo?.label === '推理模型' || modelTypeKey === '1' || modelTypeKey === '100';
};
//
const onSetChatModel = async (row: any) => {
// tenantId === 1
if (row.tenantId === 1) {
// API Key
systemModelToClone.value = row;
// isOwner === 0
if (row.isOwner === 0) {
// API Key
builtInModelToClone.value = row;
apiKeyForm.modelName = row.modelName;
apiKeyForm.apiKey = '';
apiKeyDialogVisible.value = true;
} else {
//
//
try {
await updateChatModel({
id: row.id!,
@@ -216,36 +231,39 @@ const onSetChatModel = async (row: any) => {
//
const handleCreatePrivateModelAndSetChat = async () => {
if (!apiKeyFormRef.value || !systemModelToClone.value) return;
if (!apiKeyFormRef.value || !builtInModelToClone.value) return;
try {
await apiKeyFormRef.value.validate();
creatingModel.value = true;
// apiKey
const systemModel = systemModelToClone.value;
// apiKey
const builtInModel = builtInModelToClone.value;
const createParams = {
modelName: apiKeyForm.modelName,
modelType: systemModel.modelType,
baseUrl: systemModel.baseUrl,
httpMethod: systemModel.httpMethod || 'POST',
headMsg: systemModel.headMsg || '',
isPrivate: systemModel.isPrivate ?? 1,
enabled: systemModel.enabled ?? 1,
modelType: builtInModel.modelType,
baseUrl: builtInModel.baseUrl,
httpMethod: builtInModel.httpMethod || 'POST',
headMsg: builtInModel.headMsg || '',
isPrivate: builtInModel.isPrivate ?? 1,
enabled: builtInModel.enabled ?? 1,
isChatModel: 1, //
apiKey: apiKeyForm.apiKey,
form: systemModel.form || [],
requestMapping: systemModel.requestMapping || {},
responseMapping: systemModel.responseMapping || {},
maxConcurrency: systemModel.maxConcurrency || 10,
queueLimit: systemModel.queueLimit || 100,
timeoutSeconds: systemModel.timeoutSeconds || 30,
expectedSeconds: systemModel.expectedSeconds || 15,
retryTimes: systemModel.retryTimes || 3,
retryQueueMaxSeconds: systemModel.retryQueueMaxSeconds || 60,
autoCleanSeconds: systemModel.autoCleanSeconds || 300,
remark: systemModel.remark || '',
form: builtInModel.form || {},
requestMapping: builtInModel.requestMapping || {},
responseMapping: builtInModel.responseMapping || {},
responseBody: builtInModel.responseBody || {},
tokenMapping: builtInModel.tokenMapping || '',
prompt: builtInModel.prompt || '',
maxConcurrency: builtInModel.maxConcurrency || 10,
queueLimit: builtInModel.queueLimit || 100,
timeoutSeconds: builtInModel.timeoutSeconds || 30,
expectedSeconds: builtInModel.expectedSeconds || 15,
retryTimes: builtInModel.retryTimes || 3,
retryQueueMaxSeconds: builtInModel.retryQueueMaxSeconds || 60,
autoCleanSeconds: builtInModel.autoCleanSeconds || 300,
remark: builtInModel.remark || '',
};
await addModelModule(createParams);
@@ -270,7 +288,8 @@ const resolveModelTypeLabel = (modelType: number | string | undefined | null) =>
if (modelType === undefined || modelType === null || modelType === '') {
return '—';
}
const hit = state.modelTypes.find((t) => String(t.id) === String(modelType));
const modelTypeKey = normalizeModelTypeKey(modelType);
const hit = state.modelTypes.find((t) => normalizeModelTypeKey(t.id) === modelTypeKey);
return hit?.label ?? String(modelType);
};

View File

@@ -0,0 +1,314 @@
<template>
<div class="prompt-manager-container">
<!-- 搜索栏 -->
<div class="search-bar">
<el-input v-model="searchQuery" placeholder="搜索提示词内容..." prefix-icon="Search" style="width: 300px" clearable @input="handleSearch" />
<el-button type="primary" @click="showCreateDialog = true">
<el-icon><Plus /></el-icon>
新增提示词
</el-button>
</div>
<!-- 列表 -->
<div class="table-container">
<el-table :data="filteredList" v-loading="loading" border style="width: 100%">
<el-table-column prop="nodeType" label="节点类型" width="150" />
<el-table-column prop="prompt" label="提示词内容" min-width="350">
<template #default="{ row }">
<el-tooltip v-if="row.prompt.length > 80" content="hover" :enterable="false">
<template #content>
<div style="max-width: 400px; white-space: pre-wrap">{{ row.prompt }}</div>
</template>
<span>{{ row.prompt.slice(0, 80) }}...</span>
</el-tooltip>
<span v-else>{{ row.prompt }}</span>
</template>
</el-table-column>
<el-table-column prop="sourceType" label="来源" width="100">
<template #default="{ row }">
<el-tag v-if="row.sourceType === 0">自定义</el-tag>
<el-tag v-else-if="row.sourceType === 1" type="success">公共</el-tag>
<el-tag v-else type="info">{{ row.sourceType }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="creator" label="创建者" width="120" />
<el-table-column prop="createdAt" label="创建时间" width="170" />
<el-table-column label="操作" width="120" fixed="right">
<template #default="{ row }">
<el-button type="primary" link size="small" @click="handleEdit(row)">编辑</el-button>
<el-button type="danger" link size="small" @click="handleDeleteConfirm(row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<div class="pagination-container">
<el-pagination
v-model:current-page="pagination.current"
v-model:page-size="pagination.size"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:page-sizes="[10, 20, 50, 100]"
layout="total, sizes, ->, prev, pager, next, jumper"
:total="pagination.total"
/>
</div>
</div>
<!-- 新增/编辑弹窗 -->
<el-dialog v-model="showCreateDialog" :title="isEdit ? '编辑提示词' : '新增提示词'" width="600px" :close-on-click-modal="false">
<el-form ref="createFormRef" :model="createForm" label-width="100px">
<el-form-item label="节点类型" required>
<el-select v-model="createForm.nodeType" placeholder="请选择节点类型" style="width: 100%" clearable v-loading="nodeLibraryLoading">
<el-option v-for="option in nodeOptions" :key="option.value" :label="option.label" :value="option.value"></el-option>
</el-select>
</el-form-item>
<el-form-item label="提示词内容" required>
<el-input v-model="createForm.prompt" type="textarea" :rows="8" placeholder="请输入提示词内容..." clearable />
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="cancelCreate"> </el-button>
<el-button type="primary" @click="handleSubmitCreate" :loading="submitLoading">
{{ isEdit ? '保存修改' : '确 定' }}
</el-button>
</span>
</template>
</el-dialog>
<!-- 删除确认弹窗 -->
<el-dialog v-model="showDeleteDialog" title="确认删除" width="400px" :close-on-click-modal="false">
<div>确定要删除这个提示词吗</div>
<template #footer>
<span class="dialog-footer">
<el-button @click="showDeleteDialog = false"> </el-button>
<el-button type="primary" @click="handleDelete" :loading="deleteLoading"> </el-button>
</span>
</template>
</el-dialog>
</div>
</template>
<script setup lang="ts" name="promptManager">
import { ref, reactive, computed, onMounted } from 'vue';
import { Plus } from '@element-plus/icons-vue';
import { ElMessage } from 'element-plus';
import { getNodeLibraryList, getMyPromptList, createPrompt, updatePrompt, deletePrompt, type NodeLibraryGroup, type NodeLibraryNode, type PromptItem } from '/@/api/settings/promptManager/index';
const searchQuery = ref('');
const loading = ref(false);
const list = ref<PromptItem[]>([]);
const showCreateDialog = ref(false);
const isEdit = ref(false);
const submitLoading = ref(false);
const createFormRef = ref();
const editId = ref<number | string | null>(null);
const nodeLibraryLoading = ref(false);
const nodeLibraryGroups = ref<NodeLibraryGroup[]>([]);
const showDeleteDialog = ref(false);
const deleteLoading = ref(false);
const deleteId = ref<number | string | null>(null);
const nodeOptions = computed(() => {
const options: Array<{ label: string; value: string }> = [];
nodeLibraryGroups.value.forEach((group: NodeLibraryGroup) => {
group.items.forEach((item: NodeLibraryNode) => {
// 只显示支持提示词配置的节点
if (item.promptOption) {
options.push({
label: item.nodeName,
value: item.nodeCode,
});
}
});
});
return options;
});
const createForm = reactive({
nodeType: '',
prompt: '',
sourceType: 0 as number,
});
// 加载节点库
const loadNodeLibrary = async () => {
nodeLibraryLoading.value = true;
try {
const res = await getNodeLibraryList();
if (res && res.data && res.data.groups) {
nodeLibraryGroups.value = res.data.groups;
}
} catch (e) {
console.error('加载节点库失败:', e);
ElMessage.error('加载节点类型失败');
} finally {
nodeLibraryLoading.value = false;
}
};
const pagination = reactive({
current: 1,
size: 10,
total: 0,
});
// 过滤后的列表
const filteredList = computed(() => {
if (!searchQuery.value) {
return list.value;
}
const query = searchQuery.value.toLowerCase();
return list.value.filter(
(item) => item.nodeType.toLowerCase().includes(query) || item.prompt.toLowerCase().includes(query) || item.creator?.toLowerCase().includes(query)
);
});
// 加载列表
const loadList = async () => {
loading.value = true;
try {
const res = await getMyPromptList({
pageNum: pagination.current,
pageSize: pagination.size,
});
if (res && res.data && res.data.list) {
list.value = res.data.list;
pagination.total = res.data.total || 0;
}
} catch (e) {
console.error(e);
ElMessage.error('加载失败');
} finally {
loading.value = false;
}
};
// 搜索
const handleSearch = () => {
pagination.current = 1;
loadList();
};
// 新增
const handleSubmitCreate = async () => {
// 验证
if (!createForm.nodeType?.trim()) {
ElMessage.warning('请选择节点类型');
return;
}
if (!createForm.prompt?.trim()) {
ElMessage.warning('请输入提示词内容');
return;
}
submitLoading.value = true;
try {
if (isEdit.value && editId.value) {
await updatePrompt({
id: editId.value,
...createForm,
});
ElMessage.success('修改成功');
} else {
await createPrompt({
nodeType: createForm.nodeType.trim(),
prompt: createForm.prompt.trim(),
sourceType: createForm.sourceType,
});
ElMessage.success('创建成功');
}
showCreateDialog.value = false;
cancelCreate();
loadList();
} catch (e) {
console.error(e);
ElMessage.error('操作失败');
} finally {
submitLoading.value = false;
}
};
// 编辑
const handleEdit = (row: PromptItem) => {
isEdit.value = true;
editId.value = row.id;
createForm.nodeType = row.nodeType || '';
createForm.prompt = row.prompt || '';
createForm.sourceType = row.sourceType || 0;
showCreateDialog.value = true;
};
// 打开删除确认弹窗
const handleDeleteConfirm = (id: number | string) => {
deleteId.value = id;
showDeleteDialog.value = true;
};
// 删除
const handleDelete = async () => {
if (!deleteId.value) return;
deleteLoading.value = true;
try {
await deletePrompt(deleteId.value);
ElMessage.success('删除成功');
showDeleteDialog.value = false;
loadList();
} catch (e) {
console.error(e);
ElMessage.error('删除失败');
} finally {
deleteLoading.value = false;
}
};
// 取消
const cancelCreate = () => {
createFormRef.value?.resetFields();
isEdit.value = false;
editId.value = null;
createForm.nodeType = '';
createForm.prompt = '';
createForm.sourceType = 0;
};
// 分页
const handleSizeChange = (size: number) => {
pagination.size = size;
pagination.current = 1;
loadList();
};
const handleCurrentChange = (current: number) => {
pagination.current = current;
loadList();
};
onMounted(() => {
loadNodeLibrary();
loadList();
});
</script>
<style scoped lang="scss">
.prompt-manager-container {
padding: 16px;
background-color: #fff;
border-radius: 4px;
.search-bar {
display: flex;
align-items: center;
gap: 16px;
margin-bottom: 16px;
}
.table-container {
.pagination-container {
margin-top: 16px;
display: flex;
justify-content: flex-end;
}
}
}
</style>

View File

@@ -14,63 +14,61 @@
</div>
<!-- 搜索栏 -->
<div class="search-bar">
<el-input v-model="searchParams.keyword" placeholder="搜索技能名称或描述" clearable class="search-input" @clear="handleSearch">
<template #prefix
><el-icon><Search /></el-icon
></template>
</el-input>
<el-button type="primary" @click="handleSearch">搜索</el-button>
</div>
<!-- 技能列表 -->
<div class="skill-list" v-loading="loading">
<el-empty v-if="!loading && skillList.length === 0" description="暂无技能数据" :image-size="120" />
<div v-else class="skill-grid">
<div v-for="skill in skillList" :key="skill.id" class="skill-card">
<div class="skill-card-header">
<div class="skill-category">{{ skill.category }}</div>
<el-dropdown trigger="click" @command="(cmd: string) => handleCommand(cmd, skill)">
<el-icon class="more-icon"><MoreFilled /></el-icon>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="delete">
<el-icon><Delete /></el-icon>
删除
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
<div class="skill-card-body">
<h3 class="skill-name">{{ skill.name }}</h3>
<p class="skill-desc">{{ skill.description || '暂无描述' }}</p>
<div class="skill-file" v-if="skill.fileName">
<el-icon><Document /></el-icon>
<span>{{ skill.fileName }}</span>
</div>
</div>
<div class="skill-card-footer">
<span class="skill-time">{{ formatTime(skill.createdAt) }}</span>
</div>
</div>
<el-card shadow="hover" class="search-card">
<div class="search-bar">
<el-input v-model="searchParams.keyword" placeholder="搜索技能名称或描述" clearable class="search-input" @clear="handleSearch">
<template #prefix>
<el-icon><Search /></el-icon>
</template>
</el-input>
<el-button type="primary" @click="handleSearch">
<el-icon><Search /></el-icon>
搜索
</el-button>
</div>
</div>
</el-card>
<!-- 分页 -->
<div v-if="pagination.total > 0" class="pagination-wrap">
<el-pagination
v-model:current-page="pagination.pageNum"
v-model:page-size="pagination.pageSize"
:total="pagination.total"
:page-sizes="[10, 20, 50, 100]"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handlePageChange"
/>
</div>
<!-- 技能表格 -->
<el-card shadow="hover" class="table-card">
<el-table :data="skillList" v-loading="loading" stripe style="width: 100%">
<el-table-column type="index" label="序号" width="60" />
<el-table-column prop="name" label="技能名称" min-width="150" show-overflow-tooltip />
<el-table-column prop="description" label="技能描述" min-width="200" show-overflow-tooltip />
<el-table-column prop="fileName" label="文件名" min-width="150" show-overflow-tooltip />
<el-table-column prop="fileUrl" label="文件地址" min-width="200" show-overflow-tooltip>
<template #default="{ row }">
<el-link :href="row.fileUrl" target="_blank" type="primary" :underline="false">{{ row.fileUrl }}</el-link>
</template>
</el-table-column>
<el-table-column prop="createdAt" label="创建时间" width="160" show-overflow-tooltip>
<template #default="{ row }">{{ formatTime(row.createdAt) }}</template>
</el-table-column>
<el-table-column prop="updatedAt" label="更新时间" width="160" show-overflow-tooltip>
<template #default="{ row }">{{ formatTime(row.updatedAt) }}</template>
</el-table-column>
<el-table-column label="操作" width="150" fixed="right">
<template #default="{ row }">
<el-button size="small" type="primary" link @click="handleEdit(row)">编辑</el-button>
<el-button size="small" type="danger" link @click="handleDelete(row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 创建对话框 -->
<!-- 分页 -->
<div v-if="pagination.total > 0" class="pagination-wrap">
<el-pagination
v-model:current-page="pagination.pageNum"
v-model:page-size="pagination.pageSize"
:total="pagination.total"
:page-sizes="[10, 20, 50, 100]"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handlePageChange"
/>
</div>
</el-card>
<!-- 创建/编辑对话框 -->
<el-dialog v-model="dialogVisible" :title="dialogTitle" width="600px" :close-on-click-modal="false">
<el-form :model="formData" :rules="formRules" ref="formRef" label-position="top">
<el-form-item label="技能名称" prop="name">
@@ -79,9 +77,6 @@
<el-form-item label="技能描述" prop="description">
<el-input v-model="formData.description" type="textarea" :rows="4" placeholder="请输入技能描述" maxlength="200" show-word-limit />
</el-form-item>
<el-form-item label="分类" prop="category">
<el-input v-model="formData.category" placeholder="请输入分类(如:文本生成、图像生成等)" maxlength="50" />
</el-form-item>
<el-form-item label="上传文件" prop="file">
<el-upload
ref="uploadRef"
@@ -92,11 +87,12 @@
:on-change="handleFileChange"
:on-exceed="handleExceed"
:file-list="fileList"
accept=".zip"
>
<el-icon class="el-icon--upload"><UploadFilled /></el-icon>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div class="el-upload__text"> zip 文件拖到此处<em>点击上传</em></div>
<template #tip>
<div class="el-upload__tip">支持各种文件格式文件大小不超过 100MB</div>
<div class="el-upload__tip">支持 .zip 格式且压缩包内必须包含 .md 文件文件大小不超过 100MB</div>
</template>
</el-upload>
</el-form-item>
@@ -105,7 +101,7 @@
<div v-if="formData.fileName" class="file-preview">
<div class="file-preview-header">
<span class="file-preview-title">已上传文件</span>
<el-tag type="success" size="small">上传成功</el-tag>
<el-tag type="success" size="small">{{ isEdit ? '当前文件' : '上传成功' }}</el-tag>
</div>
<div class="file-preview-info">
<div class="file-info-item">
@@ -130,8 +126,16 @@
<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue';
import { ElMessage, ElMessageBox, type FormInstance, type FormRules, type UploadInstance, type UploadProps, type UploadUserFile } from 'element-plus';
import { Plus, Search, MoreFilled, Delete, Document, UploadFilled } from '@element-plus/icons-vue';
import { getUserSkillList, createUserSkill, deleteUserSkill, type SkillItem, type CreateSkillParams } from '/@/api/digitalHuman/skill';
import { Plus, Search, UploadFilled } from '@element-plus/icons-vue';
import {
getUserSkillList,
createUserSkill,
updateUserSkill,
deleteUserSkill,
getUserSkillDetail,
type SkillItem,
type CreateSkillParams,
} from '/@/api/settings/skill';
import { uploadFile as uploadFileToOss } from '/@/api/common/upload';
const searchParams = reactive({ keyword: '' });
@@ -140,26 +144,72 @@ const skillList = ref<SkillItem[]>([]);
const loading = ref(false);
const dialogVisible = ref(false);
const dialogTitle = ref('创建技能');
const isEdit = ref(false);
const currentEditId = ref<number | null>(null);
const formRef = ref<FormInstance>();
const uploadRef = ref<UploadInstance>();
const submitting = ref(false);
const fileList = ref<UploadUserFile[]>([]);
const formData = reactive<CreateSkillParams>({ name: '', description: '', category: '', fileName: '', fileUrl: '' });
const formData = reactive<CreateSkillParams>({ name: '', description: '', fileName: '', fileUrl: '' });
const formRules: FormRules = {
name: [{ required: true, message: '请输入技能名称', trigger: 'blur' }],
category: [{ required: true, message: '请输入分类', trigger: 'blur' }],
};
const formatTime = (time: string) => (time ? time.replace('T', ' ').split('.')[0] : '');
// zip .md
const validateZipContainsMd = async (file: File): Promise<boolean> => {
return new Promise((resolve) => {
const reader = new FileReader();
reader.onload = async (e) => {
try {
const arrayBuffer = e.target?.result as ArrayBuffer;
// 使 JSZip zip
const JSZip = (await import('jszip')).default;
const zip = await JSZip.loadAsync(arrayBuffer);
// .md
const hasMdFile = Object.keys(zip.files).some(filename => filename.toLowerCase().endsWith('.md'));
resolve(hasMdFile);
} catch (error) {
console.error('解析 zip 文件失败:', error);
resolve(false);
}
};
reader.onerror = () => resolve(false);
reader.readAsArrayBuffer(file);
});
};
const handleFileChange: UploadProps['onChange'] = async (uploadFile) => {
if (!uploadFile.raw) return;
// 1. zip
const fileName = uploadFile.name.toLowerCase();
if (!fileName.endsWith('.zip')) {
ElMessage.warning('只支持上传 .zip 格式的文件');
fileList.value = [];
return;
}
// 2.
const maxSize = 100 * 1024 * 1024;
if (uploadFile.raw.size > maxSize) {
ElMessage.warning('文件大小不能超过 100MB');
fileList.value = [];
return;
}
// 3. zip .md
ElMessage.info('正在验证文件...');
const hasMdFile = await validateZipContainsMd(uploadFile.raw);
if (!hasMdFile) {
ElMessage.warning('zip 压缩包内必须包含 .md 文件');
fileList.value = [];
return;
}
// 4.
try {
ElMessage.info('正在上传文件到 OSS...');
const uploadRes = await uploadFileToOss(uploadFile.raw);
@@ -195,10 +245,12 @@ const handleSearch = () => {
pagination.pageNum = 1;
fetchSkillList();
};
const handlePageChange = (page: number) => {
pagination.pageNum = page;
fetchSkillList();
};
const handleSizeChange = (size: number) => {
pagination.pageSize = size;
pagination.pageNum = 1;
@@ -206,12 +258,49 @@ const handleSizeChange = (size: number) => {
};
const handleCreate = () => {
isEdit.value = false;
currentEditId.value = null;
dialogTitle.value = '创建技能';
Object.assign(formData, { name: '', description: '', category: '', fileName: '', fileUrl: '' });
Object.assign(formData, { name: '', description: '', fileName: '', fileUrl: '' });
fileList.value = [];
dialogVisible.value = true;
};
const handleEdit = async (row: SkillItem) => {
isEdit.value = true;
currentEditId.value = row.id;
dialogTitle.value = '编辑技能';
try {
//
const res = await getUserSkillDetail(row.id);
const detail = res.data || row;
Object.assign(formData, {
name: detail.name,
description: detail.description,
fileName: detail.fileName,
fileUrl: detail.fileUrl,
});
//
if (detail.fileName) {
fileList.value = [
{
name: detail.fileName,
url: detail.fileUrl,
} as UploadUserFile,
];
} else {
fileList.value = [];
}
dialogVisible.value = true;
} catch (error) {
ElMessage.error('获取技能详情失败');
}
};
const handleSubmit = async () => {
if (!formRef.value) return;
await formRef.value.validate(async (valid) => {
@@ -222,14 +311,23 @@ const handleSubmit = async () => {
}
submitting.value = true;
try {
await createUserSkill({
const submitData = {
name: formData.name,
description: formData.description,
category: formData.category,
fileName: formData.fileName,
fileUrl: formData.fileUrl,
});
ElMessage.success('创建成功');
};
if (isEdit.value && currentEditId.value) {
//
await updateUserSkill({ ...submitData, id: currentEditId.value });
ElMessage.success('更新成功');
} else {
//
await createUserSkill(submitData);
ElMessage.success('创建成功');
}
dialogVisible.value = false;
fetchSkillList();
} catch {
@@ -240,21 +338,19 @@ const handleSubmit = async () => {
});
};
const handleCommand = async (command: string, skill: SkillItem) => {
if (command === 'delete') {
try {
await ElMessageBox.confirm(`确定要删除技能"${skill.name}"吗?此操作不可恢复。`, '删除确认', {
confirmButtonText: '确定删除',
cancelButtonText: '取消',
type: 'warning',
});
await deleteUserSkill(skill.id);
ElMessage.success('删除成功');
fetchSkillList();
} catch (error) {
if (error !== 'cancel') {
// request message
}
const handleDelete = async (row: SkillItem) => {
try {
await ElMessageBox.confirm(`确定要删除技能"${row.name}"吗?此操作不可恢复。`, '删除确认', {
confirmButtonText: '确定删除',
cancelButtonText: '取消',
type: 'warning',
});
await deleteUserSkill(row.id);
ElMessage.success('删除成功');
fetchSkillList();
} catch (error) {
if (error !== 'cancel') {
// request message
}
}
};
@@ -268,152 +364,70 @@ onMounted(() => fetchSkillList());
background: #f6f8fb;
min-height: calc(100vh - 100px);
}
.page-header {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: 24px;
margin-bottom: 20px;
}
.header-left {
flex: 1;
}
.page-title {
font-size: 24px;
font-weight: 700;
color: #1f2937;
margin: 0 0 8px 0;
}
.page-desc {
font-size: 14px;
color: #64748b;
margin: 0;
}
.header-right {
display: flex;
gap: 12px;
}
.search-card {
margin-bottom: 20px;
}
.search-bar {
display: flex;
gap: 12px;
margin-bottom: 24px;
padding: 20px;
background: #fff;
border-radius: 12px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.search-input {
flex: 1;
max-width: 400px;
}
.skill-list {
min-height: 400px;
}
.skill-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
gap: 20px;
}
.skill-card {
background: #fff;
border-radius: 12px;
padding: 20px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
display: flex;
flex-direction: column;
}
.skill-card:hover {
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
transform: translateY(-2px);
}
.skill-card-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16px;
}
.skill-category {
display: inline-block;
padding: 4px 12px;
background: #eff6ff;
color: #3b82f6;
border-radius: 6px;
font-size: 12px;
font-weight: 600;
}
.more-icon {
cursor: pointer;
color: #94a3b8;
font-size: 20px;
transition: color 0.2s;
}
.more-icon:hover {
color: #3b82f6;
}
.skill-card-body {
flex: 1;
margin-bottom: 16px;
}
.skill-name {
font-size: 18px;
font-weight: 600;
color: #1f2937;
margin: 0 0 8px 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.skill-desc {
font-size: 14px;
color: #64748b;
line-height: 1.6;
margin: 0 0 12px 0;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
min-height: 44px;
}
.skill-file {
display: flex;
align-items: center;
gap: 8px;
padding: 8px 12px;
background: #f8fafc;
border-radius: 6px;
font-size: 13px;
color: #475569;
}
.skill-file .el-icon {
color: #3b82f6;
}
.skill-card-footer {
display: flex;
justify-content: space-between;
align-items: center;
padding-top: 16px;
border-top: 1px solid #e5e7eb;
}
.skill-time {
font-size: 12px;
color: #94a3b8;
.table-card {
:deep(.el-card__body) {
padding: 20px;
}
}
.pagination-wrap {
display: flex;
justify-content: center;
margin-top: 32px;
padding: 20px;
background: #fff;
border-radius: 12px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
justify-content: flex-end;
margin-top: 20px;
}
.upload-area {
width: 100%;
:deep(.el-upload-dragger) {
width: 100%;
}
}
.upload-area :deep(.el-upload-dragger) {
width: 100%;
}
.file-preview {
margin-top: 16px;
padding: 16px;
@@ -421,48 +435,42 @@ onMounted(() => fetchSkillList());
border-radius: 8px;
border: 1px solid #86efac;
}
.file-preview-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 12px;
}
.file-preview-title {
font-size: 14px;
font-weight: 600;
color: #166534;
}
.file-preview-info {
display: flex;
flex-direction: column;
gap: 8px;
}
.file-info-item {
display: flex;
align-items: flex-start;
font-size: 13px;
}
.file-info-label {
color: #15803d;
margin-right: 8px;
min-width: 80px;
flex-shrink: 0;
}
.file-info-value {
color: #166534;
font-weight: 500;
word-break: break-all;
}
@media (max-width: 768px) {
.skill-grid {
grid-template-columns: 1fr;
}
.search-bar {
flex-direction: column;
}
.search-input {
max-width: 100%;
width: 100%;
}
}
</style>

View File

@@ -0,0 +1,279 @@
<template>
<div class="input-source-manager">
<el-divider content-position="left">上级参数引用</el-divider>
<!-- 已引用的参数列表 -->
<div v-if="currentInputSource && currentInputSource.length > 0" class="input-source-list">
<div v-for="(sourceNode, index) in currentInputSource" :key="index" class="input-source-item">
<div class="input-source-header">
<span class="input-source-node-name">{{ getNodeName(sourceNode.nodeId) }}</span>
</div>
<div v-if="sourceNode.field && sourceNode.field.length > 0" class="input-source-fields">
<div v-for="fieldName in sourceNode.field" :key="fieldName" class="field-tag">
<el-tag size="small">{{ fieldName }}</el-tag>
<el-button type="danger" link size="small" @click="emit('removeField', sourceNode.nodeId, fieldName)">删除</el-button>
</div>
</div>
<div class="input-source-output">
<el-switch
:model-value="sourceNode.quoteOutput === true"
@change="(val: boolean) => emit('toggleOutput', sourceNode.nodeId, val)"
size="small"
active-text="引入输出"
inactive-text=""
/>
</div>
</div>
</div>
<!-- 显示所有上级节点的输出引用选项 -->
<div v-if="availableParentNodes.length > 0" class="parent-nodes-output">
<div class="parent-nodes-title">上级节点输出</div>
<div v-for="parentNode in availableParentNodes" :key="parentNode.id" class="parent-node-output-item">
<span class="parent-node-name">{{ parentNode.name }}</span>
<el-switch
:model-value="isNodeOutputQuoted(parentNode.id)"
@change="(val: boolean) => emit('toggleOutput', parentNode.id, val)"
size="small"
active-text="引入输出"
inactive-text=""
/>
</div>
</div>
<!-- 选择参数下拉框 -->
<el-form-item label="选择参数">
<el-select :model-value="selectedParam" @update:model-value="handleParamSelect" placeholder="选择上级节点的参数" class="w100">
<el-option v-for="param in availableParams" :key="param.value" :label="param.label" :value="param.value" />
</el-select>
</el-form-item>
</div>
</template>
<script setup lang="ts">
import { ref, computed } from 'vue';
import type { Node } from '@vue-flow/core';
interface NodeData {
label?: string;
nodeCode?: string;
inputSource?: Array<{ nodeId: string; field: string[]; quoteOutput?: boolean }> | null;
formConfig?: any[];
modelConfig?: any;
skillName?: string;
}
interface ParentNode {
id: string;
name: string;
}
interface ParamOption {
label: string;
value: string;
}
const props = defineProps<{
selectedNode: Node<NodeData, any, string> | null;
nodes: Node<NodeData, any, string>[];
edges: any[];
}>();
const emit = defineEmits<{
(e: 'removeField', nodeId: string, fieldName: string): void;
(e: 'toggleOutput', nodeId: string, enabled: boolean): void;
(e: 'addParam', paramValue: string): void;
}>();
const selectedParam = ref('');
// 当前节点的 inputSource
const currentInputSource = computed(() => {
if (!props.selectedNode?.data?.inputSource) return [];
return props.selectedNode.data.inputSource.filter((item) => item.field && item.field.length > 0);
});
// 获取节点名称
const getNodeName = (nodeId: string) => {
const node = props.nodes.find((n) => n.id === nodeId);
return node?.data?.label || nodeId;
};
// 获取所有上级节点(用于显示输出引用选项)
const availableParentNodes = computed(() => {
if (!props.selectedNode?.data) return [];
// 获取已经引用了字段的节点ID列表
const inputSource = props.selectedNode.data.inputSource;
const nodesWithFields = new Set<string>();
if (Array.isArray(inputSource)) {
inputSource.forEach((item) => {
if (item.field && item.field.length > 0) {
nodesWithFields.add(item.nodeId);
}
});
}
// 递归查找所有上级节点
const findAllParentNodes = (nodeId: string, visited = new Set<string>()): string[] => {
if (visited.has(nodeId)) return [];
visited.add(nodeId);
const incomingEdges = props.edges.filter((e) => e.target === nodeId);
const parentIds: string[] = [];
incomingEdges.forEach((edge) => {
parentIds.push(edge.source);
parentIds.push(...findAllParentNodes(edge.source, visited));
});
return parentIds;
};
const allParentIds = findAllParentNodes(props.selectedNode.id);
const parentNodes = allParentIds
.map((parentId) => {
const parentNode = props.nodes.find((n) => n.id === parentId);
if (!parentNode?.data) return null;
const nodeCode = String(parentNode.data.nodeCode || '').toLowerCase();
const isJudge = ['判断', 'judge', 'condition', 'if', 'branch', 'gateway'].some((k) => nodeCode.includes(k));
const isStart = nodeCode === '__start__';
if (isJudge || isStart || nodesWithFields.has(parentId)) return null;
return {
id: parentId,
name: parentNode.data.label || parentId,
};
})
.filter(Boolean);
return parentNodes as ParentNode[];
});
// 检查节点输出是否被引用
const isNodeOutputQuoted = (nodeId: string): boolean => {
if (!props.selectedNode?.data) return false;
const inputSource = props.selectedNode.data.inputSource;
if (!Array.isArray(inputSource)) return false;
const node = inputSource.find((item) => item.nodeId === nodeId);
return node?.quoteOutput === true;
};
// 获取可用的参数选项
const availableParams = computed(() => {
if (!props.selectedNode) return [];
const params: ParamOption[] = [];
const visited = new Set<string>();
const findParents = (nodeId: string) => {
if (visited.has(nodeId)) return;
visited.add(nodeId);
props.edges
.filter((e) => e.target === nodeId)
.forEach((edge) => {
const parent = props.nodes.find((n) => n.id === edge.source);
if (parent?.data && parent.data.nodeCode !== '__start__' && parent.data.nodeCode !== 'judge') {
params.push({
label: `${parent.data.label}.output`,
value: `\${${parent.id}.output}`,
});
}
findParents(edge.source);
});
};
findParents(props.selectedNode.id);
return params;
});
const handleParamSelect = (value: string) => {
if (!value) return;
emit('addParam', value);
selectedParam.value = '';
};
</script>
<style scoped lang="scss">
.input-source-manager {
margin-top: 16px;
}
.input-source-list {
margin-bottom: 16px;
}
.input-source-item {
padding: 12px;
margin-bottom: 12px;
background: #f8fafc;
border: 1px solid #e2e8f0;
border-radius: 8px;
}
.input-source-header {
margin-bottom: 8px;
}
.input-source-node-name {
font-size: 14px;
font-weight: 600;
color: #334155;
}
.input-source-fields {
display: flex;
flex-direction: column;
gap: 6px;
margin-bottom: 8px;
}
.field-tag {
display: flex;
justify-content: space-between;
align-items: center;
padding: 4px 8px;
background: #fff;
border-radius: 4px;
}
.input-source-output {
padding-top: 8px;
border-top: 1px solid #e2e8f0;
}
.parent-nodes-output {
margin-bottom: 16px;
}
.parent-nodes-title {
font-size: 13px;
font-weight: 600;
color: #64748b;
margin-bottom: 8px;
}
.parent-node-output-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 8px 12px;
margin-bottom: 6px;
background: #f8fafc;
border: 1px solid #e2e8f0;
border-radius: 6px;
}
.parent-node-name {
font-size: 13px;
color: #475569;
}
.w100 {
width: 100%;
}
</style>

View File

@@ -0,0 +1,263 @@
<template>
<div class="config-panel">
<h3>节点配置</h3>
<div v-if="selectedNode">
<el-form label-position="top">
<el-form-item label="节点名称">
<el-input :model-value="selectedNode.data?.label" @update:model-value="updateNodeLabel" />
</el-form-item>
<el-form-item label="节点类型">
<el-tag>{{ selectedNode.data?.nodeCode }}</el-tag>
</el-form-item>
<!-- 模型选择 -->
<el-form-item v-if="nodeConfig?.modelConfig && nodeConfig.modelConfig.length > 0" label="选择模型">
<el-button type="primary" @click="emit('openModelSelector')" style="width: 100%">选择模型</el-button>
<div v-if="selectedNode.data?.modelConfig?.modelName" class="selected-tag">
<el-tag type="success" size="large" closable @close="emit('removeModel')">
{{ selectedNode.data.modelConfig.modelName }}
</el-tag>
</div>
</el-form-item>
<!-- 技能选择 -->
<el-form-item v-if="nodeConfig?.skillOption" label="选择技能">
<el-button type="primary" @click="emit('openSkillSelector')" style="width: 100%">选择技能</el-button>
<div v-if="selectedNode.data?.skillName" class="selected-tag">
<el-tag type="success" size="large" closable @close="emit('removeSkill')">
{{ selectedNode.data.skillName }}
</el-tag>
</div>
</el-form-item>
<!-- 动态表单字段 -->
<template v-if="nodeConfig?.formConfig && nodeConfig.formConfig.length > 0">
<el-divider content-position="left">节点参数</el-divider>
<el-form-item v-for="field in nodeConfig.formConfig" :key="field.field" :label="field.label" :required="field.required">
<el-input
v-if="field.type === 'input' || field.type === 'string'"
:model-value="getFieldValue(field.field)"
@update:model-value="updateFieldValue(field.field, $event)"
:placeholder="field.required ? '必填' : '选填'"
/>
<el-input-number
v-else-if="field.type === 'number' || field.type === 'inputNumber'"
:model-value="getFieldValue(field.field)"
@update:model-value="updateFieldValue(field.field, $event)"
class="w100"
/>
<el-input
v-else-if="field.type === 'textarea'"
:model-value="getFieldValue(field.field)"
@update:model-value="updateFieldValue(field.field, $event)"
type="textarea"
:rows="3"
:placeholder="field.required ? '必填' : '选填'"
/>
<el-switch
v-else-if="field.type === 'switch'"
:model-value="getFieldValue(field.field)"
@update:model-value="updateFieldValue(field.field, $event)"
/>
<el-select
v-else-if="field.type === 'select' && field.options"
:model-value="getFieldValue(field.field)"
@update:model-value="updateFieldValue(field.field, $event)"
:placeholder="field.required ? '必填' : '选填'"
class="w100"
>
<el-option v-for="opt in field.options" :key="opt.value" :label="opt.label" :value="opt.value" />
</el-select>
<el-input
v-else
:model-value="getFieldValue(field.field)"
@update:model-value="updateFieldValue(field.field, $event)"
:placeholder="field.required ? '必填' : '选填'"
/>
</el-form-item>
</template>
</el-form>
<!-- 上级参数管理 -->
<InputSourceManager
v-if="selectedNode.data?.nodeCode !== '__start__'"
:selected-node="selectedNode"
:nodes="allNodes"
:edges="allEdges"
@remove-field="(nodeId: string, fieldName: string) => emit('removeField', nodeId, fieldName)"
@toggle-output="(nodeId: string, enabled: boolean) => emit('toggleOutput', nodeId, enabled)"
@add-param="(paramValue: string) => emit('addParamByValue', paramValue)"
/>
</div>
<el-empty v-else description="请选择一个节点" :image-size="100" />
</div>
</template>
<script setup lang="ts">
import type { Node } from '@vue-flow/core';
import InputSourceManager from './InputSourceManager.vue';
interface NodeData {
label?: string;
nodeCode?: string;
inputSource?: Array<{ nodeId: string; field: string[]; quoteOutput?: boolean }> | null;
formConfig?: any[];
modelConfig?: any;
skillName?: string;
}
interface ParamRef {
id: string;
label: string;
}
interface NodeConfig {
formConfig: any[];
modelConfig: any[];
skillOption: boolean;
}
const props = defineProps<{
selectedNode: Node<NodeData, any, string> | null;
availableParams: ParamRef[];
nodeConfig: NodeConfig | null;
allNodes: Node<NodeData, any, string>[];
allEdges: any[];
}>();
const emit = defineEmits<{
(e: 'update:selectedNode', node: Node<NodeData, any, string>): void;
(e: 'addParam', param: ParamRef): void;
(e: 'openModelSelector'): void;
(e: 'removeModel'): void;
(e: 'openSkillSelector'): void;
(e: 'removeSkill'): void;
(e: 'removeField', nodeId: string, fieldName: string): void;
(e: 'toggleOutput', nodeId: string, enabled: boolean): void;
(e: 'addParamByValue', paramValue: string): void;
}>();
const updateNodeLabel = (newLabel: string) => {
if (!props.selectedNode?.data) return;
const updatedNode = {
...props.selectedNode,
data: {
...props.selectedNode.data,
label: newLabel,
},
};
emit('update:selectedNode', updatedNode);
};
const getFieldValue = (fieldName: string) => {
if (!props.selectedNode?.data?.formConfig) return '';
const field = props.selectedNode.data.formConfig.find((f: any) => f.field === fieldName);
return field?.value ?? '';
};
const updateFieldValue = (fieldName: string, value: any) => {
if (!props.selectedNode?.data) return;
const formConfig = props.selectedNode.data.formConfig || [];
const existingIndex = formConfig.findIndex((f: any) => f.field === fieldName);
let updatedFormConfig;
if (existingIndex >= 0) {
updatedFormConfig = [...formConfig];
updatedFormConfig[existingIndex] = { ...updatedFormConfig[existingIndex], value };
} else {
const fieldDef = props.nodeConfig?.formConfig.find((f) => f.field === fieldName);
if (fieldDef) {
updatedFormConfig = [...formConfig, { ...fieldDef, value }];
} else {
updatedFormConfig = formConfig;
}
}
const updatedNode = {
...props.selectedNode,
data: {
...props.selectedNode.data,
formConfig: updatedFormConfig,
},
};
emit('update:selectedNode', updatedNode);
};
</script>
<style scoped lang="scss">
.config-panel {
background: #ffffff;
border-radius: 10px;
padding: 16px;
overflow-y: auto;
box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
border: 1px solid #e6eaf0;
h3 {
margin: 0 0 16px 0;
font-size: 15px;
font-weight: 700;
color: #334155;
letter-spacing: 0;
}
:deep(.el-form) {
.el-form-item {
margin-bottom: 14px;
.el-form-item__label {
font-weight: 600;
color: #475569;
margin-bottom: 6px;
font-size: 13px;
}
.el-input__wrapper {
border-radius: 6px;
box-shadow: none;
border: 1px solid #dbe3ee;
transition: all 0.2s ease;
&:hover {
border-color: #b8c4d6;
}
&.is-focus {
border-color: #3b82f6;
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}
}
}
}
.param-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px 12px;
margin-bottom: 8px;
background: #f8fafc;
border: 1px solid #e2e8f0;
border-radius: 8px;
transition: all 0.2s ease;
&:hover {
border-color: #cbd5e1;
background: #f1f5f9;
}
}
.selected-tag {
margin-top: 10px;
}
.w100 {
width: 100%;
}
:deep(.el-empty) {
padding: 32px 12px;
}
}
</style>

View File

@@ -0,0 +1,164 @@
<template>
<div class="node-library-panel" :class="{ collapsed: collapsed }">
<div class="node-library-header">
<span>节点库</span>
<el-button class="collapse-btn" text circle @click="emit('update:collapsed', !collapsed)">
<el-icon>
<ArrowRightBold v-if="collapsed" />
<ArrowLeftBold v-else />
</el-icon>
</el-button>
</div>
<div v-if="!collapsed" class="node-library-content">
<el-empty v-if="nodeLibraryGroups.length === 0" description="暂无节点" :image-size="40" />
<div v-else class="node-library-groups">
<div v-for="group in nodeLibraryGroups" :key="group.group" class="node-group">
<div class="node-group-title">{{ group.label }}</div>
<div class="node-group-items">
<el-button
v-for="item in group.items"
:key="item.nodeCode"
text
class="node-item"
@click="emit('addNode', item.nodeCode, item.nodeName)"
>
{{ item.nodeName }}
</el-button>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ArrowLeftBold, ArrowRightBold } from '@element-plus/icons-vue';
import type { NodeLibraryGroup } from '/@/api/settings/creation';
defineProps<{
nodeLibraryGroups: NodeLibraryGroup[];
collapsed: boolean;
}>();
const emit = defineEmits<{
(e: 'update:collapsed', value: boolean): void;
(e: 'addNode', nodeCode: string, nodeName: string): void;
}>();
</script>
<style scoped lang="scss">
.node-library-panel {
position: absolute;
top: 10px;
left: 10px;
z-index: 10;
background: #fff;
border: 1px solid #d8e0eb;
border-radius: 6px;
box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
width: 132px;
max-height: calc(100% - 20px);
display: flex;
flex-direction: column;
overflow: hidden;
transition: width 0.18s ease;
&.collapsed {
width: 40px;
.node-library-header {
padding: 8px;
border-bottom: none;
> span {
display: none;
}
}
.node-library-content {
display: none;
}
}
}
.node-library-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 8px;
border-bottom: 1px solid #e7ecf3;
font-size: 12px;
font-weight: 700;
color: #1f2937;
background: #f8fafc;
.collapse-btn {
width: 20px;
height: 20px;
border: 1px solid #cfd8e6;
color: #64748b;
}
}
.node-library-content {
padding: 12px;
overflow-y: auto;
max-height: 480px;
}
.node-library-groups {
display: flex;
flex-direction: column;
gap: 16px;
}
.node-group {
.node-group-title {
font-size: 12px;
font-weight: 700;
color: #64748b;
margin-bottom: 8px;
padding-bottom: 4px;
border-bottom: 1px solid #e7ecf3;
padding-left: 2px;
}
.node-group-items {
display: flex;
flex-direction: column;
gap: 2px;
}
.node-item {
justify-content: flex-start !important;
width: 100%;
padding: 0 !important;
margin: 0 !important;
color: #475569;
border-radius: 6px;
font-size: 13px;
font-weight: 500;
background: transparent;
border: none;
transition: all 0.15s ease;
text-align: left !important;
min-height: 34px;
height: auto !important;
display: block !important;
&:hover {
background: #f1f5f9;
color: #1e293b;
}
:deep(.el-button__inner) {
width: 100%;
padding: 8px !important;
margin: 0 !important;
text-align: left !important;
justify-content: flex-start !important;
display: block !important;
}
}
}
</style>

View File

@@ -0,0 +1,40 @@
<template>
<el-dialog v-model="dialogVisible" :title="dialogTitle" width="500px" :close-on-click-modal="false">
<el-form :model="saveForm" label-position="top">
<el-form-item label="工作流名称" required>
<el-input v-model="saveForm.flowName" placeholder="请输入工作流名称" maxlength="50" show-word-limit />
</el-form-item>
<el-form-item label="工作流描述">
<el-input v-model="saveForm.description" type="textarea" :rows="4" placeholder="请输入工作流描述(选填)" maxlength="200" show-word-limit />
</el-form-item>
</el-form>
<template #footer>
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" :loading="saving" @click="emit('confirm')">{{ confirmText }}</el-button>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { computed } from 'vue';
const props = defineProps<{
modelValue: boolean;
saveForm: { flowName: string; description: string };
currentEditingWorkflowId: string | null;
saving: boolean;
}>();
const emit = defineEmits<{
(e: 'update:modelValue', value: boolean): void;
(e: 'confirm'): void;
}>();
const dialogVisible = computed({
get: () => props.modelValue,
set: (value: boolean) => emit('update:modelValue', value),
});
const dialogTitle = computed(() => (props.currentEditingWorkflowId ? '编辑工作流' : '保存工作流'));
const confirmText = computed(() => (props.currentEditingWorkflowId ? '确定更新' : '确定保存'));
</script>

View File

@@ -0,0 +1,190 @@
<template>
<div class="workflow-list-panel">
<div class="panel-header">
<el-tabs v-model="activeTab" class="workflow-tabs">
<el-tab-pane label="我的工作流" name="user"></el-tab-pane>
<el-tab-pane label="模板工作流" name="template"></el-tab-pane>
</el-tabs>
</div>
<div class="workflow-list-content" v-loading="loading">
<el-empty v-if="currentList.length === 0" description="暂无工作流" :image-size="60" />
<div v-else class="workflow-items">
<div
v-for="workflow in currentList"
:key="workflow.id"
class="workflow-item"
:class="{ active: currentEditingId === workflow.id }"
@click="emit('edit', workflow)"
>
<div class="workflow-item-content">
<div class="workflow-item-name">{{ workflow.flowName || workflow.flowTemplateName || '未命名工作流' }}</div>
<div class="workflow-item-desc">{{ workflow.description || '暂无描述' }}</div>
</div>
<div class="workflow-item-actions">
<el-button type="primary" link size="small" @click.stop="emit('edit', workflow)">编辑</el-button>
<el-button type="danger" link size="small" @click.stop="emit('delete', workflow)">删除</el-button>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, computed } from 'vue';
import type { WorkflowItem } from '/@/api/settings/creation';
const props = defineProps<{
userWorkflowList: WorkflowItem[];
templateWorkflowList: WorkflowItem[];
currentEditingId: string | null;
loading: boolean;
}>();
const emit = defineEmits<{
(e: 'edit', workflow: WorkflowItem): void;
(e: 'delete', workflow: WorkflowItem): void;
(e: 'create'): void;
}>();
const activeTab = ref<'user' | 'template'>('user');
const currentList = computed(() => {
return activeTab.value === 'user' ? props.userWorkflowList : props.templateWorkflowList;
});
</script>
<style scoped lang="scss">
.workflow-list-panel {
background: #ffffff;
border-radius: 10px;
padding: 16px;
overflow-y: auto;
display: flex;
flex-direction: column;
box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
border: 1px solid #e6eaf0;
.panel-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 14px;
:deep(.el-button) {
border-radius: 6px;
font-weight: 500;
font-size: 12px;
padding: 6px 12px;
}
}
.workflow-tabs {
flex: 1;
:deep(.el-tabs__header) {
margin: 0;
}
:deep(.el-tabs__nav-wrap::after) {
display: none;
}
:deep(.el-tabs__item) {
font-size: 14px;
font-weight: 600;
color: #64748b;
padding: 0 16px;
height: 36px;
line-height: 36px;
&.is-active {
color: #3b82f6;
}
}
:deep(.el-tabs__active-bar) {
background-color: #3b82f6;
}
}
.workflow-list-content {
flex: 1;
overflow-y: auto;
&::-webkit-scrollbar {
width: 6px;
}
&::-webkit-scrollbar-track {
background: rgba(102, 126, 234, 0.05);
border-radius: 10px;
}
&::-webkit-scrollbar-thumb {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border-radius: 10px;
}
}
.workflow-items {
display: flex;
flex-direction: column;
gap: 8px;
}
.workflow-item {
padding: 12px;
border: 1px solid #e2e8f0;
border-radius: 8px;
cursor: pointer;
transition: all 0.2s ease;
background: #fff;
&:hover {
border-color: #c5d2e6;
box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}
&.active {
border-color: #3b82f6;
background: #eff6ff;
}
}
.workflow-item-content {
margin-bottom: 8px;
}
.workflow-item-name {
font-size: 14px;
font-weight: 600;
color: #1e293b;
margin-bottom: 4px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.workflow-item-desc {
font-size: 12px;
color: #64748b;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.workflow-item-actions {
display: flex;
gap: 8px;
justify-content: flex-end;
:deep(.el-button) {
border-radius: 6px;
font-weight: 500;
font-size: 12px;
padding: 4px 8px;
}
}
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,217 @@
<template>
<div class="system-pwconfig-container">
<el-card shadow="hover">
<template #header>
<div class="card-header">
<span>密码策略配置</span>
</div>
</template>
<el-form :model="ruleForm" ref="formRef" :rules="rules" label-width="180px" style="max-width: 800px;">
<el-form-item label="启用密码策略" prop="enabled">
<el-switch v-model="ruleForm.enabled" />
</el-form-item>
<el-form-item label="最小密码长度" prop="minLength">
<el-input-number v-model="ruleForm.minLength" :min="4" :max="32" placeholder="请输入最小密码长度" />
<span class="ml10 text-muted"></span>
</el-form-item>
<el-form-item label="最大密码长度" prop="maxLength">
<el-input-number v-model="ruleForm.maxLength" :min="4" :max="128" placeholder="请输入最大密码长度" />
<span class="ml10 text-muted"></span>
</el-form-item>
<el-form-item label="必须包含大写字母" prop="requireUppercase">
<el-switch v-model="ruleForm.requireUppercase" />
</el-form-item>
<el-form-item label="必须包含小写字母" prop="requireLowercase">
<el-switch v-model="ruleForm.requireLowercase" />
</el-form-item>
<el-form-item label="必须包含数字" prop="requireDigit">
<el-switch v-model="ruleForm.requireDigit" />
</el-form-item>
<el-form-item label="必须包含特殊字符" prop="requireSpecialChar">
<el-switch v-model="ruleForm.requireSpecialChar" />
<div class="text-muted mt5" style="font-size: 12px;">特殊字符包括!@#$%^&*()_+-=[]{}|;:,.<>?</div>
</el-form-item>
<el-form-item label="密码过期天数" prop="expireDays">
<el-input-number v-model="ruleForm.expireDays" :min="0" :max="365" placeholder="请输入密码过期天数" />
<span class="ml10 text-muted">0表示永不过期</span>
</el-form-item>
<el-form-item label="禁止重复使用次数" prop="historyLimit">
<el-input-number v-model="ruleForm.historyLimit" :min="0" :max="24" placeholder="请输入禁止重复使用次数" />
<span class="ml10 text-muted">0表示不限制</span>
</el-form-item>
<el-form-item label="登录失败锁定次数" prop="maxRetryCount">
<el-input-number v-model="ruleForm.maxRetryCount" :min="0" :max="10" placeholder="请输入登录失败锁定次数" />
<span class="ml10 text-muted">0表示不锁定</span>
</el-form-item>
<el-form-item label="锁定时长" prop="lockTimeMinutes">
<el-input-number v-model="ruleForm.lockTimeMinutes" :min="1" :max="1440" placeholder="请输入锁定时长" />
<span class="ml10 text-muted">分钟</span>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="ruleForm.remark" type="textarea" :rows="3" placeholder="请输入备注" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit" :loading="loading">保存配置</el-button>
<el-button @click="resetForm">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</template>
<script lang="ts">
import { reactive, toRefs, defineComponent, ref, onMounted, unref } from 'vue';
import { ElMessage, FormInstance, FormRules } from 'element-plus';
import { getPwConfig, savePwConfig } from "/@/api/system/pwconfig";
interface RuleFormState {
enabled: boolean;
minLength: number;
maxLength: number;
requireUppercase: boolean;
requireLowercase: boolean;
requireDigit: boolean;
requireSpecialChar: boolean;
expireDays: number;
historyLimit: number;
maxRetryCount: number;
lockTimeMinutes: number;
remark: string;
}
interface PwConfigState {
ruleForm: RuleFormState;
rules: FormRules;
loading: boolean;
}
export default defineComponent({
name: 'systemPwConfig',
setup() {
const formRef = ref<FormInstance>();
const state = reactive<PwConfigState>({
loading: false,
ruleForm: {
enabled: false,
minLength: 8,
maxLength: 32,
requireUppercase: false,
requireLowercase: true,
requireDigit: true,
requireSpecialChar: false,
expireDays: 90,
historyLimit: 5,
maxRetryCount: 5,
lockTimeMinutes: 30,
remark: '',
},
rules: {
minLength: [
{ required: true, message: '请输入最小密码长度', trigger: 'blur' }
],
maxLength: [
{ required: true, message: '请输入最大密码长度', trigger: 'blur' }
],
expireDays: [
{ required: true, message: '请输入密码过期天数', trigger: 'blur' }
],
historyLimit: [
{ required: true, message: '请输入禁止重复使用次数', trigger: 'blur' }
],
maxRetryCount: [
{ required: true, message: '请输入登录失败锁定次数', trigger: 'blur' }
],
lockTimeMinutes: [
{ required: true, message: '请输入锁定时长', trigger: 'blur' }
],
}
});
// 获取配置
const loadConfig = async () => {
try {
const res: any = await getPwConfig();
if (res.code === 0 && res.data) {
state.ruleForm = {
...state.ruleForm,
...res.data,
};
}
} catch {
// 错误由全局拦截器处理
}
};
// 重置表单
const resetForm = () => {
loadConfig();
};
// 保存配置
const onSubmit = async () => {
const formWrap = unref(formRef);
if (!formWrap) return;
await formWrap.validate(async (valid: boolean) => {
if (valid) {
// 验证最小长度不大于最大长度
if (state.ruleForm.minLength > state.ruleForm.maxLength) {
ElMessage.error('最小密码长度不能大于最大密码长度');
return;
}
state.loading = true;
try {
await savePwConfig(state.ruleForm);
ElMessage.success('保存成功');
} finally {
state.loading = false;
}
}
});
};
// 页面加载时
onMounted(() => {
loadConfig();
});
return {
formRef,
onSubmit,
resetForm,
...toRefs(state),
};
},
});
</script>
<style scoped lang="scss">
.text-muted {
color: var(--el-text-color-placeholder);
}
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
}
.system-pwconfig-container {
:deep(.el-card__body) {
padding-top: 30px;
}
}
</style>

View File

@@ -0,0 +1,62 @@
-----BEGIN CERTIFICATE-----
MIIGCTCCBPGgAwIBAgIQCbk8r0AqeDTQmt8tQBlLTzANBgkqhkiG9w0BAQsFADBu
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
d3cuZGlnaWNlcnQuY29tMS0wKwYDVQQDEyRFbmNyeXB0aW9uIEV2ZXJ5d2hlcmUg
RFYgVExTIENBIC0gRzIwHhcNMjYwNTI2MDAwMDAwWhcNMjYwODI1MjM1OTU5WjAd
MRswGQYDVQQDExJyZWRwb3dlcmZ1dHVyZS5jb20wggEiMA0GCSqGSIb3DQEBAQUA
A4IBDwAwggEKAoIBAQDaa/u6fK1eth80Wnn3Er/tzwUrWNT+yKeXd6Hus35C4lwD
euIv9nG+45iggLVDJvD/NCT4LlNUbZ/57MEIagpanOfbVKW+xSaYpFbhLoy+hwWU
pK4mDyv0MtzSTiFbZKU+LepiJwyjwnnbyR71Xik0nbxb68lBC/wYlMtuvn8oIfdB
j/xDxhsel4rt+gekSmmycFS4Jh5HVky8ofUVN3SbdFWgCkyPM68zc+hw2MqRHjfK
sgjx2b/WaLfSi8qBJF1oqLlqX9BsNzCP7tTBUH1o5VTPtgP1ICkp+JTlQp3WM6ua
sljXnTUdAHdvytCFd/mSFFQ1HeaYceFtRcNYxf7PAgMBAAGjggLyMIIC7jAfBgNV
HSMEGDAWgBR435GQX+7erPbFdevVTFVT7yRKtjAdBgNVHQ4EFgQUhlGg1Q8rQeyT
BZpspLDJcVphGZ0wNQYDVR0RBC4wLIIScmVkcG93ZXJmdXR1cmUuY29tghZ3d3cu
cmVkcG93ZXJmdXR1cmUuY29tMD4GA1UdIAQ3MDUwMwYGZ4EMAQIBMCkwJwYIKwYB
BQUHAgEWG2h0dHA6Ly93d3cuZGlnaWNlcnQuY29tL0NQUzAOBgNVHQ8BAf8EBAMC
BaAwEwYDVR0lBAwwCgYIKwYBBQUHAwEwgYAGCCsGAQUFBwEBBHQwcjAkBggrBgEF
BQcwAYYYaHR0cDovL29jc3AuZGlnaWNlcnQuY29tMEoGCCsGAQUFBzAChj5odHRw
Oi8vY2FjZXJ0cy5kaWdpY2VydC5jb20vRW5jcnlwdGlvbkV2ZXJ5d2hlcmVEVlRM
U0NBLUcyLmNydDAMBgNVHRMBAf8EAjAAMIIBfQYKKwYBBAHWeQIEAgSCAW0EggFp
AWcAdgDCMX5XRRmjRe5/ON6ykEHrx8IhWiK/f9W1rXaa2Q5SzQAAAZ5iSF5XAAAE
AwBHMEUCIAr6FBJHXrAg0wjPX0PStK+tIhQ/94KkU4PBR4WsTxRtAiEArtDnplV+
9hbjOs0j2cRlxGuE8QtM/pmlIV+jtkZwgsQAdQDXbX0Q0af1d8LH6V/XAL/5gskz
WmXh0LMBcxfAyMVpdwAAAZ5iSF4uAAAEAwBGMEQCICS/ddUJMlaxmEvuk4My/cZ4
TNmensyP/TbnJSpyoYdIAiBy0v/DYnFCYU+Y6KXUUJj8kTJlBR87sloDEIS/HdOl
7AB2AJROQ4f67MHvgfMZJCaoGGUBx9NfOAIBP3JnfVU3LhnYAAABnmJIXmUAAAQD
AEcwRQIgDZdQPgnfZBGbDfk01SeAbliEycANB1pkcLzIdc+L15UCIQCzk0mg544c
efvISO7fIbjx0tEnUrItMLTsYXrxpzMwZzANBgkqhkiG9w0BAQsFAAOCAQEApYQk
hfTsipwGQ/RDgmnbBrX54qHAU+u4ru3vKmQfWLt306fMw3njxWjxll0vv59Tst/v
idaA57NocaYmPV3IvaWn2XNUwZt+YIO9xmbgJ8nRse3uGrfmu8oRrulWr0xu2Gh6
FleqmGgYDP+2IGfupX+T5rhiAgH37ViG2Y8EmFZVKwG1JSzQPdUFwgiLQhU98PjR
V0iZeUkHna2HhqLEMIYpQ2cC61AS4qkx2aQ9osg4wsYInqLuaCIbEYv5UEgLU5lR
IyMfIKw8TSl9LekeksjIgKAVZQk6gYGqoQHR9HP0UIbFcu5yJ6Oar+IFBHPgWFCb
D5k/3VsDjhXUNgLs1A==
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIEqjCCA5KgAwIBAgIQDeD/te5iy2EQn2CMnO1e0zANBgkqhkiG9w0BAQsFADBh
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBH
MjAeFw0xNzExMjcxMjQ2NDBaFw0yNzExMjcxMjQ2NDBaMG4xCzAJBgNVBAYTAlVT
MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j
b20xLTArBgNVBAMTJEVuY3J5cHRpb24gRXZlcnl3aGVyZSBEViBUTFMgQ0EgLSBH
MjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAO8Uf46i/nr7pkgTDqnE
eSIfCFqvPnUq3aF1tMJ5hh9MnO6Lmt5UdHfBGwC9Si+XjK12cjZgxObsL6Rg1njv
NhAMJ4JunN0JGGRJGSevbJsA3sc68nbPQzuKp5Jc8vpryp2mts38pSCXorPR+sch
QisKA7OSQ1MjcFN0d7tbrceWFNbzgL2csJVQeogOBGSe/KZEIZw6gXLKeFe7mupn
NYJROi2iC11+HuF79iAttMc32Cv6UOxixY/3ZV+LzpLnklFq98XORgwkIJL1HuvP
ha8yvb+W6JislZJL+HLFtidoxmI7Qm3ZyIV66W533DsGFimFJkz3y0GeHWuSVMbI
lfsCAwEAAaOCAU8wggFLMB0GA1UdDgQWBBR435GQX+7erPbFdevVTFVT7yRKtjAf
BgNVHSMEGDAWgBROIlQgGJXm427mD/r6uRLtBhePOTAOBgNVHQ8BAf8EBAMCAYYw
HQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMBIGA1UdEwEB/wQIMAYBAf8C
AQAwNAYIKwYBBQUHAQEEKDAmMCQGCCsGAQUFBzABhhhodHRwOi8vb2NzcC5kaWdp
Y2VydC5jb20wQgYDVR0fBDswOTA3oDWgM4YxaHR0cDovL2NybDMuZGlnaWNlcnQu
Y29tL0RpZ2lDZXJ0R2xvYmFsUm9vdEcyLmNybDBMBgNVHSAERTBDMDcGCWCGSAGG
/WwBAjAqMCgGCCsGAQUFBwIBFhxodHRwczovL3d3dy5kaWdpY2VydC5jb20vQ1BT
MAgGBmeBDAECATANBgkqhkiG9w0BAQsFAAOCAQEAoBs1eCLKakLtVRPFRjBIJ9LJ
L0s8ZWum8U8/1TMVkQMBn+CPb5xnCD0GSA6L/V0ZFrMNqBirrr5B241OesECvxIi
98bZ90h9+q/X5eMyOD35f8YTaEMpdnQCnawIwiHx06/0BfiTj+b/XQih+mqt3ZXe
xNCJqKexdiB2IWGSKcgahPacWkk/BAQFisKIFYEqHzV974S3FAz/8LIfD58xnsEN
GfzyIDkH3JrwYZ8caPTf6ZX9M1GrISN8HnWTtdNCH2xEajRa/h9ZBXjUyFKQrGk2
n2hcLrfZSbynEC/pSw/ET7H5nWwckjmAJ1l9fcnbqkU/pf6uMQmnfl0JQjJNSg==
-----END CERTIFICATE-----

View File

@@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEA2mv7unytXrYfNFp59xK/7c8FK1jU/sinl3eh7rN+QuJcA3ri
L/ZxvuOYoIC1Qybw/zQk+C5TVG2f+ezBCGoKWpzn21SlvsUmmKRW4S6MvocFlKSu
Jg8r9DLc0k4hW2SlPi3qYicMo8J528ke9V4pNJ28W+vJQQv8GJTLbr5/KCH3QY/8
Q8YbHpeK7foHpEppsnBUuCYeR1ZMvKH1FTd0m3RVoApMjzOvM3PocNjKkR43yrII
8dm/1mi30ovKgSRdaKi5al/QbDcwj+7UwVB9aOVUz7YD9SApKfiU5UKd1jOrmrJY
1501HQB3b8rQhXf5khRUNR3mmHHhbUXDWMX+zwIDAQABAoIBAEFYoxQ07s1yIT3R
f8HKiz9De2FvjzG2qGUpdnnqm3C5NhwYbIk66ubYQrZqK1Cu2tUPLaxOd8G/lmf4
S/wPdY+Md9Vnqrq7UwPBzvhJq/Pog2PoLO3YBidl/CizFUm5f7JtnDzHQAHSUhDO
SAPSqvNB6bN6hFiAlGhqQ76bIYHIsfAmeUK6d0fmvBHWY57436VhiEMExtX29GTw
dKgePgBE+1R0Lwykwx2/CANPs+zs67b/tqDTDjk7Kxecz7LrrGoRbmOFRx2p27FQ
5lftdJqHAP5sBdVPlA+97z5cJBlU02yUb2mLfOIsCerpxl+FLdqQcQ1v16I6kXsP
B+dn37ECgYEA+jLgs3x13pzIWMLBPKGYXLDjZ8nnKza/XSoiRizEmt7tbq6An4Cw
ClYKuHd+/hygf04UsPn2sJ+zSvfmxYFnUr6YuzmVNN3S1igcBwz98kQkOSBsPqvT
YB1KgDF079QS99ixfB4idOG5NdCuXGn7PZbYgt610K/dcRZ2PcCEyQcCgYEA33x8
KZjL5RoFxdTBW9DuNRYcvDJFI+L8WsFE8nEtotpf3kSs3rMy+HxLVIcmFBnrc+N+
pwt9La8ZHvLM7eshXSi2kAUbyPe7kPrOdcv7ye7L84sVBNCw7J/d3jn+Zpvepvhc
E1B0LYhQJYzwv97pH/98epQI8QXWQsAeQN9TEfkCgYEAqrIba1j2cbI1XZlBjMQS
1uo3u4+cD3eCh2U/jPDuEVsWUfTr++YoNGUPW1rrYSLWvQPgSf2/uDC8eeE3qHfo
riMqwFFA4piUR1eGB6ltd+PVcsQUFY3U4DYbpeoYBaeCaWWFcVB94ZA+c+CzlIkZ
x6Mqg9693GqfgY/5i5fU//ECfydIuoqVUUH0UQ91VofNMhIi0OpD6+NjAvjxAC2d
t2fo+vEXIUwEM/F558Pz/b2K0NiOJLU4T8i3/rJx+5PWwQafIXgvbbLl2RKjA6ex
M5FLaI5m5Er0ZCUz9MwbZZyjyX+QKJ88hS97xprTK36OsGvvfPIPE4NKg184ZhkB
KJkCgYEAjk5kR/HyHLcLVrkrc0iQHCHYpuYRP4zCL1FdTmsXy0toAdvlA2D4nB/L
2Sdh+0Tj9qRF2zdCA4LBlpEbEPY5oYzDuurJ1lw9LV2gek+yi0wTsbPR+3pMwQ/2
M4JfUkjAldpKBIx/V68vA2mc226wlInpBkRMz6V63GIMjj8WDz8=
-----END RSA PRIVATE KEY-----