数据集(collection)是数据中心的顶层容器。分类(category)用于组织数据集内的文件,支持多级嵌套。
通用约定(鉴权、Workspace ID、全局参数、输出格式、危险操作确认、Dry-run 模式)请参阅 总览文档。
创建 FILE 数据集。
用法
bl knowledge collection create --name <text> --description <text> [flags]参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
--name <text> |
string | 是 | 数据集名称(1-20 字符) |
--description <text> |
string | 是 | 数据集描述 |
--store-type <type> |
string | 否 | 存储类型:platform(托管,默认)或 custom(自有 OSS bucket) |
--oss-region <id> |
string | 否 | OSS region ID(--store-type custom 时必填) |
--oss-bucket <name> |
string | 否 | OSS bucket 名称(--store-type custom 时必填) |
参数约束
--name长度 1-20 字符--store-type只能是platform或custom--store-type custom时--oss-region和--oss-bucket必填
输出
text 模式:
created: conn-xxx (my-collection, PLATFORM)
quiet 模式:输出数据集 ID。
json 模式:返回 API 原始响应。
注意事项
platform使用平台托管存储;custom使用已授权的 OSS bucket。- 自定义 bucket 必须携带标签
bailian-connector-access=ReadAndWrite(百炼的标签访问控制),否则服务端报setBucketCORS failed误导性错误。 - 无数据集删除 API,创建需谨慎。
示例
# 创建平台托管的数据集
bl knowledge collection create --name my-collection --description "team docs" --workspace-id ws-xxx
# 创建使用自有 OSS bucket 的数据集
bl knowledge collection create --name oss-coll --description "own bucket" --store-type custom --oss-region cn-beijing --oss-bucket my-bucket查看数据集详情。
用法
bl knowledge collection get (--collection-id <id> | --name <text>) [flags]参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
--collection-id <id> |
string | 否¹ | 数据集 ID |
--name <text> |
string | 否¹ | 数据集名称 |
¹
--collection-id和--name二选一,必须提供其一。
参数约束
--collection-id和--name互斥,必须提供其一
输出
text 模式:
id: conn-xxx
name: my-collection
description: team docs
quiet 模式:输出数据集 ID。
json 模式:返回 API 原始响应。
注意事项
- getConnector 不返回
fileConnectorConfig(storeType/regionId/bucketName),这些字段仅在创建时通过请求体传入,查询时不可读回。
示例
# 按 ID 查询
bl knowledge collection get --collection-id conn-xxx --workspace-id ws-xxx
# 按名称查询
bl knowledge collection get --name my-collection列出数据中心分类。
用法
bl knowledge category list [flags]参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
--collection-id <id> |
string | 否 | 按数据集 ID 过滤 |
--parent-id <id> |
string | 否 | 列出此分类的子分类 |
--name <text> |
string | 否 | 按分类名称过滤(精确匹配,与知识库列表的模糊匹配不同) |
--next-token <token> |
string | 否 | 游标分页令牌 |
--max-result <n> |
number | 否 | 每页条数(默认:20) |
输出
text 模式:
cate-xxx product-docs
cate-yyy system-docs [default]
next: --next-token eyJ...
标记
[default]的是文件未指定分类时的默认归属。
quiet 模式:每行一个 categoryId。
json 模式:返回 API 原始响应。
注意事项
- 分页是游标方式:使用输出的
next: --next-token <token>继续翻页。
示例
# 列出所有分类
bl knowledge category list --workspace-id ws-xxx
# 按名称过滤
bl knowledge category list --name my-category
# 翻页
bl knowledge category list --next-token eyJ...创建数据中心分类。
用法
bl knowledge category add --name <text> [flags]参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
--name <text> |
string | 是 | 分类名称(1-20 字符) |
--parent-id <id> |
string | 否 | 创建为指定分类的子分类 |
--collection-id <id> |
string | 否 | 创建在此数据集下(默认:平台数据集) |
参数约束
--name长度 1-20 字符
输出
text 模式:
created: cate-xxx (product-docs)
quiet 模式:输出分类 ID。
json 模式:返回 API 原始响应。
注意事项
- 用分类按业务域组织数据中心文件。
示例
# 创建分类
bl knowledge category add --name product-docs --workspace-id ws-xxx
# 创建子分类
bl knowledge category add --name sub --parent-id cate-xxx删除数据中心分类。
用法
bl knowledge category delete --category-id <id> [flags]参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
--category-id <id> |
string | 是 | 分类 ID |
--yes |
switch | 否 | 显式确认执行高风险操作 |
输出
text 模式:
deleted: cate-xxx
quiet 模式:无输出。
json 模式:返回 API 原始响应。
注意事项
- 含文件或子分类的分类的删除行为由服务端定义——服务端错误原样透传。
示例
# 删除分类(交互确认)
bl knowledge category delete --category-id cate-xxx --workspace-id ws-xxx
# 跳过确认
bl knowledge category delete --category-id cate-xxx --yes← 返回总览
历史 fileId 不限于 doc import-oss 创建的文件。先列出 collection 的分类,再逐个列出文件:
bl knowledge category list --collection-id collection-example --output json
bl knowledge category list --collection-id collection-example --parent-id category-example --output json
bl knowledge file list --category-id category-example --output json
bl knowledge doc import --index-id index-example --doc-id file-example --wait分类与文件列表遇到 data.nextToken 时,保持原过滤条件并追加 --next-token 继续读取;对子分类重复遍历。文件 ID 取自 data.fileList[].fileId,不要把分类 ID 或知识库 doc ID 当作文件 ID。doc import 不重复上传文件,但重新入库仍可能触发解析,真实验收仍计入一次解析预算。