Skip to content

Commit bddf58d

Browse files
authored
Merge pull request #315 from modelstudioai/feat/zelda-api-command
Feat/zelda api command
2 parents fa8330c + 3192025 commit bddf58d

54 files changed

Lines changed: 3848 additions & 116 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: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,19 @@ 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+
## [2.8.6] - 2026-11-12
10+
11+
### Added
12+
13+
- **Console dataset queries**: Add `bl dataset groups` with pagination and name filtering, and `bl dataset version` to list versions by `--dataset-group-id` or query one version by `--dataset-id`, with optional `--include-status`.
14+
- **Console file URLs**: Add `bl file url --file-key` to resolve a Console file key to a download URL without downloading the file.
15+
- **Console deployment queries**: Add `bl deploy instances` with pagination, keyword and model-service-ID filters. Existing API-key `dataset list/get` and `deploy list` commands remain unchanged.
16+
17+
### Fixed
18+
19+
- **Console response handling**: Correctly parse nested success and failure responses, preserve service error messages, codes and request IDs, and avoid treating valid workspace lists as empty.
20+
- **Workspace validation**: Reject an explicitly blank `--workspace-id` instead of silently falling back to another configured workspace.
21+
922
## [2.8.5] - 2026-11-10
1023

1124
### Fixed

‎CHANGELOG.zh.md‎

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

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

9+
## [2.8.6] - 2026-11-12
10+
11+
### 新增
12+
13+
- **Console 数据集查询**:新增 `bl dataset groups`,支持分页和名称筛选;新增 `bl dataset version`,通过 `--dataset-group-id` 列出组内版本,或通过 `--dataset-id` 查询单版本详情,可选 `--include-status` 补充状态。
14+
- **Console 文件地址解析**:新增 `bl file url --file-key`,将 Console 文件键解析为下载 URL,不自动下载文件。
15+
- **Console 部署查询**:新增 `bl deploy instances`,支持分页、关键词和模型服务 ID 筛选。原有 API Key 域的 `dataset list/get` 与 `deploy list` 保持不变。
16+
17+
### 修复
18+
19+
- **Console 响应处理**:正确解析嵌套成功与失败响应,保留服务端错误消息、错误码及请求 ID,避免将有效工作空间列表误判为空。
20+
- **工作空间参数校验**:拒绝显式传入空白 `--workspace-id`,避免静默回退到其他已配置工作空间。
21+
922
## [2.8.5] - 2026-11-10
1023

1124
### 修复

‎README.md‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,20 @@ Knowledge bases accrue running-time charges from creation, even without queries.
139139

140140
Keep the returned IDs and recovery record. Closing the CLI or a later failure does not stop billing; follow the reported cleanup actions to delete unused knowledge bases. See the [Knowledge Studio quick start](packages/kscli/README.md#quick-start) for retrieval and cleanup. The `bailian-knowledge` Skill is available through `bl skill init`.
141141

142+
### Console dataset and deployment queries
143+
144+
```bash
145+
bl dataset groups --page 1 --page-size 10 --output json
146+
bl dataset version --dataset-group-id <group-id> --output json
147+
bl dataset version --dataset-id <version-id> --include-status --output json
148+
bl file url --file-key <console-file-key> --output json
149+
bl deploy instances --page 1 --page-size 10 --output json
150+
```
151+
152+
Use `dataset groups` (`--name` optionally filters on the server) to obtain `records[].datasetGroupId`, then `dataset version --dataset-group-id <group-id>` to get `{result:[...]}` with `result[].datasetId` and its optional `fileId`. Use `dataset version --dataset-id <version-id>` for details; `--include-status` is available only in detail mode. Exactly one of `--dataset-group-id` and `--dataset-id` is required; they cannot be combined. `fileId` is not `datasetId` and must not be passed as a version ID. Groups fetch one page with one embedded version preview per group; `version --dataset-group-id` does not promise exhaustive results or expose pagination. The API Key / `file_id` semantics of `dataset list` are unchanged.
153+
154+
These read-only commands use Console authentication. An optional `--workspace-id` resolves the workspace's Console identity before querying; resolution failure stops the request. `dataset version --dataset-id` keeps metadata and version/task state separate and does not infer validation success or training readiness. `file url` only resolves a download address. `deploy instances` returns one page of independent services (`records` is the list, `items` the total), not capacity instances. The API-key `dataset get --file-id` and `deploy list` commands are unchanged. Add `--dry-run` to preview without business requests; framework update checks/telemetry follow their settings.
155+
142156
### RAG audio and video
143157

144158
`bl knowledge doc import --index-id <id> --doc-id <fileId>` imports an existing file into a knowledge base; `doc list --details` shows per-file processing settings. Media support includes parser options, streaming uploads, and media references in search/chunk output. Chat JSON separates the final answer from phases, tools, docs, usage, and raw events; quiet mode hides progress and informational messages while preserving the final result, including every JSON field. See the [command guide](docs/knowledge/knowledge-cli-guide.md).

‎README.zh.md‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,20 @@ bl knowledge init --workspace-id <workspace-id> --dry-run
138138

139139
保留返回的 ID 和恢复记录。退出 CLI 或后续步骤失败不会停止计费;按返回的清理动作删除不再需要的知识库。检索及清理示例见 [Knowledge Studio 快速开始](packages/kscli/README.zh.md#快速开始)。知识库 Skill `bailian-knowledge` 通过 `bl skill init` 安装。
140140

141+
### Console 数据集与部署查询
142+
143+
```bash
144+
bl dataset groups --page 1 --page-size 10 --output json
145+
bl dataset version --dataset-group-id <组ID> --output json
146+
bl dataset version --dataset-id <版本ID> --include-status --output json
147+
bl file url --file-key <Console文件键> --output json
148+
bl deploy instances --page 1 --page-size 10 --output json
149+
```
150+
151+
先用 `dataset groups`(可加 `--name` 服务端筛选)获取 `records[].datasetGroupId`,再用 `dataset version --dataset-group-id <组ID>` 获取 `{result:[...]}`,其中包含 `result[].datasetId` 及可能返回的 `fileId`。查询详情用 `dataset version --dataset-id <版本ID>`,`--include-status` 仅详情模式可用。`--dataset-group-id` 与 `--dataset-id` 必选一个且不能同传。`fileId` 不是 `datasetId`,不能作为版本 ID 传入。组列表仅取一页,每组附带一条版本预览;`version --dataset-group-id` 不承诺返回全部版本,也不提供分页选项。原有 `dataset list` 的 API Key / `file_id` 语义保持不变。
152+
153+
以上只读命令使用 Console 鉴权。可选 `--workspace-id` 会在查询前解析对应空间的 Console 身份,解析失败即停止。`dataset version --dataset-id` 分开保留元信息与版本/任务状态,不推导校验成功或训练就绪;`file url` 仅解析下载地址;`deploy instances` 返回独立部署服务的单页数据(`records` 为列表、`items` 为总数),不是容量实例。原有 API Key 域的 `dataset get --file-id` 与 `deploy list` 保持不变。添加 `--dry-run` 可预览且不发送业务请求;框架更新检查和埋点遵循其配置。
154+
141155
### RAG 音视频接入
142156

143157
`bl knowledge doc import --index-id <id> --doc-id <fileId>` 将历史文件导入已有库;`doc list --details` 查看文件级处理参数。支持音视频 parser、流式上传,以及检索/切片中的媒体来源展示。问答 JSON 将最终 answer 与 phases/tools/docs/usage/events 分开保存,quiet 只隐藏进度和过程提示,保留最终结果及完整 JSON 字段。参阅 [命令指南](docs/knowledge/knowledge-cli-guide.md)。

‎packages/bailian-kb-dsh/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bailian-kb-dsh",
3-
"version": "2.8.5",
3+
"version": "2.8.6",
44
"description": "Bailian knowledge-base tools for DeepSeek Harness: kb_search and kb_chat over the DashScope RAG API, plus the bl CLI management skill.",
55
"keywords": [
66
"alibaba-cloud",

‎packages/bailian-memo-dsh/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bailian-memo-dsh",
3-
"version": "2.8.5",
3+
"version": "2.8.6",
44
"description": "Bailian personal memory for DeepSeek Harness: automatic recall, silent curation, and user-controlled remember/forget.",
55
"keywords": [
66
"alibaba-cloud",

‎packages/cli/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bailian-cli",
3-
"version": "2.8.5",
3+
"version": "2.8.6",
44
"description": "CLI for Aliyun Model Studio (DashScope) AI Platform.",
55
"keywords": [
66
"agent",

‎packages/cli/src/commands.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ import {
9797
speechVocabularyUpdate,
9898
speechVocabularyDelete,
9999
fileUpload,
100+
fileUrl,
100101
consoleCall,
101102
securityOverview,
102103
securityAlerts,
@@ -163,6 +164,8 @@ import {
163164
datasetUpload,
164165
datasetList,
165166
datasetGet,
167+
datasetVersion,
168+
datasetGroups,
166169
datasetDelete,
167170
datasetValidate,
168171
finetuneTextCreate,
@@ -193,6 +196,7 @@ import {
193196
deployAudioCreate,
194197
deployImageCreate,
195198
deployList,
199+
deployInstances,
196200
deployGet,
197201
deployCapacityList,
198202
deployCapacityGet,
@@ -439,6 +443,7 @@ export const commands: Record<string, AnyCommand> = {
439443
"speech vocabulary update": speechVocabularyUpdate,
440444
"speech vocabulary delete": speechVocabularyDelete,
441445
"file upload": fileUpload,
446+
"file url": fileUrl,
442447
"console call": consoleCall,
443448
"agents security overview": securityOverview,
444449
"agents security alerts": securityAlerts,
@@ -505,6 +510,8 @@ export const commands: Record<string, AnyCommand> = {
505510
"dataset upload": datasetUpload,
506511
"dataset list": datasetList,
507512
"dataset get": datasetGet,
513+
"dataset version": datasetVersion,
514+
"dataset groups": datasetGroups,
508515
"dataset delete": datasetDelete,
509516
"dataset validate": datasetValidate,
510517
"finetune text create": finetuneTextCreate,
@@ -535,6 +542,7 @@ export const commands: Record<string, AnyCommand> = {
535542
"deploy audio create": deployAudioCreate,
536543
"deploy image create": deployImageCreate,
537544
"deploy list": deployList,
545+
"deploy instances": deployInstances,
538546
"deploy get": deployGet,
539547
"deploy capacity list": deployCapacityList,
540548
"deploy capacity get": deployCapacityGet,

‎packages/commands/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bailian-cli-commands",
3-
"version": "2.8.5",
3+
"version": "2.8.6",
44
"description": "Command library for bailian-cli products (knowledge, memory, media, …). See https://www.npmjs.com/package/bailian-cli for usage.",
55
"homepage": "https://bailian.console.aliyun.com/cli",
66
"bugs": {
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
import {
2+
CONSOLE_DATASET_GROUPS_API,
3+
buildConsoleDatasetGroupsRequest,
4+
listConsoleDatasetGroups,
5+
} from "bailian-cli-core";
6+
import { defineConsoleReadCommand, consoleReadTargetPreview } from "../shared/console-read.ts";
7+
8+
export default defineConsoleReadCommand({
9+
auth: "console",
10+
description: {
11+
"en-US": "List Console dataset groups",
12+
"zh-CN": "查询 Console 数据集组列表",
13+
},
14+
usageArgs: "[--page <n>] [--page-size <n>] [--name <name>]",
15+
flags: {
16+
page: {
17+
type: "number",
18+
valueHint: "<n>",
19+
description: {
20+
"en-US": "Page number, a positive safe integer (default: 1)",
21+
"zh-CN": "页码,正安全整数(默认:1)",
22+
},
23+
},
24+
pageSize: {
25+
type: "number",
26+
valueHint: "<n>",
27+
description: {
28+
"en-US": "Groups per page, a positive safe integer (default: 10)",
29+
"zh-CN": "每页组数,正安全整数(默认:10)",
30+
},
31+
},
32+
name: {
33+
type: "string",
34+
valueHint: "<name>",
35+
description: {
36+
"en-US": "Nonblank dataset group name for server-side filtering; trimmed before sending",
37+
"zh-CN": "用于服务端筛选的非空白数据集组名称,去除首尾空白后传递",
38+
},
39+
},
40+
},
41+
exampleArgs: ["", "--page 2 --page-size 20", "--name example-dataset --dry-run"],
42+
notes: [
43+
{
44+
"en-US":
45+
"Fetches only the requested page. records contains dataset groups; items is the server's total count for the query. All business-response fields are preserved. The API Key / file_id semantics of dataset list are unchanged.",
46+
"zh-CN":
47+
"仅获取请求的当前页。records 为数据集组列表,items 为服务端返回的查询总数。保留所有业务响应字段,不改变 dataset list 的 API Key / file_id 语义。",
48+
},
49+
{
50+
"en-US":
51+
"Each group's datasets is only a one-version preview, not its complete version list. Pass datasetGroupId to dataset version --dataset-group-id for {result:[...]} (no completeness guarantee or pagination); use dataset version --dataset-id with a version's datasetId for details (--include-status is detail-only). Exactly one ID flag is required; they cannot be combined. fileId is not datasetId.",
52+
"zh-CN":
53+
"各组的 datasets 仅是一条版本预览,不是完整版本列表。将 datasetGroupId 传给 dataset version --dataset-group-id,返回 {result:[...]}(不保证全量,无分页);查询详情用 dataset version --dataset-id,传入版本的 datasetId,仅此模式可加 --include-status。两个 ID 参数必选一个且不能同传。fileId 不是 datasetId。",
54+
},
55+
{
56+
"en-US":
57+
"--name is trimmed and sent to the server without local filtering. No type filter is hardcoded, but server-side scope and defaults still affect results; this is not an account-wide exhaustive listing. There is no --all option.",
58+
"zh-CN":
59+
"--name 去除首尾空白后交由服务端筛选,不做本地筛选。不硬编码类型过滤,但服务端作用域与默认条件仍影响结果,不代表整个账号的全量列表。不提供 --all 选项。",
60+
},
61+
{
62+
"en-US":
63+
"The preview requests one import task per version, without guaranteeing the latest task or all tasks. Status codes are preserved as returned; no release, validation, or training readiness is inferred.",
64+
"zh-CN":
65+
"预览为每个版本请求一条导入任务,不保证是最新任务或涵盖全部任务。保留返回的状态原码,不据此判断发布、校验或训练就绪。",
66+
},
67+
],
68+
validate(flags) {
69+
if (flags.page !== undefined && (!Number.isSafeInteger(flags.page) || flags.page < 1)) {
70+
return {
71+
"en-US": "--page must be a positive safe integer.",
72+
"zh-CN": "--page 必须为正安全整数。",
73+
};
74+
}
75+
if (
76+
flags.pageSize !== undefined &&
77+
(!Number.isSafeInteger(flags.pageSize) || flags.pageSize < 1)
78+
) {
79+
return {
80+
"en-US": "--page-size must be a positive safe integer.",
81+
"zh-CN": "--page-size 必须为正安全整数。",
82+
};
83+
}
84+
if (flags.name !== undefined && !flags.name.trim()) {
85+
return {
86+
"en-US": "--name must not be blank when provided.",
87+
"zh-CN": "传入的 --name 不能仅包含空白或为空。",
88+
};
89+
}
90+
return undefined;
91+
},
92+
async run(ctx) {
93+
const params = {
94+
page: ctx.flags.page ?? 1,
95+
pageSize: ctx.flags.pageSize ?? 10,
96+
name: ctx.flags.name?.trim(),
97+
};
98+
if (ctx.settings.dryRun) {
99+
const preview = {
100+
action: "dataset.groups",
101+
api: CONSOLE_DATASET_GROUPS_API,
102+
data: buildConsoleDatasetGroupsRequest(params),
103+
...consoleReadTargetPreview(ctx.settings),
104+
};
105+
ctx.output.result(preview, { text: JSON.stringify(preview, null, 2) });
106+
return;
107+
}
108+
const response = await listConsoleDatasetGroups(ctx.client, params);
109+
ctx.output.result(response, { text: JSON.stringify(response, null, 2) });
110+
},
111+
});

0 commit comments

Comments
 (0)