Fix GroupPersona serialization and group chat functionality issues #14
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses several critical issues with the GroupPersona implementation that were causing problems with group chat functionality while maintaining full backward compatibility with 1-on-1 conversations.
Issues Fixed
1. Nested JSON Serialization Problem
The original implementation stored
BotPersonasas aList<BasePersona>, which created "nested dolls" when serialized to JSON:{ "BotPersonas": [ { "Name": "Alice", "Bio": "...", "UniqueName": "alice_bot", // ... entire persona object nested here } ] }This made individual personas difficult to edit independently and violated the principle of keeping personas as separate entities.
Fix: Added
[JsonIgnore]toBotPersonasand introducedBotPersonaNamesas aList<string>for serialization:{ "BotPersonaNames": ["alice_bot", "bob_bot"], "CurrentBotId": "bob_bot" // No nested persona objects }2. Dynamic Persona Loading
The group now dynamically populates
BotPersonasduringBeginChat()usingLLMSystem.LoadedPersonas, ensuring personas remain independent while being properly linked at runtime.3. Brain Functionality Conflicts
Brain functionality was interfering with group conversations since it's designed for single personas. Added automatic Brain disabling for group chats:
4. Enhanced World Info Handling
Improved
UpdateRagAndInserts()to consider both group-level and active persona's individual MyWorlds:Testing
Added comprehensive tests covering:
LoadedPersonasAll tests pass and confirm that:
Breaking Changes
None. All changes are backward compatible with existing 1-on-1 chat functionality.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.