weather_kma current: 이번 강수 사상이 없을 때 어제 일강수량(ASOS)을 한 줄 덧붙임 — 모델이 past를 이어 부르지 않던 문제
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0091ce000b
commit
51818cf846
1 file changed
+16
@@ -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')}°)`,
|
||||
|
||||
Reference in new issue
Block a user