fix: Move sources_used definition before usage in AI enrichment
This commit is contained in:
parent
f166668f22
commit
cc83186486
@ -672,6 +672,13 @@ WAZNE:
|
||||
# Create AI enrichment PROPOSAL (requires approval before applying)
|
||||
# Instead of directly saving, we create a proposal that needs to be reviewed
|
||||
|
||||
# Count sources used (needs to be before creating proposal)
|
||||
sources_used = ['database']
|
||||
if brave_results['news'] or brave_results['web']:
|
||||
sources_used.append('brave_search')
|
||||
if website_content:
|
||||
sources_used.append('website')
|
||||
|
||||
# Check for existing pending proposals
|
||||
existing_pending = db.query(AiEnrichmentProposal).filter_by(
|
||||
company_id=company.id,
|
||||
@ -704,13 +711,6 @@ WAZNE:
|
||||
db.commit()
|
||||
proposal_id = proposal.id
|
||||
|
||||
# Count sources used
|
||||
sources_used = ['database']
|
||||
if brave_results['news'] or brave_results['web']:
|
||||
sources_used.append('brave_search')
|
||||
if website_content:
|
||||
sources_used.append('website')
|
||||
|
||||
logger.info(f"AI enrichment proposal created for {company.name}. Proposal ID: {proposal_id}. Sources: {sources_used}")
|
||||
|
||||
return jsonify({
|
||||
|
||||
Loading…
Reference in New Issue
Block a user