v4.3.19-14: 위성사진 위치→지도 이동을 클라이언트에서 결정론적으로 처리

실제 테스트에서 발견: "지도 이동해줘" 후속 요청에 모델(deepseek-v4-flash)이
도구를 재호출하지 않고 이전 응답을 그대로 반복하는 경우가 많아 프롬프트
가드만으로는 신뢰도가 부족했음. 근본 해결로 사진 뷰어에 "지도에서 위치
보기" 버튼 추가 — satellite_snapshot 파일명에 이미 박혀있는 좌표를
그대로 파싱해 지도를 이동시키므로 모델 개입이 전혀 필요 없음.

부수적으로 execute-tool.ts에도 weather_map_screenshot 성공 시 그 URL을
SSE로 직접 주입하는 방어선 추가(모델이 실제로 도구를 호출했을 때 대비).
This commit is contained in:
kim committed 2026-07-27 12:11:44 +09:00
1 parent 0b9ce3d18a
commit ce9f556e84
2 files changed
+27

No files matched your search

+8
View File
@@ -1502,6 +1502,14 @@ print(json.dumps({'slides': slides, 'total': len(prs.slides)}, ensure_ascii=Fals
}));
sendSSE?.('files', { links });
}
// weather_map_screenshot only ever runs in a weather-app session (gated in
// handle-chat.ts). The screenshot itself is for the model's own vision only —
// the visible map only updates when the raw Windy URL appears as text in the
// reply, and models unreliably skip re-emitting it on follow-up "move the map"
// requests. Push it via SSE so the map updates regardless of what the model writes.
if (name === 'weather_map_screenshot' && tr.success && typeof args?.url === 'string') {
sendSSE?.('token', { text: `\n${args.url}\n` });
}
return { name, args, result: _resultText, error: !tr.success, ...(_hasImageMd ? { isImage: true } : {}), ...(tr.data !== undefined ? { data: tr.data } : {}) };
}
}
+19
View File
@@ -103,6 +103,8 @@ body{background:var(--bg);color:var(--text);font-family:system-ui,sans-serif;fon
.wt-photo-zoom-ctrl button{width:26px;height:26px;border:none;border-radius:6px;background:rgba(255,255,255,.08);color:#e5e7eb;font-size:15px;font-weight:700;cursor:pointer;line-height:1;font-family:inherit;}
.wt-photo-zoom-ctrl button:hover{background:rgba(255,255,255,.18);}
.wt-photo-zoom-ctrl span{color:#e5e7eb;font-size:11px;font-weight:700;font-family:'IBM Plex Mono',monospace;width:38px;text-align:center;}
.wt-photo-goto-map{position:absolute;left:12px;bottom:12px;background:rgba(0,0,0,.55);border:none;border-radius:8px;padding:7px 12px;color:#e5e7eb;font-size:12px;font-weight:600;cursor:pointer;font-family:inherit;backdrop-filter:blur(4px);}
.wt-photo-goto-map:hover{background:rgba(255,255,255,.18);}
.wt-map-frame{width:100%;height:100%;border:none;display:block;}
.wt-map-loading{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;color:var(--muted);font-size:12px;background:var(--bg);pointer-events:none;transition:opacity .3s;}
.wt-map-loading.hidden{opacity:0;}
@@ -281,6 +283,7 @@ body{background:var(--bg);color:var(--text);font-family:system-ui,sans-serif;fon
<button onclick="wtPhotoZoomIn()" title="확대">+</button>
<button onclick="wtPhotoZoomReset()" title="원래 크기">⟲</button>
</div>
<button class="wt-photo-goto-map" onclick="wtShowPhotoLocationOnMap()" title="이 위치를 지도 탭에서 보기">🗺️ 지도에서 위치 보기</button>
</div>
</section>
@@ -655,6 +658,22 @@ function openPhotoTab(url,label){
switchCenterTab(addPhotoTab(url,label));
}
// Satellite photo filenames encode their own coordinates (satellite-{lat}_{lon}-...),
// so jumping the interactive map to a photo's location doesn't need the chat model at
// all — client-side lookup is instant and can't be skipped/hallucinated like relying
// on the model to re-emit a Windy URL on a follow-up "move the map" request.
function wtShowPhotoLocationOnMap(){
const tab=wtTabs.find(t=>t.id===wtActiveTab);
if(!tab||tab.type!=='photo')return;
const m=tab.url.match(/satellite-(-?\d+\.?\d*)_(-?\d+\.?\d*)-/);
if(!m)return;
mapLat=parseFloat(m[1]);mapLon=parseFloat(m[2]);
const locInput=document.getElementById('map-loc');
if(locInput)locInput.value=`${mapLat},${mapLon}`;
switchCenterTab('map');
updateMap();
}
function closeCenterTab(id){
wtTabs=wtTabs.filter(t=>t.id!==id);
saveWtTabs();