fix: allow /ai persona custom to set KV override and use CustomPersona textarea

This commit is contained in:
2026-06-17 00:55:35 +02:00
parent 2724305f67
commit 8232917210
2 changed files with 11 additions and 5 deletions
+2
View File
@@ -128,10 +128,12 @@ 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) {
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
}
+5 -1
View File
@@ -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)
if persona == "custom" {
persona = cfg.CustomPersona
} else {
persona = resolvePersona(persona)
}
if persona == "" {
if cfg.Persona == "custom" {
persona = cfg.CustomPersona