From d8d38ab1326fabafbaaa88e33ed5e1bed3bf2588 Mon Sep 17 00:00:00 2001 From: ipu Date: Mon, 22 Sep 2025 16:33:59 +0300 Subject: [PATCH] add base64 decode for context.application --- src/api/v1/router.py | 5 +++++ src/models.py | 1 + 2 files changed, 6 insertions(+) diff --git a/src/api/v1/router.py b/src/api/v1/router.py index 7520acf..bb64d39 100644 --- a/src/api/v1/router.py +++ b/src/api/v1/router.py @@ -1,3 +1,6 @@ +import base64 +import json + from fastapi import APIRouter, HTTPException from src.services.estimation_service_v2 import EstimationService @@ -20,6 +23,8 @@ async def insurance_chat(request: models.InsuranceChatRequest): application = None if request.context and request.context.application: application = request.context.application + elif request.context and request.context.applicationDTO: + application = json.loads(base64.b64decode(request.context.applicationDTO).decode()) result = await chat_service.process_insurance_chat( message=request.message, diff --git a/src/models.py b/src/models.py index 2bc517b..c19b876 100644 --- a/src/models.py +++ b/src/models.py @@ -87,6 +87,7 @@ class EstimationResponse(BaseModel): class InsuranceChatContext(BaseModel): page: str application: dict | None = None + applicationDTO: str | None = None class InsuranceChatRequest(BaseModel): userId: str | int | None = None