From 40bd54cb728ff047f4f6e1174885fd026d1738c8 Mon Sep 17 00:00:00 2001 From: xkm Date: Sun, 17 May 2026 13:29:22 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=9C=A8SkillToolFactory=E4=B8=AD=E6=93=8D?= =?UTF-8?q?=E4=BD=9CAgentSkill=E5=AF=B9=E5=A4=96=E6=8F=90=E4=BE=9B?= =?UTF-8?q?=E7=9A=84=E6=96=B9=E6=B3=95=EF=BC=8C=E8=80=8C=E4=B8=8D=E6=98=AF?= =?UTF-8?q?=E7=A7=81=E6=9C=89=E5=B1=9E=E6=80=A7=EF=BC=8C=E6=8F=90=E5=8D=87?= =?UTF-8?q?=E5=A4=96=E9=83=A8=E5=8F=AF=E6=89=A9=E5=B1=95=E6=80=A7=E3=80=82?= =?UTF-8?q?=E5=A6=82=EF=BC=9A=E5=A4=96=E9=83=A8=E5=8F=AF=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E7=9B=91=E6=8E=A7getResource=E6=96=B9=E6=B3=95=E6=84=9F?= =?UTF-8?q?=E7=9F=A5=E6=8A=80=E8=83=BD=E6=B8=90=E8=BF=9B=E5=BC=8F=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/skill/SkillToolFactory.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/agentscope-core/src/main/java/io/agentscope/core/skill/SkillToolFactory.java b/agentscope-core/src/main/java/io/agentscope/core/skill/SkillToolFactory.java index 0ed633231..c30b1313b 100644 --- a/agentscope-core/src/main/java/io/agentscope/core/skill/SkillToolFactory.java +++ b/agentscope-core/src/main/java/io/agentscope/core/skill/SkillToolFactory.java @@ -22,6 +22,8 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Set; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; import reactor.core.publisher.Mono; @@ -169,14 +171,12 @@ private String loadSkillResourceImpl(String skillId, String path) { } // Get resource - Map resources = skill.getResources(); - if (resources == null || !resources.containsKey(path)) { - // Resource not found, return available resource paths + Set paths = skill.getResourcePaths(); + if (paths == null || !paths.contains(path)) { throw new IllegalArgumentException( - buildResourceNotFoundMessage(skillId, path, resources)); + buildResourceNotFoundMessage(skillId, path, paths)); } - - String resourceContent = resources.get(path); + String resourceContent = skill.getResource(path); activateSkill(skillId); return buildResourceResponse(skillId, path, resourceContent); } @@ -225,11 +225,11 @@ private String buildResourceResponse(String skillId, String path, String resourc * * @param skillId The skill ID * @param path The requested path that was not found - * @param resources The available resources map + * @param paths The available resources * @return Formatted error message with available resources */ private String buildResourceNotFoundMessage( - String skillId, String path, Map resources) { + String skillId, String path, Set paths) { StringBuilder message = new StringBuilder(); message.append("Resource not found: '") .append(path) @@ -241,8 +241,8 @@ private String buildResourceNotFoundMessage( List resourcePaths = new ArrayList<>(); resourcePaths.add("SKILL.md"); // Always add SKILL.md as the first resource - if (resources != null && !resources.isEmpty()) { - resourcePaths.addAll(resources.keySet()); + if (paths != null && !paths.isEmpty()) { + resourcePaths.addAll(paths); } message.append("Available resources:\n"); From 5c7f75cd40d285aae82359d71bf0473502f2cef8 Mon Sep 17 00:00:00 2001 From: xkm Date: Fri, 22 May 2026 12:53:18 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=9C=A8SkillToolFactory=E4=B8=AD=E6=93=8D?= =?UTF-8?q?=E4=BD=9CAgentSkill=E5=AF=B9=E5=A4=96=E6=8F=90=E4=BE=9B?= =?UTF-8?q?=E7=9A=84=E6=96=B9=E6=B3=95=EF=BC=8C=E8=80=8C=E4=B8=8D=E6=98=AF?= =?UTF-8?q?=E7=A7=81=E6=9C=89=E5=B1=9E=E6=80=A7=EF=BC=8C=E6=8F=90=E5=8D=87?= =?UTF-8?q?=E5=A4=96=E9=83=A8=E5=8F=AF=E6=89=A9=E5=B1=95=E6=80=A7=E3=80=82?= =?UTF-8?q?=E5=A6=82=EF=BC=9A=E5=A4=96=E9=83=A8=E5=8F=AF=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E7=9B=91=E6=8E=A7getResource=E6=96=B9=E6=B3=95=E6=84=9F?= =?UTF-8?q?=E7=9F=A5=E6=8A=80=E8=83=BD=E6=B8=90=E8=BF=9B=E5=BC=8F=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/agentscope/core/skill/SkillToolFactory.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/agentscope-core/src/main/java/io/agentscope/core/skill/SkillToolFactory.java b/agentscope-core/src/main/java/io/agentscope/core/skill/SkillToolFactory.java index c30b1313b..1943b8a42 100644 --- a/agentscope-core/src/main/java/io/agentscope/core/skill/SkillToolFactory.java +++ b/agentscope-core/src/main/java/io/agentscope/core/skill/SkillToolFactory.java @@ -23,7 +23,6 @@ import java.util.List; import java.util.Map; import java.util.Set; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; import reactor.core.publisher.Mono; @@ -173,8 +172,7 @@ private String loadSkillResourceImpl(String skillId, String path) { // Get resource Set paths = skill.getResourcePaths(); if (paths == null || !paths.contains(path)) { - throw new IllegalArgumentException( - buildResourceNotFoundMessage(skillId, path, paths)); + throw new IllegalArgumentException(buildResourceNotFoundMessage(skillId, path, paths)); } String resourceContent = skill.getResource(path); activateSkill(skillId); @@ -228,8 +226,7 @@ private String buildResourceResponse(String skillId, String path, String resourc * @param paths The available resources * @return Formatted error message with available resources */ - private String buildResourceNotFoundMessage( - String skillId, String path, Set paths) { + private String buildResourceNotFoundMessage(String skillId, String path, Set paths) { StringBuilder message = new StringBuilder(); message.append("Resource not found: '") .append(path)