From 619498a4de346670f7485ad88475d4d3bb202f27 Mon Sep 17 00:00:00 2001 From: AeBoPi <109503402+AeBoPi@users.noreply.github.com> Date: Tue, 7 Jul 2026 17:26:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=A4=A9=E6=B0=94?= =?UTF-8?q?=E5=92=8C=E7=9B=B8=E6=A1=86=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/core/context.py | 4 ++-- backend/tests/test_unit_context.py | 9 +++++++++ webapp/app/config/page.tsx | 6 ++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/backend/core/context.py b/backend/core/context.py index 7d05d93b..fd755192 100644 --- a/backend/core/context.py +++ b/backend/core/context.py @@ -1060,7 +1060,7 @@ def _weather_code_to_desc(code: int, language: str = "zh") -> str: 61: "Light rain", 63: "Rain", 65: "Heavy rain", 71: "Light snow", 73: "Snow", 75: "Heavy snow", 80: "Showers", 81: "Showers", 82: "Storm rain", - 95: "Thunderstorm", 96: "Hail", 99: "Hail", + 95: "Thunderstorm", 96: "Thunderstorm", 99: "Thunderstorm", } return mapping.get(code, "Unknown") mapping = { @@ -1070,7 +1070,7 @@ def _weather_code_to_desc(code: int, language: str = "zh") -> str: 61: "小雨", 63: "中雨", 65: "大雨", 71: "小雪", 73: "中雪", 75: "大雪", 80: "阵雨", 81: "阵雨", 82: "暴雨", - 95: "雷阵雨", 96: "冰雹", 99: "冰雹", + 95: "雷阵雨", 96: "雷阵雨", 99: "雷阵雨", } return mapping.get(code, "未知") diff --git a/backend/tests/test_unit_context.py b/backend/tests/test_unit_context.py index e6d9a4d9..b9604fb5 100644 --- a/backend/tests/test_unit_context.py +++ b/backend/tests/test_unit_context.py @@ -10,6 +10,7 @@ get_weather, search_locations, _generate_weather_advice, + _weather_code_to_desc, _qweather_current, _qweather_forecast_to_standard, _qweather_icon_to_wmo, @@ -224,6 +225,14 @@ async def test_qweather_forecast_to_standard_builds_result(self): assert result["forecast"][0]["desc"] == "多云" +class TestWeatherCodeDescriptions: + def test_thunderstorm_with_hail_codes_use_general_thunderstorm_label(self): + assert _weather_code_to_desc(96, language="zh") == "雷阵雨" + assert _weather_code_to_desc(99, language="zh") == "雷阵雨" + assert _weather_code_to_desc(96, language="en") == "Thunderstorm" + assert _weather_code_to_desc(99, language="en") == "Thunderstorm" + + class TestSearchLocations: @pytest.mark.asyncio async def test_search_locations_prefers_administrative_match_from_nominatim(self): diff --git a/webapp/app/config/page.tsx b/webapp/app/config/page.tsx index 61490887..1ef1b649 100644 --- a/webapp/app/config/page.tsx +++ b/webapp/app/config/page.tsx @@ -3645,6 +3645,12 @@ function ConfigPageInner() { "Upload up to 6 images. The device cycles to the next image on each refresh.", )} +
+ {tr( + "预览或下发只会临时生效;如需下次打开仍保留这些图片,请点击页面上的“保存到设备”。", + "Previewing or sending is temporary. To keep these images next time, click \"Save to Device\" on this page.", + )} +
{adaptiveImageUrls.map((url, i) => (