fix: Correct Company model attribute names in AI enrichment endpoint
- services_text -> services relationship or services_offered - competencies_text -> competencies relationship - pkd_text -> pkd_description - certifications field properly handled as relationship
This commit is contained in:
parent
59c50e0267
commit
a4515aca74
20
app.py
20
app.py
@ -5907,20 +5907,32 @@ def api_enrich_company_ai(company_id):
|
||||
}), 503
|
||||
|
||||
# Collect existing company data for context
|
||||
# Get services from relationship or services_offered field
|
||||
services_list = []
|
||||
if company.services:
|
||||
services_list = [cs.service.name for cs in company.services if cs.service]
|
||||
elif company.services_offered:
|
||||
services_list = [company.services_offered]
|
||||
|
||||
# Get competencies from relationship
|
||||
competencies_list = []
|
||||
if company.competencies:
|
||||
competencies_list = [cc.competency.name for cc in company.competencies if cc.competency]
|
||||
|
||||
existing_data = {
|
||||
'nazwa': company.name,
|
||||
'opis_krotki': company.description_short or '',
|
||||
'opis_pelny': company.description_full or '',
|
||||
'kategoria': company.category.name if company.category else '',
|
||||
'uslugi': company.services_text or '',
|
||||
'kompetencje': company.competencies_text or '',
|
||||
'uslugi': ', '.join(services_list) if services_list else '',
|
||||
'kompetencje': ', '.join(competencies_list) if competencies_list else '',
|
||||
'slowa_kluczowe': company.keywords or '',
|
||||
'wyrozniki': company.usp or '',
|
||||
'certyfikaty': company.certifications or '',
|
||||
'certyfikaty': '', # certifications is a relationship, not text
|
||||
'wartosci': company.values or '',
|
||||
'strona_www': company.website or '',
|
||||
'miasto': company.address_city or '',
|
||||
'branza': company.pkd_text or ''
|
||||
'branza': company.pkd_description or ''
|
||||
}
|
||||
|
||||
# Build prompt for AI
|
||||
|
||||
Loading…
Reference in New Issue
Block a user