diff --git a/backend/app/services/unified_chat_service.py b/backend/app/services/unified_chat_service.py index 7b121a3d..a313286d 100644 --- a/backend/app/services/unified_chat_service.py +++ b/backend/app/services/unified_chat_service.py @@ -583,10 +583,14 @@ async def send_chat_message( Returns (ai_content, suggested_flows, session, fork_metadata, actions_data, questions_data). """ + from sqlalchemy import or_ result = await db.execute( select(AISession).where( AISession.id == session_id, - AISession.user_id == user_id, + or_( + AISession.user_id == user_id, + AISession.escalated_to_id == user_id, + ), AISession.session_type == "chat", ) )