Skip to content

Commit b830a14

Browse files
committed
docs(knowledge): 扩展知识库描述长度限制到 500 字符
- 修改命令行参数文档,将 --description 长度限制由 200 字符增加到 500 字符 - 更新代码校验逻辑,支持描述长度最大 500 字符 - 调整相关提示信息,反映新的长度限制 - 修改测试用例,支持 501 字符的描述参数触发用法错误 - 更新 CLI 参考文档中描述字段的长度说明
1 parent a6291e0 commit b830a14

4 files changed

Lines changed: 11 additions & 11 deletions

File tree

docs/knowledge/kb.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ bl knowledge create --name <text> --description <text> (--doc-id <id> | --catego
136136
| 参数 | 类型 | 必填 | 说明 |
137137
| --------------------------- | ------ | ---- | -------------------------------------------------------- |
138138
| `--name <text>` | string || 知识库名称(1-20 字符,工作区内唯一) |
139-
| `--description <text>` | string || 知识库装了什么内容、给谁用(1-200 字符) |
139+
| `--description <text>` | string || 知识库装了什么内容、给谁用(1-500 字符) |
140140
| `--doc-id <id>` | array | 否¹ | 数据中心文件 ID(可重复);与 `--category-id` 互斥 |
141141
| `--category-id <id>` | array | 否¹ | 按分类导入该分类下所有文件(可重复);与 `--doc-id` 互斥 |
142142
| `--embedding-model <name>` | string || 向量模型名称(默认:`text-embedding-v4`|
@@ -149,7 +149,7 @@ bl knowledge create --name <text> --description <text> (--doc-id <id> | --catego
149149
**参数约束**
150150

151151
- `--name` 长度 1-20 字符
152-
- `--description` 长度 1-200 字符,缺失或超长会在本地被拦截
152+
- `--description` 长度 1-500 字符,缺失或超长会在本地被拦截
153153
- `--doc-id``--category-id` 互斥,必须提供其一
154154

155155
**输出**

packages/commands/src/commands/knowledge/kb-create.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ const KB_CREATE_FLAGS = {
3434
valueHint: "<text>",
3535
description: {
3636
"en-US":
37-
"What this knowledge base holds and what it is for — tells bases apart in the workspace list (1-200 chars)",
38-
"zh-CN": "知识库装了什么内容、给谁用,用于在 Workspace 列表中区分同类知识库(1–200 个字符)",
37+
"What this knowledge base holds and what it is for — tells bases apart in the workspace list (1-500 chars)",
38+
"zh-CN": "知识库装了什么内容、给谁用,用于在 Workspace 列表中区分同类知识库(1–500 个字符)",
3939
},
4040
required: true,
4141
},
@@ -147,8 +147,8 @@ export default defineCommand({
147147
],
148148
validate(flags) {
149149
if (flags.name.length < 1 || flags.name.length > 20) return "--name must be 1-20 characters";
150-
if (flags.description.length < 1 || flags.description.length > 200) {
151-
return "--description must be 1-200 characters";
150+
if (flags.description.length < 1 || flags.description.length > 500) {
151+
return "--description must be 1-500 characters";
152152
}
153153
const hasDocIds = !!flags.docId?.length;
154154
const hasCategoryIds = !!flags.categoryId?.length;
@@ -166,8 +166,8 @@ export default defineCommand({
166166
// Note: the public docs' example uses sinkType DEFAULT, but BUILT_IN is what works against the live API.
167167
const body = {
168168
name: flags.name,
169-
// The server enforces description as a required 1-200 char field (the public
170-
// API docs still list it as absent from CreateIndexV2Request.required).
169+
// description is a required field; length limit is 1-500 (the public API docs
170+
// still list it as absent from CreateIndexV2Request.required).
171171
description: flags.description,
172172
structureType: "unstructured",
173173
sinkType: "BUILT_IN",

packages/commands/tests/e2e/knowledge/knowledge-kb-create.e2e.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,14 @@ describe("e2e: knowledge kb create", () => {
6161
expect(exitCode).toBe(2);
6262
});
6363

64-
test("--description 201 字符报 USAGE (2)", async () => {
64+
test("--description 501 字符报 USAGE (2)", async () => {
6565
const { exitCode } = await runCommandE2e(KNOWLEDGE_KB_CREATE_ROUTES, [
6666
"knowledge",
6767
"create",
6868
"--name",
6969
"demo",
7070
"--description",
71-
"x".repeat(201),
71+
"x".repeat(501),
7272
"--doc-id",
7373
"file_test",
7474
"--workspace-id",

skills/bailian-cli/reference/knowledge.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ bl knowledge collection get --name my-collection
432432
| Flag | Type | Required | Description |
433433
| --------------------------- | ------ | -------- | --------------------------------------------------------------------------------------------------------- |
434434
| `--name <text>` | string | yes | Knowledge base name (1-20 chars, unique in workspace) |
435-
| `--description <text>` | string | yes | What this knowledge base holds and what it is for — tells bases apart in the workspace list (1-200 chars) |
435+
| `--description <text>` | string | yes | What this knowledge base holds and what it is for — tells bases apart in the workspace list (1-500 chars) |
436436
| `--doc-id <id>` | array | no | Data-center file id to import (repeatable); mutually exclusive with --category-id |
437437
| `--category-id <id>` | array | no | Import every file under this category (repeatable); mutually exclusive with --doc-id |
438438
| `--embedding-model <name>` | string | no | Embedding model name (default: text-embedding-v4) |

0 commit comments

Comments
 (0)