Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2f013b4751 | ||
|
|
66dce4415a |
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "cheating-daddy",
|
"name": "cheating-daddy",
|
||||||
"productName": "cheating-daddy",
|
"productName": "cheating-daddy",
|
||||||
"version": "0.5.7",
|
"version": "0.5.8",
|
||||||
"description": "cheating daddy",
|
"description": "cheating daddy",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -19,8 +19,8 @@
|
|||||||
"cheating daddy ai assistant for interviews"
|
"cheating daddy ai assistant for interviews"
|
||||||
],
|
],
|
||||||
"author": {
|
"author": {
|
||||||
"name": "sohzm",
|
"name": "ShiftyX1",
|
||||||
"email": "sohambharambe9@gmail.com"
|
"email": "lead@pyserve.org"
|
||||||
},
|
},
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
+15
-2
@@ -281,6 +281,7 @@ async function sendImageMessage(base64Image, prompt) {
|
|||||||
let audioChunks = [];
|
let audioChunks = [];
|
||||||
let lastAudioTime = 0;
|
let lastAudioTime = 0;
|
||||||
const SILENCE_THRESHOLD_MS = 1500; // 1.5 seconds of silence
|
const SILENCE_THRESHOLD_MS = 1500; // 1.5 seconds of silence
|
||||||
|
let silenceCheckTimer = null;
|
||||||
|
|
||||||
async function processAudioChunk(base64Audio, mimeType) {
|
async function processAudioChunk(base64Audio, mimeType) {
|
||||||
if (!openaiClient) {
|
if (!openaiClient) {
|
||||||
@@ -294,8 +295,20 @@ async function processAudioChunk(base64Audio, mimeType) {
|
|||||||
audioChunks.push(buffer);
|
audioChunks.push(buffer);
|
||||||
lastAudioTime = now;
|
lastAudioTime = now;
|
||||||
|
|
||||||
// Check for silence (no new audio for SILENCE_THRESHOLD_MS)
|
// Clear existing timer
|
||||||
// This is a simple approach - in production you'd want proper VAD
|
if (silenceCheckTimer) {
|
||||||
|
clearTimeout(silenceCheckTimer);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set timer to check for silence
|
||||||
|
silenceCheckTimer = setTimeout(async () => {
|
||||||
|
const silenceDuration = Date.now() - lastAudioTime;
|
||||||
|
if (silenceDuration >= SILENCE_THRESHOLD_MS && audioChunks.length > 0) {
|
||||||
|
console.log('Silence detected, flushing audio for transcription...');
|
||||||
|
await flushAudioAndTranscribe();
|
||||||
|
}
|
||||||
|
}, SILENCE_THRESHOLD_MS);
|
||||||
|
|
||||||
return { success: true, buffering: true };
|
return { success: true, buffering: true };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user