Skip to main content
SvaraAI provides detailed insights from conversation sessions, combining emotional analysis, transcripts, and AI-generated feedback into a comprehensive view of each therapeutic interaction.

Overview

Conversation insights give you a complete picture of each session:

Emotional analysis

AI-generated summary of emotional patterns

Emotion scores

Visual representation of top detected emotions

Full transcript

Complete conversation history with speaker attribution

Data structure

Insights are stored and displayed using a structured format:
Data Types
interface InsightData {
  transcript: string;                 // Full conversation text
  emotions: Record<string, number>;   // Emotion confidence scores
  analysis: string;                   // AI-generated analysis
  timestamp: number;                  // Session timestamp (ms)
}
Insight data is stored in sessionStorage to persist across page navigation while maintaining user privacy by clearing data when the browser session ends.

Insights page

The insights interface displays all session data in an organized layout:
Frontend/src/pages/insights.tsx
import { useEffect, useState } from "react";
import { useNavigate } from "react-router-dom";
import { motion } from "framer-motion";

export default function Insights() {
  const [data, setData] = useState<InsightData | null>(null);
  const navigate = useNavigate();

  useEffect(() => {
    const stored = sessionStorage.getItem("svaraInsights");
    if (stored) {
      setData(JSON.parse(stored));
    }
  }, []);

  const topEmotions = data?.emotions
    ? Object.entries(data.emotions)
        .sort(([, a], [, b]) => b - a)
        .slice(0, 5)
    : [];

  if (!data) {
    return (
      <div className="min-h-screen flex flex-col items-center justify-center">
        <BrainIcon />
        <h1 className="text-2xl font-light text-gray-800 mb-4 mt-6">
          No conversation data
        </h1>
        <p className="text-gray-600 mb-8">
          Start a voice conversation to get insights.
        </p>
        <button
          onClick={() => navigate("/playground")}
          className="px-6 py-3 bg-[#E07155] text-white rounded-xl"
        >
          Start Conversation
        </button>
      </div>
    );
  }

  return (
    <div className="min-h-screen px-6 py-12 max-w-4xl mx-auto">
      {/* Insights content */}
    </div>
  );
}

Empty state

When no conversation data exists, users see a clear call-to-action:
1

Visual indicator

Brain icon indicates the insights feature
2

Clear messaging

“No conversation data” heading explains the empty state
3

Actionable button

“Start Conversation” button navigates to the playground

Emotional analysis section

The first insight card displays AI-generated emotional analysis:
Analysis Display
<div className="bg-white/80 backdrop-blur-md rounded-2xl p-8 shadow-lg">
  <div className="flex items-center gap-3 mb-4">
    <SparkleIcon />
    <h2 className="text-xl font-medium text-gray-800">
      Emotional Analysis
    </h2>
  </div>
  <p className="text-gray-700 leading-relaxed text-lg">
    {data.analysis}
  </p>
</div>
The backdrop blur effect creates a modern, layered visual design while maintaining readability.

Emotion visualization

Top emotions are displayed with animated progress bars:
Emotion Bars
<div className="bg-white/80 backdrop-blur-md rounded-2xl p-8 shadow-lg">
  <div className="flex items-center gap-3 mb-6">
    <ChartIcon />
    <h2 className="text-xl font-medium text-gray-800">
      Detected Emotions
    </h2>
  </div>
  <div className="space-y-4">
    {topEmotions.map(([emotion, score]) => (
      <div key={emotion} className="flex items-center gap-4">
        <span className="w-32 text-gray-600 capitalize">
          {emotion}
        </span>
        <div className="flex-1 h-3 bg-gray-200 rounded-full overflow-hidden">
          <motion.div
            initial={{ width: 0 }}
            animate={{ width: `${score * 100}%` }}
            transition={{ duration: 0.8, ease: "easeOut" }}
            className="h-full bg-gradient-to-r from-[#E07155] to-[#E39682] rounded-full"
          />
        </div>
        <span className="w-16 text-right text-gray-500 text-sm">
          {(score * 100).toFixed(0)}%
        </span>
      </div>
    ))}
  </div>
</div>

Animation details

Progress bars start at 0% width for dramatic reveal effect
The component displays the top 5 emotions by score, focusing on the most significant emotional states detected during the conversation.

Transcript display

The full conversation is shown with speaker differentiation:
Transcript Section
<div className="bg-white/80 backdrop-blur-md rounded-2xl p-8 shadow-lg">
  <div className="flex items-center gap-3 mb-4">
    <MessageIcon />
    <h2 className="text-xl font-medium text-gray-800">
      Conversation
    </h2>
  </div>
  <div className="space-y-3 max-h-64 overflow-y-auto">
    {data.transcript.split("\n").map((line, i) => {
      const isUser = line.startsWith("User:");
      return (
        <p 
          key={i} 
          className={`text-sm ${
            isUser 
              ? "text-gray-800 font-medium" 
              : "text-gray-600"
          }`}
        >
          {line}
        </p>
      );
    })}
  </div>
</div>

User messages

Displayed in darker gray with medium font weight for emphasis

Assistant messages

Shown in lighter gray with normal weight for visual hierarchy

Session metadata

Timestamp information is displayed prominently:
Timestamp Display
<div className="text-center mb-12">
  <h1 className="text-4xl font-light text-gray-800 mb-2">
    Your Insights
  </h1>
  <p className="text-gray-500 text-sm">
    {new Date(data.timestamp).toLocaleString()}
  </p>
</div>
The toLocaleString() method formats timestamps according to the user’s locale settings, providing a familiar date/time format.

Action buttons

Users can start a new conversation or return home:
Action Buttons
<div className="flex gap-4 justify-center pt-8">
  <button
    onClick={() => {
      sessionStorage.removeItem("svaraInsights");
      navigate("/playground");
    }}
    className="px-8 py-3 bg-[#E07155] text-white rounded-xl hover:bg-[#D65A3F] transition-colors"
  >
    New Conversation
  </button>
  <button
    onClick={() => navigate("/")}
    className="px-8 py-3 border border-gray-300 text-gray-700 rounded-xl hover:bg-gray-100 transition-colors"
  >
    Back Home
  </button>
</div>
The “New Conversation” button clears the current insights data from sessionStorage. This action cannot be undone.

Animation system

The insights page uses Framer Motion for smooth transitions:
Page Animation
<motion.div
  initial={{ opacity: 0, y: 20 }}
  animate={{ opacity: 1, y: 0 }}
  className="space-y-8"
>
  {/* Insight cards */}
</motion.div>

Animation properties

PropertyValueEffect
initialopacity: 0, y: 20Content starts invisible and 20px down
animateopacity: 1, y: 0Fades in and slides to position
transitionDefaultSmooth, natural-feeling animation

Data persistence

// Save insights
sessionStorage.setItem(
  "svaraInsights", 
  JSON.stringify(insightData)
);

// Retrieve insights
const stored = sessionStorage.getItem("svaraInsights");
const data = stored ? JSON.parse(stored) : null;

// Clear insights
sessionStorage.removeItem("svaraInsights");

Visual design system

The insights page uses a consistent color palette:
Color Palette
/* Primary accent */
--coral: #E07155;
--coral-dark: #D65A3F;
--coral-light: #E39682;

/* Neutrals */
--gray-800: #1F2937;
--gray-700: #374151;
--gray-600: #4B5563;
--gray-500: #6B7280;

/* Backgrounds */
--white-80: rgba(255, 255, 255, 0.8);

Glass morphism

White backgrounds with 80% opacity and backdrop blur create depth

Coral accents

Primary color (#E07155) provides warmth and therapeutic feel

Gradient bars

Emotion bars use gradient for visual interest and polish

Soft shadows

Subtle shadows enhance card elevation without being distracting

Responsive design

The insights page adapts to different screen sizes:
Responsive Layout
<div className="min-h-screen px-6 py-12 max-w-4xl mx-auto">
  <motion.div className="space-y-8">
    {/* Insight cards with consistent 8-unit spacing */}
  </motion.div>
</div>
  • Full-width cards with 6 units horizontal padding
  • Emotion bars stack vertically with full width
  • Buttons stack vertically for easier tapping
  • Cards constrained to 768px max width
  • Emotion bars maintain horizontal layout
  • Buttons remain horizontal with adequate spacing
  • Content centered with 4xl (896px) max width
  • Optimal reading width for text content
  • Generous whitespace for focus

Custom icons

The insights page uses custom SVG icons:
const BrainIcon = () => (
  <svg 
    className="w-12 h-12 text-[#E07155]" 
    viewBox="0 0 24 24" 
    fill="none" 
    stroke="currentColor" 
    strokeWidth="1.5"
  >
    <path d="M12 2a4 4 0 0 0-4 4c0 1.1.4 2.1 1 3-1.2.4-2 1.5-2 2.8 0 1-.5 1.9-1.2 2.5.7.6 1.2 1.5 1.2 2.5 0 1.8-1.5 3.2-3.3 3.2H12" />
    <path d="M12 2a4 4 0 0 1 4 4c0 1.1-.4 2.1-1 3 1.2.4 2 1.5 2 2.8 0 1 .5 1.9 1.2 2.5-.7.6-1.2 1.5-1.2 2.5 0 1.8 1.5 3.2 3.3 3.2H12" />
    <path d="M12 2v18" />
  </svg>
);
Custom icons maintain the coral color scheme and match the overall design aesthetic better than generic icon libraries.

Integration points

Insights connect with other SvaraAI features:
Data Flow
// 1. Emotion detection provides scores
const emotions = await detectEmotions(audioUrl);

// 2. Therapeutic feedback generates analysis
const { response, emotions } = await generateFeedback(
  transcript, 
  emotions
);

// 3. Insights page displays combined data
const insightData: InsightData = {
  transcript,
  emotions,
  analysis: response,
  timestamp: Date.now()
};

sessionStorage.setItem(
  "svaraInsights", 
  JSON.stringify(insightData)
);

Best practices

Data validation

Validate insight data structure before rendering to prevent errors

Loading states

Show loading indicators while retrieving data from storage

Error boundaries

Implement error boundaries to gracefully handle rendering failures

Performance

Limit transcript height with scroll to handle long conversations

Accessibility

Uses proper heading hierarchy (h1, h2) and semantic elements for screen reader navigation.
Text colors meet WCAG AA standards for contrast against backgrounds.
All buttons are keyboard accessible with proper focus states.
Consider adding prefers-reduced-motion media query support for accessibility.

Future enhancements

1

Persistent storage

Add optional account-based storage to preserve insights across sessions
2

Export functionality

Allow users to export insights as PDF or JSON for record-keeping
3

Comparison view

Enable side-by-side comparison of insights from multiple sessions
4

Trend analysis

Track emotional patterns over time with charts and statistics

Next steps

Voice emotion detection

Understand how emotions are detected from voice

Therapeutic feedback

Learn about AI-generated therapeutic responses

Build docs developers (and LLMs) love