generated from tailored/router-db-template
update
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@kevisual/video-tools",
|
||||
"version": "0.0.7",
|
||||
"version": "0.0.8",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"basename": "/root/video-tools",
|
||||
|
||||
@@ -115,6 +115,14 @@ export class AsrRelatime extends WSServer {
|
||||
console.log('error', error);
|
||||
}
|
||||
}
|
||||
async onClose(event: CloseEvent) {
|
||||
let { code } = event;
|
||||
if (code === 1007) {
|
||||
// reason: Idle timeout
|
||||
code = 0; // 超时不重连
|
||||
}
|
||||
super.onClose({ ...event, code });
|
||||
}
|
||||
async isEnd(type: string) {
|
||||
const types = ['conversation.item.input_audio_transcription.text', 'conversation.item.input_audio_transcription.completed'];
|
||||
if (type === types[1]) {
|
||||
|
||||
@@ -24,18 +24,19 @@ async function main() {
|
||||
});
|
||||
ws.emitter.on('close', (event) => {
|
||||
const { code, reason, type } = event || {};
|
||||
console.log('Connection closed:', code, reason, type);
|
||||
console.log('close envent', event);
|
||||
console.log('Connection closed:', code)
|
||||
if (typeof code === 'number' && code !== 0) {
|
||||
ws.reconnect({ timeout: 1000 });
|
||||
}
|
||||
});
|
||||
await ws.start();
|
||||
const audioContent = await fs.readFile(videoTestPath);
|
||||
// const audioContent = await fs.readFile(videoTestPath);
|
||||
|
||||
ws.sendBuffer(audioContent);
|
||||
ws.sendBlank();
|
||||
ws.sendBuffer(await fs.readFile(videoTestPath2));
|
||||
ws.sendBlank();
|
||||
// ws.sendBuffer(audioContent);
|
||||
// ws.sendBlank();
|
||||
// ws.sendBuffer(await fs.readFile(videoTestPath2));
|
||||
// ws.sendBlank();
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user