From dbf468b5860edf355ada355568bc162acc8b958a Mon Sep 17 00:00:00 2001 From: ipu Date: Thu, 2 Oct 2025 13:18:55 +0300 Subject: [PATCH] fix initialize with empty application --- src/services/chat_service.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/services/chat_service.py b/src/services/chat_service.py index 57f2bff..e563ca3 100644 --- a/src/services/chat_service.py +++ b/src/services/chat_service.py @@ -198,7 +198,13 @@ class ChatService: "answer": INIT_MESSAGES[0], } - applicant = application["applicants"][0] + try: + applicant = application["applicants"][0] + except: + return { + "session_id": session_id, + "answer": INIT_MESSAGES[2].format(name=name) + } if not applicant.get("gender") or not applicant.get("dob") or applicant.get("dob") == "-01-" or not applicant.get("weight") or applicant.get("heightFt") is None or applicant.get("heightIn") is None: return { "session_id": session_id,