generated from tailored/router-template
temp: add test
This commit is contained in:
@@ -1,28 +1,21 @@
|
||||
import { AsrWsClient, testStream } from '../asr-ws-big-model-client.ts';
|
||||
import { audioPath, config } from './common.ts';
|
||||
|
||||
import { AsrWsClient } from '../asr-ws-big-model-client.ts';
|
||||
import { audioPath, audioPath2, blankAudioPath, config } from './common.ts';
|
||||
import fs from 'fs';
|
||||
// const asr = new AsrWsClient('videos/asr_example.wav');
|
||||
|
||||
// tsx src/asr/provider/volcengine/test/asr-bigmodel.ts
|
||||
const main = async () => {
|
||||
const audioId = '123';
|
||||
const asrClient = new AsrWsClient(audioPath, {
|
||||
const asrClient = new AsrWsClient({
|
||||
appid: config.APP_ID,
|
||||
token: config.TOKEN,
|
||||
streaming: false,
|
||||
});
|
||||
await new Promise((resolve) => setTimeout(resolve, 2000));
|
||||
|
||||
return asrClient.execute().then((result) => {
|
||||
return {
|
||||
id: audioId,
|
||||
path: audioPath,
|
||||
result: result,
|
||||
};
|
||||
});
|
||||
};
|
||||
const main2 = async () => {
|
||||
testStream();
|
||||
const data = fs.readFileSync(audioPath);
|
||||
await asrClient.sendVoiceFile(data);
|
||||
await asrClient.sendVoiceFile(fs.readFileSync(blankAudioPath));
|
||||
asrClient.setIsEnd(true);
|
||||
await asrClient.sendVoiceFile(fs.readFileSync(audioPath2));
|
||||
};
|
||||
|
||||
main();
|
||||
|
||||
Reference in New Issue
Block a user