Update app.py
Browse files
app.py
CHANGED
|
@@ -610,24 +610,31 @@ def get_recommendation_with_agent(user_id, merchant, category, amount):
|
|
| 610 |
|
| 611 |
# Calculation details (collapsible)
|
| 612 |
output += f"""
|
| 613 |
-
|
| 614 |
-
|
| 615 |
-
|
| 616 |
-
|
| 617 |
-
|
| 618 |
-
|
| 619 |
-
|
| 620 |
-
|
| 621 |
-
|
| 622 |
-
|
| 623 |
-
|
| 624 |
-
|
| 625 |
-
|
| 626 |
-
|
| 627 |
-
|
| 628 |
-
|
| 629 |
-
|
| 630 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 631 |
|
| 632 |
chart = create_agent_recommendation_chart_enhanced(result)
|
| 633 |
yield output, chart
|
|
|
|
| 610 |
|
| 611 |
# Calculation details (collapsible)
|
| 612 |
output += f"""
|
| 613 |
+
<details>
|
| 614 |
+
<summary>π <b>Annual Impact Calculation</b> (Click to expand)</summary>
|
| 615 |
+
|
| 616 |
+
<br>
|
| 617 |
+
|
| 618 |
+
**Assumptions:**
|
| 619 |
+
|
| 620 |
+
- Transaction: ${amount_float:.2f} at {merchant} ({category})
|
| 621 |
+
- Frequency: {frequency_label} β ${annual_spend:.2f}/year
|
| 622 |
+
|
| 623 |
+
**Rewards Breakdown:**
|
| 624 |
+
|
| 625 |
+
{calc_table}
|
| 626 |
+
|
| 627 |
+
**vs. Baseline (1% card):** ${baseline_rewards:.2f}/year
|
| 628 |
+
|
| 629 |
+
**Net Benefit:** ${net_benefit:+.2f}/year {"π" if net_benefit > 0 else "β οΈ"}
|
| 630 |
+
|
| 631 |
+
**Card Details:** {reward_rate_value}% on {category} | Cap: {"$" + str(monthly_cap or annual_cap) if (monthly_cap or annual_cap) else "None"} | Fee: ${annual_fee}
|
| 632 |
+
|
| 633 |
+
<br>
|
| 634 |
+
|
| 635 |
+
</details>
|
| 636 |
+
"""
|
| 637 |
+
```
|
| 638 |
|
| 639 |
chart = create_agent_recommendation_chart_enhanced(result)
|
| 640 |
yield output, chart
|