From 12fd8b657010f0a9a1b2c7a2caeb90cef18fef1a Mon Sep 17 00:00:00 2001 From: Lucas Daniel <94806303+NoodleLDS@users.noreply.github.com> Date: Wed, 3 Jun 2026 01:23:14 -0300 Subject: [PATCH] fix(group): show all user-created personas in the participant selector (#1770) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit _getCharacterList() had two bugs that silently dropped every user-created persona from the group participant picker: 1. The /api/presets/templates endpoint returns a JSON array directly, but the code read `data.templates` (always undefined). The forEach over `data.templates || []` iterated over an empty array every time, so no user templates were ever added. 2. Even if the array had been read correctly, the `t.isCharacter` guard would have filtered them all out — user templates are saved by presets.js without that flag, which is only present on built-in PROMPT_TEMPLATES entries. Fix: accept both the direct-array and the {templates:[]} shapes, drop the isCharacter guard (user_templates are personas by definition), and use the correct field name (system_prompt, not prompt) so the character prompt actually reaches the group chat. Fixes #1656 --- static/js/group.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/static/js/group.js b/static/js/group.js index 4390b00..122fd01 100644 --- a/static/js/group.js +++ b/static/js/group.js @@ -299,13 +299,16 @@ async function _getCharacterList() { }); } } catch (e) {} - // Load user templates and wait for them before returning + // Load user templates and wait for them before returning. + // The endpoint returns a JSON array directly (not {templates:[...]}). + // All user templates are personas by definition — no isCharacter filter needed. try { const r = await fetch(API_BASE + '/api/presets/templates', { credentials: 'same-origin' }); const data = await r.json(); - (data.templates || []).forEach(t => { - if (t.isCharacter && !chars.find(c => c.id === t.id)) { - chars.push({ id: t.id, name: t.name, prompt: t.prompt || '' }); + const templates = Array.isArray(data) ? data : (data.templates || []); + templates.forEach(t => { + if (t.id && t.name && !chars.find(c => c.id === t.id)) { + chars.push({ id: t.id, name: t.name, prompt: t.system_prompt || t.prompt || '' }); } }); } catch (e) {}