a2a-source-edit: write agent.py

This commit is contained in:
a2a-cloud
2026-07-18 04:48:48 +00:00
parent b6f93c7d04
commit 504cb9aac8

View File

@@ -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"],
),
)