From 53225118c110f2176528c9948fd685eab2523da2 Mon Sep 17 00:00:00 2001 From: "2569718930@qq.com" <2569718930@qq.com> Date: Sat, 23 May 2026 10:06:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20Telegram=20HTML=20?= =?UTF-8?q?=E8=A7=A3=E6=9E=90=E9=94=99=E8=AF=AF=EF=BC=9A=E7=A6=81=E6=AD=A2?= =?UTF-8?q?=20AI=20=E4=BD=BF=E7=94=A8=20br=20=E6=A0=87=E7=AD=BE=EF=BC=8C?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20CMA=20=E6=95=B0=E6=8D=AE=E8=AF=8A=E6=96=AD?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/daily_weather_report.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/utils/daily_weather_report.py b/src/utils/daily_weather_report.py index 4ffe7d76..aaec86f6 100644 --- a/src/utils/daily_weather_report.py +++ b/src/utils/daily_weather_report.py @@ -141,6 +141,13 @@ def _fetch_cma_forecast(city_key: str) -> Optional[Dict[str, Any]]: except (TypeError, ValueError): result["forecast_low"] = None + logger.info( + "daily_weather_report: CMA parsed {} weather={} high={} low={}", + city_key, + result.get("weather"), + result.get("forecast_high"), + result.get("forecast_low"), + ) return result @@ -157,8 +164,8 @@ def _fetch_city_data( # 1. Try CMA first for weather description + official forecast high cma = _fetch_cma_forecast(city_key) if cma and cma.get("weather") and cma.get("forecast_high") is not None: - logger.debug( - "daily_weather_report: {} using CMA data weather={} high={}", + logger.info( + "daily_weather_report: {} using CMA weather={} high={}", city_key, cma["weather"], cma["forecast_high"], @@ -247,10 +254,11 @@ def _build_ai_prompt(cities_data: List[Dict[str, Any]], report_date: str) -> str "城市名 weather,最高 forecast_high 度。一句话体感或穿衣建议。\n\n" "要求:\n" "1. weather 和 forecast_high 直接使用数据中的值,不要修改\n" - "2. 每个城市一行,城市名用 加粗\n" - "3. 开头问候语「☀️ 早上好!今天是x月x日」\n" - "4. 播报完直接结束,禁止写结尾祝福、总结、免责声明\n" - "5. 总字数不超过 200\n" + "2. 每城一行,城市名 加粗,换行用纯换行符,禁止用
标签\n" + "3. 只允许 两种 HTML 标签,其他标签一律禁止\n" + "4. 开头问候语「☀️ 早上好!今天是x月x日」\n" + "5. 播报完直接结束,禁止结尾祝福、总结、免责\n" + "6. 总字数不超过 200\n" )