fix(weather_openmeteo): hours만 주면 일별 구간이 3일로 끊기던 문제

"이번 주 날씨"에서 모델이 hours:168만 넘기면 days 기본 3과 시간별 48시간 제한이 겹쳐 3일치만
나왔다. 기본 변수에 일별 요약(최고·최저·강수확률·강수량)을 포함하고, days를 안 주면
hours가 덮는 일수만큼 일별을 요청한다.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
kimandClaude Sonnet 5.5 committed 2026-10-14 10:52:39 +09:00
1 parent f2639eb7a8
commit 39f8fa21d3
1 file changed
+7 -2
+7 -2
View File
@@ -894,8 +894,13 @@ export const weatherOpenMeteoTool = {
if (!location) return { success: false, error: 'location is required' };
const hours = Math.min(Math.max(1, Math.round(Number(args?.hours) || 24)), 384);
const days = Math.min(Math.max(1, Math.round(Number(args?.days) || 3)), 16);
const vars = String(args?.variables || 'temperature_2m,precipitation,precipitation_probability,wind_speed_10m,wind_direction_10m,relative_humidity_2m,uv_index,weather_code');
// 2026-10-14 실사고: "이번 주 구미 날씨" → 모델이 hours:168만 주고 days는 안 줘서 일별 구간이 3일로
// 끊겼다(시간별은 48시간 표시 제한). days를 안 주면 hours가 덮는 일수만큼 일별을 요청한다.
const requestedHours = Number(args?.hours) || 0;
const defaultDays = Math.max(3, Math.ceil(requestedHours / 24));
const days = Math.min(Math.max(1, Math.round(Number(args?.days) || defaultDays)), 16);
// 기본 변수에 일별 요약(최고·최저·강수확률·강수량)을 포함한다. 시간별만 있으면 3일 밖의 날은 아예 안 나온다.
const vars = String(args?.variables || 'temperature_2m,precipitation,precipitation_probability,wind_speed_10m,wind_direction_10m,relative_humidity_2m,uv_index,weather_code,temperature_2m_max,temperature_2m_min,precipitation_probability_max,precipitation_sum');
// Daily-only names used to be posted to `hourly=`, which Open-Meteo accepts — it returns
// an hourly series under a daily name, so `temperature_2m_max` produced numbers that were
// not maxima at all. Route them before the request instead.