send application info to prompt

This commit is contained in:
ipu 2025-09-17 12:49:23 +03:00
parent 538ea04aa5
commit d61aac5813
2 changed files with 18 additions and 1 deletions

View file

@ -135,7 +135,7 @@ class ChatService:
# For now, return empty list - this would be populated when RAG is implemented
return []
async def process_insurance_chat(self, message: str, session_id: Optional[str] = None, uid: Optional[int] = None, current_page: Optional[str] = None) -> Dict[str, Any]:
async def process_insurance_chat(self, message: str, session_id: Optional[str] = None, uid: Optional[int] = None, current_page: Optional[str] = None, application: Optional[dict] = None) -> Dict[str, Any]:
"""Process an insurance chat request"""
try:
if not session_id:
@ -148,6 +148,17 @@ class ChatService:
if uid:
user_state = await self.get_user_state(uid)
instructions += f"\n\n# User Information\nApplication state (None means that application was not sent or pending):\n{user_state}"
if application:
instructions += f"\n\n# User Application Info\n"
if application.get("plans", []):
plans_info = "User plans:\n"
for p in application["plans"]:
plans_info += f"{str(p)}\n"
instructions += plans_info
if application.get("phq", {}).get("effective_date", None):
effective_date = application.get("phq", {}).get("effective_date", None)
instructions += f"Plan effective date: {effective_date}"
if current_page:
instructions += f"\n\n# User now is currently on page: {current_page}"