11
This commit is contained in:
@@ -70,11 +70,19 @@ pub async fn transcribe(
|
||||
.timeout(Duration::from_secs(60))
|
||||
.build()?;
|
||||
|
||||
// 1) submit
|
||||
// 1) submit — filetrans 用 file_url,其它模型用 file_urls
|
||||
let input = if model == "qwen3-asr-flash-filetrans" {
|
||||
json!({ "file_url": audio_url })
|
||||
} else {
|
||||
json!({ "file_urls": [audio_url] })
|
||||
};
|
||||
let submit_body = json!({
|
||||
"model": model,
|
||||
"input": { "file_urls": [audio_url] },
|
||||
"parameters": {}
|
||||
"input": input,
|
||||
"parameters": {
|
||||
"channel_id": [0],
|
||||
"enable_itn": false
|
||||
}
|
||||
});
|
||||
let submit: Value = client
|
||||
.post(SUBMIT_URL)
|
||||
@@ -124,10 +132,15 @@ pub async fn transcribe(
|
||||
return Err(AsrError::Timeout);
|
||||
}
|
||||
|
||||
// 3) fetch transcription file
|
||||
// 3) fetch transcription file (filetrans: output.result; batch: output.results[0])
|
||||
let trans_url = poll_resp
|
||||
.pointer("/output/results/0/transcription_url")
|
||||
.pointer("/output/result/transcription_url")
|
||||
.and_then(Value::as_str)
|
||||
.or_else(|| {
|
||||
poll_resp
|
||||
.pointer("/output/results/0/transcription_url")
|
||||
.and_then(Value::as_str)
|
||||
})
|
||||
.ok_or_else(|| AsrError::Api(format!("no transcription_url, raw={poll_resp}")))?
|
||||
.to_string();
|
||||
let trans_json: Value = client.get(&trans_url).send().await?.json().await?;
|
||||
|
||||
Reference in New Issue
Block a user