API 参考 · 7. 动态知识库 · dkMaintainRevisionNotes

修订说明维护

POST/open/v1/knowledge/revision-notes异步任务预览scope: dkRead

这是预览能力:字段与行为可能在后续 minor 版本中调整,调整会写进更新日志。近 30 天内新增的能力,或在生产环境 90 天内没有调用记录的能力,标为「预览」;其余为「稳定」。预览能力的字段与行为可能在后续 minor 版本中调整,调整会写进更新日志。

接入前必读:完整状态、效力、鉴权、异步及错误边界见动态知识库接入指南:/swagger-ui/open-v1/docs/dynamic-knowledge。

分支调用边界:以下列出本页样例基础形态的权限与条件头;历史revision、confirmed标注、分组及参考稿保存的附加要求见各分支正文和接入指南,组合权限须同时具备。字段、类型、默认值、上限及互斥条件以本页请求Schema为准。业务响应no-store,写入后读取最新ETag,异步结果沿原任务入口取得。

GenerateDirectRevisionNotes · action=generate:必填action、payload、input_mode;权限dkWrite;Idempotency-Key必填;If-Match不需要;成功HTTP 200。input_mode=direct,传baseline_id、final_id及before_document/after_document;块id应跨版本稳定。可附events、references、unresolved_items和human_opinions。同步200返回修订对照、摘要、完整快照与核对状态。只传正文为comparison_only;事件逐项重放一致为events_verified;不符为inconsistent并列明问题,记录退回正文差异,不沿用未经核实的事件理由。依据引用逐字核对;理由、意见均属调用方提供。无需建库,不调用模型,不自动保存、确认或发布;dkWrite和Idempotency-Key必需,计算不保存幂等键。由现有Key、dkWrite与Space状态授权,无额外环境准入。apply已返回记录,无须重复调用。

ConfirmKnowledgeNoteContent · action=confirm_content:必填action、kb_id、note_id、payload;权限dkConfirm+dkRead+dkWrite;Idempotency-Key必填;If-Match必填;成功HTTP 202。确认当前修订说明内容用于问答,不确认因果判断或制度关系。要求dkRead、dkWrite、dkConfirm及If-Match;说明正文、来源或关联信息变化后需重新确认,旧快照不能借用新确认。

CreateKnowledgeRevisionNote · action=save:必填action、kb_id、payload;权限dkWrite;Idempotency-Key必填;If-Match不需要;成功HTTP 202。text/source_ref恰好一种;version_pairs必须显式提供,[]表示不指定版本关联的独立说明,关系保持待核对;非空前后版须同一主体且不同。新增的是修订说明,不是已确认变化原因;手工声明版本对也不自动确认因果,内容仍须单独确认用于问答。

EditKnowledgeRevisionNote · action=save:必填action、kb_id、note_id、payload;权限dkWrite;Idempotency-Key必填;If-Match必填;成功HTTP 202。修改说明后重新处理,保留修订记录;依赖旧说明的关系和原因可能待复核。provided_record省略保留、null清空;不得用当前说明来源替代旧任务原来源授权。

GetKnowledgeRevisionNote · action=get:必填action、kb_id、note_id;权限dkRead;Idempotency-Key不需要;If-Match不需要;成功HTTP 200。读取独立说明及关联/处理状态;当前读取还返回content_confirmed及confirmation_index,历史revision不附当前状态。正文、来源或关联改变后旧确认失效,活动快照有该对象也不代表已确认。说明可以没有普通文档目录项,不能据目录未命中判定跨库。来源可读仍不代表原件已完整、原因已确认。

ListKnowledgeRevisionNotes · action=list:必填action、kb_id;权限dkRead;Idempotency-Key不需要;If-Match不需要;成功HTTP 200。列出本库说明及状态,独立说明在此读取,不在list_documents重复显示;逐项来源核验和分页规则同样适用。

共同限制:ready不等于released,确认/快照发布不等于制度正式发布;旧来源撤权不能靠历史快照绕过。

请求

鉴权:请求头 X-Aistrong-Key;可选 X-Request-Id 贯穿追踪。请求体类型:application/json

参数

名称位置类型约束说明
Idempotency-Key请求头string长度≥1;长度≤128仅写操作必填;同一次业务动作重试保持原值。
If-Match请求头string修改、确认、撤销、纠错、索引设置和结构化新版保存必填;分组按对象ETag,指定批次另需本头部。

请求体

字段类型约束说明
方案 1object不接受额外字段
action必填常量 "generate"
payload必填object不接受额外字段
baseline_id必填string长度≥1;长度≤256
final_id必填string长度≥1;长度≤256
before_document必填object不接受额外字段
title任一默认 null
blocks必填array<object>项数≥1;项数≤1000
[ ]object不接受额外字段
id必填string长度≥1;长度≤128
typestring枚举 "paragraph" / "heading" / "table" / "formula";默认 "paragraph"
text必填string长度≤100000
section_patharray<string>项数≤32
table_cellsarray<object>项数≤10000
source_anchorobject不接受额外字段
page任一默认 null
bbox任一默认 null
coordinate_system任一默认 null
char_start任一默认 null
char_end任一默认 null
table_row任一默认 null
table_column任一默认 null
parent_id任一默认 null
number任一默认 null
after_document必填object不接受额外字段
title任一默认 null
blocks必填array<object>项数≥1;项数≤1000
[ ]object不接受额外字段
id必填string长度≥1;长度≤128
typestring枚举 "paragraph" / "heading" / "table" / "formula";默认 "paragraph"
text必填string长度≤100000
section_patharray<string>项数≤32
table_cellsarray<object>项数≤10000
source_anchorobject不接受额外字段
page任一默认 null
bbox任一默认 null
coordinate_system任一默认 null
char_start任一默认 null
char_end任一默认 null
table_row任一默认 null
table_column任一默认 null
parent_id任一默认 null
number任一默认 null
events任一默认 null
[ ]object不接受额外字段
event_id必填string
operation_id必填string
operation必填string枚举 "replace" / "delete" / "insert_after" / "renumber" / "update_reference"
block_id必填string
anchor_block_id必填任一
before必填任一
id必填string长度≥1;长度≤128
typestring枚举 "paragraph" / "heading" / "table" / "formula";默认 "paragraph"
text必填string长度≤100000
section_patharray<string>项数≤32
table_cellsarray<object>项数≤10000
source_anchorobject不接受额外字段
page任一默认 null
bbox任一默认 null
coordinate_system任一默认 null
char_start任一默认 null
char_end任一默认 null
table_row任一默认 null
table_column任一默认 null
parent_id任一默认 null
number任一默认 null
after必填任一
id必填string长度≥1;长度≤128
typestring枚举 "paragraph" / "heading" / "table" / "formula";默认 "paragraph"
text必填string长度≤100000
section_patharray<string>项数≤32
table_cellsarray<object>项数≤10000
source_anchorobject不接受额外字段
page任一默认 null
bbox任一默认 null
coordinate_system任一默认 null
char_start任一默认 null
char_end任一默认 null
table_row任一默认 null
table_column任一默认 null
parent_id任一默认 null
number任一默认 null
rationale必填任一
citations必填array<object>
[ ]object不接受额外字段
reference_id必填string长度≥1;长度≤128
block_id必填string长度≥1;长度≤128
quote必填string长度≥1;长度≤100000
reference_updatesarray<object>项数≤3000
[ ]object不接受额外字段
block_id必填string
field必填string枚举 "text" / "table_cells.text"
cell_index必填任一
offset_unit常量 "utf-16-code-unit"默认 "utf-16-code-unit"
source_start必填integer
source_end必填integer
result_start必填integer
result_end必填integer
quote必填string
target_block_id必填string
replacement必填string
reference_review_itemsarray<object>项数≤3000
[ ]object不接受额外字段
block_id必填string
field必填string枚举 "text" / "table_cells.text"
cell_index必填任一
offset_unit常量 "utf-16-code-unit"默认 "utf-16-code-unit"
source_start必填integer
source_end必填integer
result_start必填integer
result_end必填integer
quote必填string
reason必填string枚举 "ambiguous_target" / "target_deleted" / "unresolved_target" / "unqualified_reference" / "external_reference" / "compound_reference" / "quoted_reference" / "changed_source"
candidate_block_ids必填array<string>
message必填string
referencesarray<object>项数≤100
[ ]object不接受额外字段
id必填string长度≥1;长度≤128
text必填string长度≥1;长度≤100000
title必填string长度≥1;长度≤255
source_description必填string长度≥1;长度≤4000
unresolved_itemsarray<object>项数≤100
[ ]object不接受额外字段
id必填string长度≥1;长度≤128
text必填string长度≥1;长度≤4000
event_idsarray<string>项数≤1000
human_opinionsarray<object>项数≤100
[ ]object不接受额外字段
id必填string长度≥1;长度≤128
text必填string长度≥1;长度≤4000
event_idsarray<string>项数≤1000
reference_updatesarray<object>项数≤3000
[ ]object不接受额外字段
block_id必填string
field必填string枚举 "text" / "table_cells.text"
cell_index必填任一
offset_unit常量 "utf-16-code-unit"默认 "utf-16-code-unit"
source_start必填integer
source_end必填integer
result_start必填integer
result_end必填integer
quote必填string
target_block_id必填string
replacement必填string
reference_review_itemsarray<object>项数≤3000
[ ]object不接受额外字段
block_id必填string
field必填string枚举 "text" / "table_cells.text"
cell_index必填任一
offset_unit常量 "utf-16-code-unit"默认 "utf-16-code-unit"
source_start必填integer
source_end必填integer
result_start必填integer
result_end必填integer
quote必填string
reason必填string枚举 "ambiguous_target" / "target_deleted" / "unresolved_target" / "unqualified_reference" / "external_reference" / "compound_reference" / "quoted_reference" / "changed_source"
candidate_block_ids必填array<string>
message必填string
input_mode必填常量 "direct"
方案 2object不接受额外字段
action必填常量 "confirm_content"
kb_id必填string长度≥1;长度≤32
note_id必填string长度≥1;长度≤32
payload必填object不接受额外字段
edit_reason必填string长度≥1;长度≤1000
方案 3object不接受额外字段
action必填常量 "save"
kb_id必填string长度≥1;长度≤32
note_idnull默认 null
payload必填object不接受额外字段
text任一默认 null
source_ref任一默认 null
source_id必填string长度≥1;长度≤128;正则 ^[A-Za-z0-9_.-]+$
file_id必填string长度≥1;长度≤256
source_revision任一默认 null
provided_record任一默认 null
title必填string长度≥1;长度≤255
record_id任一默认 null
provider任一默认 null
recorded_at任一默认 null
version_pairs必填array<object>项数≤100
[ ]object不接受额外字段
from_version_id必填string
to_version_id必填string
edit_reasonstring默认 "添加修订说明";长度≥1;长度≤1000
方案 4object不接受额外字段
action必填常量 "save"
kb_id必填string长度≥1;长度≤32
note_id必填string长度≥1;长度≤32
payload必填object不接受额外字段
text任一默认 null
source_ref任一默认 null
source_id必填string长度≥1;长度≤128;正则 ^[A-Za-z0-9_.-]+$
file_id必填string长度≥1;长度≤256
source_revision任一默认 null
provided_record任一默认 null
title必填string长度≥1;长度≤255
record_id任一默认 null
provider任一默认 null
recorded_at任一默认 null
version_pairs必填array<object>项数≤100
[ ]object不接受额外字段
from_version_id必填string
to_version_id必填string
edit_reasonstring默认 "添加修订说明";长度≥1;长度≤1000
方案 5object不接受额外字段
action必填常量 "get"
kb_id必填string长度≥1;长度≤32
note_id必填string长度≥1;长度≤32
revision任一默认 null
方案 6object不接受额外字段
action必填常量 "list"
kb_id必填string长度≥1;长度≤32
cursorstring默认 "";长度≤32
limitinteger默认 50;≥1;≤100

响应

JSON 响应统一为信封结构:success / data / error / metering / request_id;下表描述 data。

200请求已成功处理application/json
展开 data 结构(263 个字段)
字段类型约束说明
data任一
方案 1object
id必填string
kb_id必填string
kind必填string
state必填string
parent_id必填string | null
revision必填integer≥1
etag必填string
body必填object对应 kind 的固定修订内容;读取历史修订需要审计权限。
content_confirmedboolean
confirmation_indexobject
state必填任意枚举 "not_eligible" / "pending" / "ready" / "failed"
job_id必填string | null
action必填常量 "get"
方案 2object
items必填array<object>
[ ]object
id必填string
kb_id必填string
kind必填string
state必填string
parent_id必填string | null
revision必填integer≥1
etag必填string
body必填object对应 kind 的固定修订内容;读取历史修订需要审计权限。
content_confirmedboolean
confirmation_indexobject
state必填任意枚举 "not_eligible" / "pending" / "ready" / "failed"
job_id必填string | null
next_cursor必填string | null
action必填常量 "list"
方案 3object不接受额外字段
action必填常量 "generate"
input_mode常量 "direct"默认 "direct"
record_id必填string
baseline_id必填string
final_id必填string
baseline_fingerprint必填string
final_fingerprint必填string
verification_status必填string枚举 "comparison_only" / "events_verified" / "inconsistent"
event_source必填string枚举 "supplied_verified" / "snapshot_comparison"
summary_text必填string
revision_notes必填object不接受额外字段
baseline_id必填string
result_id必填string
summary必填object不接受额外字段
total必填integer
replace必填integer
delete必填integer
insert_after必填integer
renumberinteger默认 0
update_referenceinteger默认 0
rows必填array<object>
[ ]object不接受额外字段
event_id必填string
operation_id必填string
operation必填string枚举 "replace" / "delete" / "insert_after" / "renumber" / "update_reference"
block_id必填string
before_text必填任一
after_text必填任一
before_number必填任一
after_number必填任一
rationale必填任一
citations必填array<object>
[ ]object不接受额外字段
reference_id必填string长度≥1;长度≤128
block_id必填string长度≥1;长度≤128
quote必填string长度≥1;长度≤100000
reference_updatesarray<object>
[ ]object不接受额外字段
block_id必填string
field必填string枚举 "text" / "table_cells.text"
cell_index必填任一
offset_unit常量 "utf-16-code-unit"默认 "utf-16-code-unit"
source_start必填integer
source_end必填integer
result_start必填integer
result_end必填integer
quote必填string
target_block_id必填string
replacement必填string
references必填array<object>
[ ]object不接受额外字段
id必填string长度≥1;长度≤128
text必填string长度≥1;长度≤100000
title必填string长度≥1;长度≤255
source_description必填string长度≥1;长度≤4000
unresolved_itemsarray<object>
[ ]object不接受额外字段
block_id必填string
field必填string枚举 "text" / "table_cells.text"
cell_index必填任一
offset_unit常量 "utf-16-code-unit"默认 "utf-16-code-unit"
source_start必填integer
source_end必填integer
result_start必填integer
result_end必填integer
quote必填string
reason必填string枚举 "ambiguous_target" / "target_deleted" / "unresolved_target" / "unqualified_reference" / "external_reference" / "compound_reference" / "quoted_reference" / "changed_source"
candidate_block_ids必填array<string>
message必填string
events必填array<object>
[ ]object不接受额外字段
event_id必填string
operation_id必填string
operation必填string枚举 "replace" / "delete" / "insert_after" / "renumber" / "update_reference"
block_id必填string
anchor_block_id必填任一
before必填任一
id必填string长度≥1;长度≤128
typestring枚举 "paragraph" / "heading" / "table" / "formula";默认 "paragraph"
text必填string长度≤100000
section_patharray<string>项数≤32
table_cellsarray<object>项数≤10000
source_anchorobject不接受额外字段
page任一默认 null
bbox任一默认 null
coordinate_system任一默认 null
char_start任一默认 null
char_end任一默认 null
table_row任一默认 null
table_column任一默认 null
parent_id任一默认 null
number任一默认 null
after必填任一
id必填string长度≥1;长度≤128
typestring枚举 "paragraph" / "heading" / "table" / "formula";默认 "paragraph"
text必填string长度≤100000
section_patharray<string>项数≤32
table_cellsarray<object>项数≤10000
source_anchorobject不接受额外字段
page任一默认 null
bbox任一默认 null
coordinate_system任一默认 null
char_start任一默认 null
char_end任一默认 null
table_row任一默认 null
table_column任一默认 null
parent_id任一默认 null
number任一默认 null
rationale必填任一
citations必填array<object>
[ ]object不接受额外字段
reference_id必填string长度≥1;长度≤128
block_id必填string长度≥1;长度≤128
quote必填string长度≥1;长度≤100000
reference_updatesarray<object>项数≤3000
[ ]object不接受额外字段
block_id必填string
field必填string枚举 "text" / "table_cells.text"
cell_index必填任一
offset_unit常量 "utf-16-code-unit"默认 "utf-16-code-unit"
source_start必填integer
source_end必填integer
result_start必填integer
result_end必填integer
quote必填string
target_block_id必填string
replacement必填string
reference_review_itemsarray<object>项数≤3000
[ ]object不接受额外字段
block_id必填string
field必填string枚举 "text" / "table_cells.text"
cell_index必填任一
offset_unit常量 "utf-16-code-unit"默认 "utf-16-code-unit"
source_start必填integer
source_end必填integer
result_start必填integer
result_end必填integer
quote必填string
reason必填string枚举 "ambiguous_target" / "target_deleted" / "unresolved_target" / "unqualified_reference" / "external_reference" / "compound_reference" / "quoted_reference" / "changed_source"
candidate_block_ids必填array<string>
message必填string
submitted_events必填任一
[ ]object不接受额外字段
event_id必填string
operation_id必填string
operation必填string枚举 "replace" / "delete" / "insert_after" / "renumber" / "update_reference"
block_id必填string
anchor_block_id必填任一
before必填任一
id必填string长度≥1;长度≤128
typestring枚举 "paragraph" / "heading" / "table" / "formula";默认 "paragraph"
text必填string长度≤100000
section_patharray<string>项数≤32
table_cellsarray<object>项数≤10000
source_anchorobject不接受额外字段
page任一默认 null
bbox任一默认 null
coordinate_system任一默认 null
char_start任一默认 null
char_end任一默认 null
table_row任一默认 null
table_column任一默认 null
parent_id任一默认 null
number任一默认 null
after必填任一
id必填string长度≥1;长度≤128
typestring枚举 "paragraph" / "heading" / "table" / "formula";默认 "paragraph"
text必填string长度≤100000
section_patharray<string>项数≤32
table_cellsarray<object>项数≤10000
source_anchorobject不接受额外字段
page任一默认 null
bbox任一默认 null
coordinate_system任一默认 null
char_start任一默认 null
char_end任一默认 null
table_row任一默认 null
table_column任一默认 null
parent_id任一默认 null
number任一默认 null
rationale必填任一
citations必填array<object>
[ ]object不接受额外字段
reference_id必填string长度≥1;长度≤128
block_id必填string长度≥1;长度≤128
quote必填string长度≥1;长度≤100000
reference_updatesarray<object>项数≤3000
[ ]object不接受额外字段
block_id必填string
field必填string枚举 "text" / "table_cells.text"
cell_index必填任一
offset_unit常量 "utf-16-code-unit"默认 "utf-16-code-unit"
source_start必填integer
source_end必填integer
result_start必填integer
result_end必填integer
quote必填string
target_block_id必填string
replacement必填string
reference_review_itemsarray<object>项数≤3000
[ ]object不接受额外字段
block_id必填string
field必填string枚举 "text" / "table_cells.text"
cell_index必填任一
offset_unit常量 "utf-16-code-unit"默认 "utf-16-code-unit"
source_start必填integer
source_end必填integer
result_start必填integer
result_end必填integer
quote必填string
reason必填string枚举 "ambiguous_target" / "target_deleted" / "unresolved_target" / "unqualified_reference" / "external_reference" / "compound_reference" / "quoted_reference" / "changed_source"
candidate_block_ids必填array<string>
message必填string
title_change必填任一
inconsistencies必填array<object>
[ ]object不接受额外字段
code必填string枚举 "invalid_event" / "before_mismatch" / "invalid_citation" / "final_mismatch" / "unknown_event"
event_id任一默认 null
block_id任一默认 null
message必填string
unresolved_items必填array<object>
[ ]object不接受额外字段
id必填string长度≥1;长度≤128
text必填string长度≥1;长度≤4000
event_idsarray<string>项数≤1000
human_opinions必填array<object>
[ ]object不接受额外字段
id必填string长度≥1;长度≤128
text必填string长度≥1;长度≤4000
event_idsarray<string>项数≤1000
202任务已受理;请使用 job_id 查询进度和结果application/json
字段类型约束说明
data任一
方案 1object
job_id必填string
status必填常量 "queued"
status_url必填string正则 ^/open/v1/job/[0-9a-f]{32}$查询任务状态,成功后在该地址追加 /result 读取结果。
etagstring
note_id必填string
action必填常量 "save"
方案 2object
job_id必填string
status必填常量 "queued"
status_url必填string正则 ^/open/v1/job/[0-9a-f]{32}$查询任务状态,成功后在该地址追加 /result 读取结果。
etagstring
note_id必填string
action必填常量 "confirm_content"

异步接口:返回 202 后,用 data.job_id 调用 getJob 轮询;状态 succeeded 后调用 getJobResult 读取结果。详见异步任务。

错误状态

HTTP含义
400请求参数无效
401API Key 无效
403API Key 无权限
404文档、任务或其他资源不存在
409幂等键、任务状态或资源状态冲突
412资源修订已变化,请重新读取后提交
413请求体过大
422文件内容无法转换(已确认文件被截断、不完整,重传无效)
428缺少资源修订前置条件 If-Match
429队列或模型并发额度已满,请稍后重试
503能力暂不可用

错误体的 error.code 取值见错误码。