generated from tailored/router-template
update
This commit is contained in:
@@ -7,15 +7,22 @@ import fs from 'fs';
|
||||
const main = async () => {
|
||||
const audioId = '123';
|
||||
const asrClient = new AsrWsClient({
|
||||
appid: config.APP_ID,
|
||||
token: config.TOKEN,
|
||||
appid: config.VOLCENGINE_ASR_MODEL_APPID,
|
||||
token: config.VOLCENGINE_ASR_MODEL_TOKEN,
|
||||
});
|
||||
asrClient.emitter.on('message', (result) => {
|
||||
console.log('识别结果', JSON.stringify(result, null, 2));
|
||||
})
|
||||
asrClient.emitter.on('end', (result) => {
|
||||
console.log('识别结束', JSON.stringify(result, null, 2));
|
||||
})
|
||||
await new Promise((resolve) => setTimeout(resolve, 2000));
|
||||
const data = fs.readFileSync(audioPath);
|
||||
await asrClient.sendVoiceFile(data);
|
||||
await asrClient.sendVoiceFile(fs.readFileSync(blankAudioPath));
|
||||
// await asrClient.sendVoiceFile(fs.readFileSync(blankAudioPath));
|
||||
asrClient.setIsEnd(true);
|
||||
await asrClient.sendVoiceFile(fs.readFileSync(audioPath2));
|
||||
// await asrClient.sendVoiceFile(fs.readFileSync(audioPath2));
|
||||
|
||||
};
|
||||
|
||||
main();
|
||||
|
||||
Reference in New Issue
Block a user