You need to enable JavaScript to run this app.
文档中心
向量数据库VikingDB

向量数据库VikingDB

复制全文
下载 pdf
知识编译(Compile)
compile-知识编译
复制全文
下载 pdf
compile-知识编译
请求接口​
​
URI​
/api/v1/compile​
请求方法​
POST​
请求头​
Content-Type: application/jsonAuthorization: Bearer {api_key}​
​
请求参数​
请求体为 JSON 对象。​
​
参数​
类型​
必选​
默认值​
备注​
from​
string[]​
是​
--​
来源目录 URI 列表,指定本次编译需要读取的资源。至少包含一个 URI,每个元素均为非空字符串。即使只有一个来源,也必须使用数组。示例:["viking://resources/research"]。​
to​
string​
是​
--​
编译产物的目标目录 URI,必须为非空字符串,不能为resources根目录(viking://resources)。​
skill​
string​
是​
--​
用于执行编译的技能 URI,必须为非空字符串。​
instruction​
string​
否​
空字符串​
本次编译的补充指令,用于说明整理范围、输出格式或内容要求。​
​
响应消息​
提交成功返回 HTTP 200。以下为主要响应字段;任务 ID 可用于后续查询任务进度。​
​
字段​
类型​
参数说明​
status​
string​
请求状态。成功为 "ok",失败为 "error"。​
result​
object​
提交成功后返回的任务对象。​
result.task_id​
string​
任务唯一标识,用于查询任务进度。​
result.task_type​
string​
任务类型,为 "compile"。​
result.status​
string​
任务状态。新提交的任务可返回 "pending",表示等待执行。​
result.stage​
string​
任务当前执行阶段。"queued" 表示任务已进入队列。​
result.created_at​
number​
任务创建时间,Unix 时间戳,单位为秒。​
result.updated_at​
number​
任务更新时间,Unix 时间戳,单位为秒。​
result.created_at_iso​
string​
ISO 8601 格式的任务创建时间。​
result.updated_at_iso​
string​
ISO 8601 格式的任务更新时间。​
result.meta​
object​
任务元数据。​
error​
object / null​
本次请求的错误对象,成功时为 null 或不返回。​
error.code​
string​
错误码。​
error.message​
string​
可读的错误描述。​
​
常见错误码:​
​
error.code​
说明​
AuthenticationError / UNAUTHENTICATED​
缺少 API Key 或 API Key 无效。​
AccessDenied / PERMISSION_DENIED​
权限不足,例如无权读取来源目录或技能,或无权写入目标目录。​
InvalidParameter / INVALID_ARGUMENT​
参数错误,例如 from 为空数组、to 或 skill 未提供,或字段类型不正确。​
​
完整示例​
将研究资料目录中的内容按主题整理,写入目标知识库目录:​
​
curl -X POST https://xxx/api/v1/compile \​
-H 'Authorization: Bearer {api_key}' \​
-H 'Content-Type: application/json' \​
-d '{​
"from": [​
"viking://resources/research"​
],​
"to": "viking://resources/research-wiki",​
"skill": "viking://agent/{agent_id}/skills/research-compiler",​
"instruction": "按主题整理研究资料,生成 Markdown 知识库,并保留来源引用。"​
}'​
​
提交成功返回 HTTP 200,响应示例(仅展示主要字段):​
​
{​
"status": "ok",​
"result": {​
"task_id": "cmp_0123456789abcdef0123456789abcdef",​
"task_type": "compile",​
"status": "pending",​
"stage": "queued",​
"created_at": 1788825600.0,​
"updated_at": 1788825600.0,​
"created_at_iso": "2026-09-08T00:00:00+00:00",​
"updated_at_iso": "2026-09-08T00:00:00+00:00"​
},​
"error": null​
}​
​
请求处理失败(缺少 API Key 或 API Key 无效)返回 HTTP 401,响应示例(仅展示主要字段):​
​
{​
"status": "error",​
"error": {​
"code": "AuthenticationError",​
"message": "The API key in the request is missing or invalid. Request ID: {request_id}"​
}​
}​
​
最近更新时间:2026.09.23 11:24:43
这个页面对您有帮助吗?
有用
有用
无用
无用