mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-26 09:03:54 +08:00
格式调整
This commit is contained in:
+5
-8
@@ -371,12 +371,12 @@ public class ConfigServiceImpl implements ConfigService {
|
|||||||
Map<String, Object> result,
|
Map<String, Object> result,
|
||||||
boolean isCache) {
|
boolean isCache) {
|
||||||
Map<String, String> selectedModule = new HashMap<>();
|
Map<String, String> selectedModule = new HashMap<>();
|
||||||
|
|
||||||
String[] modelTypes = { "VAD", "ASR", "TTS", "Memory", "Intent", "LLM", "VLLM" };
|
String[] modelTypes = { "VAD", "ASR", "TTS", "Memory", "Intent", "LLM", "VLLM" };
|
||||||
String[] modelIds = { vadModelId, asrModelId, ttsModelId, memModelId, intentModelId, llmModelId, vllmModelId };
|
String[] modelIds = { vadModelId, asrModelId, ttsModelId, memModelId, intentModelId, llmModelId, vllmModelId };
|
||||||
String intentLLMModelId = null;
|
String intentLLMModelId = null;
|
||||||
String memLocalShortLLMModelId = null;
|
String memLocalShortLLMModelId = null;
|
||||||
|
|
||||||
for (int i = 0; i < modelIds.length; i++) {
|
for (int i = 0; i < modelIds.length; i++) {
|
||||||
if (modelIds[i] == null) {
|
if (modelIds[i] == null) {
|
||||||
continue;
|
continue;
|
||||||
@@ -390,17 +390,14 @@ public class ConfigServiceImpl implements ConfigService {
|
|||||||
// 复制一份配置,避免修改原始数据
|
// 复制一份配置,避免修改原始数据
|
||||||
JSONObject configJsonCopy = new JSONObject(model.getConfigJson());
|
JSONObject configJsonCopy = new JSONObject(model.getConfigJson());
|
||||||
|
|
||||||
// 对敏感数据进行隐藏处理
|
typeConfig.put(model.getId(), configJsonCopy);
|
||||||
JSONObject maskedConfigJson = SensitiveDataUtils.maskSensitiveFields(configJsonCopy);
|
|
||||||
|
|
||||||
typeConfig.put(model.getId(), maskedConfigJson);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
result.put(modelTypes[i], typeConfig);
|
result.put(modelTypes[i], typeConfig);
|
||||||
|
|
||||||
selectedModule.put(modelTypes[i], model.getId());
|
selectedModule.put(modelTypes[i], model.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
result.put("selected_module", selectedModule);
|
result.put("selected_module", selectedModule);
|
||||||
if (StringUtils.isNotBlank(prompt)) {
|
if (StringUtils.isNotBlank(prompt)) {
|
||||||
prompt = prompt.replace("{{assistant_name}}", StringUtils.isBlank(assistantName) ? "小智" : assistantName);
|
prompt = prompt.replace("{{assistant_name}}", StringUtils.isBlank(assistantName) ? "小智" : assistantName);
|
||||||
|
|||||||
+2
-2
@@ -138,7 +138,7 @@ public class ModelConfigServiceImpl extends BaseServiceImpl<ModelConfigDao, Mode
|
|||||||
throw new RenException(ErrorCode.INVALID_LLM_TYPE);
|
throw new RenException(ErrorCode.INVALID_LLM_TYPE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 再更新供应器提供的模型
|
// 再更新供应器提供的模型
|
||||||
ModelConfigEntity modelConfigEntity = ConvertUtils.sourceToTarget(modelConfigBodyDTO, ModelConfigEntity.class);
|
ModelConfigEntity modelConfigEntity = ConvertUtils.sourceToTarget(modelConfigBodyDTO, ModelConfigEntity.class);
|
||||||
modelConfigEntity.setId(id);
|
modelConfigEntity.setId(id);
|
||||||
@@ -175,7 +175,7 @@ public class ModelConfigServiceImpl extends BaseServiceImpl<ModelConfigDao, Mode
|
|||||||
public ModelConfigDTO add(String modelType, String provideCode, ModelConfigBodyDTO modelConfigBodyDTO) {
|
public ModelConfigDTO add(String modelType, String provideCode, ModelConfigBodyDTO modelConfigBodyDTO) {
|
||||||
// 先验证有没有供应器
|
// 先验证有没有供应器
|
||||||
if (StringUtils.isBlank(modelType) || StringUtils.isBlank(provideCode)) {
|
if (StringUtils.isBlank(modelType) || StringUtils.isBlank(provideCode)) {
|
||||||
throw new RenException("modelType和provideCode不能为空");
|
throw new RenException(ErrorCode.MODEL_TYPE_PROVIDE_CODE_NOT_NULL);
|
||||||
}
|
}
|
||||||
List<ModelProviderDTO> providerList = modelProviderService.getList(modelType, provideCode);
|
List<ModelProviderDTO> providerList = modelProviderService.getList(modelType, provideCode);
|
||||||
if (CollectionUtil.isEmpty(providerList)) {
|
if (CollectionUtil.isEmpty(providerList)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user