mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-27 04:49:47 +01:00
chore: 移除 Liquibase 依赖,改用手工执行 SQL 初始化脚本
- manager-api 删除 liquibase-core 依赖、@DependsOn 及 changelog-master 配置 - config_loader 拉取远端配置时对密钥字段脱敏后再打印日志 - 新增 test-page 调试页面与 mydoc 文档、全量初始化 SQL - 更新本地开发数据库/Redis 连接配置与前端 package-lock Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
9bd668aebc
commit
cde989fd47
16 changed files with 9163 additions and 840 deletions
|
|
@ -29,7 +29,6 @@
|
|||
<shiro.version>2.0.2</shiro.version>
|
||||
<captcha.version>1.6.2</captcha.version>
|
||||
<guava.version>33.6.0-jre</guava.version>
|
||||
<liquibase-core.version>4.20.0</liquibase-core.version>
|
||||
<aliyun-sms-version>4.1.0</aliyun-sms-version>
|
||||
<okio-version>3.4.0</okio-version>
|
||||
<skipTests>true</skipTests>
|
||||
|
|
@ -170,11 +169,6 @@
|
|||
<artifactId>druid-spring-boot-3-starter</artifactId>
|
||||
<version>${druid.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.liquibase</groupId>
|
||||
<artifactId>liquibase-core</artifactId>
|
||||
<version>${liquibase-core.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package xiaozhi.modules.config.init;
|
|||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.DependsOn;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import xiaozhi.common.constant.Constant;
|
||||
|
|
@ -13,7 +12,6 @@ import xiaozhi.modules.device.service.DeviceAddressBookService;
|
|||
import xiaozhi.modules.sys.service.SysParamsService;
|
||||
|
||||
@Configuration
|
||||
@DependsOn("liquibase")
|
||||
public class SystemInitConfig {
|
||||
|
||||
@Autowired
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ spring:
|
|||
druid:
|
||||
#MySQL
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://127.0.0.1:3306/xiaozhi_esp32_server?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&nullCatalogMeansCurrent=true
|
||||
url: jdbc:mysql://47.116.63.22:3306/xiaozhi_esp32_server?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
|
||||
username: root
|
||||
password: 123456
|
||||
password: aKwug4xazMemte0NUD
|
||||
initial-size: 10
|
||||
max-active: 100
|
||||
min-idle: 10
|
||||
|
|
@ -38,10 +38,10 @@ spring:
|
|||
multi-statement-allow: true
|
||||
data:
|
||||
redis:
|
||||
host: 127.0.0.1 # Redis服务器地址
|
||||
port: 6379 # Redis服务器连接端口
|
||||
password: # Redis服务器连接密码(默认为空)
|
||||
database: 0 # Redis数据库索引(默认为0)
|
||||
host: 47.116.63.22 # Redis服务器地址
|
||||
port: 6366 # Redis服务器连接端口
|
||||
password: aKwug4xazMemte0NUD # Redis服务器连接密码
|
||||
database: 2 # Redis数据库索引
|
||||
timeout: 10000ms # 连接超时时间(毫秒)
|
||||
lettuce:
|
||||
pool:
|
||||
|
|
|
|||
|
|
@ -1,755 +0,0 @@
|
|||
# 规范约定:
|
||||
# id生成根据时间时分,文件名对应id,常变数据可以根据模块命名自定义
|
||||
# 每次对数据表进行改动时,只允许新建新对changeSet,不允许对上一个changeSet配置及文件进行修改
|
||||
databaseChangeLog:
|
||||
- changeSet:
|
||||
id: 202503141335
|
||||
author: John
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202503141335.sql
|
||||
- changeSet:
|
||||
id: 202503141346
|
||||
author: czc
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202503141346.sql
|
||||
- changeSet:
|
||||
id: 202504082211
|
||||
author: John
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202504082211.sql
|
||||
- changeSet:
|
||||
id: 202504092335
|
||||
author: John
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202504092335.sql
|
||||
- changeSet:
|
||||
id: 202504112044
|
||||
author: John
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202504112044.sql
|
||||
- changeSet:
|
||||
id: 202504112058
|
||||
author: John
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202504112058.sql
|
||||
- changeSet:
|
||||
id: 202504151206
|
||||
author: John
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202504151206.sql
|
||||
- changeSet:
|
||||
id: 202504181536
|
||||
author: John
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202504181536.sql
|
||||
- changeSet:
|
||||
id: 202504221135
|
||||
author: John
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202504221135.sql
|
||||
- changeSet:
|
||||
id: 202504221555
|
||||
author: John
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202504221555.sql
|
||||
- changeSet:
|
||||
id: 202504251422
|
||||
author: jiangkunyin
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202504251422.sql
|
||||
- changeSet:
|
||||
id: 202504291043
|
||||
author: jiangkunyin
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202504291043.sql
|
||||
- changeSet:
|
||||
id: 202504301341
|
||||
author: Goody
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202504301341.sql
|
||||
- changeSet:
|
||||
id: 202505022134
|
||||
author: Goody
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202505022134.sql
|
||||
- changeSet:
|
||||
id: 202505081146
|
||||
author: hrz
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202505081146.sql
|
||||
- changeSet:
|
||||
id: 202505091555
|
||||
author: whosmyqueen
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202505091555.sql
|
||||
- changeSet:
|
||||
id: 202505111914
|
||||
author: hrz
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202505111914.sql
|
||||
- changeSet:
|
||||
id: 202505122348
|
||||
author: ljwwd2
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202505122348.sql
|
||||
- changeSet:
|
||||
id: 202505142037
|
||||
author: hrz
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202505142037.sql
|
||||
- changeSet:
|
||||
id: 202505182234
|
||||
author: amen
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202505182234.sql
|
||||
- changeSet:
|
||||
id: 202505201744
|
||||
author: hrz
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202505201744.sql
|
||||
- changeSet:
|
||||
id: 202505151451
|
||||
author: hsoftxl
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202505151451.sql
|
||||
- changeSet:
|
||||
id: 202505271414
|
||||
author: hrz
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202505271414.sql
|
||||
- changeSet:
|
||||
id: 202505292203
|
||||
author: CAIXYPROMISE
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202505292203.sql
|
||||
- changeSet:
|
||||
id: 202506010920
|
||||
author: hrz
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202506010920.sql
|
||||
- changeSet:
|
||||
id: 202506031639
|
||||
author: hrz
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202506031639.sql
|
||||
- changeSet:
|
||||
id: 202506032232
|
||||
author: hrz
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202506032232.sql
|
||||
- changeSet:
|
||||
id: 202506051538
|
||||
author: hrz
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202506051538.sql
|
||||
- changeSet:
|
||||
id: 202506080955
|
||||
author: hrz
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202506080955.sql
|
||||
- changeSet:
|
||||
id: 202506091720
|
||||
author: shane0411
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202506091720.sql
|
||||
- changeSet:
|
||||
id: 202506161101
|
||||
author: hrz
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202506161101.sql
|
||||
- changeSet:
|
||||
id: 202506191643
|
||||
author: hrz
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202506191643.sql
|
||||
- changeSet:
|
||||
id: 202506251620
|
||||
author: Tink
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202506251620.sql
|
||||
- changeSet:
|
||||
id: 202506261637
|
||||
author: hrz
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202506261637.sql
|
||||
- changeSet:
|
||||
id: 202507101203
|
||||
author: luruxian
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202507101203.sql
|
||||
- changeSet:
|
||||
id: 202507071130
|
||||
author: cgd
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202507071130.sql
|
||||
- changeSet:
|
||||
id: 202507071530
|
||||
author: cgd
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202507071530.sql
|
||||
- changeSet:
|
||||
id: 202507031602
|
||||
author: zjy
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202507031602.sql
|
||||
- changeSet:
|
||||
id: 202507041018
|
||||
author: zjy
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202507041018.sql
|
||||
- changeSet:
|
||||
id: 202507081646
|
||||
author: zjy
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202507081646.sql
|
||||
- changeSet:
|
||||
id: 202508081701
|
||||
author: hrz
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202508081701.sql
|
||||
- changeSet:
|
||||
id: 202508111734
|
||||
author: RanChen
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202508111734.sql
|
||||
- changeSet:
|
||||
id: 202508131557
|
||||
author: RanChen
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202508131557.sql
|
||||
- changeSet:
|
||||
id: 202508271113
|
||||
author: cgd
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202508271113.sql
|
||||
- changeSet:
|
||||
id: 202509051745
|
||||
author: RanChen
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202509051745.sql
|
||||
- changeSet:
|
||||
id: 202509081140
|
||||
author: cgd
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202509081140.sql
|
||||
- changeSet:
|
||||
id: 202509091042
|
||||
author: cgd
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202509091042.sql
|
||||
- changeSet:
|
||||
id: 202509091633
|
||||
author: fyb
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202509091633.sql
|
||||
- changeSet:
|
||||
id: 202509080922
|
||||
author: fyb
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202509080922.sql
|
||||
- changeSet:
|
||||
id: 202509161610
|
||||
author: fyb
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202509161610.sql
|
||||
- changeSet:
|
||||
id: 202509161701
|
||||
author: RanChen
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202509161701.sql
|
||||
- changeSet:
|
||||
id: 202509221530
|
||||
author: cgd
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202509221530.sql
|
||||
- changeSet:
|
||||
id: 202509191545
|
||||
author: RanChen
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202509191545.sql
|
||||
- changeSet:
|
||||
id: 202509220926
|
||||
author: fyb
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202509220926.sql
|
||||
|
||||
- changeSet:
|
||||
id: 202509220958
|
||||
author: fyb
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202509220958.sql
|
||||
- changeSet:
|
||||
id: 202510071522
|
||||
author: hrz
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202510071522.sql
|
||||
- changeSet:
|
||||
id: 202510191042
|
||||
author: hrz
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202510191042.sql
|
||||
- changeSet:
|
||||
id: 202510250956
|
||||
author: rainv123
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202510250956.sql
|
||||
- changeSet:
|
||||
id: 202510251150
|
||||
author: rainv123
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202510251150.sql
|
||||
- changeSet:
|
||||
id: 202511131023
|
||||
author: hrz
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202511131023.sql
|
||||
- changeSet:
|
||||
id: 202511221450
|
||||
author: RanChen
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202511221450.sql
|
||||
- changeSet:
|
||||
id: 202512031517
|
||||
author: rainv123
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202512031517.sql
|
||||
|
||||
- changeSet:
|
||||
id: 202512041515
|
||||
author: cgd
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202512041515.sql
|
||||
- changeSet:
|
||||
id: 202512131453
|
||||
author: hrz
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202512131453.sql
|
||||
- changeSet:
|
||||
id: 202512161529
|
||||
author: RanChen
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202512161529.sql
|
||||
- changeSet:
|
||||
id: 202512192245
|
||||
author: hrz
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202512192245.sql
|
||||
- changeSet:
|
||||
id: 202512221117
|
||||
author: RanChen
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202512221117.sql
|
||||
- changeSet:
|
||||
id: 202512301430
|
||||
author: RanChen
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202512301430.sql
|
||||
- changeSet:
|
||||
id: 202601051433
|
||||
author: RanChen
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202601051433.sql
|
||||
- changeSet:
|
||||
id: 202601141645
|
||||
author: RanChen
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202601141645.sql
|
||||
- changeSet:
|
||||
id: 202601231530
|
||||
author: RanChen
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202601231530.sql
|
||||
- changeSet:
|
||||
id: 202601261730
|
||||
author: RanChen
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202601261730.sql
|
||||
- changeSet:
|
||||
id: 202602021555
|
||||
author: shengzhou1216
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202602021555.sql
|
||||
- changeSet:
|
||||
id: 202602051017
|
||||
author: RanChen
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202602051017.sql
|
||||
- changeSet:
|
||||
id: 202602051125
|
||||
author: DaGou12138
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202602051125.sql
|
||||
- changeSet:
|
||||
id: 202602061650
|
||||
author: DaGou12138
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202602061650.sql
|
||||
- changeSet:
|
||||
id: 202602271137
|
||||
author: RanChen
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202602271137.sql
|
||||
- changeSet:
|
||||
id: 202602281000
|
||||
author: rainv123
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202602281000.sql
|
||||
- changeSet:
|
||||
id: 202603091051
|
||||
author: rainv123
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202603091051.sql
|
||||
- changeSet:
|
||||
id: 202603101723
|
||||
author: RanChen
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202603101723.sql
|
||||
- changeSet:
|
||||
id: 202603111131
|
||||
author: DaGou12138
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202603111131.sql
|
||||
- changeSet:
|
||||
id: 202603231037
|
||||
author: rainv123
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202603231037.sql
|
||||
- changeSet:
|
||||
id: 202603311200
|
||||
author: cgd
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202603311200.sql
|
||||
- changeSet:
|
||||
id: 202604010930
|
||||
author: rainv123
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202604010930.sql
|
||||
- changeSet:
|
||||
id: 202604011035
|
||||
author: RanChen
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202604011035.sql
|
||||
- changeSet:
|
||||
id: 202604011545
|
||||
author: rainv123
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202604011545.sql
|
||||
- changeSet:
|
||||
id: 202604161357
|
||||
author: hrz
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202604161357.sql
|
||||
- changeSet:
|
||||
id: 202604201719
|
||||
author: RanChen
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202604201719.sql
|
||||
- changeSet:
|
||||
id: 202604211515
|
||||
author: rainv123
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202604211515.sql
|
||||
- changeSet:
|
||||
id: 202604211700
|
||||
author: RanChen
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202604211700.sql
|
||||
- changeSet:
|
||||
id: 202604300930
|
||||
author: RanChen
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202604300930.sql
|
||||
- changeSet:
|
||||
id: 202605071037
|
||||
author: fyb
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202605071037.sql
|
||||
- changeSet:
|
||||
id: 202605071120
|
||||
author: fyb
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202605071120.sql
|
||||
- changeSet:
|
||||
id: 202605081008
|
||||
author: fyb
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202605081008.sql
|
||||
- changeSet:
|
||||
id: 202605121509
|
||||
author: DaGou12138
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202605121509.sql
|
||||
- changeSet:
|
||||
id: 202605251426
|
||||
author: RanChen
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202605251426.sql
|
||||
- changeSet:
|
||||
id: 202606231030
|
||||
author: RanChen
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202606231030.sql
|
||||
- changeSet:
|
||||
id: 202606261131
|
||||
author: RanChen
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202606261131.sql
|
||||
- changeSet:
|
||||
id: 202607011405
|
||||
author: LauraGPT
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202607011405.sql
|
||||
- changeSet:
|
||||
id: 202607071530
|
||||
author: tykechen
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202607071530.sql
|
||||
- changeSet:
|
||||
id: 202607101200
|
||||
author: tykechen
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202607101200.sql
|
||||
- changeSet:
|
||||
id: 202607290930
|
||||
author: cgd
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202607290930.sql
|
||||
- changeSet:
|
||||
id: 202608061000
|
||||
author: cgd
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202608061030.sql
|
||||
- changeSet:
|
||||
id: 202608061800
|
||||
author: cgd
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202608061800.sql
|
||||
- changeSet:
|
||||
id: 202608131030
|
||||
author: tykechen
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202608131030.sql
|
||||
- changeSet:
|
||||
id: 202609021000
|
||||
author: JacobNg1
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202609021000.sql
|
||||
- changeSet:
|
||||
id: 202609172100
|
||||
author: googio
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202609172100.sql
|
||||
|
|
@ -1623,35 +1623,6 @@ class AgentSnapshotServiceImplTest {
|
|||
assertFalse(updateSql.contains("created_at ="));
|
||||
}
|
||||
|
||||
@Test
|
||||
void snapshotMigrationIsMergedIntoSingleChangeLog() throws Exception {
|
||||
String sql = Files.readString(Path.of("src/main/resources/db/changelog/202607071530.sql"));
|
||||
String master = Files.readString(Path.of("src/main/resources/db/changelog/db.changelog-master.yaml"));
|
||||
|
||||
assertTrue(sql.contains("restore_from_snapshot_id"));
|
||||
assertTrue(sql.contains("restore_from_version_no"));
|
||||
assertTrue(sql.contains("idx_snapshot_user_created_at"));
|
||||
assertTrue(sql.contains("DEFAULT (JSON_OBJECT())"));
|
||||
assertTrue(master.contains("202607071530.sql"));
|
||||
assertFalse(master.contains("202607081150.sql"));
|
||||
assertFalse(master.contains("202607081230.sql"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void legacySnapshotRedactionHasItsOwnResumableSchemaVersionChangeLog() throws Exception {
|
||||
String sql = Files.readString(Path.of("src/main/resources/db/changelog/202607101200.sql"));
|
||||
String master = Files.readString(Path.of("src/main/resources/db/changelog/db.changelog-master.yaml"));
|
||||
String mapper = Files.readString(Path.of("src/main/resources/mapper/agent/AgentSnapshotDao.xml"));
|
||||
|
||||
assertTrue(sql.contains("redaction_version"));
|
||||
assertTrue(sql.contains("idx_snapshot_redaction_version_id"));
|
||||
assertTrue(sql.contains("-- rollback"));
|
||||
assertTrue(master.contains("202607101200.sql"));
|
||||
assertTrue(mapper.contains("selectLegacyRedactionBatch"));
|
||||
assertTrue(mapper.contains("redaction_version < #{targetRedactionVersion}"));
|
||||
assertTrue(mapper.contains("<update id=\"updateRedactedSnapshots\">"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void selectNextSnapshotLoadsRestoreTraceColumnsWithoutPreviousVersionQuery() throws Exception {
|
||||
String xml = normalizeWhitespace(Files.readString(Path.of("src/main/resources/mapper/agent/AgentSnapshotDao.xml")));
|
||||
|
|
|
|||
42
main/manager-web/package-lock.json
generated
42
main/manager-web/package-lock.json
generated
|
|
@ -2276,9 +2276,6 @@
|
|||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"glibc"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -2901,9 +2898,6 @@
|
|||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"glibc"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -2918,9 +2912,6 @@
|
|||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"musl"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -2935,9 +2926,6 @@
|
|||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"glibc"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -2952,9 +2940,6 @@
|
|||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"musl"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -2969,9 +2954,6 @@
|
|||
"loong64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"glibc"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -2986,9 +2968,6 @@
|
|||
"loong64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"musl"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -3003,9 +2982,6 @@
|
|||
"ppc64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"glibc"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -3020,9 +2996,6 @@
|
|||
"ppc64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"musl"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -3037,9 +3010,6 @@
|
|||
"riscv64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"glibc"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -3054,9 +3024,6 @@
|
|||
"riscv64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"musl"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -3071,9 +3038,6 @@
|
|||
"s390x"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"glibc"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -3088,9 +3052,6 @@
|
|||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"glibc"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -3105,9 +3066,6 @@
|
|||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"musl"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
|
|||
484
main/test-page/css/style.css
Normal file
484
main/test-page/css/style.css
Normal file
|
|
@ -0,0 +1,484 @@
|
|||
:root {
|
||||
--bg: #eef2f7;
|
||||
--bg-deep: #dfe7f1;
|
||||
--card: #ffffff;
|
||||
--border: #dbe3ed;
|
||||
--text: #1f2937;
|
||||
--text-soft: #64748b;
|
||||
--primary: #2563eb;
|
||||
--primary-dark: #1d4ed8;
|
||||
--primary-soft: #e8efff;
|
||||
--danger: #ef4444;
|
||||
--assistant: #ffffff;
|
||||
--shadow: 0 8px 24px rgba(31, 41, 55, 0.08);
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html, body {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
|
||||
color: var(--text);
|
||||
background: radial-gradient(circle at 12% 0%, #ffffff 0%, var(--bg) 42%, var(--bg-deep) 100%);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.app {
|
||||
width: 100%;
|
||||
max-width: 980px;
|
||||
height: calc(100vh - 40px);
|
||||
min-height: 560px;
|
||||
background: rgba(255, 255, 255, 0.72);
|
||||
border: 1px solid rgba(255, 255, 255, 0.9);
|
||||
border-radius: 22px;
|
||||
box-shadow: var(--shadow);
|
||||
backdrop-filter: blur(10px);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
padding: 16px 22px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
background: rgba(255, 255, 255, 0.86);
|
||||
}
|
||||
|
||||
.brand {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.brand-mark {
|
||||
width: 42px;
|
||||
height: 42px;
|
||||
flex: 0 0 42px;
|
||||
border-radius: 13px;
|
||||
background: linear-gradient(135deg, #3b82f6, #1d4ed8);
|
||||
color: #fff;
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: 0 6px 14px rgba(37, 99, 235, 0.28);
|
||||
}
|
||||
|
||||
.brand-text h1 {
|
||||
margin: 0;
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.2px;
|
||||
}
|
||||
|
||||
.brand-text p {
|
||||
margin: 3px 0 0;
|
||||
font-size: 12px;
|
||||
color: var(--text-soft);
|
||||
}
|
||||
|
||||
.status {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 7px;
|
||||
padding: 6px 12px;
|
||||
border-radius: 999px;
|
||||
background: #f1f5f9;
|
||||
font-size: 12px;
|
||||
color: var(--text-soft);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.status-dot {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
background: #94a3b8;
|
||||
transition: background 0.2s ease;
|
||||
}
|
||||
|
||||
.status-dot.on {
|
||||
background: #22c55e;
|
||||
box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.16);
|
||||
}
|
||||
|
||||
.status-dot.error {
|
||||
background: var(--danger);
|
||||
box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.14);
|
||||
}
|
||||
|
||||
.panel {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
gap: 10px;
|
||||
padding: 12px 22px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
background: rgba(255, 255, 255, 0.6);
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
min-width: 140px;
|
||||
}
|
||||
|
||||
.field.grow {
|
||||
flex: 1 1 280px;
|
||||
}
|
||||
|
||||
.field label {
|
||||
font-size: 11px;
|
||||
color: var(--text-soft);
|
||||
padding-left: 2px;
|
||||
}
|
||||
|
||||
input[type="text"] {
|
||||
height: 36px;
|
||||
padding: 0 11px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 10px;
|
||||
background: #fff;
|
||||
font-size: 13px;
|
||||
color: var(--text);
|
||||
outline: none;
|
||||
transition: border-color 0.15s ease, box-shadow 0.15s ease;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
input[type="text"]:focus {
|
||||
border-color: #93b4f5;
|
||||
box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
|
||||
}
|
||||
|
||||
input[type="text"]:disabled {
|
||||
background: #f8fafc;
|
||||
color: #94a3b8;
|
||||
}
|
||||
|
||||
.actions {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.btn {
|
||||
height: 36px;
|
||||
padding: 0 18px;
|
||||
border-radius: 10px;
|
||||
border: 1px solid transparent;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: background 0.15s ease, transform 0.05s ease, opacity 0.15s ease;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.btn:active:not(:disabled) {
|
||||
transform: translateY(1px);
|
||||
}
|
||||
|
||||
.btn:disabled {
|
||||
opacity: 0.45;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.btn.primary {
|
||||
background: var(--primary);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.btn.primary:hover:not(:disabled) {
|
||||
background: var(--primary-dark);
|
||||
}
|
||||
|
||||
.btn.ghost {
|
||||
background: #fff;
|
||||
color: var(--text-soft);
|
||||
border-color: var(--border);
|
||||
}
|
||||
|
||||
.btn.ghost:hover:not(:disabled) {
|
||||
background: #f8fafc;
|
||||
}
|
||||
|
||||
.chat {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 20px 22px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
|
||||
.system-msg {
|
||||
align-self: center;
|
||||
max-width: 86%;
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
color: var(--text-soft);
|
||||
background: rgba(255, 255, 255, 0.72);
|
||||
border: 1px dashed var(--border);
|
||||
border-radius: 10px;
|
||||
padding: 8px 14px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.msg {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
max-width: 78%;
|
||||
gap: 4px;
|
||||
animation: rise 0.18s ease-out;
|
||||
}
|
||||
|
||||
@keyframes rise {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(6px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
.msg.user {
|
||||
align-self: flex-end;
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
.msg.assistant {
|
||||
align-self: flex-start;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.msg .meta {
|
||||
font-size: 11px;
|
||||
color: var(--text-soft);
|
||||
padding: 0 4px;
|
||||
}
|
||||
|
||||
.msg .bubble {
|
||||
padding: 10px 14px;
|
||||
border-radius: 14px;
|
||||
font-size: 14px;
|
||||
line-height: 1.65;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.msg.user .bubble {
|
||||
background: linear-gradient(135deg, #3b82f6, #2563eb);
|
||||
color: #fff;
|
||||
border-bottom-right-radius: 4px;
|
||||
}
|
||||
|
||||
.msg.assistant .bubble {
|
||||
background: var(--assistant);
|
||||
border: 1px solid var(--border);
|
||||
color: var(--text);
|
||||
border-bottom-left-radius: 4px;
|
||||
box-shadow: 0 2px 8px rgba(31, 41, 55, 0.04);
|
||||
}
|
||||
|
||||
.msg .bubble.pending {
|
||||
color: var(--text-soft);
|
||||
}
|
||||
|
||||
.typing {
|
||||
display: inline-flex;
|
||||
gap: 4px;
|
||||
align-items: center;
|
||||
height: 18px;
|
||||
}
|
||||
|
||||
.typing i {
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
background: #94a3b8;
|
||||
animation: blink 1.1s infinite ease-in-out;
|
||||
}
|
||||
|
||||
.typing i:nth-child(2) {
|
||||
animation-delay: 0.16s;
|
||||
}
|
||||
|
||||
.typing i:nth-child(3) {
|
||||
animation-delay: 0.32s;
|
||||
}
|
||||
|
||||
@keyframes blink {
|
||||
0%, 80%, 100% {
|
||||
opacity: 0.25;
|
||||
transform: translateY(0);
|
||||
}
|
||||
40% {
|
||||
opacity: 1;
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
}
|
||||
|
||||
.composer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 14px 22px;
|
||||
border-top: 1px solid var(--border);
|
||||
background: rgba(255, 255, 255, 0.86);
|
||||
}
|
||||
|
||||
.composer input[type="text"] {
|
||||
flex: 1;
|
||||
height: 42px;
|
||||
}
|
||||
|
||||
.mic-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 7px;
|
||||
height: 42px;
|
||||
padding: 0 16px;
|
||||
border-radius: 999px;
|
||||
border: 1px solid var(--border);
|
||||
background: #fff;
|
||||
color: var(--primary);
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.mic-btn:hover:not(:disabled) {
|
||||
background: var(--primary-soft);
|
||||
}
|
||||
|
||||
.mic-btn:disabled {
|
||||
opacity: 0.45;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.mic-btn.recording {
|
||||
background: var(--danger);
|
||||
border-color: var(--danger);
|
||||
color: #fff;
|
||||
animation: pulse 1.4s infinite;
|
||||
}
|
||||
|
||||
@keyframes pulse {
|
||||
0% {
|
||||
box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.34);
|
||||
}
|
||||
70% {
|
||||
box-shadow: 0 0 0 12px rgba(239, 68, 68, 0);
|
||||
}
|
||||
100% {
|
||||
box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
|
||||
}
|
||||
}
|
||||
|
||||
.composer .btn.primary {
|
||||
height: 42px;
|
||||
}
|
||||
|
||||
.debug {
|
||||
border-top: 1px solid var(--border);
|
||||
background: rgba(248, 250, 252, 0.9);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.debug summary {
|
||||
cursor: pointer;
|
||||
padding: 9px 22px;
|
||||
color: var(--text-soft);
|
||||
user-select: none;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.debug summary span {
|
||||
display: inline-block;
|
||||
min-width: 18px;
|
||||
padding: 0 5px;
|
||||
border-radius: 999px;
|
||||
background: #e2e8f0;
|
||||
color: #475569;
|
||||
text-align: center;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.log {
|
||||
margin: 0;
|
||||
max-height: 140px;
|
||||
overflow: auto;
|
||||
padding: 0 22px 12px;
|
||||
color: #475569;
|
||||
font-family: Consolas, "Courier New", monospace;
|
||||
font-size: 11px;
|
||||
line-height: 1.6;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
body {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.app {
|
||||
height: 100vh;
|
||||
min-height: 0;
|
||||
border-radius: 0;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.panel {
|
||||
padding: 10px 14px;
|
||||
}
|
||||
|
||||
.field {
|
||||
flex: 1 1 45%;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.field.grow {
|
||||
flex-basis: 100%;
|
||||
}
|
||||
|
||||
.header, .composer {
|
||||
padding-left: 14px;
|
||||
padding-right: 14px;
|
||||
}
|
||||
|
||||
.chat {
|
||||
padding: 14px;
|
||||
}
|
||||
|
||||
.msg {
|
||||
max-width: 88%;
|
||||
}
|
||||
|
||||
.mic-btn span {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.mic-btn {
|
||||
padding: 0 12px;
|
||||
}
|
||||
}
|
||||
72
main/test-page/index.html
Normal file
72
main/test-page/index.html
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>小智语音测试页 - test_page</title>
|
||||
<link rel="stylesheet" href="css/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="app">
|
||||
<header class="header">
|
||||
<div class="brand">
|
||||
<div class="brand-mark">智</div>
|
||||
<div class="brand-text">
|
||||
<h1>小智语音测试页</h1>
|
||||
<p>WebSocket 协议联调 · 支持文字与语音对话</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="status">
|
||||
<span id="statusDot" class="status-dot"></span>
|
||||
<span id="statusText">未连接</span>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<section class="panel">
|
||||
<div class="field grow">
|
||||
<label for="otaUrl">OTA 地址</label>
|
||||
<input id="otaUrl" type="text" spellcheck="false" placeholder="http://127.0.0.1:8002/xiaozhi/ota/">
|
||||
</div>
|
||||
<div class="field grow">
|
||||
<label for="wsUrl">WebSocket 地址</label>
|
||||
<input id="wsUrl" type="text" spellcheck="false" placeholder="ws://127.0.0.1:8000/xiaozhi/v1/">
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="deviceId">设备 ID(虚拟 MAC)</label>
|
||||
<input id="deviceId" type="text" spellcheck="false" placeholder="正在生成虚拟 MAC...">
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="token">Token</label>
|
||||
<input id="token" type="text" spellcheck="false" placeholder="留空时自动通过 OTA 获取">
|
||||
</div>
|
||||
<div class="actions">
|
||||
<button id="connectBtn" class="btn primary">连接</button>
|
||||
<button id="disconnectBtn" class="btn ghost" disabled>断开</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<main id="chat" class="chat" aria-live="polite">
|
||||
<div class="system-msg">直接双击打开 index.html 即可使用。点击“连接”时会先请求 OTA 获取 WebSocket 地址与 Token,再建立连接;语音需要浏览器允许麦克风权限,若浏览器限制本地文件访问麦克风,请改用 http://127.0.0.1 或 https 访问。</div>
|
||||
</main>
|
||||
|
||||
<footer class="composer">
|
||||
<button id="micBtn" class="mic-btn" type="button" disabled>
|
||||
<svg viewBox="0 0 24 24" width="20" height="20" aria-hidden="true">
|
||||
<path fill="currentColor" d="M12 14a3 3 0 0 0 3-3V6a3 3 0 1 0-6 0v5a3 3 0 0 0 3 3zm5-3a5 5 0 0 1-10 0H5a7 7 0 0 0 6 6.92V21h-2v2h6v-2h-2v-3.08A7 7 0 0 0 19 11h-2z"/>
|
||||
</svg>
|
||||
<span id="micLabel">开始说话</span>
|
||||
</button>
|
||||
<input id="textInput" type="text" placeholder="输入文字后按 Enter 发送" autocomplete="off" disabled>
|
||||
<button id="sendBtn" class="btn primary" disabled>发送</button>
|
||||
</footer>
|
||||
|
||||
<details class="debug">
|
||||
<summary>协议日志 <span id="logCount">0</span></summary>
|
||||
<pre id="log" class="log"></pre>
|
||||
</details>
|
||||
</div>
|
||||
|
||||
<script src="js/libopus.js"></script>
|
||||
<script src="js/app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
1169
main/test-page/js/app.js
Normal file
1169
main/test-page/js/app.js
Normal file
File diff suppressed because it is too large
Load diff
266
main/test-page/js/libopus.js
Normal file
266
main/test-page/js/libopus.js
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -1,7 +1,9 @@
|
|||
import os
|
||||
import asyncio
|
||||
import json
|
||||
import yaml
|
||||
from collections.abc import Mapping
|
||||
from loguru import logger
|
||||
from config.manage_api_client import (
|
||||
init_service,
|
||||
get_server_config,
|
||||
|
|
@ -11,6 +13,31 @@ from config.manage_api_client import (
|
|||
DeviceBindException,
|
||||
)
|
||||
|
||||
TAG = __name__
|
||||
|
||||
_SENSITIVE_KEYWORDS = (
|
||||
"secret",
|
||||
"api_key",
|
||||
"apikey",
|
||||
"password",
|
||||
"token",
|
||||
"private_key",
|
||||
)
|
||||
|
||||
|
||||
def _mask_sensitive(data):
|
||||
"""打印配置前脱敏,避免把密钥写进日志"""
|
||||
if isinstance(data, dict):
|
||||
return {
|
||||
key: "***"
|
||||
if any(word in str(key).lower() for word in _SENSITIVE_KEYWORDS)
|
||||
else _mask_sensitive(value)
|
||||
for key, value in data.items()
|
||||
}
|
||||
if isinstance(data, list):
|
||||
return [_mask_sensitive(item) for item in data]
|
||||
return data
|
||||
|
||||
|
||||
def get_project_dir():
|
||||
"""获取项目根目录"""
|
||||
|
|
@ -62,6 +89,11 @@ async def get_config_from_api_async(config):
|
|||
if config_data is None:
|
||||
raise Exception("Failed to fetch server config from API")
|
||||
|
||||
logger.bind(tag=TAG).info(
|
||||
"成功从manager-api获取配置: {}",
|
||||
json.dumps(_mask_sensitive(config_data), ensure_ascii=False, indent=2),
|
||||
)
|
||||
|
||||
config_data["read_config_from_api"] = True
|
||||
config_data["manager-api"] = {
|
||||
"url": config["manager-api"].get("url", ""),
|
||||
|
|
|
|||
253
mydoc/python端安装启动说明.md
Normal file
253
mydoc/python端安装启动说明.md
Normal file
|
|
@ -0,0 +1,253 @@
|
|||
# Python 端安装启动说明
|
||||
|
||||
> 适用目录:`main/xiaozhi-server`
|
||||
> 安装方式:项目内 Python 虚拟环境(`.venv`),不使用 conda
|
||||
> 验证环境:Windows + Python 3.11.3 + ffmpeg 9.0.2 + libopus 1.3.1
|
||||
|
||||
## 0. 环境与端口
|
||||
|
||||
| 项目 | 值 |
|
||||
| --- | --- |
|
||||
| Python | 3.11.3(`py -3.11` 启动器;项目推荐 3.10,3.11 实测可用) |
|
||||
| 虚拟环境 | `main/xiaozhi-server/.venv` |
|
||||
| ffmpeg | 9.0.2(Gyan 构建) |
|
||||
| libopus | 1.3.1(`opus.dll`) |
|
||||
| WebSocket | 8000 |
|
||||
| HTTP(OTA / 视觉分析) | 8003 |
|
||||
| 关键依赖 | torch 2.2.2、torchaudio 2.2.2、funasr 1.4.16、numpy 1.26.4、websockets 14.2 |
|
||||
|
||||
## 1. 创建虚拟环境
|
||||
|
||||
```powershell
|
||||
cd main\xiaozhi-server
|
||||
py -3.11 -m venv .venv
|
||||
.\.venv\Scripts\Activate.ps1
|
||||
```
|
||||
|
||||
若提示“禁止运行脚本”,先在当前窗口放行:
|
||||
|
||||
```powershell
|
||||
Set-ExecutionPolicy -Scope Process Bypass
|
||||
```
|
||||
|
||||
升级打包工具(可选,建议做):
|
||||
|
||||
```powershell
|
||||
python -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple/
|
||||
```
|
||||
|
||||
## 2. 安装 ffmpeg
|
||||
|
||||
```powershell
|
||||
winget install --id Gyan.FFmpeg --accept-source-agreements --accept-package-agreements
|
||||
```
|
||||
|
||||
安装后把 `ffmpeg.exe`、`ffprobe.exe` 复制到虚拟环境的 `Scripts` 目录,避免 IDE 或子进程拿到的 PATH 里没有 ffmpeg:
|
||||
|
||||
```powershell
|
||||
$bin = Get-ChildItem "$env:LOCALAPPDATA\Microsoft\WinGet\Packages\Gyan.FFmpeg_*\ffmpeg-*\bin" -Recurse -Filter ffmpeg.exe | Select-Object -First 1
|
||||
Copy-Item $bin.FullName .venv\Scripts\
|
||||
Copy-Item (Join-Path $bin.DirectoryName 'ffprobe.exe') .venv\Scripts\
|
||||
.\.venv\Scripts\ffmpeg.exe -version
|
||||
```
|
||||
|
||||
> winget 安装 ffmpeg 时已自动把它加入系统 PATH,正常启动可直接找到。若只想使用复制到 `.venv\Scripts` 的这份,需要把该目录加入 PATH(见 4.1 节);否则启动检查 `check_ffmpeg_installed()` 会报 ffmpeg 无法运行,pydub 也会打印 `Couldn't find ffmpeg or avconv` 警告。
|
||||
|
||||
## 3. 安装 Python 依赖
|
||||
|
||||
```powershell
|
||||
pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/ --timeout 180
|
||||
```
|
||||
|
||||
- torch 2.2.2 体积较大,首次安装耗时较长属正常现象;超时可重复执行(pip 有缓存)。
|
||||
- 本项目固定 `transformers<5`,不要手动升级到 transformers 5.x(会导致 torch 2.2.2 不可用,本地 ASR 无法加载)。
|
||||
|
||||
## 4. 安装 libopus(Windows 必需)
|
||||
|
||||
venv 里无法用 conda 安装 libopus,而 `opuslib_next` 在 Windows 上会查找 PATH 中的 `opus.dll`。这里从 conda-forge 提取官方编译好的 DLL:
|
||||
|
||||
```powershell
|
||||
$d = "$env:TEMP\opus_dl"
|
||||
New-Item -ItemType Directory -Path $d -Force | Out-Null
|
||||
Invoke-WebRequest -UseBasicParsing `
|
||||
'https://conda.anaconda.org/conda-forge/win-64/libopus-1.3.1-h8ffe710_1.tar.bz2' `
|
||||
-OutFile "$d\libopus.tar.bz2"
|
||||
|
||||
# Windows 自带 tar 不支持 bz2,用 Python 解压
|
||||
.\.venv\Scripts\python.exe -c "import tarfile,os;d=os.path.join(os.environ['TEMP'],'opus_dl');tarfile.open(os.path.join(d,'libopus.tar.bz2')).extractall(d)"
|
||||
|
||||
Copy-Item "$d\Library\bin\opus.dll" .venv\Scripts\
|
||||
```
|
||||
|
||||
验证:
|
||||
|
||||
```powershell
|
||||
python -c "from opuslib_next import Encoder; Encoder(24000,1,2049); print('opus ok')"
|
||||
```
|
||||
|
||||
> `opuslib_next` 在 Windows 下只用 `ctypes.util.find_library("opus")` 按 **PATH** 查找 `opus.dll`,不会查 `python.exe` 所在目录。因此必须把 `.venv\Scripts` 加入 PATH,否则会报 `Exception: Could not find Opus library`。
|
||||
|
||||
**4.1 把 `.venv\Scripts` 加入 PATH(Windows)**
|
||||
|
||||
方式一:图形界面(推荐,永久生效)
|
||||
|
||||
1. `Win+R` → 输入 `sysdm.cpl` → 「高级」→「环境变量」
|
||||
2. 在「用户变量」中选中 `Path` → 「编辑」→「新建」,填入:
|
||||
`D:\工作空间\code\xiaozhi\xiaozhi-esp32-server\main\xiaozhi-server\.venv\Scripts`
|
||||
3. 逐级「确定」;已打开的终端、IDEA 需要重启才会读到新 PATH
|
||||
|
||||
方式二:PowerShell 永久写入用户 Path
|
||||
|
||||
```powershell
|
||||
$dir = 'D:\工作空间\code\xiaozhi\xiaozhi-esp32-server\main\xiaozhi-server\.venv\Scripts'
|
||||
$old = [Environment]::GetEnvironmentVariable('Path','User')
|
||||
[Environment]::SetEnvironmentVariable('Path', "$old;$dir", 'User')
|
||||
```
|
||||
|
||||
系统级(所有用户)需管理员权限,把 `'User'` 换成 `'Machine'`。
|
||||
|
||||
方式三:只在当前窗口临时生效
|
||||
|
||||
```powershell
|
||||
$env:PATH = 'D:\工作空间\code\xiaozhi\xiaozhi-esp32-server\main\xiaozhi-server\.venv\Scripts;' + $env:PATH
|
||||
```
|
||||
|
||||
验证(需在新开的终端中执行):
|
||||
|
||||
```powershell
|
||||
where.exe opus.dll
|
||||
python -c "import ctypes.util; print(ctypes.util.find_library('opus'))"
|
||||
```
|
||||
|
||||
第二条输出 `...\.venv\Scripts\opus.dll` 即配置成功;同时 `where.exe ffmpeg` 也能输出路径,说明 ffmpeg 同样可用。
|
||||
|
||||
**IDEA / PyCharm 运行配置**
|
||||
|
||||
1. `Run` → `Edit Configurations...`
|
||||
2. 选中运行 `app.py` 的 Python 配置
|
||||
3. 找到 `Environment variables`,点击右侧输入框,填:
|
||||
|
||||
```
|
||||
PATH=D:\工作空间\code\xiaozhi\xiaozhi-esp32-server\main\xiaozhi-server\.venv\Scripts;$PATH$
|
||||
```
|
||||
|
||||
`$PATH$` 会展开为当前的系统 PATH(JetBrains 的宏语法,保留原有 PATH,避免 ffmpeg 等命令丢失)。
|
||||
4. `Apply` → `OK`,再运行。
|
||||
|
||||
如果该版本不支持 `$PATH$`,可改为在 IDEA 底部的 Terminal 里先执行 `.\.venv\Scripts\Activate.ps1`,再用 `python app.py` 启动。
|
||||
|
||||
## 5. 配置 data/.config.yaml
|
||||
|
||||
`config/config_loader.py` 会直接读取 `data/.config.yaml`,文件不存在会报 `FileNotFoundError`;文件存在但完全为空(YAML 解析为 `None`)会报 `AttributeError: 'NoneType' object has no attribute 'get'`。因此至少要写入 `{}`。
|
||||
|
||||
```powershell
|
||||
New-Item -ItemType Directory -Path data -Force | Out-Null
|
||||
Set-Content data\.config.yaml "{}" -Encoding utf8
|
||||
```
|
||||
|
||||
两种配置模式:
|
||||
|
||||
**A. 本地配置模式(当前使用,不依赖 Java 端)**
|
||||
|
||||
保持 `data/.config.yaml` 为 `{}`,直接使用 `config.yaml`:
|
||||
|
||||
- 模型选择在 `selected_module`(默认:`FunASR` / `ChatGLMLLM` / `EdgeTTS` / `SileroVAD` / `nomem` / `function_call`)
|
||||
- LLM 密钥需在 `config.yaml` 的 `LLM` 段填写真实 `api_key`
|
||||
|
||||
**B. 智控台配置模式(需先启动 manager-api + manager-web)**
|
||||
|
||||
```yaml
|
||||
manager-api:
|
||||
url: http://127.0.0.1:8002/xiaozhi
|
||||
secret: 智控台「参数管理」里 server.secret 的值
|
||||
```
|
||||
|
||||
写入后启动时会从 Java 端拉取模型配置,`config.yaml` 中的模型配置不再生效。
|
||||
|
||||
- 判断是否走了 manager-api:启动时会打印 `成功从manager-api获取配置` 及脱敏后的完整配置(`secret`、`api_key`、`private_key` 等显示为 `***`);同时调用 `POST /config/server-base`。日志里**不再打印**“OTA接口是 http://…:8003/…”,但 WebSocket 地址仍会打印(OTA 由 manager-api 的 8002 提供)。
|
||||
- `secret` 不能保留占位符(含“你”会直接报错);每次从零部署 `server.secret` 都会变化。
|
||||
- manager-api 必须先启动,否则 Python 端会重试 6 次(间隔 10s)后报 `Failed to fetch server config from API`。
|
||||
- 监听端口等仍以本地为准:如需固定,可参照 `config_from_api.yaml` 一并写上 `server` 段的 `ip` / `port` / `http_port` / `vision_explain`。
|
||||
- 本地模式下 `config.yaml` 里的 LLM/ASR/TTS 选择与密钥在 API 模式下失效,必须在智控台「模型配置」里配好,否则设备连接后会报错。
|
||||
|
||||
## 6. 下载本地 ASR 模型(FunASR / SenseVoiceSmall)
|
||||
|
||||
本地模式下 ASR 使用 `models/SenseVoiceSmall`。缺少 `model.pt` 时服务仍能启动,但识别结果是乱码,必须补齐:
|
||||
|
||||
```powershell
|
||||
.\.venv\Scripts\modelscope.exe download --model iic/SenseVoiceSmall model.pt --local_dir models/SenseVoiceSmall
|
||||
```
|
||||
|
||||
约 936 MB。下载完成后目录应包含 `model.pt`、`config.yaml`、`configuration.json` 等文件。
|
||||
|
||||
可选验证:
|
||||
|
||||
```powershell
|
||||
python -c "from funasr import AutoModel; m=AutoModel(model='models/SenseVoiceSmall',disable_update=True,hub='hf'); print(m.generate(input='models/SenseVoiceSmall/example/zh.mp3')[0]['text'])"
|
||||
```
|
||||
|
||||
## 7. 启动
|
||||
|
||||
```powershell
|
||||
cd main\xiaozhi-server
|
||||
.\.venv\Scripts\Activate.ps1
|
||||
python app.py
|
||||
```
|
||||
|
||||
启动成功的日志(地址随本机局域网 IP 变化):
|
||||
|
||||
```
|
||||
OTA接口是 http://192.168.x.x:8003/xiaozhi/ota/
|
||||
视觉分析接口是 http://192.168.x.x:8003/mcp/vision/explain
|
||||
Websocket地址是 ws://192.168.x.x:8000/xiaozhi/v1/
|
||||
server listening on 0.0.0.0:8000
|
||||
```
|
||||
|
||||
验证:
|
||||
|
||||
```powershell
|
||||
netstat -ano | findstr ":8000"
|
||||
(Invoke-WebRequest -UseBasicParsing http://127.0.0.1:8003/xiaozhi/ota/).StatusCode # 期望 200
|
||||
```
|
||||
|
||||
停止:在运行窗口按 `Ctrl+C`。
|
||||
|
||||
> WebSocket 地址不能用浏览器直接打开;浏览器端对话测试请启动 `main/digital-human`(<http://127.0.0.1:8006/index.html>)。
|
||||
|
||||
## 8. 语音对话前提
|
||||
|
||||
| 能力 | 状态 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| ASR(本地 FunASR) | 需模型 | 按第 6 节下载 `model.pt`,否则识别乱码 |
|
||||
| LLM | **需配置密钥** | `config.yaml` 默认是占位符(如 `你的chat-glm web key`),日志会报 `LLM 的 API key 未设置`,服务能启动但不会回复 |
|
||||
| TTS(EdgeTTS) | 开箱可用 | 无需密钥 |
|
||||
| VAD(Silero) | 开箱可用 | 模型已在仓库内 |
|
||||
| 设备接入地址 | 按需配置 | 智控台模式下要在「参数管理」填 `server.websocket`、`server.ota`,用局域网 IP,不能填 `127.0.0.1` |
|
||||
|
||||
## 9. 本次安装遇到的问题与处理
|
||||
|
||||
| 问题 | 现象 | 处理 |
|
||||
| --- | --- | --- |
|
||||
| `data/.config.yaml` 为空文件 | `AttributeError: 'NoneType' object has no attribute 'get'` | 写入 `{}`,不要留纯空文件 |
|
||||
| 未安装 ffmpeg | `ffmpeg 无法正常运行` / pydub 警告 | `winget install Gyan.FFmpeg`,并把 exe 复制到 `.venv\Scripts` |
|
||||
| 缺少 libopus | `Could not find Opus library` | 从 conda-forge 取 `libopus-1.3.1`,`opus.dll` 放入 `.venv\Scripts`,并把该目录加入 PATH(见 4.1 节) |
|
||||
| `where opus.dll` 能找到,但运行仍报 `Could not find Opus library` | 当前进程的 PATH 是改 PATH 之前继承的旧值(终端/IDE 未重启) | 关闭并重启终端与 IDE;在报错的那个进程里打印 `os.environ['PATH']` 确认是否包含 `.venv\Scripts` |
|
||||
| 缺少 ASR 权重 | SenseVoice 推理输出乱码 | 用 modelscope 下载 `model.pt` 到 `models/SenseVoiceSmall` |
|
||||
| LLM 密钥为占位符 | 启动日志 ERROR:`LLM 的 API key 未设置` | 在 `config.yaml` 填真实密钥,或改用智控台配置模式 |
|
||||
| 端口被占用 | 启动报地址占用 | `netstat -ano \| findstr :8000` 后结束对应进程 |
|
||||
|
||||
## 10. 常用命令速查
|
||||
|
||||
```powershell
|
||||
# 进入环境
|
||||
cd main\xiaozhi-server; .\.venv\Scripts\Activate.ps1
|
||||
|
||||
# 启动 / 停止
|
||||
python app.py # Ctrl+C 停止
|
||||
|
||||
# 检查端口
|
||||
netstat -ano | findstr ":8000"
|
||||
|
||||
# 重新安装依赖
|
||||
pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/ --timeout 180
|
||||
```
|
||||
4154
mydoc/xiaozhi_esp32_server_init.sql
Normal file
4154
mydoc/xiaozhi_esp32_server_init.sql
Normal file
File diff suppressed because it is too large
Load diff
2338
mydoc/小智语音对接说明.md
Normal file
2338
mydoc/小智语音对接说明.md
Normal file
File diff suppressed because it is too large
Load diff
160
mydoc/本地启动指南.md
Normal file
160
mydoc/本地启动指南.md
Normal file
|
|
@ -0,0 +1,160 @@
|
|||
# 本地启动指南
|
||||
|
||||
> xiaozhi-esp32-server(dev 分支)
|
||||
|
||||
## 启动顺序
|
||||
|
||||
```
|
||||
MySQL / Redis → manager-api → manager-web(注册管理员、取 server.secret)
|
||||
→ xiaozhi-server(需 server.secret)
|
||||
```
|
||||
|
||||
| 项目 | 目录 | 端口 |
|
||||
| --- | --- | --- |
|
||||
| Java 端 | `main/manager-api` | 8002 |
|
||||
| 前端 | `main/manager-web` | 8001 |
|
||||
| Python 端 | `main/xiaozhi-server` | 8000 / 8003 |
|
||||
| 数字人(可选) | `main/digital-human` | 8006 |
|
||||
| 移动端(可选) | `main/manager-mobile` | 9000 |
|
||||
|
||||
## 环境
|
||||
|
||||
- Python 端:Python 3.10、ffmpeg(PATH)、libopus
|
||||
- Java 端:JDK 21、Maven 3.9+
|
||||
- 前端:Node.js 18+
|
||||
- 移动端:Node.js 18+、pnpm 10
|
||||
|
||||
## 1. Java 端:manager-api
|
||||
|
||||
### 1.1 准备数据库
|
||||
|
||||
```sql
|
||||
CREATE DATABASE xiaozhi_esp32_server CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
```
|
||||
|
||||
建表脚本已合并为一个文件:`mydoc/xiaozhi_esp32_server_init.sql`,在空库执行:
|
||||
|
||||
```powershell
|
||||
mysql -uroot -p123456 xiaozhi_esp32_server -e "source mydoc/xiaozhi_esp32_server_init.sql"
|
||||
```
|
||||
|
||||
### 1.2 配置与启动
|
||||
|
||||
1. 在 [application-dev.yml](../main/manager-api/src/main/resources/application-dev.yml) 配置 MySQL / Redis(当前指向远程库)
|
||||
2. 启动:
|
||||
|
||||
```powershell
|
||||
cd main\manager-api
|
||||
mvn spring-boot:run
|
||||
```
|
||||
|
||||
3. 验证:日志出现 `Started AdminApplication`,且 <http://127.0.0.1:8002/xiaozhi/doc.html> 可访问
|
||||
|
||||
## 2. 前端:manager-web
|
||||
|
||||
```powershell
|
||||
cd main\manager-web
|
||||
npm install
|
||||
npm run serve
|
||||
```
|
||||
|
||||
访问 <http://127.0.0.1:8001>。代理已配置 `/xiaozhi` → `127.0.0.1:8002`,无需改接口地址。
|
||||
|
||||
## 3. 智控台初始化
|
||||
|
||||
1. 打开 <http://127.0.0.1:8001>,注册第一个账号(自动成为超级管理员)
|
||||
2. 「参数管理」→ `server.secret`,复制参数值
|
||||
3. 「模型配置」→ 大语言模型 → 智谱AI,填入 API 密钥并保存
|
||||
|
||||
## 4. Python 端:xiaozhi-server
|
||||
|
||||
1. 创建环境:
|
||||
|
||||
```powershell
|
||||
conda create -n xiaozhi-esp32-server python=3.10 -y
|
||||
conda activate xiaozhi-esp32-server
|
||||
conda install libopus ffmpeg -y
|
||||
```
|
||||
|
||||
2. 安装依赖:
|
||||
|
||||
```powershell
|
||||
cd main\xiaozhi-server
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
3. 下载 ASR 模型,放到 `models/SenseVoiceSmall/model.pt`(只用云端 ASR 可跳过):
|
||||
|
||||
- 魔搭:<https://modelscope.cn/models/iic/SenseVoiceSmall/resolve/master/model.pt>
|
||||
- 百度网盘:<https://pan.baidu.com/share/init?surl=QlgM58FHhYv1tFnUT_A8Sg> 提取码 `qvna`
|
||||
|
||||
4. 配置:
|
||||
|
||||
```powershell
|
||||
mkdir data
|
||||
copy config_from_api.yaml data\.config.yaml
|
||||
```
|
||||
|
||||
```yaml
|
||||
manager-api:
|
||||
url: http://127.0.0.1:8002/xiaozhi
|
||||
secret: 第3章复制的server.secret值
|
||||
```
|
||||
|
||||
5. 启动:
|
||||
|
||||
```powershell
|
||||
python app.py
|
||||
```
|
||||
|
||||
日志出现 `Websocket地址是 ws://...` 即成功(该地址不能用浏览器访问)。
|
||||
|
||||
6. 在智控台「参数管理」回填:
|
||||
|
||||
| 参数 | 填写 |
|
||||
| --- | --- |
|
||||
| `server.websocket` | `ws://局域网IP:8000/xiaozhi/v1/` |
|
||||
| `server.ota` | `http://局域网IP:8002/xiaozhi/ota/` |
|
||||
|
||||
不要填 `127.0.0.1`,否则 ESP32 无法访问。
|
||||
|
||||
## 5. 可选模块
|
||||
|
||||
**digital-human(8006)**
|
||||
|
||||
```powershell
|
||||
cd main\digital-human
|
||||
pip install -r wakeword_runtime\requirements.txt
|
||||
python start.py
|
||||
```
|
||||
|
||||
访问 <http://127.0.0.1:8006/index.html>。
|
||||
|
||||
**manager-mobile(9000)**
|
||||
|
||||
```powershell
|
||||
cd main\manager-mobile
|
||||
pnpm install
|
||||
pnpm dev:h5
|
||||
```
|
||||
|
||||
先在 [env/.env](../main/manager-mobile/env/.env) 设置 `VITE_SERVER_BASEURL = 'http://127.0.0.1:8002/xiaozhi'`。
|
||||
|
||||
## 端口速查
|
||||
|
||||
| 服务 | 地址 |
|
||||
| --- | --- |
|
||||
| 智控台 | <http://127.0.0.1:8001> |
|
||||
| manager-api 文档 | <http://127.0.0.1:8002/xiaozhi/doc.html> |
|
||||
| WebSocket | `ws://127.0.0.1:8000/xiaozhi/v1/` |
|
||||
| OTA | <http://127.0.0.1:8002/xiaozhi/ota/> |
|
||||
| digital-human | <http://127.0.0.1:8006/index.html> |
|
||||
| manager-mobile | <http://127.0.0.1:9000> |
|
||||
|
||||
## 常见问题
|
||||
|
||||
- ffmpeg / libopus 报错:`conda install ffmpeg libopus -y`
|
||||
- 拉不到配置:检查 `data/.config.yaml` 的 `url` 与 `secret`
|
||||
- 数据库连接失败:确认库已创建、`application-dev.yml` 配置正确
|
||||
- 页面 404:先确认 8002 已启动
|
||||
- 端口被占用:`netstat -ano | findstr :8000` 结束对应进程
|
||||
229
mydoc/项目结构.md
Normal file
229
mydoc/项目结构.md
Normal file
|
|
@ -0,0 +1,229 @@
|
|||
# 项目结构
|
||||
|
||||
> 项目:xiaozhi-esp32-server(为 ESP32 智能硬件提供后端服务的开源项目)
|
||||
> 分支:dev
|
||||
> 说明:本文基于仓库当前代码整理,路径均相对于仓库根目录。
|
||||
|
||||
## 1. 顶层结构
|
||||
|
||||
```
|
||||
xiaozhi-esp32-server/
|
||||
├─ .github/ GitHub Actions 工作流与模板
|
||||
├─ docs/ 项目文档(部署、FAQ、集成指南、架构图、截图)
|
||||
├─ main/ 所有可运行模块(业务代码都在这里)
|
||||
│ ├─ xiaozhi-server/ Python 核心服务:语音对话 + 设备通信
|
||||
│ ├─ manager-api/ Java 管理后端:账号、设备、模型、参数等 REST API
|
||||
│ ├─ manager-web/ Vue2 智控台前端
|
||||
│ ├─ manager-mobile/ uni-app + Vue3 移动端智控台
|
||||
│ └─ digital-human/ 数字人测试页 + 本地唤醒词运行时
|
||||
├─ Dockerfile-server Python 服务镜像
|
||||
├─ Dockerfile-server-base Python 服务基础镜像
|
||||
├─ Dockerfile-web Java + 前端合并镜像
|
||||
├─ docker-setup.sh Ubuntu 一键部署脚本
|
||||
├─ Makefile 测试入口(Python / Java / Web)
|
||||
├─ README.md 项目说明与部署入口
|
||||
└─ mydoc/ 本目录(个人/团队补充文档)
|
||||
```
|
||||
|
||||
## 2. 模块与端口
|
||||
|
||||
| 模块 | 技术栈 | 默认端口 | 职责 |
|
||||
| --- | --- | --- | --- |
|
||||
| xiaozhi-server | Python 3.10 + asyncio + websockets | 8000(WebSocket)、8003(HTTP:OTA/视觉) | 与 ESP32 建立长连接,完成 VAD→ASR→LLM→TTS 全链路 |
|
||||
| manager-api | Java 21 + Spring Boot 3 + MyBatis-Plus + Shiro | 8002(context-path `/xiaozhi`) | 智控台后端、为 xiaozhi-server 提供配置、OTA 元数据 |
|
||||
| manager-web | Vue 2 + Vuex + Element UI + Vue CLI | 8001(开发服务器) | 智控台 Web 界面 |
|
||||
| manager-mobile | uni-app + Vue 3 + Vite + pinia + alova | 9000(H5 开发) | 移动端智控台,可打包 App / 小程序 |
|
||||
| digital-human | Python + 原生 HTML/JS + Sherpa-ONNX | 8006 | 数字人测试页、唤醒词检测、事件桥 |
|
||||
| MySQL | MySQL 8 | 3306 | 账号、设备、模型、参数等业务数据 |
|
||||
| Redis | Redis | 6379 | 会话与热点配置缓存 |
|
||||
| MQTT/UDP 网关(可选) | 独立部署 | 见 `docs/mqtt-gateway-integration.md` | 支持 MQTT+UDP 协议的设备接入 |
|
||||
|
||||
## 3. main/xiaozhi-server(核心 Python 服务)
|
||||
|
||||
```
|
||||
main/xiaozhi-server/
|
||||
├─ app.py 程序入口:检查 ffmpeg、加载配置、启动 WS 与 HTTP 服务
|
||||
├─ config.yaml 默认配置(含全部可选组件说明,不建议直接改)
|
||||
├─ config_from_api.yaml 从 manager-api 拉取配置的模板
|
||||
├─ requirements.txt Python 依赖(推荐 Python 3.10 / torch 2.2.2)
|
||||
├─ pyproject.toml
|
||||
├─ docker-compose.yml 单服务 Docker 编排(8000/8003)
|
||||
├─ docker-compose_all.yml 全模块 Docker 编排(server + web + MySQL + Redis)
|
||||
├─ core/
|
||||
│ ├─ websocket_server.py WebSocket 服务,每个连接一个 ConnectionHandler
|
||||
│ ├─ http_server.py OTA / 视觉分析等 HTTP 接口
|
||||
│ ├─ connection.py 单个设备连接的状态与消息分发
|
||||
│ ├─ auth.py JWT / 鉴权
|
||||
│ ├─ handle/ 消息处理:hello、收音频、文本、函数调用、发音频、打断、IoT、MCP 等
|
||||
│ ├─ providers/ AI 能力提供者(工厂模式动态加载)
|
||||
│ │ ├─ asr/ FunASR、SherpaASR、讯飞、火山、腾讯、阿里、百度、OpenAI 等
|
||||
│ │ ├─ llm/ OpenAI 兼容、Ollama、Dify、Coze、智谱、Gemini 等
|
||||
│ │ ├─ tts/ EdgeTTS、火山、CosyVoice、Index-TTS、FishSpeech 等
|
||||
│ │ ├─ vad/ SileroVAD
|
||||
│ │ ├─ vllm/ 视觉大模型
|
||||
│ │ ├─ intent/ 意图识别(function_call / llm / none)
|
||||
│ │ ├─ memory/ 本地短期记忆、mem0ai、PowerMem
|
||||
│ │ └─ tools/ 工具调用相关
|
||||
│ └─ utils/ 模块初始化、日志、通用工具、缓存等
|
||||
├─ config/
|
||||
│ ├─ config_loader.py 读取 data/.config.yaml,并用 config.yaml 补全
|
||||
│ ├─ manage_api_client.py 调用 manager-api 拉取远程配置
|
||||
│ ├─ settings.py 全局配置对象
|
||||
│ ├─ logger.py loguru 日志封装
|
||||
│ └─ assets/ 绑定提示音、停止播报提示音等静态音频
|
||||
├─ plugins_func/ 插件系统
|
||||
│ ├─ loadplugins.py 启动时扫描并加载插件
|
||||
│ ├─ register.py 函数注册、描述与参数 schema
|
||||
│ └─ functions/ 天气、新闻、HomeAssistant、音乐、MCP 等具体插件
|
||||
├─ models/ 本地模型目录(如 SenseVoiceSmall/model.pt)
|
||||
├─ music/ 音乐资源
|
||||
├─ performance_tester/ 性能测试模块
|
||||
├─ performance_tester.py 模型响应速度测试脚本
|
||||
└─ tests/ pytest 用例
|
||||
```
|
||||
|
||||
关键运行机制:
|
||||
|
||||
- 配置优先级:`data/.config.yaml` > `config.yaml`;使用智控台时,远程配置会覆盖本地配置。
|
||||
- `selected_module` 决定实际启用的 VAD / ASR / LLM / VLLM / TTS / Memory 实现,由 `core/utils/modules_initialize.py` 动态实例化。
|
||||
- 每个设备连接独立的 `ConnectionHandler`,互不干扰;支持并发。
|
||||
- 语音链路:设备音频 → VAD 切分 → ASR 转文本 → LLM(可触发插件/MCP/知识库)→ TTS → 音频流回传设备。
|
||||
|
||||
## 4. main/manager-api(Java 管理后端)
|
||||
|
||||
```
|
||||
main/manager-api/
|
||||
├─ pom.xml Spring Boot 3.4.3,Java 21
|
||||
└─ src/main/
|
||||
├─ java/xiaozhi/
|
||||
│ ├─ AdminApplication.java 启动类(8002,context-path /xiaozhi)
|
||||
│ ├─ common/ 通用配置:MyBatis-Plus、Redis、Swagger/Knife4j、异常、AOP、工具类
|
||||
│ └─ modules/ 按业务域分包,每个包内为 controller / service / dao / entity / dto
|
||||
│ ├─ agent/ 智能体配置(模型组合、提示词、音色、插件)
|
||||
│ ├─ device/ ESP32 设备注册与绑定
|
||||
│ ├─ model/ 模型提供者与模型配置
|
||||
│ ├─ llm/ 大模型相关
|
||||
│ ├─ config/ 参数管理,并向 xiaozhi-server 提供配置
|
||||
│ ├─ knowledge/ 知识库配置
|
||||
│ ├─ timbre/ 音色管理
|
||||
│ ├─ voiceclone/ 声音克隆
|
||||
│ ├─ correctword/ 纠错词/替换词
|
||||
│ ├─ security/ 认证、鉴权(Shiro)、OTA 安全
|
||||
│ ├─ sms/ 短信验证码
|
||||
│ └─ sys/ 用户、角色、菜单、字典、日志等系统管理
|
||||
└─ resources/
|
||||
├─ application.yml 主配置(端口 8002、context-path、激活 dev)
|
||||
├─ application-dev.yml 本地开发:MySQL / Redis 连接
|
||||
├─ db/changelog/ 建表与数据变更 SQL 脚本(已合并为 mydoc/xiaozhi_esp32_server_init.sql)
|
||||
├─ mapper/ MyBatis XML
|
||||
├─ i18n/ 国际化文案
|
||||
├─ lua/ Redis 限流等 Lua 脚本
|
||||
└─ logback-spring.xml 日志配置
|
||||
```
|
||||
|
||||
## 5. main/manager-web(智控台前端)
|
||||
|
||||
```
|
||||
main/manager-web/
|
||||
├─ package.json npm 脚本:serve / build / test:unit / test:contract
|
||||
├─ vue.config.js 开发端口 8001,代理 /xiaozhi → http://127.0.0.1:8002
|
||||
├─ .env.development VUE_APP_API_BASE_URL=/xiaozhi
|
||||
├─ public/ HTML 模板与静态资源
|
||||
├─ tests/ 契约测试
|
||||
└─ src/
|
||||
├─ main.js / App.vue 入口与根组件
|
||||
├─ apis/ 接口封装(按模块划分,统一拦截器)
|
||||
├─ views/ 页面:登录、设备、智能体、模型配置、参数管理等
|
||||
├─ components/ 通用组件
|
||||
├─ router/ 路由与登录守卫
|
||||
├─ store/ Vuex 状态
|
||||
├─ i18n/ 简中 / 繁中 / 英文
|
||||
├─ styles/ 全局 SCSS
|
||||
└─ utils/ 工具函数
|
||||
```
|
||||
|
||||
## 6. main/manager-mobile(移动端智控台)
|
||||
|
||||
```
|
||||
main/manager-mobile/
|
||||
├─ package.json pnpm 管理,开发:pnpm dev:h5 / dev:mp-weixin / dev:app
|
||||
├─ env/.env 接口地址 VITE_SERVER_BASEURL、H5 代理开关
|
||||
├─ src/
|
||||
│ ├─ pages/ pages-sub/ 页面
|
||||
│ ├─ layouts/ 布局
|
||||
│ ├─ api/ http/ alova 请求封装
|
||||
│ ├─ store/ pinia(持久化)
|
||||
│ ├─ components/ hooks/ utils/
|
||||
│ └─ static/
|
||||
├─ manifest.config.ts 应用/小程序配置
|
||||
├─ pages.config.ts 页面路由
|
||||
└─ vite.config.ts / uno.config.ts
|
||||
```
|
||||
|
||||
## 7. main/digital-human(数字人测试模块)
|
||||
|
||||
```
|
||||
main/digital-human/
|
||||
├─ start.py 启动入口(默认 8006)
|
||||
├─ index.html 测试页面
|
||||
├─ js/ css/ images/ resources/ 页面资源
|
||||
└─ wakeword_runtime/
|
||||
├─ config.json 唤醒词、音频、检测器、日志配置
|
||||
├─ bridge/ 页面与运行时的事件桥(WebSocket)
|
||||
├─ core/ runtime/ plugins/ 采集、检测、服务生命周期
|
||||
└─ requirements.txt 该模块独立依赖(sherpa-onnx 等)
|
||||
```
|
||||
|
||||
访问地址:`http://127.0.0.1:8006/index.html`、`ws://127.0.0.1:8006/wakeword-ws`、`http://127.0.0.1:8006/health`。
|
||||
|
||||
## 8. docs 目录(常用文档)
|
||||
|
||||
| 文档 | 内容 |
|
||||
| --- | --- |
|
||||
| `docs/Deployment.md` | 最简化安装(只跑 server) |
|
||||
| `docs/Deployment_all.md` | 全模块安装(源码 / Docker 两种方式) |
|
||||
| `docs/FAQ.md` | 常见问题 |
|
||||
| `docs/mqtt-gateway-integration.md` | MQTT+UDP 网关部署 |
|
||||
| `docs/mcp-endpoint-enable.md` | MCP 接入点部署 |
|
||||
| `docs/voiceprint-integration.md` | 声纹识别 |
|
||||
| `docs/mcp-vision-integration.md` | 视觉模型(拍照识物) |
|
||||
| `docs/performance_tester.md` | 各组件性能测试 |
|
||||
| `docs/firmware-build.md` / `firmware-setting.md` | ESP32 固件编译与服务器配置 |
|
||||
| `docs/dev-ops-integration.md` | 自动拉取代码、编译、启动 |
|
||||
|
||||
## 9. 数据流概览
|
||||
|
||||
```
|
||||
ESP32 设备 ──WebSocket(8000)──> xiaozhi-server ──HTTP──> manager-api(8002) 拉取配置
|
||||
↑ │
|
||||
└────── 音频流 / 控制消息 ──────────┘
|
||||
|
||||
管理员浏览器 ──HTTP(8001 dev)──> manager-web ──/xiaozhi 代理──> manager-api(8002) ──> MySQL / Redis
|
||||
|
||||
设备 OTA 请求 ──HTTP(8002 /xiaozhi/ota/)──> manager-api
|
||||
视觉分析请求 ──HTTP(8003 /mcp/vision/explain)──> xiaozhi-server
|
||||
```
|
||||
|
||||
## 10. 配置与环境文件
|
||||
|
||||
| 文件 | 作用 | 是否提交 |
|
||||
| --- | --- | --- |
|
||||
| `main/xiaozhi-server/config.yaml` | 默认全量配置和组件说明 | 是 |
|
||||
| `main/xiaozhi-server/data/.config.yaml` | 本地覆盖配置(含密钥),由 `config_from_api.yaml` 复制而来 | 否 |
|
||||
| `main/xiaozhi-server/data/` | 运行数据、日志、密钥 | 否 |
|
||||
| `main/manager-api/src/main/resources/application-dev.yml` | 数据库、Redis 连接 | 是(本地按需改) |
|
||||
| `main/manager-web/.env.development` | 前端接口前缀 | 是 |
|
||||
| `main/manager-mobile/env/.env` | 移动端后端地址 | 是 |
|
||||
| `main/xiaozhi-server/docker-compose*.yml` | Docker 编排 | 是 |
|
||||
|
||||
## 11. 常用命令
|
||||
|
||||
```bash
|
||||
# 全量快速测试(根目录)
|
||||
make test
|
||||
|
||||
# 分模块
|
||||
make test-python # main/xiaozhi-server: pytest
|
||||
make test-java # main/manager-api: mvn test
|
||||
make test-web # main/manager-web: npm ci + npm test
|
||||
```
|
||||
Loading…
Reference in a new issue