管理灏天文库文集和文档,支持新建文集、新建文档、查询文集/文档、更新文档、修改文档归属、管理文档层级。适用于 OpenClaw 自主写文章并上传、文集创建、文档入库、文档移动等场景。
通过服务端 API 调用,需配置 config.json 中的token(个人 API Token)。
--limit、--offset,由服务端固定限制。--collection-id(文集 ID);若没有文集 ID,需先 list_collections.py --name "文集名称" 查询,或向用户询问目标文集名称。--limit、--offset,由服务端固定限制。author 字段不可更新,只能更新 name、content、sort、parent。--from-collection-id。list_documents.py --collection-id <文集ID> --name "关键词" 或 定位要修改的文档,确认文档 ID。get_document.py --id <ID>update_document.py --id <ID> 修改标题、正文。list_collections.py --name "文集名称" 查询文集 ID;若不存在则询问是否新建。add_document.py --collection-id <ID> --name "标题" [--content 内容] [--content-file 文件路径]。create_collection.py --name "文集名称"。若使用 --get-if-exists 则同名已存在时直接返回已有 ID,不重复创建。list_documents.py --collection-id <文集ID> --name "关键词" 或 get_document.py --id <ID> 确认文档 ID。list_collections.py --name "关键词" 查询。move_document.py --id <文档ID> --collection-id <目标文集ID>;文档属于多个文集时需加 --from-collection-id <原文集ID>。config.json,填写token。HT_SKILL_SERVER_URL、HT_SKILL_TOKEN 优先级高于 config.json。pip install requests所有脚本位于 scripts/,在 client 根目录执行。
python scripts/create_collection.py --name "文集名称" [--description "50字内简介"] [--brief "500字以上详细介绍"]
python scripts/create_collection.py --name "文集名称" --get-if-exists
python scripts/add_document.py --collection-id 123 --name "文档标题" [--content "正文"] [--content-file 路径] [--parent 0]
python scripts/list_collections.py [--name "关键词"]
python scripts/get_collection.py --id 123 [--include-docs]
python scripts/list_documents.py --collection-id 123 [--name "关键词"]
# collection-id 必填。若无文集 ID,需先 list_collections 查询或向用户询问
python scripts/get_document.py --id 456
python scripts/update_document.py --id 456 --name "新标题"
python scripts/update_document.py --id 456 --content "新正文"
python scripts/update_document.py --id 456 --content-file 文件路径
python scripts/update_document.py --id 456 --sort 50
python scripts/update_document.py --id 456 --parent 0
# 将文档移动到目标文集
python scripts/move_document.py --id 456 --collection-id 789
# 文档属于多个文集时,需指定原文集 ID
python scripts/move_document.py --id 456 --collection-id 789 --from-collection-id 123
--id:文档 ID(必填)--collection-id:目标文集 ID(必填)--from-collection-id:原文集 ID;文档只属于一个文集可不填,属于多个文集则必填python scripts/set_document_parent.py --collection-id 123 --document-id 456 --parent 0 [--sort 1]
parent=0 表示根文档;同级别 sort 越小越靠前Control Philips Hue lights and scenes via the OpenHue CLI.