diff --git a/server/command.go b/server/command.go index 50cd390..79a8b09 100644 --- a/server/command.go +++ b/server/command.go @@ -128,9 +128,11 @@ func (p *Plugin) handlePersonaList(args *model.CommandArgs) (*model.CommandRespo // handlePersonaSwitch persists a persona override for the user+channel. func (p *Plugin) handlePersonaSwitch(args *model.CommandArgs, personaID string) (*model.CommandResponse, *model.AppError) { - resolved := resolvePersona(personaID) - if resolved == "" { - return p.response("Unknown persona. Available: " + p.listPersonas()), nil + if personaID != "custom" { + resolved := resolvePersona(personaID) + if resolved == "" { + return p.response("Unknown persona. Available: " + p.listPersonas()), nil + } } if err := p.SavePersonaOverride(args.UserId, args.ChannelId, personaID); err != nil { return p.response("Failed to save persona: " + err.Error()), nil diff --git a/server/hooks.go b/server/hooks.go index 33349e6..9085038 100644 --- a/server/hooks.go +++ b/server/hooks.go @@ -194,10 +194,14 @@ func (p *Plugin) MessageHasBeenPosted(c *plugin.Context, post *model.Post) { // Prepend the persona system prompt to set the bot's character. // Priority: KV override > dropdown selection - // If dropdown = "custom" → use CustomPersona textarea field + // KV "custom" or dropdown "custom" → use CustomPersona textarea field // Otherwise → resolve from personaLibrary persona := p.GetPersonaOverride(post.UserId, post.ChannelId) - persona = resolvePersona(persona) + if persona == "custom" { + persona = cfg.CustomPersona + } else { + persona = resolvePersona(persona) + } if persona == "" { if cfg.Persona == "custom" { persona = cfg.CustomPersona