agentgui 1.0.485 → 1.0.486
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/static/js/voice.js +8 -2
package/package.json
CHANGED
package/static/js/voice.js
CHANGED
|
@@ -508,6 +508,11 @@
|
|
|
508
508
|
var streamingSupported = true;
|
|
509
509
|
var streamingFailedAt = 0;
|
|
510
510
|
|
|
511
|
+
function optimizePromptForSpeech(text) {
|
|
512
|
+
var optimizationInstructions = ' [Optimize for speech: Keep it short. Use simple words. Use short sentences. Focus on clarity.]';
|
|
513
|
+
return text + optimizationInstructions;
|
|
514
|
+
}
|
|
515
|
+
|
|
511
516
|
function playNextChunk() {
|
|
512
517
|
if (audioChunkQueue.length === 0) {
|
|
513
518
|
isPlayingChunk = false;
|
|
@@ -582,6 +587,7 @@
|
|
|
582
587
|
}
|
|
583
588
|
|
|
584
589
|
var remainingText = uncachedText.join(' ');
|
|
590
|
+
var optimizedText = optimizePromptForSpeech(remainingText);
|
|
585
591
|
|
|
586
592
|
function onTtsSuccess() {
|
|
587
593
|
ttsConsecutiveFailures = 0;
|
|
@@ -602,11 +608,11 @@
|
|
|
602
608
|
}
|
|
603
609
|
|
|
604
610
|
function tryStreaming() {
|
|
605
|
-
if (!streamingSupported) { tryNonStreaming(
|
|
611
|
+
if (!streamingSupported) { tryNonStreaming(optimizedText); return; }
|
|
606
612
|
fetch(BASE + '/api/tts-stream', {
|
|
607
613
|
method: 'POST',
|
|
608
614
|
headers: { 'Content-Type': 'application/json' },
|
|
609
|
-
body: JSON.stringify({ text:
|
|
615
|
+
body: JSON.stringify({ text: optimizedText, voiceId: selectedVoiceId })
|
|
610
616
|
}).then(function(resp) {
|
|
611
617
|
if (!resp.ok) {
|
|
612
618
|
streamingSupported = false;
|