DivergentUnity - Project Story

Inspiration

In an era of increasing polarization, we noticed that online debates often devolve into echo chambers and hostile exchanges. People talk past each other, unable to find common ground even when shared values exist beneath the surface. We asked ourselves: What if AI could help people understand each other better instead of driving them further apart?

DivergentUnity was born from the belief that divergent perspectives can unite through deep understanding. We wanted to create a platform where:

  • People could engage in meaningful debate without fear of toxicity
  • An AI "judge" could provide real-time feedback on bias, facts, and civility
  • Hidden common ground could be discovered through advanced value analysis
  • Participants could see their perspectives visualized and mapped to find bridges between viewpoints

What We Built

DivergentUnity is an AI-powered debate platform that transforms polarized conversations into opportunities for mutual understanding.

Core Features:

  1. Multi-Pane Live Chat
  • Each participant gets their own dedicated chat pane
  • Real-time updates showing all perspectives simultaneously
  • Color-coded participants with avatars for easy tracking

    1. AI Judge System
  • Monitors every message for cognitive biases (strawman, ad hominem, false dichotomies)

  • Fact-checks claims and identifies overgeneralizations

  • Ensures civility by flagging personal attacks and dismissive language

  • Provides constructive suggestions for rephrasing problematic statements

    1. Deep Value Analysis
  • Extracts core values from each participant's statements

  • Maps relationships between different values

  • Identifies shared values that might be hidden beneath disagreements

  • Calculates tension and empathy scores to track debate quality

    1. AI-Generated Insights
  • Biases & Assumptions: Pinpoints specific cognitive biases with direct quotes

  • Common Ground: Discovers shared values and potential bridges

  • Deep Understanding: Provides each participant's perspective in their own voice

  • Evidence & News: Aggregates real-world evidence and recent developments

  • AI Compromise: Generates balanced solutions honoring all viewpoints

    1. Comprehensive Summary
  • Neutral summary of the entire conversation

  • Key points from each perspective

  • Visual tension/empathy timeline

  • Debate quality metrics (civility score, bias score, evidence-based score)

  • Final compromise proposal with rationale

How We Built It

Tech Stack:

Backend:

  • FastAPI - High-performance Python web framework
  • SQLModel - Type-safe database ORM combining SQLAlchemy with Pydantic
  • SQLite - Lightweight database for storing conversations and value nodes
  • Google Gemini 2.5 Flash Lite - Powers all AI analysis (judge, biases, common ground, compromise)
  • Uvicorn - ASGI server for running the backend

Frontend:

  • Next.js 14 - React framework with App Router for modern routing
  • React 18 - Component-based UI with hooks
  • TypeScript - Type safety throughout the frontend
  • Tailwind CSS - Utility-first styling with custom animations
  • TanStack Query (React Query) - Server state management with real-time polling
  • Lucide React - Beautiful, consistent icons

Architecture:

  • RESTful API with FastAPI endpoints
  • Real-time polling (1-second intervals) for live chat updates
  • Modular service layer for AI insights
  • Persistent storage with SQLite database
  • Value graph system with nodes and edges for relationship mapping

Key Implementation Details:

  1. AI Judge Pipeline:
  • Analyzes each message before storage
  • Passes conversation history for context
  • Returns structured JSON with issues categorized by type
  • Stores analysis in database for later visualization

    1. Value Extraction:
  • Uses Gemini to extract core values from natural language

  • Creates value nodes (fairness, freedom, progress, etc.)

  • Builds relation edges showing how values support/contradict each other

  • Calculates importance scores and tension/empathy metrics

    1. Real-Time Updates:
  • Frontend polls every 1 second for new messages

  • Quality metrics refresh every 5 seconds

  • Memoized components prevent unnecessary re-renders

  • Optimistic updates for smooth UX

    1. Multi-Pane Layout:
  • Dynamic grid layout (2, 3, or 4 columns based on participant count)

  • Independent scroll for each participant's message history

  • Auto-scroll to bottom when new messages arrive

  • Typing indicators per participant

Challenges We Ran Into

1. AI Judge Reliability

Problem: The AI judge would sometimes timeout or fail due to DNS resolution issues with Google's API. Solution:

  • Implemented graceful error handling that returns empty analysis on failure
  • Added socket-level timeout configuration (30 seconds)
  • Created fallback responses so the app continues working even if judge fails
  • Added detailed logging to track issues: ✓ Judge analyzed message or ✗ Judge error
Share this project:

Updates