From 4f3a2f02a57262ddf4a5af91f5a2df9cc26fca65 Mon Sep 17 00:00:00 2001 From: kim Date: Sun, 25 Oct 2026 10:10:39 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9D=B4=EB=A0=A5=EC=9D=98=20=ED=95=9C?= =?UTF-8?q?=EC=98=81=20=EC=98=A4=ED=83=80=20=EC=9B=90=EB=AC=B8=EB=8F=84=20?= =?UTF-8?q?=EB=B3=80=ED=99=98=ED=95=B4=EC=84=9C=20=EB=AA=A8=EB=8D=B8?= =?UTF-8?q?=EC=97=90=20=EB=84=98=EA=B9=80=20=E2=80=94=20=EC=84=B8=EC=85=98?= =?UTF-8?q?=EC=97=94=20'ahsxoskwnrk=20djel=20dlTwl=3F'=20=EC=9B=90?= =?UTF-8?q?=EB=AC=B8=EC=9D=B4=20=EC=A0=80=EC=9E=A5=EB=8F=BC(=ED=98=84?= =?UTF-8?q?=EC=9E=AC=20=ED=84=B4=EB=A7=8C=20=EB=B3=80=ED=99=98),=20?= =?UTF-8?q?=EB=8B=A4=EC=9D=8C=20=ED=84=B4=20=EB=AA=A8=EB=8D=B8=EC=9D=80=20?= =?UTF-8?q?=EC=95=9E=20=EC=A7=88=EB=AC=B8(=EB=AA=AC=ED=83=9C=EB=82=98?= =?UTF-8?q?=EC=A3=BC=EA=B0=80=20=EC=96=B4=EB=94=94=20=EC=9E=88=EC=A7=80=3F?= =?UTF-8?q?)=EC=9D=84=20=EA=B9=A8=EC=A7=84=20=EA=B8=80=EC=9E=90=EB=A1=9C?= =?UTF-8?q?=EB=A7=8C=20=EB=B4=90=EC=84=9C=20"=EC=A7=80=EB=8F=84=20?= =?UTF-8?q?=EC=97=B4=EC=96=B4=EC=A4=98"=EC=97=90=20=EC=96=B4=EB=8A=90=20?= =?UTF-8?q?=EA=B3=B3=EC=9D=B4=EB=83=90=EA=B3=A0=20=EB=90=98=EB=AC=BC?= =?UTF-8?q?=EC=9D=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- src/gateway/chat/handle-chat.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gateway/chat/handle-chat.ts b/src/gateway/chat/handle-chat.ts index e1d958a..cf0e0e1 100644 --- a/src/gateway/chat/handle-chat.ts +++ b/src/gateway/chat/handle-chat.ts @@ -260,9 +260,16 @@ async function handleChat( setWorkspace(sessionId, workspacePath, username); } const historyTurns = (getConfig().getConfig() as any)?.session?.historyTurns ?? 8; - const history = historyOverride + const history = (historyOverride ? historyOverride.map(m => ({ role: m.role as 'user' | 'assistant', content: String(m.content) })) - : getHistoryForApiCall(sessionId, historyTurns, username); + : getHistoryForApiCall(sessionId, historyTurns, username) + ).map(h => { + // 세션에는 한영 오타 원문이 저장된다(server.ts가 handleChat 전에 저장). 그대로 이력에 실으면 다음 턴 모델은 + // "ahsxoskwnrk djel dlTwl?"만 보고 앞 질문을 모른다(10-25 몬태나 → "지도 열어줘"에 어디냐고 되물음). + if (executionMode !== 'interactive' || h.role !== 'user' || typeof h.content !== 'string') return h; + const fixed = fixKeyboardLayout(h.content); + return fixed ? { ...h, content: fixed.text } : h; + }); // 인자 보정 게이트가 볼 텍스트. 현재 메시지만 보면 "더 보여줘" 같은 후속 요청에서 앞 턴의 // 주제가 사라진다 — 모델은 대화 이력을 받아 맥락을 아는데 보정 쪽만 몰라서, 맥락을 아는 쪽의 // 판단을 모르는 쪽이 덮어쓰게 된다(2026-08-12 사용자 지적). 직전 사용자 발화 2턴까지만 본다: