Skip to content

Commit e76ebee

Browse files
authored
Merge pull request #172 from modelstudioai/feat/iteration1-w1-foundation
Feat/iteration1 w1 foundation
2 parents 0a63115 + 78a1c54 commit e76ebee

42 files changed

Lines changed: 3227 additions & 90 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,23 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
66

77
[中文版](CHANGELOG.zh.md) · [README](README.md) · [Contributing](CONTRIBUTING.md)
88

9+
## [1.17.1] - 2026-08-22
10+
11+
### Fixed
12+
13+
- **`knowledge create` now requires `--description`** — aligns with the server's required-description validation: the new `--description` flag is mandatory and its 1-500 character limit is checked locally before the request goes out. `bl knowledge create` / `kscli kb create` calls need to pass it.
14+
- **`knowledge service update` warned about config fields the server itself returned** — updating the draft config through scalar flags such as `--policy` reads the full draft and merges before writing back; the draft's `user_system_prompt`, `anti_leak_prompt`, `refusal_prompt`, `credibility_prompt`, `session_file_parse_mode`, and `enable_thinking` / `enable_temperature` / `enable_credibility` / `enable_max_completion_tokens` were not recognized by the CLI, so every update printed a run of `unknown agent_config field passed through` warnings. The config itself was always written correctly; the spurious warnings are gone.
15+
16+
### Added
17+
18+
- **`bailian-web-search` routing skill**`bl skill init` now also installs a dedicated web-search routing skill, so agents pick the right search entry point instead of guessing.
19+
- **Knowledge Studio CLI command manual** — full `kscli` reference docs covering knowledge bases, documents, chunks, collections/categories, files, retrieval/Q&A services, and search/chat, with runnable examples for every command.
20+
21+
### Changed
22+
23+
- **Description flags explain what to write** — help text for the collection and service `--description` flags now states what the field is for (telling similar items apart in lists; for services, agents read it to pick the right one) rather than just repeating "required".
24+
- **`knowledge retrieve --rerank-model` documents its precondition** — help now states that the target knowledge base must already have a rerank model configured, otherwise every value is rejected.
25+
926
## [1.17.0] - 2026-08-18
1027

1128
### Added

CHANGELOG.zh.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,23 @@
66

77
[English](CHANGELOG.md) · [README](README.zh.md) · [参与贡献](CONTRIBUTING.zh.md)
88

9+
## [1.17.1] - 2026-08-22
10+
11+
### 修复
12+
13+
- **`knowledge create``--description` 更新为必填** —— 对齐服务端对知识库描述的必填校验:新增 `--description` 参数并设为必填,在发出请求前于本地校验 1–500 个字符的长度限制。`bl knowledge create` / `kscli kb create` 调用需带上该参数。
14+
- **`knowledge service update` 对服务端自己返回的配置字段误报警告** —— 通过 `--policy` 等标量参数更新草稿配置时,CLI 会先读取完整草稿再合并回写;草稿中的 `user_system_prompt``anti_leak_prompt``refusal_prompt``credibility_prompt``session_file_parse_mode` 以及 `enable_thinking` / `enable_temperature` / `enable_credibility` / `enable_max_completion_tokens` 此前不被 CLI 识别,导致每次更新都刷出一串 `unknown agent_config field passed through` 警告。配置本身始终被正确写入,现在不再误报。
15+
16+
### 新增
17+
18+
- **`bailian-web-search` 路由技能** —— `bl skill init` 现在会一并安装专门的联网搜索路由技能,让 agent 直接选中正确的搜索入口,不再靠猜。
19+
- **Knowledge Studio CLI 命令手册** —— 完整的 `kscli` 参考文档,覆盖知识库、文档、切片、集合/类目、文件、检索/问答服务以及 search/chat,每条命令均附可运行示例。
20+
21+
### 变更
22+
23+
- **描述类参数说明写清该填什么** —— 数据集合与服务的 `--description` 帮助文案现在会说明该字段的用途(在列表中区分同类项;服务描述供 agent 判断该调用哪个服务),不再只是重复「必填」。
24+
- **`knowledge retrieve --rerank-model` 补充前置条件说明** —— 帮助文案现在会说明目标知识库必须已配置重排序模型,否则任何取值都会被拒绝。
25+
926
## [1.17.0] - 2026-08-18
1027

1128
### 新增

docs/knowledge/kb.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,15 @@ bl knowledge info --index-id idx-xxx --workspace-id ws-xxx
128128
**用法**
129129

130130
```bash
131-
bl knowledge create --name <text> (--doc-id <id> | --category-id <id>) [flags]
131+
bl knowledge create --name <text> --description <text> (--doc-id <id> | --category-id <id>) [flags]
132132
```
133133

134134
**参数**
135135

136136
| 参数 | 类型 | 必填 | 说明 |
137137
| --------------------------- | ------ | ---- | -------------------------------------------------------- |
138138
| `--name <text>` | string || 知识库名称(1-20 字符,工作区内唯一) |
139+
| `--description <text>` | string || 知识库装了什么内容、给谁用(1-500 字符) |
139140
| `--doc-id <id>` | array | 否¹ | 数据中心文件 ID(可重复);与 `--category-id` 互斥 |
140141
| `--category-id <id>` | array | 否¹ | 按分类导入该分类下所有文件(可重复);与 `--doc-id` 互斥 |
141142
| `--embedding-model <name>` | string || 向量模型名称(默认:`text-embedding-v4`|
@@ -148,6 +149,7 @@ bl knowledge create --name <text> (--doc-id <id> | --category-id <id>) [flags]
148149
**参数约束**
149150

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

153155
**输出**
@@ -176,13 +178,13 @@ json 模式:返回 API 原始响应,包含 `pipelineId`(知识库 ID)和
176178

177179
```bash
178180
# 从指定文件创建知识库
179-
bl knowledge create --name demo --doc-id file-xxx --workspace-id ws-xxx
181+
bl knowledge create --name demo --description '产品文档' --doc-id file-xxx --workspace-id ws-xxx
180182

181183
# 从分类导入并等待导入完成
182-
bl knowledge create --name demo --category-id cate-xxx --wait
184+
bl knowledge create --name demo --description '产品文档' --category-id cate-xxx --wait
183185

184186
# 指定向量模型和切片大小
185-
bl knowledge create --name my-kb --doc-id file-a --doc-id file-b --embedding-model text-embedding-v4 --chunk-size 400 --workspace-id ws-xxx
187+
bl knowledge create --name my-kb --description '产品文档 v2' --doc-id file-a --doc-id file-b --embedding-model text-embedding-v4 --chunk-size 400 --workspace-id ws-xxx
186188
```
187189

188190
---

docs/knowledge/knowledge-cli-guide.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ bl knowledge doc upload --file ./docs/intro.md --workspace-id ws-xxx
153153
# → 返回 file-id
154154

155155
# 2. 用文件创建知识库
156-
bl knowledge create --name my-kb --doc-id file-xxx --workspace-id ws-xxx --wait
156+
bl knowledge create --name my-kb --description '产品文档' --doc-id file-xxx --workspace-id ws-xxx --wait
157157
# → 返回 index-id (pipelineId) 和导入任务状态
158158

159159
# 3. 创建检索服务(search 场景)
@@ -245,7 +245,7 @@ bl knowledge doc import-oss \
245245
# → 返回各文件的 fileId
246246

247247
# 2. 创建知识库并导入这些文件
248-
bl knowledge create --name oss-kb --doc-id file-a --doc-id file-b --workspace-id ws-xxx --wait
248+
bl knowledge create --name oss-kb --description 'OSS 导入文档' --doc-id file-a --doc-id file-b --workspace-id ws-xxx --wait
249249

250250
# 3. 检索
251251
bl knowledge search --query "相关内容" --agent-id aid-xxx --workspace-id ws-xxx

docs/knowledge/service.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,14 @@ bl knowledge service create --name <text> --scene <chat|search> [flags]
142142
| ------------------------ | ------ | ---- | ------------------------------------------------- |
143143
| `--name <text>` | string || 服务名称(最多 200 字符,同一场景下工作区内唯一) |
144144
| `--scene <chat\|search>` | string || 服务场景:`chat`(Q&A)或 `search`(检索) |
145-
| `--description <text>` | string | | 服务描述(最多 1000 字符) |
145+
| `--description <text>` | string | 建议 | 这个服务能回答什么、给谁用(最多 1000 字符) |
146146
| `--index-id <id>` | string || 绑定此知识库;其他配置使用服务端默认值 |
147147

148148
**参数约束**
149149

150150
- `--name` 最多 200 字符
151151
- `--scene` 只能是 `chat``search`
152-
- `--description` 最多 1000 字符
152+
- `--description` 最多 1000 字符;建议填写 —— agent 靠它判断该调用哪个服务
153153

154154
**输出**
155155

docs/kscli/chunk.md

Lines changed: 248 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,248 @@
1+
# Chunk 管理命令手册
2+
3+
Chunk 是知识库中最小的检索单元。文档导入后自动切分为 chunk,也可以手动添加。
4+
5+
> **通用约定**(鉴权、Workspace ID、全局参数、输出格式、危险操作确认、Dry-run 模式)请参阅 [总览文档](./kscli-cli-guide.md#通用约定)
6+
7+
---
8+
9+
#### `kscli chunk add`
10+
11+
直接向知识库添加 chunk。
12+
13+
**用法**
14+
15+
```bash
16+
kscli chunk add --index-id <id> (--content <text> | --field <k=v>) [flags]
17+
```
18+
19+
**参数**
20+
21+
| 参数 | 类型 | 必填 | 说明 |
22+
| ----------------------- | ------ | ---- | ------------------------------------------------------------------------------------------- |
23+
| `--index-id <id>` | string || 知识库 ID |
24+
| `--doc-id <id>` | string | 否² | 所属文档 ID;表格/图片知识库必填,文档型可选 |
25+
| `--content <text>` | string | 否¹ | Chunk 正文,最多 6000 字符(文档型);与 `--content-file` 互斥 |
26+
| `--content-file <path>` | string | 否¹ | 从 UTF-8 文本文件读取正文(`.md`/`.txt` 等);与 `--content` 互斥 |
27+
| `--title <text>` | string || Chunk 标题,最多 50 字符(文档型) |
28+
| `--image-url <url>` | array || Chunk 图片 URL(可重复,最多 10 个;文档型) |
29+
| `--field <key=value>` | array | 否¹ | 任意字段键值对(可重复),用于表格/图片知识库,键为 Excel 列名;与 content/title/image 互斥 |
30+
31+
> ¹ `--content`/`--content-file`/`--title`/`--image-url``--field` 互斥,必须提供其一。
32+
> ² 表格/图片知识库必须提供 `--doc-id`。文档型知识库可选。
33+
34+
**参数约束**
35+
36+
- `--field``--content`/`--content-file`/`--title`/`--image-url` 互斥
37+
- `--content``--content-file` 互斥
38+
- `--content` 最多 6000 字符
39+
- `--title` 最多 50 字符
40+
- `--image-url` 最多 10 个
41+
42+
**输出**
43+
44+
text 模式:
45+
46+
```
47+
chunk created (pipeline: idx-xxx)
48+
List chunks to find the new chunk id.
49+
```
50+
51+
quiet 模式:无输出(成功退出码 0)。
52+
53+
json 模式:返回 API 原始响应(不含 chunk ID)。
54+
55+
**注意事项**
56+
57+
- 支持文档/表格/图片知识库;音视频知识库不支持。
58+
- API 响应不含 chunk ID,需用 `chunk list` 查找新 chunk。
59+
- API 幂等但限流 10 次/秒,批量脚本需自行节流。
60+
- 表格/图片知识库用 `--field`,键为 Excel 列名,值为字符串。
61+
62+
**示例**
63+
64+
```bash
65+
# 添加文本 chunk
66+
kscli chunk add --index-id idx-xxx --content "chunk text" --title intro --workspace-id ws-xxx
67+
68+
# 添加表格行(字段方式)
69+
kscli chunk add --index-id idx-xxx --field 列A=v1 --field 列B=v2
70+
71+
# 从文件读取内容
72+
kscli chunk add --index-id idx-xxx --content-file ./chunk.md --doc-id doc-xxx
73+
```
74+
75+
---
76+
77+
#### `kscli chunk list`
78+
79+
列出知识库中的 chunk,含内容和状态。
80+
81+
**用法**
82+
83+
```bash
84+
kscli chunk list --index-id <id> [flags]
85+
```
86+
87+
**参数**
88+
89+
| 参数 | 类型 | 必填 | 说明 |
90+
| ------------------- | ------ | ---- | ------------------------------ |
91+
| `--index-id <id>` | string || 知识库 ID |
92+
| `--doc-id <id>` | string || 只显示属于此文档的 chunk |
93+
| `--page-number <n>` | number || 页码(默认:1) |
94+
| `--page-size <n>` | number || 每页条数(默认:20,最大 100) |
95+
96+
**参数约束**
97+
98+
- `--page-size` 范围 1-100
99+
100+
**输出**
101+
102+
text 模式:
103+
104+
```
105+
[chunk] chunk-xxx (doc: intro.md, doc_id: file-xxx) status: COMPLETED
106+
chunk content preview (truncated at 200 chars)…
107+
total: 1
108+
```
109+
110+
> 如果 chunk 被排除检索,行尾会显示 `[excluded from retrieval]`
111+
112+
quiet 模式:每行一个 `metadata._id`(chunk ID),用于管道传给 update/delete。
113+
114+
json 模式:返回 API 原始响应,`data.nodes[]` 含完整 chunk 数据。
115+
116+
**注意事项**
117+
118+
-`metadata._id` 作为 chunk ID,`metadata.doc_id` 作为文档 ID,在 chunk update/delete 中使用。
119+
- 页大小默认 20,最大 100。
120+
121+
**示例**
122+
123+
```bash
124+
# 列出所有 chunk
125+
kscli chunk list --index-id idx-xxx --workspace-id ws-xxx
126+
127+
# 只看某文档的 chunk
128+
kscli chunk list --index-id idx-xxx --doc-id file-xxx --page-size 50
129+
```
130+
131+
---
132+
133+
#### `kscli chunk update`
134+
135+
更新 chunk 内容或切换其检索可见性。
136+
137+
**用法**
138+
139+
```bash
140+
kscli chunk update --index-id <id> --chunk-id <id> --doc-id <id> [flags]
141+
```
142+
143+
**参数**
144+
145+
| 参数 | 类型 | 必填 | 说明 |
146+
| ----------------------- | ------ | ---- | ------------------------------------------------------ |
147+
| `--index-id <id>` | string || 知识库 ID |
148+
| `--chunk-id <id>` | string || Chunk ID(`metadata._id`,来自 chunk list 输出) |
149+
| `--doc-id <id>` | string || 所属文档 ID(`metadata.doc_id`,来自 chunk list 输出) |
150+
| `--content <text>` | string | 否¹ | 新内容,10-6000 字符;与 `--content-file` 互斥 |
151+
| `--content-file <path>` | string | 否¹ | 从 UTF-8 文本文件读取新内容 |
152+
| `--title <text>` | string || Chunk 标题,0-50 字符(空字符串清除标题;不传则不变) |
153+
| `--exclude` | switch | 否² | 将此 chunk 排除出检索 |
154+
| `--include` | switch | 否² | 将此 chunk 恢复检索(默认行为) |
155+
156+
> ¹ `--content``--content-file` 互斥。
157+
> ² `--exclude``--include` 互斥。
158+
159+
**参数约束**
160+
161+
- `--content``--content-file` 互斥
162+
- `--exclude``--include` 互斥
163+
- 至少提供一个更新项(`--content`/`--content-file`/`--title`/`--exclude`/`--include`
164+
- `--content` 长度 10-6000 字符
165+
- `--title` 最多 50 字符
166+
167+
**输出**
168+
169+
text 模式:
170+
171+
```
172+
updated: chunk-xxx
173+
```
174+
175+
quiet 模式:无输出。
176+
177+
json 模式:返回 API 原始响应。
178+
179+
**注意事项**
180+
181+
- 内容必须 10-6000 字符,且不超过知识库的 max chunk size。
182+
- `--content-file` 期望 UTF-8 纯文本文件,不解析 `.docx`/`.pdf` 等文档格式。
183+
- 仅切换 `--exclude`/`--include` 而不提供新内容时,CLI 自动读回当前内容并重新提交(API 要求 content 字段必填,CLI 隐藏了此限制)。
184+
185+
**示例**
186+
187+
```bash
188+
# 修改内容
189+
kscli chunk update --index-id idx-xxx --chunk-id chunk-xxx --doc-id file-xxx --content "corrected text" --workspace-id ws-xxx
190+
191+
# 排除 chunk 不参与检索
192+
kscli chunk update --index-id idx-xxx --chunk-id chunk-xxx --doc-id file-xxx --exclude
193+
194+
# 恢复检索
195+
kscli chunk update --index-id idx-xxx --chunk-id chunk-xxx --doc-id file-xxx --include
196+
```
197+
198+
---
199+
200+
#### `kscli chunk delete`
201+
202+
从知识库中删除 chunk(不可逆)。
203+
204+
**用法**
205+
206+
```bash
207+
kscli chunk delete --index-id <id> --chunk-id <id> [flags]
208+
```
209+
210+
**参数**
211+
212+
| 参数 | 类型 | 必填 | 说明 |
213+
| ----------------- | ------ | ---- | ------------------------------------------------ |
214+
| `--index-id <id>` | string || 知识库 ID |
215+
| `--chunk-id <id>` | array || Chunk ID(可重复,每批最多 10 个,超出自动分批) |
216+
| `--yes` | switch || 跳过确认提示 |
217+
218+
**输出**
219+
220+
text 模式:
221+
222+
```
223+
deleted: 2 chunk(s) in 1 batch(es)
224+
```
225+
226+
quiet 模式:无输出。
227+
228+
json 模式:返回 `{ deleted_count, batches }`
229+
230+
**注意事项**
231+
232+
- 服务端每次最多接受 10 个 chunk ID,CLI 自动分批。
233+
- 如果某批失败,操作停止,已删除的批次会在错误 hint 中列出。
234+
- Chunk 被永久移除,不可恢复。
235+
236+
**示例**
237+
238+
```bash
239+
# 删除多个 chunk
240+
kscli chunk delete --index-id idx-xxx --chunk-id chunk-a --chunk-id chunk-b --workspace-id ws-xxx
241+
242+
# 跳过确认
243+
kscli chunk delete --index-id idx-xxx --chunk-id chunk-a --yes
244+
```
245+
246+
---
247+
248+
[返回总览](./kscli-cli-guide.md)

0 commit comments

Comments
 (0)