docs(knowledge): 扩展知识库描述长度限制到 500 字符

- 修改命令行参数文档,将 --description 长度限制由 200 字符增加到 500 字符
- 更新代码校验逻辑,支持描述长度最大 500 字符
- 调整相关提示信息,反映新的长度限制
- 修改测试用例,支持 501 字符的描述参数触发用法错误
- 更新 CLI 参考文档中描述字段的长度说明
This commit is contained in:
zeyu.fz
2026-08-22 11:52:39 +08:00
parent a6291e00e1
commit b830a14e11
4 changed files with 11 additions and 11 deletions
+2 -2
View File
@@ -136,7 +136,7 @@ bl knowledge create --name <text> --description <text> (--doc-id <id> | --catego
| 参数 | 类型 | 必填 | 说明 |
| --------------------------- | ------ | ---- | -------------------------------------------------------- |
| `--name <text>` | string | 是 | 知识库名称(1-20 字符,工作区内唯一) |
| `--description <text>` | string | 是 | 知识库装了什么内容、给谁用(1-200 字符) |
| `--description <text>` | string | 是 | 知识库装了什么内容、给谁用(1-500 字符) |
| `--doc-id <id>` | array | 否¹ | 数据中心文件 ID(可重复);与 `--category-id` 互斥 |
| `--category-id <id>` | array | 否¹ | 按分类导入该分类下所有文件(可重复);与 `--doc-id` 互斥 |
| `--embedding-model <name>` | string | 否 | 向量模型名称(默认:`text-embedding-v4`) |
@@ -149,7 +149,7 @@ bl knowledge create --name <text> --description <text> (--doc-id <id> | --catego
**参数约束**
- `--name` 长度 1-20 字符
- `--description` 长度 1-200 字符,缺失或超长会在本地被拦截
- `--description` 长度 1-500 字符,缺失或超长会在本地被拦截
- `--doc-id` 和 `--category-id` 互斥,必须提供其一
**输出**
@@ -34,8 +34,8 @@ const KB_CREATE_FLAGS = {
valueHint: "<text>",
description: {
"en-US":
"What this knowledge base holds and what it is for — tells bases apart in the workspace list (1-200 chars)",
"zh-CN": "知识库装了什么内容、给谁用,用于在 Workspace 列表中区分同类知识库(1–200 个字符)",
"What this knowledge base holds and what it is for — tells bases apart in the workspace list (1-500 chars)",
"zh-CN": "知识库装了什么内容、给谁用,用于在 Workspace 列表中区分同类知识库(1–500 个字符)",
},
required: true,
},
@@ -147,8 +147,8 @@ export default defineCommand({
],
validate(flags) {
if (flags.name.length < 1 || flags.name.length > 20) return "--name must be 1-20 characters";
if (flags.description.length < 1 || flags.description.length > 200) {
return "--description must be 1-200 characters";
if (flags.description.length < 1 || flags.description.length > 500) {
return "--description must be 1-500 characters";
}
const hasDocIds = !!flags.docId?.length;
const hasCategoryIds = !!flags.categoryId?.length;
@@ -166,8 +166,8 @@ export default defineCommand({
// Note: the public docs' example uses sinkType DEFAULT, but BUILT_IN is what works against the live API.
const body = {
name: flags.name,
// The server enforces description as a required 1-200 char field (the public
// API docs still list it as absent from CreateIndexV2Request.required).
// description is a required field; length limit is 1-500 (the public API docs
// still list it as absent from CreateIndexV2Request.required).
description: flags.description,
structureType: "unstructured",
sinkType: "BUILT_IN",
@@ -61,14 +61,14 @@ describe("e2e: knowledge kb create", () => {
expect(exitCode).toBe(2);
});
test("--description 201 字符报 USAGE (2)", async () => {
test("--description 501 字符报 USAGE (2)", async () => {
const { exitCode } = await runCommandE2e(KNOWLEDGE_KB_CREATE_ROUTES, [
"knowledge",
"create",
"--name",
"demo",
"--description",
"x".repeat(201),
"x".repeat(501),
"--doc-id",
"file_test",
"--workspace-id",
+1 -1
View File
@@ -432,7 +432,7 @@ bl knowledge collection get --name my-collection
| Flag | Type | Required | Description |
| --------------------------- | ------ | -------- | --------------------------------------------------------------------------------------------------------- |
| `--name <text>` | string | yes | Knowledge base name (1-20 chars, unique in workspace) |
| `--description <text>` | string | yes | What this knowledge base holds and what it is for — tells bases apart in the workspace list (1-200 chars) |
| `--description <text>` | string | yes | What this knowledge base holds and what it is for — tells bases apart in the workspace list (1-500 chars) |
| `--doc-id <id>` | array | no | Data-center file id to import (repeatable); mutually exclusive with --category-id |
| `--category-id <id>` | array | no | Import every file under this category (repeatable); mutually exclusive with --doc-id |
| `--embedding-model <name>` | string | no | Embedding model name (default: text-embedding-v4) |