Skip to content

Conversation

@rixitgithub
Copy link
Contributor

@rixitgithub rixitgithub commented Jun 24, 2025

Summary by CodeRabbit

  • New Features

    • Introduced a richer bot selection experience with new cinematic "Legends" bots (Yoda, Tony Stark, Dumbledore, Rafiki, Darth Vader) and detailed personality traits.
    • Bots are now grouped by difficulty level in expandable cards for easier navigation and selection.
    • Enhanced bot preview with avatar, quote, level, and rating display.
  • Improvements

    • Improved input handling for phase timings to prevent invalid values.
    • Enhanced error handling and more immersive, personality-driven bot responses during debates.
    • More expressive and dynamic debate interactions, with bots adapting to opponent styles.
  • Documentation

    • Cleaned up README formatting for improved readability; no instructional changes.

@coderabbitai
Copy link

coderabbitai bot commented Jun 24, 2025

Walkthrough

This update introduces a comprehensive overhaul of the DebateAI bot personality system. The backend now features a detailed BotPersonality model with nuanced behavioral and rhetorical traits, dynamic prompt construction, and personality-aware error handling. The frontend Bot Selection page is refactored to support grouped, expandable bot lists, including new cinematic bots, improved type safety, and enhanced UI logic. Minor formatting and import adjustments were made elsewhere.

Changes

File(s) Change Summary
README.md Cleaned up leading spaces and whitespace for more consistent Markdown formatting; no content changes.
backend/services/debatevsbot.go Replaced simple personality struct with detailed model; added dynamic prompt logic, opponent style inference, phase-specific instructions, personality-aware error handling, and enhanced debate judging with personality context.
backend/services/personalities.go New file defining BotPersonality struct with rich attributes and GetBotPersonality function for multiple archetypal and cinematic bots.
backend/utils/auth.go Added import statement for "arguehub/config"; no logic changes.
frontend/src/Pages/BotSelection.tsx Refactored to use a typed bot array, added cinematic bots, grouped bots by difficulty in expandable cards, improved state management, type safety, input handling, and UI; updated logic for phase timings and bot selection.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant BotSelectionUI
    participant BackendAPI
    participant DebateService
    participant PersonalityModule

    User->>BotSelectionUI: Selects bot and topic
    BotSelectionUI->>BackendAPI: Sends debate creation request with selected bot
    BackendAPI->>DebateService: CreateDebateService(debate, stance)
    DebateService->>PersonalityModule: GetBotPersonality(botName)
    PersonalityModule-->>DebateService: Returns BotPersonality struct
    DebateService->>BackendAPI: Logs personality, creates debate record
    BackendAPI-->>BotSelectionUI: Returns debate session info
    User->>BotSelectionUI: Starts debate
    BotSelectionUI->>BackendAPI: Sends message history for bot response
    BackendAPI->>DebateService: GenerateBotResponse(...)
    DebateService->>PersonalityModule: GetBotPersonality(botName)
    PersonalityModule-->>DebateService: Returns BotPersonality struct
    DebateService->>DebateService: inferOpponentStyle(message)
    DebateService->>DebateService: constructPrompt(...) with personality, style, phase
    DebateService-->>BackendAPI: Returns personality-aware bot response
    BackendAPI-->>BotSelectionUI: Sends bot reply
Loading

Possibly related PRs

  • AOSSIE-Org/DebateAI#92: Also modifies the README.md file, focusing on restructuring and expanding setup instructions, whereas this PR focuses on whitespace and formatting cleanup.

Poem

In the warren of code, new bots take the stage,
Personalities rich, with wisdom and rage.
Yoda debates, and Stark makes a quip,
Dumbledore muses with a philosophical tip.
Now grouped by their prowess, they await your selection—
Hop in, dear debater, and join the connection!
🐰✨

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (3)
README.md (1)

37-37: Add language specifiers to code blocks for better syntax highlighting.

Markdown best practice recommends specifying the language for code blocks. These configuration blocks would benefit from YAML syntax highlighting.

Update the code block beginnings:

-```
+```yaml

Also applies to: 91-91, 129-129, 135-135

backend/services/personalities.go (1)

28-1028: Consider refactoring this large function for better maintainability.

The GetBotPersonality function is over 1000 lines long. Consider extracting personality definitions into a map or separate functions to improve readability and maintainability.

Example refactoring approach:

var botPersonalities = map[string]BotPersonality{
    "Rookie Rick": {
        Name: "Rookie Rick",
        Rating: 1200,
        // ... other fields
    },
    // ... other bots
}

func GetBotPersonality(botName string) BotPersonality {
    if personality, exists := botPersonalities[botName]; exists {
        return personality
    }
    return getDefaultPersonality(botName)
}
backend/services/debatevsbot.go (1)

59-98: Minor: Consider consistent case handling in opponent style inference.

The function converts the message to lowercase but the word lists use mixed case for readability. This works correctly but could be more explicit.

Consider documenting that the word matching is case-insensitive or keeping word lists in lowercase:

// inferOpponentStyle infers the opponent's debating style based on their latest message
// Word matching is case-insensitive
func inferOpponentStyle(message string) string {
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 325db9a and bccddb9.

⛔ Files ignored due to path filters (11)
  • frontend/public/images/casual_casey.jpg is excluded by !**/*.jpg
  • frontend/public/images/darthvader.jpg is excluded by !**/*.jpg
  • frontend/public/images/expert_emma.jpg is excluded by !**/*.jpg
  • frontend/public/images/grand_greg.jpg is excluded by !**/*.jpg
  • frontend/public/images/innovative_iris.jpg is excluded by !**/*.jpg
  • frontend/public/images/moderate_mike.jpg is excluded by !**/*.jpg
  • frontend/public/images/rafiki.jpeg is excluded by !**/*.jpeg
  • frontend/public/images/rookie_rick.jpg is excluded by !**/*.jpg
  • frontend/public/images/sassy_sarah.jpg is excluded by !**/*.jpg
  • frontend/public/images/tough_tony.jpg is excluded by !**/*.jpg
  • frontend/public/images/yoda.jpeg is excluded by !**/*.jpeg
📒 Files selected for processing (5)
  • README.md (5 hunks)
  • backend/services/debatevsbot.go (9 hunks)
  • backend/services/personalities.go (1 hunks)
  • backend/utils/auth.go (2 hunks)
  • frontend/src/Pages/BotSelection.tsx (9 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
README.md

37-37: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


91-91: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


129-129: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


135-135: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)

🪛 LanguageTool
README.md

[style] ~154-~154: The wording of this phrase can be improved.
Context: ...bateAI**! We appreciate your efforts in making this project better. Please follow these best practices to ...

(MAKE_STYLE_BETTER)


[uncategorized] ~161-~161: Consider adding a hyphen.
Context: ...AI). - Click the Fork button in the top right corner. - Clone the forked repository t...

(TOP_LEFT_CORNER)

🔇 Additional comments (8)
backend/services/personalities.go (2)

28-1028: Excellent implementation of the personality system!

The detailed personality definitions with tone, rhetorical style, catchphrases, and universe ties create a rich, immersive debate experience. The interaction modifiers and philosophical tenets add depth to each bot's behavior.


3-26: Consider adding JSON tags if serialization is needed.

The BotPersonality struct lacks JSON tags. If this data needs to be serialized for APIs or storage, consider adding appropriate tags.

#!/bin/bash
# Check if BotPersonality is used in JSON serialization contexts
rg -A 5 "json\.(Marshal|Unmarshal|NewEncoder|NewDecoder).*BotPersonality"
rg -A 5 "BotPersonality.*json:"
frontend/src/Pages/BotSelection.tsx (3)

244-252: Good implementation of phase timing validation!

The bounds checking (60-600 seconds) and NaN handling ensure robust input validation for debate phase timings.


15-24: Excellent TypeScript improvements and bot organization!

The addition of the Bot interface and the consolidated allBots array with proper typing significantly improves code maintainability and type safety. The inclusion of cinematic "Legends" bots adds variety to the debate experience.

Also applies to: 26-138


32-32: I’m still not seeing an images folder under public/. Let’s locate where these avatars actually live and list all image files:

#!/bin/bash
set -e

echo "1) All image files in the repo:"
fd -t f -e jpg -e jpeg -e webp -e avif .

echo
echo "2) All directories named ‘images’ (case-insensitive):"
fd -t d -i images .

echo
echo "3) Locate just rookie_rick.jpg:"
fd -t f rookie_rick.jpg .

Once we know the correct path, we can confirm each of these exists:

  • rookie_rick.jpg
  • casual_casey.jpg
  • moderate_mike.jpg
  • sassy_sarah.jpg
  • innovative_iris.jpg
  • tough_tony.jpg
  • expert_emma.jpg
  • grand_greg.jpg
  • yoda.jpeg
  • tony.webp
  • dumbledore.avif
  • rafiki.jpeg
  • darthvader.jpg

—please run and share the output so we can verify the avatars are present.

backend/services/debatevsbot.go (3)

319-401: Creative and immersive error handling!

The personality-specific error messages and clarification requests add character and maintain immersion even during error states. This attention to detail enhances the user experience.


100-256: Excellent integration of the personality system into prompt construction!

The enhanced prompt construction with personality traits, interaction modifiers, philosophical tenets, and universe ties creates rich, character-driven debates. The phase-specific instructions and opponent style inference add strategic depth.


403-481: Good enhancement of the judging system!

Including personality adherence in the judging criteria ensures bots are evaluated not just on argument quality but also on how well they maintain their character. This reinforces the immersive experience.

Comment on lines +12 to +13
"arguehub/config"

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Remove unused import to fix compilation error.

The "arguehub/config" import is not used anywhere in this file. Go will fail to compile with unused imports.

 	"time"
-	"arguehub/config"
-	
 	"crypto/sha256"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"arguehub/config"
"time"
"crypto/sha256"
🤖 Prompt for AI Agents
In backend/utils/auth.go around lines 12 to 13, the import "arguehub/config" is
unused and causes a compilation error. Remove this import statement entirely
from the import block to fix the issue.

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.

2 participants