-
Notifications
You must be signed in to change notification settings - Fork 160
FEAT(added bots personality): Added a detailed bot personality and added 5 additional bots #101
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
Conversation
WalkthroughThis update introduces a comprehensive overhaul of the DebateAI bot personality system. The backend now features a detailed Changes
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
Possibly related PRs
Poem
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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:
-``` +```yamlAlso applies to: 91-91, 129-129, 135-135
backend/services/personalities.go (1)
28-1028: Consider refactoring this large function for better maintainability.The
GetBotPersonalityfunction 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
⛔ Files ignored due to path filters (11)
frontend/public/images/casual_casey.jpgis excluded by!**/*.jpgfrontend/public/images/darthvader.jpgis excluded by!**/*.jpgfrontend/public/images/expert_emma.jpgis excluded by!**/*.jpgfrontend/public/images/grand_greg.jpgis excluded by!**/*.jpgfrontend/public/images/innovative_iris.jpgis excluded by!**/*.jpgfrontend/public/images/moderate_mike.jpgis excluded by!**/*.jpgfrontend/public/images/rafiki.jpegis excluded by!**/*.jpegfrontend/public/images/rookie_rick.jpgis excluded by!**/*.jpgfrontend/public/images/sassy_sarah.jpgis excluded by!**/*.jpgfrontend/public/images/tough_tony.jpgis excluded by!**/*.jpgfrontend/public/images/yoda.jpegis 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
BotPersonalitystruct 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
Botinterface and the consolidatedallBotsarray 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 animagesfolder underpublic/. 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.
| "arguehub/config" | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| "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.
Summary by CodeRabbit
New Features
Improvements
Documentation