`Class AbstractSkillSource<PathT>`
java.lang.Object
com.google.adk.skills.AbstractSkillSource<PathT>
- Type Parameters:
PathT- the type of path object
- All Implemented Interfaces:
SkillSource
- Direct Known Subclasses:
ClassPathSkillSource, LocalSkillSource
这是一个抽象基类,用于实现 `SkillSource` 接口;此类可以从类似对象的路径中加载技能数据。
-
嵌套类概述
Nested ClassesModifier and TypeClassDescriptionstatic final class这是一个容器类(container class),用于存储技能的名称以及该技能对应的 SKILL.md 文件的路径。 -
构造函数概述
Constructors -
方法概述
Modifier and TypeMethodDescriptionprotected abstract io.reactivex.rxjava3.core.Single<PathT> findResourcePath(String skillName, String resourcePath) 返回给定技能所对应资源的路径。protected abstract io.reactivex.rxjava3.core.Single<PathT> findSkillMdPath(String skillName) 返回给定技能对应的 SKILL.md 文件的路径。io.reactivex.rxjava3.core.Single<com.google.common.collect.ImmutableMap<String, Frontmatter>> 列出所有可用的选项。Frontmatter“s”代表已发现的技能(discovered skills)。protected abstract io.reactivex.rxjava3.core.Flowable<AbstractSkillSource.SkillMdPath<PathT>> 返回一个Flowable这些技能信息以“技能名称”与对应 SKILL.md 文件的路径的形式组合在一起进行存储。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) 加载特定的资源文件内容。protected abstract ReadableByteChannelopenChannel(PathT path) 打开一个InputStream用于读取指定路径下的内容。Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface SkillSource
listResourcesModifier and TypeMethodDescriptionio.reactivex.rxjava3.core.Single<com.google.common.collect.ImmutableList<String>> listResources(String skillName, String resourceDirectory) 列出指定目录中某个特定技能所使用的所有资源文件。
-
构造函数详细信息
-
AbstractSkillSource
public AbstractSkillSource()
-
-
方法详细信息(Method Details)
-
listFrontmatters
public io.reactivex.rxjava3.core.Single<com.google.common.collect.ImmutableMap<String, Frontmatter>> listFrontmatters()描述内容复制自接口文档:SkillSource列出所有可用的选项。Frontmatter“s”代表已发现的技能(discovered skills)。如果源配置错误(例如目录不存在,或者技能信息格式不正确),则返回的结果将会……
Single程序将以……方式终止。SkillSourceException根据消息中的原因(with the reason in the message)。- Specified by:
listFrontmattersin interfaceSkillSource- Returns:
- a
Singleemitting a map where keys are skill names and values are theirFrontmatter
-
loadFrontmatter
描述内容复制自接口文档:SkillSource加载……Frontmatter针对某项特定的技能(for a specific skill)。如果找不到该技能信息,或者其相关文档(frontmatter)的格式不正确,那么返回的结果将会是……(具体返回内容需要根据实际情况填写)。
Single将以……结尾SkillSourceException或者是因为解析错误(parsing error)。- Specified by:
loadFrontmatterin interfaceSkillSource- Parameters:
skillName- the name of the skill- Returns:
- a
Singleemitting theFrontmatterfor the skill
-
loadInstructions
描述内容复制自接口文档:SkillSource加载特定技能的指令(即 SKILL.md 文件中的内容)。如果该技能未被找到,或者其文件结构无效(例如:前置内容(frontmatter)块未正确关闭),则返回的……
Single程序将以……方式终止。SkillSourceException.- Specified by:
loadInstructionsin interfaceSkillSource- Parameters:
skillName- the name of the skill- Returns:
- a
Singleemitting the instructions as a String
-
loadResource
public io.reactivex.rxjava3.core.Single<com.google.common.io.ByteSource> loadResource(String skillName, String resourcePath) 描述内容复制自接口文档:SkillSource加载特定的资源文件内容。如果找不到该技能或相应的资源路径,系统将返回以下内容:
Single将以……结尾SkillSourceException.- Specified by:
loadResourcein interfaceSkillSource- Parameters:
skillName- the name of the skillresourcePath- the path to the resource file relative to the skill directory- Returns:
- a
Singleemitting theByteSourcefor the resource content
-
listSkills
protected abstract io.reactivex.rxjava3.core.Flowable<AbstractSkillSource.SkillMdPath<PathT>> listSkills()返回一个Flowable这些技能信息以“技能名称”与对应 SKILL.md 文件的路径的形式组合在一起进行存储。 -
findSkillMdPath
-
findResourcePath
-
openChannel
打开一个InputStream用于读取指定路径下的内容。- Throws:
IOException
-