음성 통화: 멈춤 말(어/잠깐/그만…)은 재생·생성만 끊고 대화로 보내지 않음, 끼어들기 확인 500→300ms, 음성 턴 답변은 1~3문장·정정/검증 과정 설명 금지

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
kimandClaude Sonnet 5.5 committed 2026-10-19 23:16:26 +09:00
1 parent 16c4ba2c0f
commit ebcf92ed7c
2 files changed
+13 -2

No files matched your search

+1 -1
View File
@@ -1,5 +1,5 @@
// 음성 통화 턴에 붙이는 안내(시스템 프롬프트 쪽 skillContext로 전달). 인식 오류를 문맥으로 해석하고, 모호하면 되묻게 한다.
var VOICE_INPUT_HINT = 'VOICE INPUT: the user message below came from speech recognition (Korean Whisper) and may contain sound-alike or spacing errors, especially proper nouns (클로서버, 지서버, 옥토서버, 홈클로, 시어엔진, 라즈베리 파이, 기상청). Interpret by context. If a critical word (device/server name, number, or the target of an action with side effects) is ambiguous, ask a one-line confirmation instead of guessing. Keep the reply short and speakable — it will be read aloud: no tables, no emoji, no URLs unless asked.';
var VOICE_INPUT_HINT = 'VOICE INPUT: the user message below came from speech recognition (Korean Whisper) and may contain sound-alike or spacing errors, especially proper nouns (클로서버, 지서버, 옥토서버, 홈클로, 시어엔진, 라즈베리 파이, 기상청). Interpret by context. If a critical word (device/server name, number, or the target of an action with side effects) is ambiguous, ask a one-line confirmation instead of guessing. Keep the reply short and speakable — it will be read aloud: no tables, no emoji, no URLs unless asked. Answer in 1-3 sentences, conclusion first. Never explain or apologize for your own earlier mistakes or corrections, and do not narrate how you searched or verified — just state the corrected answer. Offer details only if asked.';
// chat-sse.js — sendChat (SSE chat dispatch), extracted from app.js.
// Loaded BEFORE app.js so the bare sendChat() references in app.js (chat-input Enter,
+12 -1
View File
@@ -19,7 +19,7 @@
// 훨씬 엄격하게 둔다(더 크고 더 오래). 재생이 끝난 직후에도 잔향 유예 시간 동안은 발화 감지를 막는다.
// (09-26 "말이 군데군데 끊어진다": 자기 목소리가 끼어들기로 잡혀 재생이 끊기고 남은 문장이 사라졌다)
const BARGE_RMS_ON = 0.06;
const BARGE_CONFIRM_CHUNKS = 5; // ~500ms 지속
const BARGE_CONFIRM_CHUNKS = 3; // ~300ms 지속 (짧은 "어"·"잠깐"도 끊기게)
const POST_PLAYBACK_GRACE_MS = 500;
let ws = null;
@@ -314,6 +314,17 @@
break;
}
if (!text) { state = 'listening'; setStatus('듣는 중…'); break; }
// 멈춤 말("어", "잠깐", "그만", "스톱"…): 재생·생성을 끊고 대화로 보내지 않는다.
if (/^[\s.,!?~…]*(어+|아+|으+|음+|잠깐|잠시만?|잠깐만|그만|멈춰|멈춰봐|스톱|스탑|stop|됐어|됐다|아니|아니야)[\s.,!?~…]*$/i.test(text)) {
ttsQueue = [];
if (playerNode) playerNode.port.postMessage({ type: 'clear' });
playbackActive = false;
if (ws && ws.readyState === WebSocket.OPEN && currentTtsId) ws.send(JSON.stringify({ type: 'tts_cancel', id: currentTtsId }));
ttsBusy = false; currentTtsId = null;
try { if (typeof isThinking !== 'undefined' && isThinking && typeof stopGeneration === 'function') stopGeneration(); } catch {}
state = 'listening'; setStatus('듣는 중…');
break;
}
spokenUpTo = 0; pendingTts = ''; spokenKeys.clear(); tableLines = [];
setStatus('생각 중…');
// 사후 보정(고유어 표기 정리) — 서버 /api/voice/correct. 실패·지연 시 원문 그대로 보낸다(통화가 막히면 안 됨).