음성 통화: 모델이 확인차 되물은 직후 '음/응'을 '네'로 전달(멈춤 말로 버리지 않음)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
edfa1460cd
commit
90fe19f7ba
1 file changed
+12
-1
@@ -307,13 +307,24 @@
|
||||
|
||||
case 'stt_final': {
|
||||
setCaption('');
|
||||
const text = (msg.text || '').trim();
|
||||
let text = (msg.text || '').trim();
|
||||
if (spkEnrolling) { // 목소리 등록 중: 인식문은 채팅으로 보내지 않고 등록 표본 수만 갱신한다
|
||||
state = 'listening'; setStatus('목소리 등록 중… 계속 말씀해 주세요');
|
||||
if (ws && ws.readyState === WebSocket.OPEN) ws.send(JSON.stringify({ type: 'spk_enroll', action: 'status' }));
|
||||
break;
|
||||
}
|
||||
if (!text) { state = 'listening'; setStatus('듣는 중…'); break; }
|
||||
// 모델이 확인차 되물은 직후(재생·생성이 끝난 상태)의 "음"/"응"은 "네"로 받는다 — 멈춤 말이 아니라 긍정 대답이다.
|
||||
if (/^[\s.,!?~…]*(음+|응+|으응+|으음+|흠|웅)[\s.,!?~…]*$/.test(text)) {
|
||||
let idle = true, asked = false;
|
||||
try {
|
||||
idle = !(typeof isThinking !== 'undefined' && isThinking) && !playbackActive && !ttsBusy && ttsQueue.length === 0;
|
||||
const last = typeof chatHistory !== 'undefined' && chatHistory.length ? chatHistory[chatHistory.length - 1] : null;
|
||||
const tail = last && last.role === 'ai' ? String(last.content || '').replace(/[\s*_`~)\]]+$/g, '') : '';
|
||||
asked = /[??]$/.test(tail);
|
||||
} catch {}
|
||||
if (idle && asked) text = '네';
|
||||
}
|
||||
// 멈춤 말("어", "잠깐", "그만", "스톱"…): 재생·생성을 끊고 대화로 보내지 않는다.
|
||||
if (/^[\s.,!?~…]*(어+|아+|으+|음+|잠깐|잠시만?|잠깐만|그만|멈춰|멈춰봐|스톱|스탑|stop|됐어|됐다|아니|아니야)[\s.,!?~…]*$/i.test(text)) {
|
||||
ttsQueue = [];
|
||||
|
||||
Reference in new issue
Block a user