Spaces:
Running
Running
SamiKoen commited on
Commit ·
af2e91e
1
Parent(s): 705b5d3
Echo loop fix: asistan sesi yeni turn tetiklemesin
Browse files- VAD threshold 0.5 -> 0.7 (daha kati: hoparlor sesi user gibi algilanmasin)
- silence_duration 700ms -> 1200ms (daha uzun bekleme)
- Frontend gate: asistan konusurken mikrofon audio'su OpenAI'a gonderilmez
- realtime_relay.py +2 -2
- static/index.html +2 -0
realtime_relay.py
CHANGED
|
@@ -118,9 +118,9 @@ def _session_update_payload() -> dict:
|
|
| 118 |
"transcription": {"model": "gpt-4o-mini-transcribe", "language": "tr"},
|
| 119 |
"turn_detection": {
|
| 120 |
"type": "server_vad",
|
| 121 |
-
"threshold": 0.
|
| 122 |
"prefix_padding_ms": 300,
|
| 123 |
-
"silence_duration_ms":
|
| 124 |
"interrupt_response": False,
|
| 125 |
"create_response": True,
|
| 126 |
},
|
|
|
|
| 118 |
"transcription": {"model": "gpt-4o-mini-transcribe", "language": "tr"},
|
| 119 |
"turn_detection": {
|
| 120 |
"type": "server_vad",
|
| 121 |
+
"threshold": 0.7, # Daha katı (0.5 -> 0.7) — asistan sesi user gibi algılanmasın
|
| 122 |
"prefix_padding_ms": 300,
|
| 123 |
+
"silence_duration_ms": 1200, # Sessizlik daha uzun (700 -> 1200ms)
|
| 124 |
"interrupt_response": False,
|
| 125 |
"create_response": True,
|
| 126 |
},
|
static/index.html
CHANGED
|
@@ -246,6 +246,8 @@ async function connect() {
|
|
| 246 |
workletNode = new AudioWorkletNode(audioCtx, 'pcm-processor');
|
| 247 |
workletNode.port.onmessage = (e) => {
|
| 248 |
if (ws?.readyState !== WebSocket.OPEN) return;
|
|
|
|
|
|
|
| 249 |
const b64 = arrayBufferToBase64(e.data.pcm);
|
| 250 |
ws.send(JSON.stringify({ type: 'input_audio_buffer.append', audio: b64 }));
|
| 251 |
};
|
|
|
|
| 246 |
workletNode = new AudioWorkletNode(audioCtx, 'pcm-processor');
|
| 247 |
workletNode.port.onmessage = (e) => {
|
| 248 |
if (ws?.readyState !== WebSocket.OPEN) return;
|
| 249 |
+
// Asistan konusurken mikrofon audio'sunu OpenAI'a GONDERME — echo-feedback'i onler
|
| 250 |
+
if (assistantSpeaking) return;
|
| 251 |
const b64 = arrayBufferToBase64(e.data.pcm);
|
| 252 |
ws.send(JSON.stringify({ type: 'input_audio_buffer.append', audio: b64 }));
|
| 253 |
};
|