From 0d1bf3f1acb16f39af21ca4881dc659a51328657 Mon Sep 17 00:00:00 2001 From: ipu Date: Wed, 13 Aug 2025 11:58:39 +0300 Subject: [PATCH] add request copy to estimation response --- src/api/v1/router.py | 6 ++++++ src/models.py | 1 + 2 files changed, 7 insertions(+) diff --git a/src/api/v1/router.py b/src/api/v1/router.py index 0e37edf..6de1ea0 100644 --- a/src/api/v1/router.py +++ b/src/api/v1/router.py @@ -40,6 +40,12 @@ async def estimate(request: models.EstimationRequest): estimation_service = EstimationService() estimation_response = await estimation_service.estimate_insurance(request.applicants, request.phq, request.plans) + estimation_response.request = request + try: + if estimation_response.request.plans: + estimation_response.request.plans[0].tier = f"Tier {estimation_response.details.tier}" + except Exception as e: + pass return estimation_response diff --git a/src/models.py b/src/models.py index b0af4d4..3c2f6ff 100644 --- a/src/models.py +++ b/src/models.py @@ -85,6 +85,7 @@ class EstimationResponse(BaseModel): status: str details: EstimationDetails results: List[EstimationResult] + request: EstimationRequest | None = None class InsuranceChatRequest(BaseModel): message: str = Field(..., description="User message")