mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-22 07:03:53 +08:00
update:智控台添加相似度阈值配置
This commit is contained in:
+14
@@ -298,6 +298,20 @@ public class ConfigServiceImpl implements ConfigService {
|
||||
Map<String, Object> voiceprintConfig = new HashMap<>();
|
||||
voiceprintConfig.put("url", voiceprintUrl);
|
||||
voiceprintConfig.put("speakers", speakers);
|
||||
|
||||
// 获取声纹识别相似度阈值,默认0.4
|
||||
String thresholdStr = sysParamsService.getValue("server.voiceprint_similarity_threshold", true);
|
||||
if (StringUtils.isNotBlank(thresholdStr) && !"null".equals(thresholdStr)) {
|
||||
try {
|
||||
double threshold = Double.parseDouble(thresholdStr);
|
||||
voiceprintConfig.put("similarity_threshold", threshold);
|
||||
} catch (NumberFormatException e) {
|
||||
// 如果解析失败,使用默认值0.4
|
||||
voiceprintConfig.put("similarity_threshold", 0.4);
|
||||
}
|
||||
} else {
|
||||
voiceprintConfig.put("similarity_threshold", 0.4);
|
||||
}
|
||||
|
||||
result.put("voiceprint", voiceprintConfig);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
-- 添加声纹识别相似度阈值参数配置
|
||||
delete from `sys_params` where id = 115;
|
||||
INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark)
|
||||
VALUES (115, 'server.voiceprint_similarity_threshold', '0.4', 'string', 1, '声纹识别相似度阈值,范围0.0-1.0,默认0.4,数值越高越严格');
|
||||
@@ -303,3 +303,10 @@ databaseChangeLog:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202508131557.sql
|
||||
- changeSet:
|
||||
id: 202509081140
|
||||
author: cgd
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202509081140.sql
|
||||
|
||||
Reference in New Issue
Block a user