fix(rebase): align upstream DTO and test startup behavior

This commit is contained in:
lapy 2026-10-11 11:44:13 +01:00
parent 67a0a512d9
commit f92fb3439a
5 changed files with 32 additions and 3 deletions

View file

@ -103,11 +103,34 @@ public class AgentUpdateDTO implements Serializable {
@Data @Data
@Schema(description = "Plugin function information") @Schema(description = "Plugin function information")
public static class FunctionInfo implements Serializable { public static class FunctionInfo implements Serializable {
private static final TypeReference<HashMap<String, Object>> PARAM_INFO_TYPE = new TypeReference<>() {};
@Schema(description = "Plugin ID", example = "plugin_01") @Schema(description = "Plugin ID", example = "plugin_01")
private String pluginId; private String pluginId;
@Schema(description = "Function parameter information", nullable = true) @Schema(description = "Function parameter information", nullable = true)
private HashMap<String, Object> paramInfo; private HashMap<String, Object> paramInfo = new HashMap<>();
public void setParamInfo(Object paramInfo) {
this.paramInfo = normalizeParamInfo(paramInfo);
}
private static HashMap<String, Object> normalizeParamInfo(Object paramInfo) {
if (paramInfo == null || (paramInfo instanceof String value && value.trim().isEmpty())) {
return new HashMap<>();
}
if (paramInfo instanceof String value) {
return JsonUtils.parseObject(value, PARAM_INFO_TYPE);
}
if (paramInfo instanceof Map<?, ?> value) {
HashMap<String, Object> normalized = new HashMap<>();
value.forEach((key, entryValue) -> {
if (key != null) normalized.put(String.valueOf(key), entryValue);
});
return normalized;
}
return JsonUtils.parseObject(JsonUtils.toJsonString(paramInfo), PARAM_INFO_TYPE);
}
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

View file

@ -3,6 +3,7 @@ package xiaozhi.modules.agent.service.impl;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.springframework.beans.factory.SmartInitializingSingleton; import org.springframework.beans.factory.SmartInitializingSingleton;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -12,6 +13,7 @@ import xiaozhi.modules.agent.service.AgentSnapshotService;
@Slf4j @Slf4j
@Component @Component
@ConditionalOnProperty(prefix = "spring.liquibase", name = "enabled", havingValue = "true", matchIfMissing = true)
@RequiredArgsConstructor @RequiredArgsConstructor
public class AgentSnapshotRedactionRunner implements SmartInitializingSingleton { public class AgentSnapshotRedactionRunner implements SmartInitializingSingleton {
static final long ROLLING_DEPLOYMENT_INITIAL_DELAY_MILLIS = 5_000; static final long ROLLING_DEPLOYMENT_INITIAL_DELAY_MILLIS = 5_000;

View file

@ -1,6 +1,7 @@
package xiaozhi.modules.config.init; package xiaozhi.modules.config.init;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn; import org.springframework.context.annotation.DependsOn;
@ -14,6 +15,7 @@ import xiaozhi.modules.sys.service.SysParamsService;
@Configuration @Configuration
@DependsOn("liquibase") @DependsOn("liquibase")
@ConditionalOnProperty(prefix = "spring.liquibase", name = "enabled", havingValue = "true", matchIfMissing = true)
public class SystemInitConfig { public class SystemInitConfig {
@Autowired @Autowired
@ -45,4 +47,4 @@ public class SystemInitConfig {
// 初始化设备通讯录缓存 // 初始化设备通讯录缓存
deviceAddressBookService.refreshCache(); deviceAddressBookService.refreshCache();
} }
} }

View file

@ -42,7 +42,8 @@ public class TimbreEntity {
private String referenceText; private String referenceText;
@Schema(description = "Sort Order") @Schema(description = "Sort Order")
private long sort; @TableField(updateStrategy = FieldStrategy.NOT_NULL)
private Long sort;
@Schema(description = "Corresponding TTS Model Primary Key") @Schema(description = "Corresponding TTS Model Primary Key")
private String ttsModelId; private String ttsModelId;

View file

@ -9,6 +9,7 @@ import org.junit.jupiter.api.Assertions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Import;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;