Spaces:
Sleeping
Sleeping
Update frontend/js/main.js
Browse files- frontend/js/main.js +13 -18
frontend/js/main.js
CHANGED
|
@@ -106,37 +106,32 @@ class GeminiApp {
|
|
| 106 |
* Handle incoming WebSocket messages
|
| 107 |
*/
|
| 108 |
handleWebSocketMessage(response) {
|
| 109 |
-
// 1. Map Real-Time User Speech Transcript (Generated by input_transcription_config)
|
| 110 |
-
if (response.inputTranscription && response.inputTranscription.text) {
|
| 111 |
-
this.uiController.appendMessage(`[You] ${response.inputTranscription.text}`);
|
| 112 |
-
return;
|
| 113 |
-
}
|
| 114 |
-
|
| 115 |
-
// 2. Map Real-Time Gemini Speech Transcript
|
| 116 |
-
if (response.outputTranscription && response.outputTranscription.text) {
|
| 117 |
-
this.uiController.appendMessage(`[Gemini] ${response.outputTranscription.text}`);
|
| 118 |
-
return;
|
| 119 |
-
}
|
| 120 |
-
|
| 121 |
-
// 3. Fallback Route Parser for Core Signal Objects
|
| 122 |
switch (response.type) {
|
| 123 |
case 'audio':
|
| 124 |
this.audioManager.playAudio(response.data);
|
| 125 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
|
| 127 |
case 'text':
|
| 128 |
-
//
|
| 129 |
-
// If you want to hide the background tool/search reasoning thoughts entirely, comment this out.
|
| 130 |
this.uiController.appendMessage(`[System Reasoning] ${response.text}`);
|
| 131 |
break;
|
| 132 |
|
| 133 |
case 'turn_complete':
|
| 134 |
-
this.uiController.appendMessage('
|
| 135 |
break;
|
| 136 |
|
| 137 |
default:
|
| 138 |
-
|
| 139 |
-
console.log("Other socket metadata payload received:", response);
|
| 140 |
}
|
| 141 |
}
|
| 142 |
|
|
|
|
| 106 |
* Handle incoming WebSocket messages
|
| 107 |
*/
|
| 108 |
handleWebSocketMessage(response) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
switch (response.type) {
|
| 110 |
case 'audio':
|
| 111 |
this.audioManager.playAudio(response.data);
|
| 112 |
break;
|
| 113 |
+
|
| 114 |
+
case 'user_text':
|
| 115 |
+
// Prints clean spoken transcript text for user input chunks
|
| 116 |
+
this.uiController.appendMessage(`[You] ${response.text}`);
|
| 117 |
+
break;
|
| 118 |
+
|
| 119 |
+
case 'gemini_text':
|
| 120 |
+
// Prints clean spoken transcript text for Gemini audio output chunks
|
| 121 |
+
this.uiController.appendMessage(`[Gemini] ${response.text}`);
|
| 122 |
+
break;
|
| 123 |
|
| 124 |
case 'text':
|
| 125 |
+
// Optional: Hide internal chain-of-thought or search tool logic entirely if desired.
|
|
|
|
| 126 |
this.uiController.appendMessage(`[System Reasoning] ${response.text}`);
|
| 127 |
break;
|
| 128 |
|
| 129 |
case 'turn_complete':
|
| 130 |
+
this.uiController.appendMessage('[Turn Complete]');
|
| 131 |
break;
|
| 132 |
|
| 133 |
default:
|
| 134 |
+
this.uiController.appendMessage(`[Unknown Payload]: ${JSON.stringify(response)}`);
|
|
|
|
| 135 |
}
|
| 136 |
}
|
| 137 |
|