Files

6.8 KiB
Raw Permalink Blame History

数据中心集合与分类命令手册

集合collection是数据中心的顶层容器对应服务端的 connector。分类category用于组织集合内的文件支持多级嵌套。

通用约定鉴权、Workspace ID、全局参数、输出格式、危险操作确认、Dry-run 模式)请参阅 总览文档


bl knowledge collection create

创建 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 只能是 platformcustom
  • --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

查看数据集合详情。

用法

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 不返回 fileConnectorConfigstoreType/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

列出数据中心分类。

用法

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

创建数据中心分类。

用法

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

删除数据中心分类。

用法

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

返回总览