Class PathSkillSource

java.lang.Object
com.google.adk.skills.AbstractSkillSource<com.google.common.reflect.ClassPath.ResourceInfo>
com.google.adk.skills.ClassPathSkillSource
All Implemented Interfaces:
SkillSource

public final class ClassPathSkillSource extends AbstractSkillSource<com.google.common.reflect.ClassPath.ResourceInfo>
从类路径(classpath)中加载所需的技能(或功能)。
  • 构造函数详细信息

    • ClassPathSkillSource

      public ClassPathSkillSource(String baseResourcePath)
      创建一个新的…… ClassPathSkillSource 该功能会从指定的基础资源路径(base resource path)加载相关技能数据,并使用当前线程的上下文类加载器(context class loader)来完成加载过程。
      Parameters:
      baseResourcePath - the base classpath path to scan for skills (e.g., "skills/")
    • ClassPathSkillSource

      public ClassPathSkillSource(String baseResourcePath, ClassLoader classLoader)
      创建一个新的…… ClassPathSkillSource 该功能会从指定的基础资源路径加载相关技能(即技能数据),并使用指定的方法或流程来进行加载操作。 ClassLoader.
      Parameters:
      baseResourcePath - the base classpath path to scan for skills
      classLoader - the class loader to use for scanning resources
  • 方法详细信息(Method Details)

    • listResources

      public io.reactivex.rxjava3.core.Single<com.google.common.collect.ImmutableList<String>> listResources(String skillName, String resourceDirectory)
      描述内容复制自接口文档: SkillSource
      列出指定目录中某个特定技能所使用的所有资源文件。

      如果该技能或资源目录不存在,那么返回的结果将会是……(具体内容需要根据实际情况填写)。 Single 将以……结尾 SkillSourceException.

      Parameters:
      skillName - the name of the skill
      resourceDirectory - the relative directory within the skill to list (e.g., "assets", "scripts")
      Returns:
      a Single emitting a list of resource paths relative to the skill directory
    • listSkills

      protected io.reactivex.rxjava3.core.Flowable<AbstractSkillSource.SkillMdPath<com.google.common.reflect.ClassPath.ResourceInfo>> listSkills()
      描述内容复制自相关类: AbstractSkillSource
      返回一个 Flowable 这些技能信息以“技能名称”与对应 SKILL.md 文件的路径的形式组合在一起进行存储。
      Specified by:
      listSkills in class AbstractSkillSource<com.google.common.reflect.ClassPath.ResourceInfo>
    • findSkillMdPath

      protected io.reactivex.rxjava3.core.Single<com.google.common.reflect.ClassPath.ResourceInfo> findSkillMdPath(String skillName)
      描述内容复制自相关类: AbstractSkillSource
      返回给定技能对应的 SKILL.md 文件的路径。
      Specified by:
      findSkillMdPath in class AbstractSkillSource<com.google.common.reflect.ClassPath.ResourceInfo>
    • findResourcePath

      protected io.reactivex.rxjava3.core.Single<com.google.common.reflect.ClassPath.ResourceInfo> findResourcePath(String skillName, String resourcePath)
      描述内容复制自相关类: AbstractSkillSource
      返回给定技能所对应资源的路径。
      Specified by:
      findResourcePath in class AbstractSkillSource<com.google.common.reflect.ClassPath.ResourceInfo>
    • openChannel

      protected ReadableByteChannel openChannel(com.google.common.reflect.ClassPath.ResourceInfo path) throws IOException
      描述内容复制自相关类: AbstractSkillSource
      打开一个 InputStream 用于读取指定路径下的内容。
      Specified by:
      openChannel in class AbstractSkillSource<com.google.common.reflect.ClassPath.ResourceInfo>
      Throws:
      IOException