Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/design.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ RSS 来源可以按地点 ID 限定范围,并配置正文清洗规则。`verba

和风天气使用 `QWeatherJWTAuthenticator` 签发短期 JWT。认证输入包括项目 ID、凭据 ID、专属 API Host 和 Base64 编码的 Ed25519 私钥。实现不支持用长期 API Key 代替该流程。

`OpenMeteoProvider` 提供全球天气,并从独立接口读取空气质量和欧洲花粉数据。适配器在生成来源正文前把 WMO 天气代码转换为可读的中文天气现象;未知代码保留为“未识别天气现象”并写入安全日志。公开接口适用于非商业使用,没有 SLA;Base URL 和可选 API Key 可以替换。
`OpenMeteoProvider` 提供全球天气,并从独立接口读取空气质量和欧洲花粉数据。它生成固定 `zh-CN` 来源正文,并在生成正文前把 WMO 天气代码转换为可读的中文天气现象;映射数据在模块加载时完成验证,未知代码保留为“未识别天气现象”并写入安全日志。`SourceDocument` 保留这个实际来源语言,模型再把整份来源统一转换为地点的目标语言,因此最终简报不受中文映射限制。公开接口适用于非商业使用,没有 SLA;Base URL 和可选 API Key 可以替换。

`AQICNProvider` 只在最终天气结果缺少空气质量时补充当前观测。它不参与未来日期查询,也不把 PM2.5 单项 AQI 换算为浓度。

Expand Down
6 changes: 3 additions & 3 deletions weather_briefing/weather_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@

_WEATHER_DOCUMENT_LABELS = localization_table("weather_document")
_QWEATHER_FORMATS = localization_table("qweather")
_OPEN_METEO_WEATHER_CODES = open_meteo_weather_code_descriptions()
Comment thread
qodo-code-review[bot] marked this conversation as resolved.
Outdated


class WeatherContextError(RuntimeError):
Expand Down Expand Up @@ -1041,9 +1042,8 @@ def _format_open_meteo_day(daily: dict[str, object], index: int) -> str:


def _open_meteo_weather_description(value: object) -> str:
descriptions = open_meteo_weather_code_descriptions()
if type(value) is int and value in descriptions:
return descriptions[value]
if type(value) is int and value in _OPEN_METEO_WEATHER_CODES:
return _OPEN_METEO_WEATHER_CODES[value]
if type(value) is int:
_LOGGER.warning("Unknown Open-Meteo weather code code=%d", value)
else:
Expand Down