节点手册:文档操作与查询

适用版本:ChengOS v0.1.0+ | 最后核对:2026-08-13 | 来源:crates/cheng-nodes/src/nodes/builtin/documentcrates/cheng-nodes/src/nodes/builtin/table

结构化内容的两种形态。文档以块为单位:document/ops_hub 像文件 Hub 一样按操作分发, 而单独的节点则显式地创建、查询和更新块。表格以记录为单位,包含查询节点、应用记录操作的节点, 以及把表格渲染成 LLM 上下文的节点。之所以有 format_for_llmbuild_llm_context, 是因为原始的文档或表格 JSON 并不适合当提示词 —— 它们产出的是模型真正该看到的、有上限且可读的形式。 Shadow 会话的内部机件是隐藏的,由 Hub 驱动。

文档操作中心 — document/ops_hub

文档操作中心节点:通过开关控制 Agent 的文档操作能力

输入

字段 类型 必填 默认值 说明
operation string "" 输入 – 操作
document_id string 输入 – 文档 ID
config object (端口) 统一配置对象(可直接输入 JSON 文本). 连接端口,不是表单字段。 控件:text
workspace_id string 输入 – 工作空间 ID
allow_query boolean true 输入 – Allow 查询. 控件:switch
allow_format boolean true 输入 – Allow 格式. 控件:switch
allow_discovery boolean true 是否允许文档发现(列表/搜索)(只读). 控件:switch
allow_diff boolean true 是否允许差异预览建议的编辑(只读). 控件:switch
allow_update boolean false 输入 – Allow 更新. 控件:switch
allow_batch boolean false 是否允许批量文档操作(混合副作用). 控件:switch
allow_create boolean false 输入 – Allow 创建. 控件:switch
allow_duplicate boolean false 是否允许复制文档(中等副作用). 控件:switch
allow_import boolean false 是否允许从文本导入文档(中等副作用). 控件:switch
allow_delete_document boolean false 是否允许硬删除文档(高风险). 控件:switch
allow_rollback boolean false 是否允许从快照恢复/回滚文档(高风险). 控件:switch

输出

字段 类型 说明
operation string 输入 – 操作
requires_review boolean 此操作是否暂存了必须审查的影子版本.
shadow_id string 影子会话 ID(当写操作被暂存审查时).
document_id string 与暂存审查关联的文档 ID.
change_summary string 从影子应用输出中提取的变更摘要,供 Agent 进行最终/审查处理.
error string 输入 – 错误
result any 输入 – 结果
preview_context string 从影子应用输出中提取的预览上下文,供 Agent 进行最终/审查处理.

创建文档 — document/create

创建新文档

输入

字段 类型 必填 默认值 说明
context object (端口) null AgentContext 端口. 连接端口,不是表单字段。
title string null 输入 – 标题
initial_content string null 输入 – Initial 内容
block_type string paragraph 输入 – 块类型
priority enum normal 初始块优先级. 控件:select. 取值:low, normal, medium, high, critical
tags string null 初始块标签(逗号分隔)

输出

字段 类型 说明
context object (端口) AgentContext 端口. 连接端口,不是表单字段。
string string 输入 – 字符串
document_id string 输入 – 文档 ID
title string 输入 – 标题
root_block_id string 输入 – Root 块 ID
success boolean 输入 – 成功
error string 输入 – 错误

查询文档 — document/query

获取文档内容(块结构或 Markdown 格式)

输入

字段 类型 必填 默认值 说明
document_id string 输入 – 文档 ID. 控件:dynamic-select
include_content boolean true 输入 – Include 内容
as_markdown boolean false 输入 – As Markdown

输出

字段 类型 说明
success boolean 输入 – 成功
found boolean 输入 – 是否找到
document_id string 输入 – 文档 ID
title string 输入 – 标题
blocks array<object> 输入 – 块列表
markdown string 输入 – Markdown 内容
plain_text string 输入 – 纯文本
block_count integer 输入 – 块数量
character_count integer 输入 – Character 数量
error string 输入 – 错误
content_type string 输入 – 内容类型
root_block_id string 输入 – Root 块 ID

更新文档块 — document/update_block

更新文档中的特定块

输入

字段 类型 必填 默认值 说明
context object (端口) null AgentContext 端口. 连接端口,不是表单字段。
document_id string 选择要更新的文档. 控件:dynamic-select
block_id string 输入 – 块 ID
content string 输入 – 内容
block_type string null 输入 – 块类型
language string null 输入 – 语言
priority enum null 块优先级. 控件:select. 取值:low, normal, medium, high, critical
tags string null 块标签(逗号分隔)

输出

字段 类型 说明
context object (端口) AgentContext 端口. 连接端口,不是表单字段。
string string 输入 – 字符串
success boolean 输入 – 成功
block_id string 输入 – 块 ID
block_type string 输入 – 块类型
content string 输入 – 内容
document_version integer 输入 – Document 版本
error string 输入 – 错误

提取文档项 — document/extract_items

提取文档块标签和行,转换为循环可用项

输入

字段 类型 必填 默认值 说明
document_id string 选择文档,可按名称搜索. 控件:dynamic-select
extract_target enum tags 选择输出哪种载荷:标签,行,键值对,对象,分组. 控件:select. 取值:tags (Just the tag list.), lines (Just the line list.), pairs ({ tag, line } pairs.), objects (Structured object whose keys are tags, values are selected lines.), groups (Full { tag, lines } candidate pool.)
combine_mode enum list 组合模式:列表,顺序,随机,选中,zip,笛卡尔积. 控件:select. 取值:list (Simple flat list.), sequential (Iterate in document order (tags × lines, document-order interleaved).), random (One random pick per tag.), selected (Use selection_map to pick one line per tag.), zip (Align lines across tags by index.), cartesian (Cartesian product across tags.)
tag_filter string null 标签过滤器(逗号分隔,大小写不敏感,子串匹配)
tag_policy enum first_tag 如何处理包含多个标签的块. 控件:select. 取值:first_tag (Use only the first tag of a block as its group label.), all_tags (The same block belongs to every tag it carries.)
untagged_policy enum skip 如何处理没有标签的块. 控件:select. 取值:skip (Skip blocks without tags (default).), group (Group untagged blocks under the synthetic tag _untagged.)
selection_map object null 每个标签的用户选择(由弹窗组件填充). 控件:document-extract-selector. 依赖字段:document_id
random_seed string null 可选的随机种子,用于可复现的随机选择
max_items integer 0 最大输出项数量(0 = 不限制). 控件:number
delimiter string , 用于将项文本连接成 formatted_text 的分隔符
strict boolean false 当 selection_map 引用缺失行时报错. 控件:switch

输出

字段 类型 说明
items any 标准循环项数组
formatted_text string 项连接成的单个字符串
groups array<object> 标签 -> 候选行池
count integer 项数量
document_title string 文档标题(如有)
success boolean 节点是否执行成功
error string 致命错误信息(如有)
warnings array<string> 非致命警告

格式化文档 (LLM) — document/format_for_llm

读取并格式化文档供 LLM 使用,支持优先级和标签过滤

输入

字段 类型 必填 默认值 说明
context object (端口) null AgentContext 端口. 连接端口,不是表单字段。
document_id string 选择要读取的文档,可按名称搜索. 控件:dynamic-select
priority_filter enum all 按优先级过滤块. 控件:select. 取值:all (所有优先级), high_only (仅高优先级(High + Critical)), critical_only (仅 Critical), normal_and_above (Normal 及以上(Normal + High + Critical))
tag_filter string null 按标签过滤(逗号分隔,如:核心概念,API)
sort_order enum original 块排序顺序. 控件:select. 取值:original (按文档原始顺序), priority_desc (按优先级降序(Critical -> High -> Normal -> Low)), priority_asc (按优先级升序(Low -> Normal -> High -> Critical))
output_format enum markdown 输出格式. 控件:select. 取值:markdown (Markdown 格式), plain_text (纯文本), structured (结构化(包含块信息))
include_metadata boolean true 是否在输出中包含块标签和优先级信息
system_prompt string null 自定义系统提示词(可选). 控件:textarea
max_chars integer 0 最大字符限制(0 表示不限制)

输出

字段 类型 说明
context object (端口) AgentContext 端口. 连接端口,不是表单字段。
formatted_content string 格式化后的文档内容
preview_content string 便于预览的文档摘要,含标题,字符数和内容节选
blocks array<object> 结构化块列表
title string 输入 – 标题
block_count integer 输入 – 块数量
filtered_block_count integer 输入 – Filtered 块数量
character_count integer 输入 – Character 数量
truncated boolean 输入 – Truncated
success boolean 输入 – 成功
error string 输入 – 错误

查询表格 — table/query

查询表格数据,支持可选过滤

输入

字段 类型 必填 默认值 说明
table_id string 输入 – 表格 ID
record_ids array null 输入 – 记录 Ids
include_schema boolean true 输入 – Include 模式
page integer 1 输入 – 页码
page_size integer 100 输入 – 每页数量

输出

字段 类型 说明
success boolean 输入 – 成功
found boolean 输入 – Found
table object 输入 – 表
columns array<object> 输入 – Columns
records array<object> 输入 – 记录列表
total_records integer 输入 – 总数 记录列表
page integer 输入 – 页码
total_pages integer 输入 – 总数 Pages
error string 输入 – 错误
markdown string 输入 – Markdown
agent_context object (端口) AgentContext 端口(可直接连接 Agent 节点的 context 输入). 连接端口,不是表单字段。

应用表格操作 — table/apply_record_ops

批量插入,更新和删除表格记录

输入

字段 类型 必填 默认值 说明
table_id string 输入 – 表格 ID
operations array<enum> 输入 – 操作列表
summary string null 输入 – 摘要

输出

字段 类型 说明
success boolean 输入 – 成功
results array<object> 输入 – 结果
summary string 输入 – 摘要
table_id string 输入 – 表格 ID
records_affected integer 输入 – 记录列表 Affected
records_inserted integer 输入 – 记录列表 Inserted
records_updated integer 输入 – 记录列表 Updated
records_deleted integer 输入 – 记录列表 Deleted
error string 输入 – 错误

构建表格 LLM 上下文 — table/build_llm_context

从表格数据构建 LLM 上下文作为 Agent 输入

输入

字段 类型 必填 默认值 说明
table_id string 输入 – 表格 ID
selected_record_ids array null 输入 – 已选择 记录 Ids
instruction string 输入 – Instruction
format string json 输入 – 格式
max_records integer 100 输入 – Max 记录列表

输出

字段 类型 说明
success boolean 输入 – 成功
table_id string 输入 – 表格 ID
table_name string 输入 – 表 名称
system_prompt string 输入 – 系统提示词
table_context string 输入 – 表 上下文
user_prompt string 输入 – User Prompt
tools_json string 输入 – 工具 Json
llm_context string 输入 – Llm 上下文
agent_context object (端口) AgentContext 端口(可直接连接 Agent 节点的 context 输入). 连接端口,不是表单字段。
records_included integer 输入 – 记录列表 Included
column_count integer 输入 – 列数
error string 输入 – 错误
warnings array<string> 输入 – Warnings

下一步

© 版权声明
THE END
喜欢就支持一下吧
点赞14 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容