temp: add test

This commit is contained in:
2025-04-18 18:28:34 +08:00
parent d92b93c6f9
commit fdc3985b93
22 changed files with 669 additions and 2082 deletions

View File

@@ -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();