fix(discord): show actual voter values in decision embed during fallback

Pass raw a/b decisions to notify_decision so gemini shows its real
value ( limit) instead of groq's value when rate-limited.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
sylyx 2026-05-07 20:25:25 +02:00
parent 680a4fcc5f
commit 7a0eccbcef
2 changed files with 10 additions and 4 deletions

View File

@ -155,8 +155,10 @@ def run_tick(
discord.notify_decision(
settings, symbol, result,
label_a=f"{voter_a.provider}",
label_a=voter_a.provider,
label_b=(voter_b.provider if voter_b else "-"),
decision_a=a,
decision_b=b,
)
if result.action in ("BUY", "SELL") and not position:

View File

@ -64,7 +64,7 @@ def notify_startup(settings: Settings) -> None:
)
def notify_decision(settings: Settings, symbol: str, ensemble, label_a: str, label_b: str) -> None:
def notify_decision(settings: Settings, symbol: str, ensemble, label_a: str, label_b: str, decision_a=None, decision_b=None) -> None:
"""Optional: jede Ensemble-Decision posten (kann spammig sein)."""
if not _should(settings, "decision"):
return
@ -73,14 +73,18 @@ def notify_decision(settings: Settings, symbol: str, ensemble, label_a: str, lab
else COLOR_RED if ensemble.action == "SELL"
else COLOR_GRAY
)
va = decision_a or ensemble.voter_a
vb = decision_b or ensemble.voter_b
va_val = "⛔ limit" if va.reasoning == "rate_limit_exhausted" else f"{va.action} ({va.confidence:.2f})"
vb_val = f"{vb.action} ({vb.confidence:.2f})"
_post(
settings,
{
"title": f"🧠 Decision {symbol}: {ensemble.action}",
"color": color,
"fields": [
{"name": label_a, "value": f"{ensemble.voter_a.action} ({ensemble.voter_a.confidence:.2f})", "inline": True},
{"name": label_b, "value": f"{ensemble.voter_b.action} ({ensemble.voter_b.confidence:.2f})", "inline": True},
{"name": label_a, "value": va_val, "inline": True},
{"name": label_b, "value": vb_val, "inline": True},
{"name": "Rationale", "value": ensemble.rationale, "inline": False},
],
},