add prompt role icons to prompt manager

2109a7bda1c9d099df0dddb1615463cd0bcc01f5

RossAscends <124905043+RossAscends@users.noreply.github.com>

1 files changed, +33 -2Ignore whitespace
public/scripts/PromptManager.js+33 -2
@@ -1550,22 +1550,53 @@ class PromptManager {
15501550 const isInjectionPrompt = prompt.injection_position === INJECTION_POSITION.ABSOLUTE;
15511551 const isOverriddenPrompt = Array.isArray(this.overriddenPrompts) && this.overriddenPrompts.includes(prompt.identifier);
15521552 const importantClass = isImportantPrompt ? `${prefix}prompt_manager_important` : '';
1553+
1554+ //add role icons to the right of prompt name
1555+
1556+ const hasRole = prompt.role ? true : false;
1557+ let roleIcon, roleTitle;
1558+ if (hasRole) {
1559+ switch (prompt.role) {
1560+ case 'system':
1561+ roleIcon = 'fa-cog';
1562+ roleTitle = 'Prompt will be sent as System';
1563+ break;
1564+ case 'assistant':
1565+ roleIcon = 'fa-robot';
1566+ roleTitle = 'Prompt will be sent as Assistant';
1567+ break;
1568+ case 'user':
1569+ roleIcon = 'fa-user';
1570+ roleTitle = 'Prompt will be sent as User';
1571+ }
1572+
1573+ // not sure if this makes sense to include as 'markers' should not be sendable except by System, included in case I'm wrong.
1574+ // if it shouldn't be changeable, we should remove that dropdown from editor for Marker prompts.
1575+ /*
1576+ if (isMarkerPrompt && prompt.role !== 'user' && prompt.role !== 'assistant' && prompt.role !== 'system') {
1577+ roleIcon = 'fa-cog';
1578+ roleTitle = 'ST Global Prompt is sent as System by default (but can be changed in Editor)';
1579+ }
1580+ */
1581+ }
1582+
15531583 listItemHtml += `
15541584 <li class="${prefix}prompt_manager_prompt ${draggableClass} ${enabledClass} ${markerClass} ${importantClass}" data-pm-identifier="${prompt.identifier}">
15551585 <span class="${prefix}prompt_manager_prompt_name" data-pm-name="${encodedName}">
15561586 ${isMarkerPrompt ? '<span class="fa-fw fa-solid fa-thumb-tack" title="Marker"></span>' : ''}
15571587 ${isSystemPrompt ? '<span class="fa-fw fa-solid fa-square-poll-horizontal" title="Global Prompt"></span>' : ''}
15581588 ${isImportantPrompt ? '<span class="fa-fw fa-solid fa-star" title="Important Prompt"></span>' : ''}
15591589 ${isUserPrompt ? '<span class="fa-fw fa-solid fa-user" title="UserPreset Prompt"></span>' : ''}
15601590 ${isInjectionPrompt ? '<span class="fa-fw fa-solid fa-syringe" title="In-Chat Injection"></span>' : ''}
15611591 ${this.isPromptInspectionAllowed(prompt) ? `<a title="${encodedName}" class="prompt-manager-inspect-action">${encodedName}</a>` : `<span title="${encodedName}">${encodedName}</span>`}
1592+ ${hasRole ? `<span class='fa-solid ${roleIcon}' title='${roleTitle}'></span>` : ''}
15621593 ${isInjectionPrompt ? `<small class="prompt-manager-injection-depth">@ ${prompt.injection_depth}</small>` : ''}
15631594 ${isOverriddenPrompt ? '<small class="fa-solid fa-address-card prompt-manager-overridden" title="Pulled from a character card"></small>' : ''}
15641595 </span>
15651596 <span>
15661597 <span class="prompt_manager_prompt_controls">
15671598 ${detachSpanHtml}
15681599 ${ editSpanHtml }
15691600 ${toggleSpanHtml}
15701601 </span>
15711602 </span>