Skip to content

Commit 42a5938

Browse files
committed
fix(Jmanus): 修改配置文件加载方式,规避yml文件加载错误
1 parent 5861138 commit 42a5938

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

spring-ai-alibaba-jmanus/src/main/java/com/alibaba/cloud/ai/example/manus/dynamic/agent/startupAgent/StartupAgentConfigLoader.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,15 @@ public AgentConfig loadAgentConfig(String agentName, String language) {
113113
configPath = CONFIG_BASE_PATH + agentName.toLowerCase() + "/agent-config.yml";
114114
}
115115

116-
String configContent = loadConfigContent(configPath);
117-
118-
if (configContent.isEmpty()) {
119-
log.warn("Agent configuration file does not exist or is empty: {}", configPath);
120-
return null;
121-
}
122-
123116
try {
117+
ClassPathResource resource = new ClassPathResource(configPath);
118+
if (!resource.exists()) {
119+
log.warn("Configuration file does not exist: {}", configPath);
120+
return null;
121+
}
122+
124123
Yaml yaml = new Yaml();
125-
Map<String, Object> yamlData = yaml.load(configContent);
124+
Map<String, Object> yamlData = yaml.load(resource.getInputStream());
126125

127126
if (yamlData == null) {
128127
log.warn("YAML configuration file parsing result is empty: {}", configPath);

0 commit comments

Comments
 (0)