[31388f42] Fix field naming: Use industry_ai and research_dossier from CE API

This commit is contained in:
2026-03-02 10:20:06 +00:00
parent aa1a8699e0
commit 035680b0d0
3 changed files with 74 additions and 6 deletions

View File

@@ -4,7 +4,7 @@ from db import get_leads, init_db
import json
import re
import os
from enrich import run_sync, refresh_ce_data
from enrich import run_sync, refresh_ce_data, sync_single_lead
from generate_reply import generate_email_draft
def clean_html_to_text(html_content):
@@ -164,6 +164,17 @@ if not df.empty:
c1.write(f"**Purpose:** {meta.get('purpose', '-')}")
c1.write(f"**Location:** {meta.get('zip', '')} {meta.get('city', '')}")
# Manual Sync Button for individual lead
if row['status'] == 'new':
if c1.button("🚀 Sync to Company Explorer", key=f"sync_single_{row['id']}"):
with st.spinner("Processing lead (Role + CE Sync)..."):
res = sync_single_lead(row['id'])
if res.get('status') != 'error':
st.success("Lead synced successfully!")
st.rerun()
else:
st.error(f"Sync failed: {res.get('message')}")
with c1.expander("Show Original Email Content"):
st.text(clean_html_to_text(row['raw_body']))
if st.checkbox("Show Raw HTML", key=f"raw_{row['id']}"):
@@ -181,10 +192,11 @@ if not df.empty:
# CE Data Display
ce_data = enrichment.get('ce_data', {})
vertical = ce_data.get('vertical')
summary = ce_data.get('summary')
# Support both names (CE uses industry_ai internally)
vertical = ce_data.get('industry_ai') or ce_data.get('vertical')
summary = ce_data.get('research_dossier') or ce_data.get('summary')
if vertical:
if vertical and vertical != 'None':
c2.info(f"**Industry:** {vertical}")
else:
c2.warning("Industry Analysis pending...")