a2a-source-edit: write agent.py
This commit is contained in:
24
agent.py
24
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"],
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user