Skip to content

Commit c3fa1cb

Browse files
committed
feat: 前端升级vue3,替换vue2,后端性能调优,新增权限控制
1 parent a83c9e7 commit c3fa1cb

File tree

309 files changed

+10269
-90762
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

309 files changed

+10269
-90762
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ vosk-model*
1515
*.tmp
1616
*.swp
1717
*.swo
18+
.vite
1819

1920
# 忽略 IDE 相关文件
2021
.idea/

Dockerfile-node

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
FROM node:18-alpine
2-
3-
WORKDIR /node
4-
5-
COPY web .
6-
7-
# 安装所有依赖
8-
RUN npm config set registry https://registry.npmmirror.com && \
9-
npm install
10-
11-
# 设置环境变量
12-
ENV HOST=0.0.0.0
13-
ENV PORT=8084
14-
ENV API_URL=http://server:8091
15-
16-
# 使用开发模式
1+
FROM node:22-alpine
2+
3+
WORKDIR /node
4+
5+
COPY web .
6+
7+
# 安装所有依赖
8+
RUN npm config set registry https://registry.npmmirror.com && \
9+
npm install
10+
11+
# 设置环境变量
12+
ENV HOST=0.0.0.0
13+
ENV PORT=8084
14+
ENV API_URL=http://server:8091
15+
16+
# 使用开发模式
1717
CMD ["npm", "run", "dev"]

README.md

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -304,31 +304,11 @@ Xiaozhi ESP32 Server Java 是基于 [Xiaozhi ESP32](https://github.com/78/xiaozh
304304

305305
---
306306

307-
## 开发路线图 🗺️
307+
### 商业合作
308308

309-
根据我们的[项目开发需求清单](https://github.com/users/joey-zhou/projects/1),未来我们计划实现以下功能:
309+
我们接受各种项目开发,如果您有特定需求或对商业版本感兴趣,欢迎通过微信联系洽谈。
310310

311-
### 近期计划 (2025 Q2)
312-
- 完善Function Call功能,支持更多复杂任务处理
313-
- 实现多角色混合模式,支持不同唤醒词唤醒不同角色
314-
- 优化记忆管理系统,提供更灵活的历史对话管理
315-
- 实现聊天数据可视化功能,提供数据分析能力
316-
317-
### 中期计划 (2025 Q3-Q4)
318-
- 实现声纹识别功能,支持个性化语音助手
319-
- 完善Home Assistant集成,提供更全面的智能家居控制能力
320-
- 开发多模态交互功能,支持图像识别和处理
321-
- 实现自定义插件系统,支持功能扩展
322-
323-
### 长期计划 (2026+)
324-
- 开发多设备协同工作机制,实现全屋覆盖的语音助手系统
325-
- 实现情感分析功能,提供更人性化的交互体验
326-
- 开发知识库集成功能,增强问答能力
327-
- 实现多用户支持,满足家庭多成员使用需求
328-
329-
我们将根据社区反馈和技术发展不断调整开发计划,确保项目持续满足用户需求。
330-
331-
---
311+
<img src="./web/static/img/wechat.jpg" alt="微信" width="200" />
332312

333313
## 贡献指南 👐
334314

@@ -346,17 +326,11 @@ Xiaozhi ESP32 Server Java 是基于 [Xiaozhi ESP32](https://github.com/78/xiaozh
346326

347327
<img src="./web/static/img/qq.jpg" alt="QQ群" width="200" />
348328

349-
### 定制开发
350-
351-
我们接受各种定制化开发项目,如果您有特定需求,欢迎通过微信联系洽谈。
352-
353-
<img src="./web/static/img/wechat.jpg" alt="微信" width="200" />
354-
355329
---
356330

357331
## 免责声明 ⚠️
358332

359-
本项目仅提供音乐和绘本播放的技术实现代码,不提供任何媒体内容。用户在使用相关功能时应确保拥有合法的使用权或版权许可,并遵守所在地区的版权法律法规。
333+
本项目仅提供技术实现代码,不提供任何媒体内容。用户在使用相关功能时应确保拥有合法的使用权或版权许可,并遵守所在地区的版权法律法规。
360334

361335
项目中可能涉及的示例内容或资源均来自网络或由用户投稿提供,仅用于功能演示和技术测试。如有任何内容侵犯了您的权益,请立即联系我们,我们将在核实后立即采取删除等处理措施。
362336

db/2025_06_25.sql

Lines changed: 0 additions & 1 deletion
This file was deleted.

db/2025_06_26.sql

Lines changed: 0 additions & 2 deletions
This file was deleted.

db/2025_06_28.sql

Lines changed: 0 additions & 2 deletions
This file was deleted.

db/2025_09_18.sql

Lines changed: 0 additions & 2 deletions
This file was deleted.

db/2025_10_27.sql

Lines changed: 0 additions & 5 deletions
This file was deleted.

db/2025_11_01.sql

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
2+
-- 创建权限表
3+
DROP TABLE IF EXISTS `xiaozhi`.`sys_permission`;
4+
CREATE TABLE `xiaozhi`.`sys_permission` (
5+
`permissionId` int unsigned NOT NULL AUTO_INCREMENT COMMENT '权限ID',
6+
`parentId` int unsigned DEFAULT NULL COMMENT '父权限ID',
7+
`name` varchar(100) NOT NULL COMMENT '权限名称',
8+
`permissionKey` varchar(100) NOT NULL COMMENT '权限标识',
9+
`permissionType` enum('menu','button','api') NOT NULL COMMENT '权限类型:菜单、按钮、接口',
10+
`path` varchar(255) DEFAULT NULL COMMENT '前端路由路径',
11+
`component` varchar(255) DEFAULT NULL COMMENT '前端组件路径',
12+
`icon` varchar(100) DEFAULT NULL COMMENT '图标',
13+
`sort` int DEFAULT '0' COMMENT '排序',
14+
`visible` enum('1','0') DEFAULT '1' COMMENT '是否可见(1可见 0隐藏)',
15+
`status` enum('1','0') DEFAULT '1' COMMENT '状态(1正常 0禁用)',
16+
`createTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
17+
`updateTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
18+
PRIMARY KEY (`permissionId`),
19+
UNIQUE KEY `uk_permission_key` (`permissionKey`)
20+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='权限表';
21+
22+
-- 创建角色表
23+
DROP TABLE IF EXISTS `xiaozhi`.`sys_auth_role`;
24+
CREATE TABLE `xiaozhi`.`sys_auth_role` (
25+
`roleId` int unsigned NOT NULL AUTO_INCREMENT COMMENT '角色ID',
26+
`roleName` varchar(100) NOT NULL COMMENT '角色名称',
27+
`roleKey` varchar(100) NOT NULL COMMENT '角色标识',
28+
`description` varchar(500) DEFAULT NULL COMMENT '角色描述',
29+
`status` enum('1','0') DEFAULT '1' COMMENT '状态(1正常 0禁用)',
30+
`createTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
31+
`updateTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
32+
PRIMARY KEY (`roleId`),
33+
UNIQUE KEY `uk_role_key` (`roleKey`)
34+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='权限角色表';
35+
36+
-- 创建角色-权限关联表
37+
DROP TABLE IF EXISTS `xiaozhi`.`sys_role_permission`;
38+
CREATE TABLE `xiaozhi`.`sys_role_permission` (
39+
`id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
40+
`roleId` int unsigned NOT NULL COMMENT '角色ID',
41+
`permissionId` int unsigned NOT NULL COMMENT '权限ID',
42+
`createTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
43+
PRIMARY KEY (`id`),
44+
UNIQUE KEY `uk_role_permission` (`roleId`,`permissionId`)
45+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='角色-权限关联表';
46+
47+
48+
-- 插入菜单权限
49+
INSERT INTO `xiaozhi`.`sys_permission` (`parentId`, `name`, `permissionKey`, `permissionType`, `path`, `component`, `icon`, `sort`, `visible`, `status`) VALUES
50+
-- 主菜单
51+
(NULL, 'Dashboard', 'system:dashboard', 'menu', '/dashboard', 'page/Dashboard', 'dashboard', 1, '1', '1'),
52+
(NULL, '用户管理', 'system:user', 'menu', '/user', 'page/User', 'team', 2, '1', '1'),
53+
(NULL, '设备管理', 'system:device', 'menu', '/device', 'page/Device', 'robot', 3, '1', '1'),
54+
(NULL, '智能体', 'system:agents', 'menu', '/agents', 'page/user/Agents', 'robot', 4, '1', '1'),
55+
(NULL, '对话管理', 'system:message', 'menu', '/message', 'page/Message', 'message', 5, '1', '1'),
56+
(NULL, '角色配置', 'system:role', 'menu', '/role', 'page/Role', 'user-add', 6, '1', '1'),
57+
(NULL, '提示词模板管理', 'system:prompt-template', 'menu', '/prompt-template', 'page/PromptTemplate', 'snippets', 7, '0', '1'),
58+
(NULL, '配置管理', 'system:config', 'menu', '/config', 'common/PageView', 'setting', 8, '1', '1'),
59+
(NULL, '设置', 'system:setting', 'menu', '/setting', 'common/PageView', 'setting', 9, '1', '1');
60+
61+
-- 配置管理子菜单
62+
INSERT INTO `xiaozhi`.`sys_permission` (`parentId`, `name`, `permissionKey`, `permissionType`, `path`, `component`, `icon`, `sort`, `visible`, `status`) VALUES
63+
(8, '模型配置', 'system:config:model', 'menu', '/config/model', 'page/config/ModelConfig', NULL, 1, '1', '1'),
64+
(8, '智能体管理', 'system:config:agent', 'menu', '/config/agent', 'page/config/Agent', NULL, 2, '1', '1'),
65+
(8, '语音识别配置', 'system:config:stt', 'menu', '/config/stt', 'page/config/SttConfig', NULL, 3, '1', '1'),
66+
(8, '语音合成配置', 'system:config:tts', 'menu', '/config/tts', 'page/config/TtsConfig', NULL, 4, '1', '1');
67+
68+
-- 设置子菜单
69+
INSERT INTO `xiaozhi`.`sys_permission` (`parentId`, `name`, `permissionKey`, `permissionType`, `path`, `component`, `icon`, `sort`, `visible`, `status`) VALUES
70+
(9, '个人中心', 'system:setting:account', 'menu', '/setting/account', 'page/setting/Account', NULL, 1, '1', '1'),
71+
(9, '个人设置', 'system:setting:config', 'menu', '/setting/config', 'page/setting/Config', NULL, 2, '1', '1');
72+
73+
-- 插入角色
74+
INSERT INTO `xiaozhi`.`sys_auth_role` (`roleName`, `roleKey`, `description`, `status`) VALUES
75+
('管理员', 'admin', '系统管理员,拥有所有权限', '1'),
76+
('普通用户', 'user', '普通用户,拥有基本操作权限', '1');
77+
78+
-- 管理员角色权限(所有权限)
79+
INSERT INTO `xiaozhi`.`sys_role_permission` (`roleId`, `permissionId`)
80+
SELECT 1, permissionId FROM `xiaozhi`.`sys_permission`;
81+
82+
-- 将admin用户设为管理员角色
83+
UPDATE `xiaozhi`.`sys_user` SET `roleId` = 1 WHERE `username` = 'admin';
84+
85+
-- 将其他用户设为普通用户角色
86+
UPDATE `xiaozhi`.`sys_user` SET `roleId` = 2 WHERE `username` != 'admin';

db/init.sql

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ CREATE TABLE `xiaozhi`.`sys_role` (
106106
`vadEnergyTh` FLOAT DEFAULT 0.01 COMMENT '能量检测阈值',
107107
`vadSilenceMs` INT DEFAULT 1200 COMMENT '静音检测时间',
108108
`voiceName` varchar(100) NOT NULL COMMENT '角色语音名称',
109+
`ttsPitch` FLOAT DEFAULT 1.0 COMMENT '语音音调',
110+
`ttsSpeed` FLOAT DEFAULT 1.0 COMMENT '语音语速',
109111
`state` enum('1','0') DEFAULT '1' COMMENT '状态:1-启用,0-禁用',
110112
`isDefault` enum('1','0') DEFAULT '0' COMMENT '是否默认角色:1-是,0-否',
111113
`userId` int NOT NULL COMMENT '创建人',
@@ -234,3 +236,90 @@ INSERT INTO `xiaozhi`.`sys_template` (`userId`, `templateName`, `templateDesc`,
234236
-不要动不动转移话题
235237
如果用户回复转为 “暴躁小智” 或 好几次攻击你 你就以现在规则回复
236238
理解用户的信息,酝酿你的愤怒情绪,你越想越生气。', '社交角色', '1');
239+
240+
241+
-- 创建权限表
242+
DROP TABLE IF EXISTS `xiaozhi`.`sys_permission`;
243+
CREATE TABLE `xiaozhi`.`sys_permission` (
244+
`permissionId` int unsigned NOT NULL AUTO_INCREMENT COMMENT '权限ID',
245+
`parentId` int unsigned DEFAULT NULL COMMENT '父权限ID',
246+
`name` varchar(100) NOT NULL COMMENT '权限名称',
247+
`permissionKey` varchar(100) NOT NULL COMMENT '权限标识',
248+
`permissionType` enum('menu','button','api') NOT NULL COMMENT '权限类型:菜单、按钮、接口',
249+
`path` varchar(255) DEFAULT NULL COMMENT '前端路由路径',
250+
`component` varchar(255) DEFAULT NULL COMMENT '前端组件路径',
251+
`icon` varchar(100) DEFAULT NULL COMMENT '图标',
252+
`sort` int DEFAULT '0' COMMENT '排序',
253+
`visible` enum('1','0') DEFAULT '1' COMMENT '是否可见(1可见 0隐藏)',
254+
`status` enum('1','0') DEFAULT '1' COMMENT '状态(1正常 0禁用)',
255+
`createTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
256+
`updateTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
257+
PRIMARY KEY (`permissionId`),
258+
UNIQUE KEY `uk_permission_key` (`permissionKey`)
259+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='权限表';
260+
261+
-- 创建角色表
262+
DROP TABLE IF EXISTS `xiaozhi`.`sys_auth_role`;
263+
CREATE TABLE `xiaozhi`.`sys_auth_role` (
264+
`roleId` int unsigned NOT NULL AUTO_INCREMENT COMMENT '角色ID',
265+
`roleName` varchar(100) NOT NULL COMMENT '角色名称',
266+
`roleKey` varchar(100) NOT NULL COMMENT '角色标识',
267+
`description` varchar(500) DEFAULT NULL COMMENT '角色描述',
268+
`status` enum('1','0') DEFAULT '1' COMMENT '状态(1正常 0禁用)',
269+
`createTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
270+
`updateTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
271+
PRIMARY KEY (`roleId`),
272+
UNIQUE KEY `uk_role_key` (`roleKey`)
273+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='权限角色表';
274+
275+
-- 创建角色-权限关联表
276+
DROP TABLE IF EXISTS `xiaozhi`.`sys_role_permission`;
277+
CREATE TABLE `xiaozhi`.`sys_role_permission` (
278+
`id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
279+
`roleId` int unsigned NOT NULL COMMENT '角色ID',
280+
`permissionId` int unsigned NOT NULL COMMENT '权限ID',
281+
`createTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
282+
PRIMARY KEY (`id`),
283+
UNIQUE KEY `uk_role_permission` (`roleId`,`permissionId`)
284+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='角色-权限关联表';
285+
286+
287+
-- 插入菜单权限
288+
INSERT INTO `xiaozhi`.`sys_permission` (`parentId`, `name`, `permissionKey`, `permissionType`, `path`, `component`, `icon`, `sort`, `visible`, `status`) VALUES
289+
-- 主菜单
290+
(NULL, 'Dashboard', 'system:dashboard', 'menu', '/dashboard', 'page/Dashboard', 'dashboard', 1, '1', '1'),
291+
(NULL, '用户管理', 'system:user', 'menu', '/user', 'page/User', 'team', 2, '1', '1'),
292+
(NULL, '设备管理', 'system:device', 'menu', '/device', 'page/Device', 'robot', 3, '1', '1'),
293+
(NULL, '智能体', 'system:agents', 'menu', '/agents', 'page/user/Agents', 'robot', 4, '1', '1'),
294+
(NULL, '对话管理', 'system:message', 'menu', '/message', 'page/Message', 'message', 5, '1', '1'),
295+
(NULL, '角色配置', 'system:role', 'menu', '/role', 'page/Role', 'user-add', 6, '1', '1'),
296+
(NULL, '提示词模板管理', 'system:prompt-template', 'menu', '/prompt-template', 'page/PromptTemplate', 'snippets', 7, '0', '1'),
297+
(NULL, '配置管理', 'system:config', 'menu', '/config', 'common/PageView', 'setting', 8, '1', '1'),
298+
(NULL, '设置', 'system:setting', 'menu', '/setting', 'common/PageView', 'setting', 9, '1', '1');
299+
300+
-- 配置管理子菜单
301+
INSERT INTO `xiaozhi`.`sys_permission` (`parentId`, `name`, `permissionKey`, `permissionType`, `path`, `component`, `icon`, `sort`, `visible`, `status`) VALUES
302+
(8, '模型配置', 'system:config:model', 'menu', '/config/model', 'page/config/ModelConfig', NULL, 1, '1', '1'),
303+
(8, '智能体管理', 'system:config:agent', 'menu', '/config/agent', 'page/config/Agent', NULL, 2, '1', '1'),
304+
(8, '语音识别配置', 'system:config:stt', 'menu', '/config/stt', 'page/config/SttConfig', NULL, 3, '1', '1'),
305+
(8, '语音合成配置', 'system:config:tts', 'menu', '/config/tts', 'page/config/TtsConfig', NULL, 4, '1', '1');
306+
307+
-- 设置子菜单
308+
INSERT INTO `xiaozhi`.`sys_permission` (`parentId`, `name`, `permissionKey`, `permissionType`, `path`, `component`, `icon`, `sort`, `visible`, `status`) VALUES
309+
(9, '个人中心', 'system:setting:account', 'menu', '/setting/account', 'page/setting/Account', NULL, 1, '1', '1'),
310+
(9, '个人设置', 'system:setting:config', 'menu', '/setting/config', 'page/setting/Config', NULL, 2, '1', '1');
311+
312+
-- 插入角色
313+
INSERT INTO `xiaozhi`.`sys_auth_role` (`roleName`, `roleKey`, `description`, `status`) VALUES
314+
('管理员', 'admin', '系统管理员,拥有所有权限', '1'),
315+
('普通用户', 'user', '普通用户,拥有基本操作权限', '1');
316+
317+
-- 管理员角色权限(所有权限)
318+
INSERT INTO `xiaozhi`.`sys_role_permission` (`roleId`, `permissionId`)
319+
SELECT 1, permissionId FROM `xiaozhi`.`sys_permission`;
320+
321+
-- 将admin用户设为管理员角色
322+
UPDATE `xiaozhi`.`sys_user` SET `roleId` = 1 WHERE `username` = 'admin';
323+
324+
-- 将其他用户设为普通用户角色
325+
UPDATE `xiaozhi`.`sys_user` SET `roleId` = 2 WHERE `username` != 'admin';

0 commit comments

Comments
 (0)