Bridge legacy QuoteJudge database columns

This commit is contained in:
2026-07-18 01:16:49 -03:00
parent a232cc28a8
commit 8b6b5188a5
4 changed files with 38 additions and 7 deletions

View File

@@ -108,7 +108,7 @@ class QuoteJudgeStudioV1(A2AAgent[QuoteJudgeStudioV1Config, PlatformUserAuth]):
"QuoteJudge compares vendor quotes with weighted price, delivery, and "
"warranty scoring, persists per-user comparisons, and serves a one-page product UI."
)
version = "0.1.4"
version = "0.1.5"
config_model = QuoteJudgeStudioV1Config
auth_model = PlatformUserAuth
@@ -574,11 +574,14 @@ async def _save_comparison(tenant_key: str, payload: dict[str, Any]) -> None:
cur.execute(
"""
INSERT INTO quote_comparisons
(tenant_key, comparison_id, recommended_vendor, score, normalized_total, payload, updated_at)
VALUES (%s, %s, %s, %s, %s, %s, NOW())
(tenant_key, comparison_id, recommended_vendor, recommendation_vendor,
score, weighted_score, normalized_total, payload, updated_at)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, NOW())
ON CONFLICT (tenant_key, comparison_id) DO UPDATE SET
recommended_vendor = EXCLUDED.recommended_vendor,
recommendation_vendor = EXCLUDED.recommendation_vendor,
score = EXCLUDED.score,
weighted_score = EXCLUDED.weighted_score,
normalized_total = EXCLUDED.normalized_total,
payload = EXCLUDED.payload,
updated_at = NOW()
@@ -587,6 +590,8 @@ async def _save_comparison(tenant_key: str, payload: dict[str, Any]) -> None:
tenant_key,
payload["comparison_id"],
payload["recommendation"]["vendor"],
payload["recommendation"]["vendor"],
payload["recommendation"]["score"],
payload["recommendation"]["score"],
payload["recommendation"]["normalized_total"],
json.dumps(payload),
@@ -645,16 +650,18 @@ async def _persist_receipt(
cur.execute(
"""
INSERT INTO quote_execution_receipts
(tenant_key, comparison_id, receipt_id, skill_name, status, input_hash,
result_hash, payload, created_at)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, NOW())
(tenant_key, comparison_id, receipt_id, skill_name, tool_name, status, ok,
input_hash, result_hash, payload, created_at)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, NOW())
""",
(
tenant_key,
comparison_id,
receipt["receipt_id"],
skill_name,
skill_name,
status,
status == "ok",
receipt["input_hash"],
receipt["result_hash"],
json.dumps(receipt),