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