From dd585ac83b244c818849f9c1d11af3ab056614a7 Mon Sep 17 00:00:00 2001 From: "2569718930@qq.com" <2569718930@qq.com> Date: Tue, 26 May 2026 11:51:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E5=8C=BA=E9=97=B4=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E4=BF=AE=E5=A4=8D=EF=BC=9Ascan=20row=20=E4=BC=98?= =?UTF-8?q?=E5=85=88=20daily=20models=EF=BC=8Cfallback=20=E5=88=B0=20multi?= =?UTF-8?q?=20forecasts=20+=20hourly?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 后端 _build_quick_row: model_cluster_sources 先从 multi_model_daily 取 daily models - 前端 chart: modelValues 优先 row.model_cluster_sources,缺失时从 hourly.multiModelDaily 补 --- .../LiveTemperatureThresholdChart.tsx | 7 ++++++- web/scan_terminal_city_row.py | 17 +++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/frontend/components/dashboard/scan-terminal/LiveTemperatureThresholdChart.tsx b/frontend/components/dashboard/scan-terminal/LiveTemperatureThresholdChart.tsx index 453c466b..755b41fe 100644 --- a/frontend/components/dashboard/scan-terminal/LiveTemperatureThresholdChart.tsx +++ b/frontend/components/dashboard/scan-terminal/LiveTemperatureThresholdChart.tsx @@ -1486,7 +1486,12 @@ export function LiveTemperatureThresholdChart({ const displayRunwayTemp = liveTemp ?? currentRunwayTemp; const wundergroundDailyHigh = validNumber(hourly?.airportCurrent?.max_so_far ?? hourly?.airportPrimary?.max_so_far) ?? null; - const modelValues = Object.values(row?.model_cluster_sources || {}) + const localDateStr = row?.local_date || new Date().toISOString().slice(0, 10); + const modelSources = (row?.model_cluster_sources && Object.keys(row.model_cluster_sources).length > 0) + ? row.model_cluster_sources + : (hourly?.multiModelDaily?.[localDateStr]?.models || null); + + const modelValues = Object.values(modelSources || {}) .map(validNumber) .filter((v): v is number => v !== null); const modelMin = modelValues.length ? Math.min(...modelValues) : (row?.cluster_core_low ?? null); diff --git a/web/scan_terminal_city_row.py b/web/scan_terminal_city_row.py index 1ae267a8..95006734 100644 --- a/web/scan_terminal_city_row.py +++ b/web/scan_terminal_city_row.py @@ -183,6 +183,11 @@ def _build_quick_row( tz_offset = _safe_int(city_meta.get("tz"), 0) market_region = _market_region_from_tz_offset(tz_offset) + multi_model_daily = data.get("multi_model_daily") or {} + daily_entry = multi_model_daily.get(local_date) if isinstance(multi_model_daily, dict) else {} + if not isinstance(daily_entry, dict): + daily_entry = {} + id_parts = [city, local_date or "today"] if data.get("temp_symbol") == "°F": id_parts.append("F") @@ -201,10 +206,14 @@ def _build_quick_row( "current_temp": curr.get("temp"), "current_max_so_far": curr.get("max_so_far"), "deb_prediction": deb.get("prediction"), - "model_cluster_sources": { - str(k): v for k, v in multi.get("forecasts", {}).items() - if v is not None - }, + "model_cluster_sources": ( + daily_entry.get("models") + if isinstance(daily_entry.get("models"), dict) + else { + str(k): v for k, v in multi.get("forecasts", {}).items() + if v is not None + } + ), "distribution_preview": distribution[:6] if distribution else [], "trading_region": market_region["key"], "trading_region_label": market_region["label_en"],