fix: allow /ai persona custom to set KV override and use CustomPersona textarea
This commit is contained in:
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user