fix: initialize Cluedo state when enabled and role is CluedoPlayer

This commit is contained in:
Grail Finder (aider)
2025-03-21 18:58:13 +03:00
parent d05cea050c
commit e8f2fe7809

5
bot.go
View File

@@ -415,6 +415,11 @@ func removeThinking(chatBody *models.ChatBody) {
func applyCharCard(cc *models.CharCard) { func applyCharCard(cc *models.CharCard) {
cfg.AssistantRole = cc.Role cfg.AssistantRole = cc.Role
// Initialize Cluedo if enabled and matching role
if cfg.EnableCluedo && cc.Role == "CluedoPlayer" {
playerOrder = []string{cfg.UserRole, cfg.AssistantRole, cfg.CluedoRole2}
cluedoState = extra.CluedoPrepCards(playerOrder)
}
history, err := loadAgentsLastChat(cfg.AssistantRole) history, err := loadAgentsLastChat(cfg.AssistantRole)
if err != nil { if err != nil {
logger.Warn("failed to load last agent chat;", "agent", cc.Role, "err", err) logger.Warn("failed to load last agent chat;", "agent", cc.Role, "err", err)