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

@@ -8,6 +8,8 @@ import { useReviewIQFilters } from '@/contexts/ReviewIQFilterContext';
interface SentimentPieProps {
data: SentimentDataPoint[];
// AI-generated insight (optional - shows when available)
insight?: string | null;
}
// User-friendly sentiment config
@@ -74,7 +76,7 @@ const SENTIMENT_ORDER = ['V+', 'V-', 'V0', 'V±'];
* User-friendly design with emojis and clear numbers.
* Click to filter by sentiment.
*/
export function SentimentPie({ data }: SentimentPieProps) {
export function SentimentPie({ data, insight }: SentimentPieProps) {
const { filters, toggleSentiment } = useReviewIQFilters();
// Process data
@@ -185,6 +187,19 @@ export function SentimentPie({ data }: SentimentPieProps) {
</div>
</div>
{/* AI Insight (when available) */}
{insight && (
<div className="mb-4 p-3 bg-gradient-to-r from-purple-50 to-blue-50 rounded-lg border border-purple-200">
<div className="flex items-start gap-2">
<span className="text-sm"></span>
<div>
<div className="text-xs font-medium text-purple-600 mb-0.5">AI Insight</div>
<p className="text-sm text-gray-700">{insight}</p>
</div>
</div>
</div>
)}
{processedData.cards.length === 0 ? (
<div className="flex items-center justify-center h-64 text-gray-500">
No sentiment data available