Skip to content

Commit b7a4efe

Browse files
committed
feat(speech): 支持同步Flash ASR模型和异步文件转录模型
- 新增同步Flash ASR模型请求流程,支持单音频文件识别 - 实现了对同步Flash模型不支持异步标志及参数的限制校验 - 异步文件转录模型支持单文件URL上传和语言参数细化 - 优化异步和同步鉴权域显示,丰富根帮助和分组帮助提示 - speech recognize增加dry-run测试覆盖多种识别场景 - free-tier自动停用功能优化,改用统一轮询函数处理批量请求 - 统一轮询逻辑,支持console和telemetry接口的异步任务完成判定 - 规范输出格式和错误提示,增强用户调试体验 - 版本升级到1.14.3,更新示例参数和模型ID引用
2 parents 30f7525 + daefc09 commit b7a4efe

64 files changed

Lines changed: 2777 additions & 1452 deletions

Some content is hidden

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

docs/knowledge/kb.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ json 模式:返回知识库完整配置 JSON。
110110

111111
**注意事项**
112112

113-
- 服务端无专用详情 API,CLI 通过分页遍历 `index/list`(每页 100 条,最多 10 页)查找目标知识库
113+
- CLI 通过 `index/list``pipeline_id` 参数精确过滤目标知识库,单次请求即可获取详情
114114
- 索引设置(向量模型、切片大小等)不可变,修改需重建知识库。
115115

116116
**示例**

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": "1.14.2",
3+
"version": "1.14.3",
44
"description": "CLI for Aliyun Model Studio (DashScope) AI Platform.",
55
"keywords": [
66
"agent",

packages/cli/tests/e2e/registry.smoke.e2e.test.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,40 @@ const commandPaths = Object.keys(commands).sort();
77
const groupPaths = deriveGroupPaths(commandPaths);
88

99
describe("e2e: bl registry smoke", () => {
10-
test("根帮助展示 bl 与全局 flag", async () => {
10+
test("根帮助展示 bl、逐命令鉴权域与全局 flag", async () => {
1111
const { stderr, exitCode } = await runCli(["--help"]);
1212
expect(exitCode, stderr).toBe(0);
1313
expect(stderr).toMatch(/\bbl\b/i);
14+
expect(stderr).not.toMatch(/COMMAND\s+AUTH\s+DESCRIPTION/);
15+
expect(stderr).toMatch(/app call\s+\[API Key\]\s+Call a Bailian application/);
16+
expect(stderr).toMatch(/app list\s+\[Console\]\s+List Bailian applications/);
17+
expect(stderr).toMatch(/token-plan create-key\s+\[AK\/SK\]\s+Create a Token Plan API key/);
18+
expect(stderr).toMatch(/config show\s+\[No Auth\]\s+Display current configuration/);
1419
expect(stderr).toMatch(/--base-url/);
1520
expect(stderr).toMatch(/--console-region/);
1621
expect(stderr).toMatch(/--console-site/);
1722
expect(stderr).toMatch(/--console-switch-agent/);
1823
expect(stderr).not.toMatch(/^\s*--region\s/m);
1924
});
2025

26+
test("分组帮助按叶子命令展示不同鉴权域", async () => {
27+
const { stderr, exitCode } = await runCli(["app", "--help"]);
28+
expect(exitCode, stderr).toBe(0);
29+
expect(stderr).toMatch(/app call\s+\[API Key\]\s+Call a Bailian application/);
30+
expect(stderr).toMatch(/app list\s+\[Console\]\s+List Bailian applications/);
31+
});
32+
33+
test.each([
34+
[["text", "chat"], "API Key"],
35+
[["app", "list"], "Console"],
36+
[["token-plan", "list-seats"], "AK/SK"],
37+
[["config", "show"], "No Auth"],
38+
] as const)("%s --help 明确展示鉴权域 %s", async (commandPath, authLabel) => {
39+
const { stderr, exitCode } = await runCli([...commandPath, "--help"]);
40+
expect(exitCode, stderr).toBe(0);
41+
expect(stderr).toContain(`Authentication: ${authLabel}`);
42+
});
43+
2144
test("quota check --help:Flags 含 console 域鉴权 flag,Global Flags 全量列出", async () => {
2245
const { stderr, exitCode } = await runCli(["quota", "check", "--help"]);
2346
expect(exitCode, stderr).toBe(0);

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": "1.14.2",
3+
"version": "1.14.3",
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": {

packages/commands/src/commands/console/call.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default defineCommand({
2525
},
2626
},
2727
exampleArgs: [
28-
`--api zeldaEasy.broadscope-bailian.freeTrial.queryFreeTierQuota --data '{"queryFreeTierQuotaRequest":{"models":["qwen3-max"]}}'`,
28+
`--api zeldaEasy.bailian-commerce.freeTrial.queryFreeTierQuota --data '{"queryFreeTierQuotaRequest":{"models":["qwen3-max"]}}'`,
2929
`--api some.api.name --data '{"key":"value"}' --console-region cn-beijing`,
3030
],
3131
async run(ctx) {

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

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,39 +23,37 @@ const KB_INFO_FLAGS = {
2323
...WORKSPACE_FLAG,
2424
} satisfies FlagsDef;
2525

26-
function indexListUrl(workspaceId: string, pageNumber: number): string {
26+
function indexDetailUrl(workspaceId: string, indexId: string): string {
2727
const url = new URL(ragEndpoint(workspaceId, RAG_PATHS.indexList));
28-
url.searchParams.set("page_number", String(pageNumber));
29-
url.searchParams.set("page_size", "100");
28+
url.searchParams.set("pipeline_id", indexId);
29+
url.searchParams.set("page_number", "1");
30+
url.searchParams.set("page_size", "1");
3031
return url.toString();
3132
}
3233

3334
/**
34-
* There is no dedicated detail API on the server, so fall back to paging
35-
* through index/list. If a detail API ships, only this function changes.
36-
* Also reused by kb delete for its confirmation summary.
35+
* The index/list API now supports pipeline_id filtering, so a single
36+
* request suffices instead of paginating. Reused by kb delete for its
37+
* confirmation summary.
3738
*/
3839
export async function fetchIndexDetail(
3940
client: Client,
4041
workspaceId: string,
4142
indexId: string,
4243
): Promise<RagIndexRow> {
43-
const maxPages = 10;
44-
for (let pageNumber = 1; pageNumber <= maxPages; pageNumber++) {
45-
const response = await client.requestJson<RagIndexListResponse>({
46-
path: indexListUrl(workspaceId, pageNumber),
47-
method: "GET",
48-
});
49-
const rows = response.data?.rows ?? [];
50-
const match = rows.find((row) => row.id === indexId);
51-
if (match) return match;
52-
if (rows.length < 100) break; // reached the last page
44+
const response = await client.requestJson<RagIndexListResponse>({
45+
path: indexDetailUrl(workspaceId, indexId),
46+
method: "GET",
47+
});
48+
const row = response.data?.rows?.[0];
49+
if (!row) {
50+
throw new BailianError(
51+
`Knowledge base not found: ${indexId}`,
52+
ExitCode.GENERAL,
53+
"Check the id — list knowledge bases in this workspace to verify it.",
54+
);
5355
}
54-
throw new BailianError(
55-
`Knowledge base not found: ${indexId}`,
56-
ExitCode.GENERAL,
57-
"Check the id — list knowledge bases in this workspace to verify it.",
58-
);
56+
return row;
5957
}
6058

6159
function formatField(label: string, value: string | number | boolean | null | undefined): string {
@@ -68,7 +66,7 @@ export default defineCommand({
6866
usageArgs: "--index-id <id> [flags]",
6967
flags: KB_INFO_FLAGS,
7068
notes: [
71-
"No dedicated detail API on the server yet — falls back to paginating the index list (up to 10 pages of 100).",
69+
"Uses the index/list API with pipeline_id filtering to fetch a single knowledge base.",
7270
"Indexing settings are immutable; changing them requires recreating the knowledge base.",
7371
],
7472
exampleArgs: ["--index-id idx-xxx --workspace-id ws-xxx"],
@@ -80,10 +78,8 @@ export default defineCommand({
8078
if (settings.dryRun) {
8179
emitResult(
8280
{
83-
endpoint: indexListUrl(workspaceId, 1),
81+
endpoint: indexDetailUrl(workspaceId, flags.indexId),
8482
request: null,
85-
strategy:
86-
"paginate index/list (page_size=100, up to 10 pages) to find --index-id; no dedicated detail API",
8783
},
8884
format,
8985
);

0 commit comments

Comments
 (0)