- Cache the latest fetched tomorrow weather and expose it via /api/system/weather/latest - Add a header Clock widget showing date/time plus the cached weather summary - Redirect useless-talk mentions from the weather bot to the useless-tips webhook - Switch Bedrock auth from bearer token to standard IAM access key/secret Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
20 lines
496 B
Python
20 lines
496 B
Python
"""直近で取得した「明日の天気」データをメモリ上にキャッシュする。"""
|
|
from datetime import datetime
|
|
|
|
_latest: dict | None = None
|
|
|
|
|
|
def set_latest(weather: str, pop: int | None, judgement: str, reason: str) -> None:
|
|
global _latest
|
|
_latest = {
|
|
"weather": weather,
|
|
"pop": pop,
|
|
"judgement": judgement,
|
|
"reason": reason,
|
|
"fetched_at": datetime.now().isoformat(),
|
|
}
|
|
|
|
|
|
def get_latest() -> dict | None:
|
|
return _latest
|