mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-22 23:23:55 +08:00
Merge branch 'py_test_error_response' into fix/2075
This commit is contained in:
@@ -304,7 +304,7 @@ public interface Constant {
|
||||
/**
|
||||
* 版本号
|
||||
*/
|
||||
public static final String VERSION = "0.8.11";
|
||||
public static final String VERSION = "0.9.1";
|
||||
|
||||
/**
|
||||
* 无效固件URL
|
||||
|
||||
+12
-5
@@ -1,6 +1,12 @@
|
||||
package xiaozhi.modules.agent.service.impl;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -81,9 +87,9 @@ public class AgentServiceImpl extends BaseServiceImpl<AgentDao, AgentEntity> imp
|
||||
|
||||
if (agent.getMemModelId() != null && agent.getMemModelId().equals(Constant.MEMORY_NO_MEM)) {
|
||||
agent.setChatHistoryConf(Constant.ChatHistoryConfEnum.IGNORE.getCode());
|
||||
if (agent.getChatHistoryConf() == null) {
|
||||
agent.setChatHistoryConf(Constant.ChatHistoryConfEnum.RECORD_TEXT_AUDIO.getCode());
|
||||
}
|
||||
}
|
||||
if (agent.getChatHistoryConf() == null) {
|
||||
agent.setChatHistoryConf(Constant.ChatHistoryConfEnum.RECORD_TEXT_AUDIO.getCode());
|
||||
}
|
||||
|
||||
// 查询上下文源配置
|
||||
@@ -132,7 +138,8 @@ public class AgentServiceImpl extends BaseServiceImpl<AgentDao, AgentEntity> imp
|
||||
if (StringUtils.isNotBlank(keyword)) {
|
||||
if ("mac".equals(searchType)) {
|
||||
// 按MAC地址搜索:先搜索设备,再获取对应的智能体
|
||||
List<DeviceEntity> devices = Optional.ofNullable(deviceService.searchDevicesByMacAddress(keyword, userId)).orElseGet(ArrayList::new);
|
||||
List<DeviceEntity> devices = Optional
|
||||
.ofNullable(deviceService.searchDevicesByMacAddress(keyword, userId)).orElseGet(ArrayList::new);
|
||||
// 获取设备对应的智能体ID列表
|
||||
List<String> agentIds = devices.stream()
|
||||
.map(DeviceEntity::getAgentId)
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
-- 批量清理 ai_model_provider 中的 sample_rate 字段定义
|
||||
UPDATE `ai_model_provider` ap
|
||||
JOIN (
|
||||
SELECT
|
||||
id,
|
||||
JSON_ARRAYAGG(
|
||||
JSON_OBJECT('key', jt.k, 'label', jt.l, 'type', jt.t)
|
||||
) AS new_fields
|
||||
FROM `ai_model_provider`,
|
||||
JSON_TABLE(`fields`, '$[*]' COLUMNS (
|
||||
k VARCHAR(50) PATH '$.key',
|
||||
l VARCHAR(100) PATH '$.label',
|
||||
t VARCHAR(20) PATH '$.type'
|
||||
)) AS jt
|
||||
WHERE `model_type` = 'TTS'
|
||||
AND jt.k != 'sample_rate'
|
||||
GROUP BY id
|
||||
) filtered ON ap.id = filtered.id
|
||||
SET ap.fields = filtered.new_fields;
|
||||
|
||||
-- 清理 config_json 顶层的 sample_rate
|
||||
UPDATE `ai_model_config`
|
||||
SET `config_json` = JSON_REMOVE(`config_json`, '$.sample_rate')
|
||||
WHERE `model_type` = 'TTS'
|
||||
AND JSON_EXTRACT(`config_json`, '$.sample_rate') IS NOT NULL;
|
||||
|
||||
-- 清理Minimax流式TTS的sample_rate参数(位于audio_setting内部)
|
||||
UPDATE `ai_model_config` SET
|
||||
`config_json` = JSON_SET(`config_json`, '$.audio_setting', JSON_REMOVE(JSON_EXTRACT(`config_json`, '$.audio_setting'), '$.sample_rate'))
|
||||
WHERE `id` = 'TTS_MinimaxStreamTTS'
|
||||
AND JSON_EXTRACT(`config_json`, '$.audio_setting.sample_rate') IS NOT NULL;
|
||||
@@ -0,0 +1,87 @@
|
||||
-- 更新HuoshanDoubleStreamTTS供应器配置,将分散的参数改为JSON字典配置
|
||||
-- 将 speech_rate, loudness_rate, pitch, emotion, emotion_scale 等参数整合为 audio_params, additions, mix_speaker 三个JSON字典
|
||||
|
||||
UPDATE `ai_model_provider`
|
||||
SET `fields` = '[
|
||||
{"key": "ws_url", "type": "string", "label": "WebSocket地址"},
|
||||
{"key": "appid", "type": "string", "label": "应用ID"},
|
||||
{"key": "access_token", "type": "string", "label": "访问令牌"},
|
||||
{"key": "resource_id", "type": "string", "label": "资源ID"},
|
||||
{"key": "speaker", "type": "string", "label": "默认音色"},
|
||||
{"key": "enable_ws_reuse", "type": "boolean", "label": "是否开启链接复用", "default": true},
|
||||
{"key": "audio_params", "type": "dict", "label": "音频输出配置"},
|
||||
{"key": "additions", "type": "dict", "label": "高级文本处理配置"},
|
||||
{"key": "mix_speaker", "type": "dict", "label": "混音控制配置"}
|
||||
]'
|
||||
WHERE `id` = 'SYSTEM_TTS_HSDSTTS';
|
||||
|
||||
-- 更新现有配置,将旧的分散参数迁移到新的JSON字典结构
|
||||
UPDATE `ai_model_config`
|
||||
SET `config_json` = JSON_SET(
|
||||
`config_json`,
|
||||
'$.audio_params', JSON_OBJECT(
|
||||
'speech_rate', CAST(COALESCE(NULLIF(JSON_UNQUOTE(JSON_EXTRACT(`config_json`, '$.speech_rate')), ''), '0') AS SIGNED),
|
||||
'loudness_rate', CAST(COALESCE(NULLIF(JSON_UNQUOTE(JSON_EXTRACT(`config_json`, '$.loudness_rate')), ''), '0') AS SIGNED)
|
||||
),
|
||||
'$.additions', JSON_OBJECT(
|
||||
'aigc_metadata', JSON_OBJECT(),
|
||||
'cache_config', JSON_OBJECT(),
|
||||
'post_process', JSON_OBJECT(
|
||||
'pitch', CAST(COALESCE(NULLIF(JSON_UNQUOTE(JSON_EXTRACT(`config_json`, '$.pitch')), ''), '0') AS SIGNED)
|
||||
)
|
||||
),
|
||||
'$.mix_speaker', JSON_OBJECT()
|
||||
)
|
||||
WHERE `id` = 'TTS_HuoshanDoubleStreamTTS';
|
||||
|
||||
-- 删除旧的分散参数字段
|
||||
UPDATE `ai_model_config`
|
||||
SET `config_json` = JSON_REMOVE(
|
||||
`config_json`,
|
||||
'$.speech_rate',
|
||||
'$.loudness_rate',
|
||||
'$.pitch',
|
||||
'$.emotion',
|
||||
'$.emotion_scale'
|
||||
)
|
||||
WHERE `id` = 'TTS_HuoshanDoubleStreamTTS';
|
||||
|
||||
-- 更新文档链接和备注说明
|
||||
UPDATE `ai_model_config` SET
|
||||
`doc_link` = 'https://www.volcengine.com/docs/6561/1329505',
|
||||
`remark` = '火山引擎双向流式TTS配置说明:
|
||||
1. 访问 https://www.volcengine.com/ 注册并开通火山引擎账号
|
||||
2. 访问 https://console.volcengine.com/speech/service/10007 开通语音合成大模型,购买音色
|
||||
3. 在页面底部获取appid和access_token
|
||||
4. 资源ID固定为:volc.service_type.10029(大模型语音合成及混音)
|
||||
5. 链接复用:开启WebSocket连接复用,默认true减少链接损耗(注意:复用后设备处于聆听状态时空闲链接会占并发数)
|
||||
|
||||
详细参数文档:https://www.volcengine.com/docs/6561/1329505
|
||||
【audio_params】音频输出配置 - 用户可自定义添加火山引擎支持的任何音频参数
|
||||
- speech_rate: 语速(-50~100),默认0
|
||||
- loudness_rate: 音量(-50~100),默认0
|
||||
- emotion: 情感类型(仅部分音色支持),可选值:neutral、happy、sad、angry、fearful、disgusted、surprised
|
||||
- emotion_scale: 情感强度(1~5),默认4
|
||||
示例:{"speech_rate": 10, "loudness_rate": 5, "emotion": "happy", "emotion_scale": 4}
|
||||
|
||||
【additions】高级文本处理配置 - 用户可自定义添加火山引擎支持的任何高级参数
|
||||
- post_process.pitch: 音高(-12~12),默认0
|
||||
- aigc_metadata: AIGC元数据配置
|
||||
- cache_config: 缓存配置
|
||||
示例:{"post_process": {"pitch": 2}, "aigc_metadata": {}, "cache_config": {}}
|
||||
|
||||
【mix_speaker】混音控制配置 - 多音色混合(仅 TTS 1.0)
|
||||
示例:
|
||||
{"speakers": [
|
||||
{"source_speaker": "zh_male_bvlazysheep","mix_factor": 0.3},
|
||||
{"source_speaker": "BV120_streaming","mix_factor": 0.3},
|
||||
{"source_speaker": "zh_male_ahu_conversation_wvae_bigtts","mix_factor": 0.4}
|
||||
]}
|
||||
|
||||
注意:
|
||||
- 多情感音色参数(emotion、emotion_scale)仅部分音色支持
|
||||
- 相关音色列表:https://www.volcengine.com/docs/6561/1257544
|
||||
- 用户可根据火山引擎API文档自行添加更多参数
|
||||
- 混音功能主要适用于豆包语音合成模型1.0的音色,使用时需要将req_params.speaker设置为custom_mix_bigtts
|
||||
'
|
||||
WHERE `id` = 'TTS_HuoshanDoubleStreamTTS';
|
||||
@@ -0,0 +1,14 @@
|
||||
-- 更新小智参数中的默认采样率从 16000 改为 24000
|
||||
UPDATE `sys_params`
|
||||
SET `param_value` = '{
|
||||
"type": "hello",
|
||||
"version": 1,
|
||||
"transport": "websocket",
|
||||
"audio_params": {
|
||||
"format": "opus",
|
||||
"sample_rate": 24000,
|
||||
"channels": 1,
|
||||
"frame_duration": 60
|
||||
}
|
||||
}'
|
||||
WHERE `id` = 309 AND `param_code` = 'xiaozhi';
|
||||
@@ -487,6 +487,27 @@ databaseChangeLog:
|
||||
- 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: 202601291552
|
||||
author: shengzhou1216
|
||||
|
||||
Reference in New Issue
Block a user