查询 Wiki

更新时间:
复制 MD 格式

使用 GetWiki 接口查询三段 Agent Scope 对应的 Wiki。首次调用时自动创建该 Wiki。

前提条件

  • 已创建 AgentStorage 实例且状态为 normal,并获取实例访问地址(endpoint)和实例名。

  • 已创建 API Key。

  • Wiki 操作使用完整三段 Agent Scope(appId/tenantId/agentId),每段非空且不能为 *,最长 128 字节,不能包含 /;不要传入 runId。

  • 构建为异步过程,构建状态通过本接口返回的 latestBuild.status 查询,需轮询直至 ready 或失败。

请求参数

字段

类型

必填

说明

memoryStoreName

string

是

记忆库名称。

scope

object

是

完整三段 Agent Scope。

scope.appId

string

是

应用标识。

scope.tenantId

string

是

租户或用户标识。

scope.agentId

string

是

Agent 标识。

Scope 字段均不允许为空或使用 *,每段最长 128 字节,不能包含 /。不要传入 runId。

请求示例

使用 API Key 认证时,通过 x-ots-instancename 和 x-ots-apikey 请求头传入实例名和 API Key。

curl -X POST https://<endpoint>/GetWiki \
  -H "x-ots-instancename: <instance-name>" \
  -H "x-ots-apikey: <your-api-key>" \
  -H "Content-Type: application/json" \
  -d '{
  "memoryStoreName": "agent_memory",
  "scope": {
    "appId": "app-001",
    "tenantId": "user-001",
    "agentId": "assistant"
  }
}'

响应

字段

说明

name

Wiki 名称,默认 Wiki。

summary

Wiki 摘要;未设置时省略。

status

Wiki 状态:draft 或 ready。

pageCount

当前已发布页面数量。

hasPendingChanges

来源是否存在尚未构建发布的变化。

latestBuild

最近一次构建;尚未发起构建时省略。

createdAt、updatedAt

创建和更新时间。

latestBuild 字段如下。

字段

说明

status

构建状态。

step

当前处理步骤;无可用值时省略。

progress

当前进度;无可用值时省略。

changes.added、modified、deleted

相对上一已发布版本的来源变化数。

changes.affectedPages

受来源变化影响的页面数。

pageCount、totalBytes

构建生成的页面数和页面数据总字节数。

quality

构建质量指标;完成质量检查后返回。quality 包含 sourceCoverage、groundedPageRate、brokenLinkCount、orphanPageCount、uncitedPageCount 和 duplicateTitleCount。

errorMessage

构建失败原因;没有错误时省略。

createdAt、updatedAt、finishedAt

构建时间信息。

{
    "name": "Wiki",
    "status": "draft",
    "pageCount": 0,
    "hasPendingChanges": false,
    "createdAt": "2026-09-16T12:21:46.826185003Z",
    "updatedAt": "2026-09-16T12:21:46.826185003Z"
}