agentscope-java
agentscope-java copied to clipboard
[Bug]: change `JarSkillRepositoryAdapter` to `ClasspathSkillRepository`, then can't load the skill correctly
Describe the bug my code before:
try (JarSkillRepositoryAdapter repository = new JarSkillRepositoryAdapter("skills")) {
allSkills = repository.getAllSkills();
} catch (Exception e) {
log.error("{} loadAgentSkill repository error:{}", getClass().getSimpleName(), e);
}
my code after:
try (ClasspathSkillRepository repository = new ClasspathSkillRepository("skills")) {
allSkills = repository.getAllSkills();
} catch (Exception e) {
log.error("{} loadAgentSkill repository error:{}", getClass().getSimpleName(), e);
}
My code before runs correctly with agentscope-java:1.0.8, but my code after runs failed with agentscope-java:1.0.9.
related log records:
ClasspathSkillRepository : Resource URL: jar:nested:/opt/app/xxx-app.jar/!BOOT-INF/lib/ai-provider-1.0-SNAPSHOT.jar!/skills
ClasspathSkillRepository : Actual resource path: BOOT-INF/lib/ai-provider-1.0-SNAPSHOT.jar
ClasspathSkillRepository : is in Jar environment: true
java.lang.RuntimeException: Failed to list skill directories
at io.agentscope.core.skill.util.SkillFileSystemHelper.getAllSkills(SkillFileSystemHelper.java:156)
at io.agentscope.core.skill.repository.ClasspathSkillRepository.getAllSkills(ClasspathSkillRepository.java:192)
I think the bug should occur in this part of the code.
Environment (please complete the following information):
- AgentScope-Java Version: 1.0.9
- Java Version: 17
this is my pr: https://github.com/agentscope-ai/agentscope-java/pull/837 to fix the bug