From 51818cf846ef7821e0ba1716dac0c3dc93dacb16 Mon Sep 17 00:00:00 2001 From: kim Date: Mon, 19 Oct 2026 10:07:20 +0900 Subject: [PATCH] =?UTF-8?q?weather=5Fkma=20current:=20=EC=9D=B4=EB=B2=88?= =?UTF-8?q?=20=EA=B0=95=EC=88=98=20=EC=82=AC=EC=83=81=EC=9D=B4=20=EC=97=86?= =?UTF-8?q?=EC=9D=84=20=EB=95=8C=20=EC=96=B4=EC=A0=9C=20=EC=9D=BC=EA=B0=95?= =?UTF-8?q?=EC=88=98=EB=9F=89(ASOS)=EC=9D=84=20=ED=95=9C=20=EC=A4=84=20?= =?UTF-8?q?=EB=8D=A7=EB=B6=99=EC=9E=84=20=E2=80=94=20=EB=AA=A8=EB=8D=B8?= =?UTF-8?q?=EC=9D=B4=20past=EB=A5=BC=20=EC=9D=B4=EC=96=B4=20=EB=B6=80?= =?UTF-8?q?=EB=A5=B4=EC=A7=80=20=EC=95=8A=EB=8D=98=20=EB=AC=B8=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 5.5 --- src/tools/weather.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/tools/weather.ts b/src/tools/weather.ts index 41a906c..8b791bc 100644 --- a/src/tools/weather.ts +++ b/src/tools/weather.ts @@ -1755,6 +1755,21 @@ export const weatherKmaTool = { + `강수 ${episode.wetHours}시간${episode.truncated ? ', 7일 조회창을 넘겨 하한값' : ''} · ${episodeSource})` : null; + // 이번 강수 사상은 비가 그친 지 몇 시간 지나면 사라진다. 그 뒤 "이번 비 얼마나 왔어"를 받으면 + // 모델이 type=past를 이어서 부르지 않고 "어제 값을 조회해야 한다"며 멈췄다(2026-10-19). + // 어제 비가 있었으면 그 일강수량을 같이 준다 — 일자료는 전날까지라 오늘과 겹치지 않는다. + let yesterdayLine: string | null = null; + if (!episodeLine && station && base_date === todayKst) { + try { + const yd = new Date(Date.now() + 9 * 3600 * 1000 - 24 * 3600 * 1000).toISOString().slice(0, 10).replace(/-/g, ''); + const yItems = await fetchAsosDaily(station.id, yd, yd); + const ymm = parseFloat(String(yItems[0]?.sumRn ?? '')); + if (Number.isFinite(ymm) && ymm > 0) { + yesterdayLine = `어제(${yd.slice(4, 6)}/${yd.slice(6, 8)}) 일강수량: ${ymm} mm (ASOS ${station.name} 관측소) — 비가 어제부터 이어졌다면 "이번 비"는 어제 값 + 위 오늘 누적`; + } + } catch { /* 어제 값은 덤이라 실패해도 실황은 그대로 준다 */ } + } + const lines = [ `기상청 초단기실황: ${displayName}`, `기준시각: ${base_date.slice(0,4)}-${base_date.slice(4,6)}-${base_date.slice(6,8)} ${base_time.slice(0,2)}:${base_time.slice(2,4)} KST`, @@ -1764,6 +1779,7 @@ export const weatherKmaTool = { `1시간 강수량: ${get('RN1')} mm`, rainLine, ...(episodeLine ? [episodeLine] : []), + ...(yesterdayLine ? [yesterdayLine] : []), ...(fogLine ? [fogLine] : []), `습도: ${get('REH')}%`, `풍향: ${windDirectionKo(vecDeg)} (${get('VEC')}°)`,