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)中加载所需的技能(或功能)。
-
嵌套类概述
Nested classes/interfaces inherited from class AbstractSkillSource
AbstractSkillSource.SkillMdPath<PathT>Modifier and TypeClassDescriptionstatic final class这是一个容器类(container class),用于存储技能的名称以及该技能对应的 SKILL.md 文件的路径。 -
构造函数概述
ConstructorsConstructorDescriptionClassPathSkillSource(String baseResourcePath) 创建一个新的……ClassPathSkillSource该功能会从指定的基础资源路径(base resource path)加载相关技能数据,并使用当前线程的上下文类加载器(context class loader)来完成加载过程。ClassPathSkillSource(String baseResourcePath, ClassLoader classLoader) 创建一个新的……ClassPathSkillSource该功能会从指定的基础资源路径加载相关技能(即技能数据),并使用指定的方法或流程来进行加载操作。ClassLoader. -
方法概述
Modifier and TypeMethodDescriptionprotected io.reactivex.rxjava3.core.Single<com.google.common.reflect.ClassPath.ResourceInfo> findResourcePath(String skillName, String resourcePath) 返回给定技能所对应资源的路径。protected io.reactivex.rxjava3.core.Single<com.google.common.reflect.ClassPath.ResourceInfo> findSkillMdPath(String skillName) 返回给定技能对应的 SKILL.md 文件的路径。io.reactivex.rxjava3.core.Single<com.google.common.collect.ImmutableList<String>> listResources(String skillName, String resourceDirectory) 列出指定目录中某个特定技能所使用的所有资源文件。protected io.reactivex.rxjava3.core.Flowable<AbstractSkillSource.SkillMdPath<com.google.common.reflect.ClassPath.ResourceInfo>> 返回一个Flowable这些技能信息以“技能名称”与对应 SKILL.md 文件的路径的形式组合在一起进行存储。protected ReadableByteChannelopenChannel(com.google.common.reflect.ClassPath.ResourceInfo path) 打开一个InputStream用于读取指定路径下的内容。Methods inherited from class AbstractSkillSource
listFrontmatters, loadFrontmatter, loadInstructions, loadResourceModifier and TypeMethodDescriptionio.reactivex.rxjava3.core.Single<com.google.common.collect.ImmutableMap<String, Frontmatter>> 列出所有可用的选项。Frontmatter“s”代表已发现的技能(discovered skills)。io.reactivex.rxjava3.core.Single<Frontmatter> loadFrontmatter(String skillName) 加载……Frontmatter针对某项特定的技能(for a specific skill)。io.reactivex.rxjava3.core.Single<String> loadInstructions(String skillName) 加载特定技能的指令(即 SKILL.md 文件中的内容)。io.reactivex.rxjava3.core.Single<com.google.common.io.ByteSource> loadResource(String skillName, String resourcePath) 加载特定的资源文件内容。
-
构造函数详细信息
-
ClassPathSkillSource
创建一个新的……ClassPathSkillSource该功能会从指定的基础资源路径(base resource path)加载相关技能数据,并使用当前线程的上下文类加载器(context class loader)来完成加载过程。- Parameters:
baseResourcePath- the base classpath path to scan for skills (e.g., "skills/")
-
ClassPathSkillSource
创建一个新的……ClassPathSkillSource该功能会从指定的基础资源路径加载相关技能(即技能数据),并使用指定的方法或流程来进行加载操作。ClassLoader.- Parameters:
baseResourcePath- the base classpath path to scan for skillsclassLoader- 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 skillresourceDirectory- the relative directory within the skill to list (e.g., "assets", "scripts")- Returns:
- a
Singleemitting 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:
listSkillsin classAbstractSkillSource<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:
findSkillMdPathin classAbstractSkillSource<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:
findResourcePathin classAbstractSkillSource<com.google.common.reflect.ClassPath.ResourceInfo>
-
openChannel
protected ReadableByteChannel openChannel(com.google.common.reflect.ClassPath.ResourceInfo path) throws IOException 描述内容复制自相关类:AbstractSkillSource打开一个InputStream用于读取指定路径下的内容。- Specified by:
openChannelin classAbstractSkillSource<com.google.common.reflect.ClassPath.ResourceInfo>- Throws:
IOException
-