번역 세션(translate-*): AUTO-RECOVER·모델 라우팅 제외 + 마법사 번역은 모델 선택창과 무관(서버 기본 모델)

논문 속 숫자에 unverified-spec 가드가 걸려 5,500자 번역을 버리고 Opus로 2회 재생성(5분 $1.8)한 사고 대응.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
kimandClaude Sonnet 5.5 committed 2026-10-19 17:10:09 +09:00
1 parent 2a6635d001
commit 01400a064f
2 files changed
+8 -6

No files matched your search

+5 -3
View File
@@ -488,7 +488,9 @@ async function handleChat(
// strip tool availability entirely for the rest of the turn — a text-only next call can't
// retry a tool call no matter how insistent the model is.
let searchBudgetBlockedCount = 0;
let toolsDisabledForRestOfTurn = false;
// 번역 세션(translate-*, 슬라이드 마법사의 PDF·초록 번역): 도구도, 사실조회 가드도, 모델 라우팅도 필요 없다.
// 2026-10-19: 논문 속 숫자에 AUTO-RECOVER(unverified spec)가 걸려 5,500자 번역을 버리고 Opus로 두 번 더 생성 — 5분에 $1.8.
let toolsDisabledForRestOfTurn = isTranslateSession;
// Scroll-before-act gate: tracks whether a fill/click has happened yet this turn.
// Blocks PageDown/scroll calls on interactive pages until the model actually acts.
let browserFillOrClickDoneThisTurn = false;
@@ -1488,7 +1490,7 @@ async function handleChat(
// 라우팅은 사용자가 모델을 직접 고르지 않았을 때만(modelOverride가 최우선), 실시간·사실 조회 턴은 제외.
const _route = (String(modelOverride || '').trim() || _visionFallbackModel)
? {} as { model?: string; reason?: string }
: decideRoute(message, { skip: isLiveDataRequest(message) || isFactualInfoRequest(message) });
: decideRoute(message, { skip: isTranslateSession || isLiveDataRequest(message) || isFactualInfoRequest(message) });
if (_route.model && round === 0) console.log(`[v2] ROUTE: ${_route.reason} → ${_route.model}`);
const effectiveModel = String(modelOverride || '').trim()
|| _visionFallbackModel
@@ -1822,7 +1824,7 @@ async function handleChat(
// NOTE: gate on "no relevant tool called yet", not "no tool called yet" / "round 0 only" —
// a model that calls one irrelevant/decoy tool (e.g. coder_list_files while answering a
// GPU spec question) must not permanently disarm this for the rest of the turn.
if ((!toolCalls || toolCalls.length === 0) && response.content && toolSkipForcedRetries < MAX_TOOL_SKIP_FORCED_RETRIES) {
if (!isTranslateSession && (!toolCalls || toolCalls.length === 0) && response.content && toolSkipForcedRetries < MAX_TOOL_SKIP_FORCED_RETRIES) {
const content = response.content;
const _recover = decideAutoRecover({
message,
+3 -3
View File
@@ -774,7 +774,7 @@ async function translateAbstract() {
bodyEl.textContent='번역 중...';
try {
const msg='다음 영문 의학 논문 초록을 자연스러운 한국어로 번역해주세요:\n\n'+abEn;
const r=await fetch('/api/chat',{method:'POST',credentials:'include',headers:{'Content-Type':'application/json','Accept':'text/event-stream'},body:JSON.stringify({message:msg,sessionId:'translate-abstract',...wizModelBody()})});
const r=await fetch('/api/chat',{method:'POST',credentials:'include',headers:{'Content-Type':'application/json','Accept':'text/event-stream'},body:JSON.stringify({message:msg,sessionId:'translate-abstract'})});
if(!r.ok) throw new Error('API '+r.status);
const reader=r.body.getReader(),dec=new TextDecoder();
let buf='',reply='';
@@ -825,7 +825,7 @@ function splitChunks(text, size) {
return chunks;
}
// 모델 선택: 비워 두면 서버의 활성 provider 기본 모델을 따른다(모델 이름을 코드에 박지 않는다 —
// 모델 선택(슬라이드 구성·AI 검색에만 적용; PDF·초록 번역은 비용 때문에 항상 서버 기본 모델): 비워 두면 서버의 활성 provider 기본 모델을 따른다(모델 이름을 코드에 박지 않는다 —
// provider가 바뀌면 옛 이름이 그대로 API로 가서 실패한다). 선택값은 이 브라우저에만 저장.
const WIZ_MODEL_KEY='pptx_wizard_model';
function wizModel(){try{return localStorage.getItem(WIZ_MODEL_KEY)||'';}catch{return '';}}
@@ -849,7 +849,7 @@ loadWizModels();
async function chatStream(msg, sessionId) {
const r = await fetch('/api/chat', {method:'POST', credentials:'include',
headers:{'Content-Type':'application/json','Accept':'text/event-stream'},
body: JSON.stringify({message: msg, sessionId, direct: true, ...wizModelBody(), ...(_presenterSkill?{skillContext:_presenterSkill}:{})})});
body: JSON.stringify({message: msg, sessionId, direct: true, ...(_presenterSkill?{skillContext:_presenterSkill}:{})})});
if (!r.ok) throw new Error('API ' + r.status);
const reader = r.body.getReader(), dec = new TextDecoder();
let buf = '', reply = '';