From 504cb9aac844adffe0b72f77bf90f414dc3f3a58 Mon Sep 17 00:00:00 2001 From: a2a-cloud Date: Sat, 18 Jul 2026 04:48:48 +0000 Subject: [PATCH] a2a-source-edit: write agent.py --- agent.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/agent.py b/agent.py index 87ca724..f5cf8e5 100644 --- a/agent.py +++ b/agent.py @@ -455,14 +455,32 @@ async def _save_comparison(tenant_key: str, comparison_id: str, result: dict[str with conn.cursor() as cur: cur.execute( """ - INSERT INTO quote_comparisons (tenant_key, comparison_id, recommendation_vendor, result) - VALUES (%s, %s, %s, %s) + INSERT INTO quote_comparisons ( + tenant_key, comparison_id, recommendation_vendor, recommended_vendor, + result, payload, weighted_score, score, normalized_total + ) + VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s) ON CONFLICT (tenant_key, comparison_id) DO UPDATE SET recommendation_vendor = EXCLUDED.recommendation_vendor, + recommended_vendor = EXCLUDED.recommended_vendor, result = EXCLUDED.result, + payload = EXCLUDED.payload, + weighted_score = EXCLUDED.weighted_score, + score = EXCLUDED.score, + normalized_total = EXCLUDED.normalized_total, updated_at = NOW() """, - (tenant_key, comparison_id, result["recommendation"]["vendor"], json.dumps(result)), + ( + tenant_key, + comparison_id, + result["recommendation"]["vendor"], + result["recommendation"]["vendor"], + json.dumps(result), + json.dumps(result), + result["recommendation"]["score"], + result["recommendation"]["score"], + result["recommendation"]["score"], + ), )