feat(reviewiq): Add AI synthesis support to dashboard components

Frontend:
- Add Synthesis type with action plan, insights, annotations
- ExecutiveSummary: Accept synthesis prop for AI narrative
- SentimentPie: Accept insight prop for contextual explanation
- IntensityHeatmap: Accept insight + highlightDomain props
- TimelineChart: Accept insight + annotations props
- All components gracefully degrade when synthesis is null

Backend:
- Add Stage 4: Synthesize for generating AI narratives
- Gathers context from classified spans
- Generates executive narrative, section insights, action plan
- Produces timeline annotations and marketing angles
- Stores synthesis in pipeline.executions table

Components show AI insights with purple gradient styling when available,
fall back to existing behavior when synthesis is not yet generated.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Alejandro Gutiérrez
2026-01-29 02:59:47 +00:00
parent 8f9dd136cd
commit c8ecb4b98f
21 changed files with 3959 additions and 90 deletions

View File

@@ -112,6 +112,7 @@ function ReviewIQDashboardInner({ jobId, businessId }: ReviewIQDashboardProps) {
avgRating={data.overview.avg_rating}
domainScores={data.domain_scores}
onDomainClick={handleDomainClick}
synthesis={data.synthesis}
/>
{/* ═══════════════════════════════════════════════════════════════
@@ -119,8 +120,15 @@ function ReviewIQDashboardInner({ jobId, businessId }: ReviewIQDashboardProps) {
Side-by-side: How customers feel + What they talk about
═══════════════════════════════════════════════════════════════ */}
<div className="grid grid-cols-1 lg:grid-cols-2 gap-6">
<SentimentPie data={data.sentiment.distribution} />
<IntensityHeatmap data={data.urt.domains} />
<SentimentPie
data={data.sentiment.distribution}
insight={data.synthesis?.sentiment_insight}
/>
<IntensityHeatmap
data={data.urt.domains}
insight={data.synthesis?.category_insight}
highlightDomain={data.synthesis?.priority_domain}
/>
</div>
{/* ═══════════════════════════════════════════════════════════════
@@ -133,7 +141,11 @@ function ReviewIQDashboardInner({ jobId, businessId }: ReviewIQDashboardProps) {
SECTION 4: TRENDS (Timeline)
How things change over time
═══════════════════════════════════════════════════════════════ */}
<TimelineChart data={data.timeline} />
<TimelineChart
data={data.timeline}
insight={data.synthesis?.timeline_insight}
annotations={data.synthesis?.timeline_annotations}
/>
{/* ═══════════════════════════════════════════════════════════════
SECTION 5: DEEP DIVE (Tables)