fix(agent-office): 일요 회고 견고화 (dead import 제거·send 가드·부분 payload 방어)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -232,7 +232,7 @@ async def send_evolution_report(eval_result: Dict[str, Any], current_base: List[
|
||||
def format_sunday_review(payload: Dict[str, Any]) -> str:
|
||||
"""일요 회고 브리핑 텍스트 (HTML parse_mode)."""
|
||||
wa = payload.get("winner_analysis") or {}
|
||||
draw_no = payload.get("draw_no")
|
||||
draw_no = payload.get("draw_no") or "?"
|
||||
pct = wa.get("percentile")
|
||||
pct_txt = f"{pct*100:.0f}%" if pct is not None else "—"
|
||||
lines = [f"🔍 <b>로또 #{draw_no} 일요 회고</b>", ""]
|
||||
@@ -243,18 +243,24 @@ def format_sunday_review(payload: Dict[str, Any]) -> str:
|
||||
f"· 갭 {wa.get('score_gap',0):.2f} · 공동출현 {wa.get('score_cooccur',0):.2f} "
|
||||
f"· 다양성 {wa.get('score_diversity',0):.2f}")
|
||||
lines.append("")
|
||||
lines.append("📊 <b>이번 회차 가상구매 성적</b>")
|
||||
for f in payload.get("forward", []):
|
||||
p = f["prizes"]
|
||||
name = {"engine_w": f"엔진({f['label']})", "random_null": "무작위", "coverage": "커버리지"}.get(
|
||||
f["strategy"], f["strategy"])
|
||||
lines.append(f" {name}: 최고 {f['best_match']}일치 / "
|
||||
f"4등 {p['4th']} · 5등 {p['5th']}")
|
||||
if payload.get("forward"):
|
||||
lines.append("📊 <b>이번 회차 가상구매 성적</b>")
|
||||
for f in payload.get("forward", []):
|
||||
p = f.get("prizes") or {}
|
||||
name = {"engine_w": f"엔진({f.get('label','')})", "random_null": "무작위", "coverage": "커버리지"}.get(
|
||||
f.get("strategy", ""), f.get("strategy", "?"))
|
||||
lines.append(f" {name}: 최고 {f.get('best_match','?')}일치 / "
|
||||
f"4등 {p.get('4th', 0)} · 5등 {p.get('5th', 0)}")
|
||||
else:
|
||||
lines.append("📊 <b>이번 회차 가상구매 성적</b>: 데이터 없음 (아직 집계 전)")
|
||||
lines.append("")
|
||||
lines.append("ℹ️ 무작위 대비 우위가 통계적으로 의미있을 때만 가중치가 진화합니다.")
|
||||
return "\n".join(lines)
|
||||
|
||||
|
||||
async def send_sunday_review(payload: Dict[str, Any]) -> None:
|
||||
from ..telegram.messaging import send_raw
|
||||
await send_raw(format_sunday_review(payload))
|
||||
text = format_sunday_review(payload)
|
||||
try:
|
||||
await send_raw(text)
|
||||
except Exception as e:
|
||||
logger.warning(f"[telegram_lotto] sunday review send failed: {e}")
|
||||
|
||||
Reference in New Issue
Block a user