Spaces:
Running
Running
Update script1.js
Browse files- script1.js +3 -4
script1.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
const USER_SPEECH_INTERRUPT_DELAY = 500;
|
3 |
const TEXT_TO_SPEECH_API_ENDPOINT = "https://api.streamelements.com/kappa/v2/speech";
|
4 |
const CHUNK_SIZE = 300;
|
5 |
-
const MAX_PREFETCH_REQUESTS =
|
6 |
const PREFETCH_CACHE_EXPIRATION = 60000; // 1 minute
|
7 |
const AUDIO_CACHE_EXPIRATION = 3600000; // 1 hour
|
8 |
const WEBCAM_INTERVAL = 5000;
|
@@ -223,10 +223,9 @@ async function sendQueryToAI(query) {
|
|
223 |
|
224 |
try {
|
225 |
let combinedQuery = `{USER: "${query}"}`;
|
226 |
-
if (
|
227 |
-
combinedQuery += `, ${lastCaption}`;
|
228 |
}
|
229 |
-
combinedQuery += `, {USER: "${query}"}`;
|
230 |
|
231 |
await streamAndHandleAudioResponse(combinedQuery, voiceSelectionDropdown.value, requestAbortController.signal);
|
232 |
} catch (error) {
|
|
|
2 |
const USER_SPEECH_INTERRUPT_DELAY = 500;
|
3 |
const TEXT_TO_SPEECH_API_ENDPOINT = "https://api.streamelements.com/kappa/v2/speech";
|
4 |
const CHUNK_SIZE = 300;
|
5 |
+
const MAX_PREFETCH_REQUESTS = 10;
|
6 |
const PREFETCH_CACHE_EXPIRATION = 60000; // 1 minute
|
7 |
const AUDIO_CACHE_EXPIRATION = 3600000; // 1 hour
|
8 |
const WEBCAM_INTERVAL = 5000;
|
|
|
223 |
|
224 |
try {
|
225 |
let combinedQuery = `{USER: "${query}"}`;
|
226 |
+
if (lastCaption !== "") {
|
227 |
+
combinedQuery += `, ${lastCaption} , {USER: "${query}"}`;
|
228 |
}
|
|
|
229 |
|
230 |
await streamAndHandleAudioResponse(combinedQuery, voiceSelectionDropdown.value, requestAbortController.signal);
|
231 |
} catch (error) {
|