Skip to content

Implemented AI-Powered Debate Bots with Dynamic Personalities, Skill Levels, and AI-Driven Scoring #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 31 commits into
base: main
Choose a base branch
from

Conversation

rixitgithub
Copy link
Contributor

Implemented AI-Powered Debate Bots with Dynamic Personalities, Skill Levels, and AI-Driven Scoring

Description

This pull request significantly enhances the debate application by introducing a comprehensive bot debate system. Users can now engage in structured debates against AI opponents with distinct personalities, complete with speech recognition, text-to-speech capabilities, and a sophisticated judgment system that evaluates performance across different debate phases.

These changes transform the application from a text-based platform to an immersive, interactive debating experience with real-time voice capabilities, customizable debate parameters, and detailed performance evaluation.


Context

Previously, the "Play vs Bot" feature was completely non-functional, with users encountering only a blank page upon clicking the button. The debate system had no implementation whatsoever - no bot opponents, no debate interface, and no backend support for AI-driven debates. This PR addresses this critical gap by:

  • Introducing distinct bot personalities with unique debate styles and characteristics
  • Adding speech recognition for voice-to-text input and text-to-speech for bot responses
  • Implementing a structured debate format with timed phases (Opening Statements, Cross-Examination, etc.)
  • Creating a comprehensive judgment system that evaluates specific aspects of debate performance
  • Enhancing the UI with visual feedback, phase transitions, and customization options

These features collectively create an entirely new, engaging, educational, and accessible debate platform that serves both casual users and those looking to improve their debating skills.


Changes Made

Frontend (React/TypeScript)

  • Bot Selection (BotSelection.tsx):

    • Implemented a visually appealing bot selection interface with personality cards
    • Added hover effects, chat bubbles with bot quotes, and personalized descriptions
    • Incorporated stance selection (for, against, random) with automatic assignment
    • Added customizable phase timing controls (60-600 seconds per phase)
    • Implemented loading state feedback during debate creation
  • Debate Room (DebateRoom.tsx):

    • Integrated Web Speech API for voice-to-text input with real-time transcription
    • Implemented text-to-speech for bot responses with mute/unmute controls
    • Created dynamic timer with visual cues (pulsing effect when time is low)
    • Added phase transition notifications with clear phase labeling
    • Implemented automatic turn advancement when time expires
    • Enhanced message display with phase context and styling
  • Judgment System (JudgmentPopup.tsx):

    • Designed a comprehensive debate evaluation UI showing scores by phase
    • Displayed detailed feedback with reasoning for each score
    • Added user and bot profiles with stance information
    • Included navigation options for continuing or ending the debate session
  • Services (vsbot.ts):

    • Enhanced API interaction with phase tracking and context parameters
    • Updated type definitions to support new features
    • Implemented judgment request/response handling

Backend (Go)

  • Services (debateVsBot.go):

    • Created detailed bot personality profiles with specific debate characteristics
    • Enhanced prompt construction with phase-specific instructions
    • Improved bot response generation with context awareness
    • Implemented structured judgment algorithm for multi-facet evaluation
  • Models (debateVsBot.go):

    • Updated data structures to support phase timing for both users and bots
    • Enhanced debate storage with phase tracking
  • Controllers (debateVsBot.go):

    • Modified API endpoints to handle new parameters (timing, context, phase)
    • Enhanced judgment endpoint to provide detailed, structured feedback
    • Implemented data conversion between frontend and backend formats

Bot Personalities

The PR introduces a diverse range of AI debate opponents, each with a unique personality, debate style, and difficulty level:

Avatar Bot Difficulty Personality Debate Style
Rick Rookie Rick (1200) Easy "Keep your language simple and a bit naive." Beginner-friendly with straightforward arguments
Casey Casual Casey (1300) Easy "Maintain a friendly and relaxed tone." Conversational style with approachable reasoning
Mike Moderate Mike (1500) Medium "Be balanced, logical, and provide clear reasoning." Balanced approach with methodical point-counterpoint
Sarah Sassy Sarah (1600) Medium "Inject wit and sarcasm while remaining convincing." Witty rebuttals with occasional humorous jabs
Iris Innovative Iris (1550) Medium "Show creativity and originality in your arguments." Unique perspectives and creative analogies
Tony Tough Tony (1700) Hard "Be assertive and relentless in your logic." Aggressive stance with forceful logical chains
Emma Expert Emma (1800) Hard "Use authoritative language with deep insights." Evidence-based arguments with scholarly references
Greg Grand Greg (2000) Expert "Exude confidence and superiority in your arguments." Commanding presence with sophisticated reasoning

Each bot provides a different challenge level, allowing users to practice against various opponent types or select one that matches their learning objectives.

How to Test

Setup

  1. Backend:
    • Ensure MongoDB is running
    • Start the backend with:
      go run main.go
  2. Frontend:
    • Start the frontend with:
      npm run dev
    • The application should be accessible on localhost:5173

Test Cases

  • Bot Selection:

    • Navigate to /startdebate and select different bots to verify unique personalities
    • Test stance selection (for, against, random) to ensure correct assignment
    • Adjust phase timings to confirm customization works
  • Debate Experience:

    • Initiate a debate and test the speech recognition by clicking the microphone icon
    • Verify text-to-speech works when bot responds (toggle mute to test)
    • Confirm timer works properly, advancing turns when time expires
    • Check that phase transitions display correctly with appropriate messages
  • Judgment System:

    • Complete a full debate to trigger the judgment system
    • Verify scores and feedback are displayed for each phase
    • Test navigation options (Back to Home, Close) function correctly
  • Edge Cases:

    • Test browser compatibility for speech features (Chrome recommended)
    • Try different microphone setups to ensure voice recognition works
    • Test with extremely short and long time settings

Video Comparison

Before Implementation:

user_vs_bot_before.mp4

After Implementation:

user_vs_bot_after.mp4

Screenshots

Feature Screenshot
Bot Selection Screenshot 2025-04-02 105133
Debate Room Screenshot 2025-04-02 105307
Judgment Results Screenshot 2025-04-02 105403
Final Verdict Screenshot 2025-04-02 105349

Checklist

  • Speech recognition tested across supported browsers
  • Text-to-speech functionality verified with different bot personalities
  • Timer functionality works correctly in all debate phases
  • Judgment system provides accurate and helpful feedback
  • UI is responsive on both desktop and mobile devices
  • Phase transitions work smoothly with appropriate visual feedback
  • API endpoints handle all required parameters correctly

Reviewers


Additional Notes

  • Speech recognition works best in Chrome and Edge browsers
  • The default phase timing (120 seconds) has been tested for optimal debate flow
  • Bot personalities are designed to offer varying difficulty levels, from beginner-friendly to challenging
  • Future work could include user voice customization for the text-to-speech feature
  • Consider adding a practice mode where users can debate without time constraints

Closes #70

ceilican and others added 22 commits December 3, 2024 10:38
…-Hide-Password-Functionality-46

password hide-visible feature added ( issue AOSSIE-Org#46 )
…DebateAI

- Added seamless post-sign-in user flow with navigation logic in React
- Implemented profile UI and /user backend routes with edit functionality
- Built leaderboard UI and /leaderboard API, sorting users by EloRating
- Created user and debate schemas in MongoDB with Go integration
- Seeded test data; updated config, auth, and dependencies for full stack support
@rixitgithub rixitgithub changed the title Feat/user vs bot debate Implemented AI-Powered Debate Bots with Dynamic Personalities, Skill Levels, and AI-Driven Scoring Apr 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement AI-Powered Debate Bots with Dynamic Personalities, Skill Levels, and AI-Driven Scoring
9 participants