diff --git a/src/gateway/chat/handle-chat.ts b/src/gateway/chat/handle-chat.ts index 98e11e0..7970a5e 100644 --- a/src/gateway/chat/handle-chat.ts +++ b/src/gateway/chat/handle-chat.ts @@ -2636,14 +2636,13 @@ async function handleChat( const _alt = _loc ? suspectSoundAlikePlace(_loc) : null; const _lastAsst = String([...history].reverse().find(h => h.role === 'assistant')?.content || ''); if (_alt && !(_lastAsst.includes(_loc) && /말씀|맞으|맞나/.test(_lastAsst))) { - const askMsg = `PLACE CONFIRMATION NEEDED: "${_loc}" sounds like "${_alt}" and may be a speech-recognition error. The weather lookup was NOT run. Reply with ONE short speakable question only — e.g. "${_loc}이 ${_alt} 말씀이세요?" — and nothing else; do not call any tool. If the user confirms "${_loc}" is correct, look it up as written.`; + // 약한 모델(gemma4)은 "되묻기만 하라"는 도구 결과를 무시하고 다른 지명으로 다시 조회했다 — 모델에 맡기지 않고 + // 서버가 직접 확인 질문으로 이번 턴을 끝낸다. + const question = `혹시 ${_loc}이 아니라 ${_alt} 말씀이세요? 맞으면 "응"이라고 하고, 아니면 지명을 다시 말씀해 주세요.`; console.log(`[v2] VOICE PLACE CHECK: "${_loc}" ~ "${_alt}" — asking for confirmation instead of ${toolName}`); - const askResult: ToolResult = { name: toolName, args: toolArgs, result: askMsg, error: false }; - allToolResults.push(askResult); - sendSSE('tool_call', { action: toolName, args: toolArgs, stepNum: allToolResults.length }); - sendSSE('tool_result', { action: toolName, result: askMsg.slice(0, 300), error: false, stepNum: allToolResults.length }); - messages.push({ role: 'tool', name: toolName, tool_name: toolName, tool_call_id: toolCallId || undefined, content: askMsg }); - continue; + sendSSE('info', { message: `음성 인식 확인: "${_loc}" → "${_alt}"?` }); + logToDaily(workspacePath, 'SmallClaw', question, sessionId); + return { type: 'chat', text: question, usage: lastUsage }; } }