Files
playchat/backend/app/core/weather_cache.py
T
colcaroliandClaude Sonnet 4.6 4e837d1419 Add weather caching, useless-tip redirect, clock widget, and IAM Bedrock auth
- 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>
2026-06-20 15:15:11 +09:00

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