fix(chat): Normalize person names to Title Case for link matching

- DB stores names in UPPERCASE (e.g. 'MICHAŁ BOGDAN ROSZMAN')
- AI generates Title Case (e.g. 'Michał Bogdan Roszman')
- Post-processing now converts to title() before matching

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Maciej Pienczyn 2026-01-27 14:10:53 +01:00
parent 05d8e3f6ec
commit 2a749e09d3

View File

@ -1163,10 +1163,12 @@ BŁĘDNIE (NIE RÓB - resetuje numerację):
# Add company
if data.get('profile'):
name_to_url[company_name] = data['profile']
# Add people
# Add people - normalize to Title Case (DB stores UPPERCASE)
for person in data.get('people', []):
if person.get('name') and person.get('profile'):
name_to_url[person['name']] = person['profile']
# Convert "MICHAŁ BOGDAN ROSZMAN" to "Michał Bogdan Roszman"
normalized_name = person['name'].title()
name_to_url[normalized_name] = person['profile']
# Also extract from companies list (context['companies'] has profile URLs)
# Companies format: list of dicts with 'name' and 'profile'