@@ -14,6 +14,7 @@ import {
1414 speechRecognizePath ,
1515 resolveAsrApi ,
1616 buildAsrFlashRequest ,
17+ buildAsyncAsrLanguageFields ,
1718 extractAsrFlashText ,
1819 type AsrApiRoute ,
1920 type AsrFlashFamily ,
@@ -42,7 +43,7 @@ const RECOGNIZE_FLAGS = {
4243 type : "string" ,
4344 valueHint : "<lang>" ,
4445 description :
45- "Language hint (e.g. zh, en, ja). Async & input-audio sync : language_hints; qwen3 sync: asr_options.language" ,
46+ "Language hint (e.g. zh, en, ja). Classic async/ input-audio: language_hints; qwen3-filetrans: language ; qwen3 sync: asr_options.language" ,
4647 } ,
4748 diarization : { type : "switch" , description : "Enable automatic speaker diarization" } ,
4849 speakerCount : {
@@ -70,11 +71,18 @@ const RECOGNIZE_FLAGS = {
7071} satisfies FlagsDef ;
7172type RecognizeFlags = ParsedFlags < typeof RECOGNIZE_FLAGS > ;
7273
73- function assertSyncFlashFlagsAllowed ( flags : RecognizeFlags , model : string ) : void {
74+ function assertSyncFlashFlagsAllowed (
75+ flags : RecognizeFlags ,
76+ model : string ,
77+ flashFamily : AsrFlashFamily ,
78+ ) : void {
7479 const unsupported : string [ ] = [ ] ;
7580 if ( flags . diarization === true ) unsupported . push ( "--diarization" ) ;
7681 if ( flags . speakerCount !== undefined ) unsupported . push ( "--speaker-count" ) ;
77- if ( flags . vocabularyId !== undefined ) unsupported . push ( "--vocabulary-id" ) ;
82+ // qwen3 sync Flash 不走 vocabulary_id;input-audio Flash(fun-asr-flash* / qwen-audio-*-asr-flash)官方支持
83+ if ( flashFamily === "qwen3" && flags . vocabularyId !== undefined ) {
84+ unsupported . push ( "--vocabulary-id" ) ;
85+ }
7886 if ( flags . channelId !== undefined ) unsupported . push ( "--channel-id" ) ;
7987 if ( flags . async === true ) unsupported . push ( "--async" ) ;
8088 if ( flags . pollInterval !== undefined ) unsupported . push ( "--poll-interval" ) ;
@@ -133,7 +141,7 @@ export default defineCommand({
133141 }
134142
135143 if ( route . kind === "sync-flash" ) {
136- assertSyncFlashFlagsAllowed ( flags , model ) ;
144+ assertSyncFlashFlagsAllowed ( flags , model , route . flashFamily ! ) ;
137145 if ( rawUrls . length !== 1 ) {
138146 throw new BailianError (
139147 `Model "${ model } " is a sync Flash ASR model and accepts exactly one --url (got ${ rawUrls . length } ).\n` +
@@ -173,8 +181,11 @@ export default defineCommand({
173181 }
174182
175183 const channelId = flags . channelId ;
176- const language = flags . language ;
177184 const vocabularyId = flags . vocabularyId ;
185+ const languageFields = buildAsyncAsrLanguageFields (
186+ route . asyncLanguageStyle ?? "language_hints" ,
187+ flags . language ,
188+ ) ;
178189
179190 const body : DashScopeASRRequest = {
180191 model,
@@ -184,7 +195,7 @@ export default defineCommand({
184195 : { file_urls : resolvedUrls } ,
185196 parameters : {
186197 channel_id : channelId !== undefined ? [ channelId ] : [ 0 ] ,
187- language_hints : language ? [ language ] : undefined ,
198+ ... languageFields ,
188199 diarization_enabled : diarization ? true : undefined ,
189200 speaker_count : speakerCount ,
190201 vocabulary_id : vocabularyId ,
@@ -221,6 +232,7 @@ async function handleSyncFlashMode(
221232 model,
222233 audioUrl,
223234 language : flags . language ,
235+ vocabularyId : flags . vocabularyId ,
224236 flashFamily,
225237 } ) ;
226238
0 commit comments