fix: handle lazy loading error for company.category in chat routes
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions

This commit is contained in:
Maciej Pienczyn 2026-03-28 05:54:49 +01:00
parent 8d64639e27
commit 86c7e83886

View File

@ -272,12 +272,17 @@ def chat_send_message(conversation_id):
'user_email': current_user.email,
'company_name': current_user.company.name if current_user.company else None,
'company_id': current_user.company.id if current_user.company else None,
'company_category': current_user.company.category.name if current_user.company and current_user.company.category else None,
'company_category': None,
'company_role': current_user.company_role or 'MEMBER',
'is_norda_member': current_user.is_norda_member,
'chamber_role': current_user.chamber_role,
'member_since': current_user.created_at.strftime('%Y-%m-%d') if current_user.created_at else None,
}
try:
if current_user.company and current_user.company.category:
user_context['company_category'] = current_user.company.category.name
except Exception:
pass
# Map model choice to actual model name and thinking level
model_map = {
@ -364,12 +369,17 @@ def chat_send_message_stream(conversation_id):
'user_email': current_user.email,
'company_name': current_user.company.name if current_user.company else None,
'company_id': current_user.company.id if current_user.company else None,
'company_category': current_user.company.category.name if current_user.company and current_user.company.category else None,
'company_category': None,
'company_role': current_user.company_role or 'MEMBER',
'is_norda_member': current_user.is_norda_member,
'chamber_role': current_user.chamber_role,
'member_since': current_user.created_at.strftime('%Y-%m-%d') if current_user.created_at else None,
}
try:
if current_user.company and current_user.company.category:
user_context['company_category'] = current_user.company.category.name
except Exception:
pass
model_map = {
'flash': '3-flash',