Install
openclaw skills install @iguoguo/2ryun-skillUse when the user wants to import documents, build a knowledge base, search structured knowledge, generate websites from content, or publish sites. Use when the user mentions 2Ryun, 第二现实, knowledge base, 知识库, 文档管理, 知识图谱, 建站, 发布网站. 2Ryun is an AI-era knowledge/content platform where knowledge extraction from documents happens automatically once enabled — the agent's role is to decide which documents should enter the knowledge base and which should not.
openclaw skills install @iguoguo/2ryun-skill2Ryun(第二现实)为 AI Agent 提供文档管理、知识库、建站、笔记等能力。所有操作通过 REST API 调用(Authorization: Bearer <key> 鉴权,Key 从 2Ryun 设置页获取,格式为 sk- 前缀 + 多段随机字符)。
API 技术文档: 2ryun-api-spec.md — 完整 endpoint、参数、返回格式。
提取和组织是 2Ryun 自动完成的,Agent 不需要手动调用 extract/organize API。 Agent 只需要:
setting.wikiAutoExtract 决定是否让这篇文档进入知识库✅ 适合进入知识库("wikiAutoExtract": true):
❌ 不适合进入知识库("wikiAutoExtract": false,或不设置):
核心原则:如果一个文档是根据知识库中的知识生成的,它就不应该再被提取回知识库。只有包含新信息的文档才值得进入。
积累和管理文档,并决定哪些进入知识库。
从文本内容创建:
curl -X POST https://www.2ryun.com/restapi/documents/create \
-H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" \
-d '{
"title": "文档标题",
"content": "Markdown 正文",
"tags": ["标签1"],
"setting": {"wikiAutoExtract": true}
}'
"wikiAutoExtract": true 表示这篇文档应进入知识库。如果是衍生内容则设为 false。
⚠️ 提取需要时间:文档创建后,2Ryun 在后台异步提取和组织知识,不会立即出现在知识库中。单篇文档通常 1-3 分钟,批量可能更长。如果创建后立刻搜索,可能查不到刚入库的内容。告知用户稍等片刻再查询。
从文件导入:
curl -X POST https://www.2ryun.com/restapi/documents/import \
-H "Authorization: Bearer $API_KEY" \
-F "file=@/path/to/file.pdf" -F "title=文档标题"
导入的文档默认自动提取。支持 pdf、docx、xlsx、pptx、md、txt、html。
# 列表
curl "https://www.2ryun.com/restapi/documents?page=1&pageSize=20" \
-H "Authorization: Bearer $API_KEY"
# 搜索
curl "https://www.2ryun.com/restapi/documents/search?q=关键词" \
-H "Authorization: Bearer $API_KEY"
# 获取单篇
curl "https://www.2ryun.com/restapi/documents/:id" -H "Authorization: Bearer $API_KEY"
PUT /restapi/documents/update/:id -d '{"title":"...","content":"..."}'DELETE /restapi/documents/delete/:id知识库在文档创建时自动构建(提取→组织→关联)。Agent 只需查询和使用。
用户说:"帮我查一下 XX 相关的知识" / "我的知识库里有什么关于 XX 的"
curl "https://www.2ryun.com/restapi/wiki/search?q=查询词&max_results=10" \
-H "Authorization: Bearer $API_KEY"
返回语义相似的知识条目,按相关度排序。用于回答问题、查找背景信息、辅助写作。
# 可视化用(节点+边)
curl "https://www.2ryun.com/restapi/wiki/graph?root_id=xxx" -H "Authorization: Bearer $API_KEY"
# 带元数据
curl "https://www.2ryun.com/restapi/wiki/graph/data?max_nodes=100" -H "Authorization: Bearer $API_KEY"
用于了解知识结构、发现关联、识别知识空白。
# 条目列表
curl "https://www.2ryun.com/restapi/wiki/entries?limit=100" -H "Authorization: Bearer $API_KEY"
# 统计
curl "https://www.2ryun.com/restapi/wiki/stats" -H "Authorization: Bearer $API_KEY"
# 哪些文档已提取
curl "https://www.2ryun.com/restapi/wiki/extracted-status?content_ids=id1,id2" \
-H "Authorization: Bearer $API_KEY"
当用户明确要求重新提取或手动控制时:
POST /restapi/wiki/extract — 单篇提取POST /restapi/wiki/extract-batch — 批量提取POST /restapi/wiki/organize — 手动整理大多数情况下不需要调用这些,因为文档创建时已自动触发。
将内容和知识转化为精美网页,构建站点并发布。
GET /restapi/documents/:idcurl "https://www.2ryun.com/restapi/gen-html/templates" -H "Authorization: Bearer $API_KEY"
article-magazine,技术文档→documentation,产品介绍→landing-page,综合站点→magazine-minimal。不要硬编码模板,始终从接口获取并根据内容匹配。curl -X POST https://www.2ryun.com/restapi/gen-html/generate \
-H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" \
-d '{"content":"Markdown 内容","title":"页面标题","template":"选定的模板名"}'
POST /restapi/gen-html/generations/GEN_ID/publishhttps://www.2ryun.com/restapi/gen-html/public/GEN_IDGET /restapi/documents/fulltree/:rootIdcurl -X POST https://www.2ryun.com/restapi/gen-html/sites \
-H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" \
-d '{"name":"站点名","content_id":"根文档id","template":"magazine-minimal","docs":[...]}'
docs = [{"content_id":"...","title":"...","content":"...","parent_id":"..."}]POST /restapi/gen-html/sites/SITE_ID/publishhttps://www.2ryun.com/s/SITE_IDGET /restapi/wiki/search?q=主题&max_results=10POST /restapi/gen-html/generate注意:生成的报告是新文档,但内容来源于已有知识库,不应设置 wikiAutoExtract: true。
已生成的网页可以通过对话方式继续编辑:
curl -X POST https://www.2ryun.com/restapi/gen-html/generations/GEN_ID/chat \
-H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" \
-d '{"feedback": "把标题改成红色,字号加大到 48px"}'
支持选中页面的某个局部区域进行针对性编辑,传入选中区域的 HTML:
curl -X POST https://www.2ryun.com/restapi/gen-html/generations/GEN_ID/chat \
-H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" \
-d '{"feedback": "把这段改成蓝色背景", "selected_html": "<div>...</div>"}'
笔记(Note)比文档更轻量,不提取知识库,适合日常记录、随手记、灵感备忘。
curl -X POST https://www.2ryun.com/restapi/note/create \
-H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" \
-d '{"title": "会议备忘", "content": "Markdown 正文"}'
GET /restapi/note?page=1&pageSize=20 — 笔记列表GET /restapi/note/:id — 获取单篇PUT /restapi/note/update/:id -d '{"title":"...","content":"..."}' — 更新DELETE /restapi/note/delete/:id — 删除笔记 vs 文档:笔记不进入知识库,没有 wikiAutoExtract 设置。适合临时内容、随手记、灵感备忘。需要长期保存并进入知识库的内容用文档。
| 状态码 | 含义 | Agent 行为 |
|---|---|---|
| 200 | 成功 | — |
| 400 | 参数错误 | 检查请求体,修正后重试一次 |
| 401 | API Key 无效或缺失 | 提示用户检查 Key 是否正确,或去设置页重新生成 |
| 402 | 积分/配额不足 | 告知用户,引导到 /pricing 升级,不要重试 |
| 403 | 权限不足 | 检查 Key 的 scope,可能需要 api:write 或 api:admin |
| 404 | 资源不存在 | 确认 ID 是否正确 |
| 429 | 请求过于频繁 | 等待 Retry-After 秒后重试,或降低请求频率 |
| 500 | 服务端错误 | 等待 3 秒后重试一次,仍失败则告知用户稍后再试 |
| 任务 | 端点 | 说明 |
|---|---|---|
| 创建文档 | POST /restapi/documents/create | setting.wikiAutoExtract 决定是否入知识库 |
| 导入文件 | POST /restapi/documents/import | 自动转换格式,导入为文档 |
| 搜索知识 | GET /restapi/wiki/search?q=... | 语义搜索 |
| 创建笔记 | POST /restapi/note/create | 轻量记录,不提取知识库 |
| 查询积分 | GET /restapi/users/quota | 积分、配额、有效期 |
| 生成网页 | POST /restapi/gen-html/generate | 30-120s |
| 聊天编辑 | POST /restapi/gen-html/generations/:id/chat | 对话式编辑网页 |
| 创建站点 | POST /restapi/gen-html/sites | 从文档树构建 |
| 发布 | POST /restapi/gen-html/*/publish | 获取公开 URL |
wikiAutoExtract: falsewikiAutoExtract 选项,天生不进知识库。临时记录、灵感备忘用笔记setting/pricing,不重试