Remove unspecified role, hide icons for non-custom prompts of non-system roles

e9c9dda3fb695399ed85aefbe9e9752c5fdb8411

Cohee <18619528+Cohee1207@users.noreply.github.com>

2 files changed, +6 -8Showing whitespace changes
public/index.html+0 -2
@@ -6115,10 +6115,8 @@
61156115 </label>
61166116 <div class="text_muted">
61176117 <span data-i18n="To whom this message will be attributed.">To whom this message will be attributed.</span>
6118- <span data-i18n="Unspecified = Prompt Manager decides.">Unspecified = Prompt Manager decides.</span>
61196118 </div>
61206119 <select id="completion_prompt_manager_popup_entry_form_role" class="text_pole" name="role">
6121- <option data-i18n="Unspecified" value="">Unspecified</option>
61226120 <option data-i18n="System" value="system">System</option>
61236121 <option data-i18n="User" value="user">User</option>
61246122 <option data-i18n="AI Assistant" value="assistant">AI Assistant</option>
public/scripts/PromptManager.js+6 -6
@@ -430,7 +430,7 @@ class PromptManager {
430430 }
431431
432432 document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_name').value = prompt.name;
433433 document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_role').value = 'system';
434434 document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_prompt').value = prompt.content ?? '';
435435 document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_position').value = prompt.injection_position ?? 0;
436436 document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_depth').value = prompt.injection_depth ?? DEFAULT_DEPTH;
@@ -1208,7 +1208,7 @@ class PromptManager {
12081208 const forbidOverridesBlock = document.getElementById(this.configuration.prefix + 'prompt_manager_forbid_overrides_block');
12091209
12101210 nameField.value = prompt.name ?? '';
12111211 roleField.value = prompt.role ??|| 'system';
12121212 promptField.value = prompt.content ?? '';
12131213 promptField.disabled = prompt.marker ?? false;
12141214 injectionPositionField.value = prompt.injection_position ?? INJECTION_POSITION.RELATIVE;
@@ -1543,7 +1543,6 @@ class PromptManager {
15431543 }
15441544
15451545 const encodedName = escapeHtml(prompt.name);
1546- const isRolePrompt = !!prompt.role;
15471546 const isMarkerPrompt = prompt.marker && prompt.injection_position !== INJECTION_POSITION.ABSOLUTE;
15481547 const isSystemPrompt = !prompt.marker && prompt.system_prompt && prompt.injection_position !== INJECTION_POSITION.ABSOLUTE && !prompt.forbid_overrides;
15491548 const isImportantPrompt = !prompt.marker && prompt.system_prompt && prompt.injection_position !== INJECTION_POSITION.ABSOLUTE && prompt.forbid_overrides;
@@ -1551,6 +1550,7 @@ class PromptManager {
15511550 const isInjectionPrompt = prompt.injection_position === INJECTION_POSITION.ABSOLUTE;
15521551 const isOverriddenPrompt = Array.isArray(this.overriddenPrompts) && this.overriddenPrompts.includes(prompt.identifier);
15531552 const importantClass = isImportantPrompt ? `${prefix}prompt_manager_important` : '';
1553+ const iconLookup = prompt.role === 'system' && (prompt.marker || prompt.system_prompt) ? '' : prompt.role;
15541554
15551555 //add role icons to the right of prompt name
15561556 const promptRoles = {
@@ -1558,8 +1558,8 @@ class PromptManager {
15581558 assistant: { roleIcon: 'fa-robot', roleTitle: 'Prompt will be sent as Assistant' },
15591559 user: { roleIcon: 'fa-user', roleTitle: 'Prompt will be sent as User' },
15601560 };
15611561 const roleIcon = isRolePrompt ? promptRoles[prompt.roleiconLookup]?.roleIcon :|| '';
15621562 const roleTitle = isRolePrompt ? promptRoles[prompt.roleiconLookup]?.roleTitle :|| '';
15631563
15641564 listItemHtml += `
15651565 <li class="${prefix}prompt_manager_prompt ${draggableClass} ${enabledClass} ${markerClass} ${importantClass}" data-pm-identifier="${escapeHtml(prompt.identifier)}">
@@ -1570,7 +1570,7 @@ class PromptManager {
15701570 ${isUserPrompt ? '<span class="fa-fw fa-solid fa-asterisk" title="Preset Prompt"></span>' : ''}
15711571 ${isInjectionPrompt ? '<span class="fa-fw fa-solid fa-syringe" title="In-Chat Injection"></span>' : ''}
15721572 ${this.isPromptInspectionAllowed(prompt) ? `<a title="${encodedName}" class="prompt-manager-inspect-action">${encodedName}</a>` : `<span title="${encodedName}">${encodedName}</span>`}
15731573 ${isRolePromptroleIcon ? `<span data-role="${escapeHtml(prompt.role)}" class="fa-xs fa-solid ${roleIcon}" title="${roleTitle}"></span>` : ''}
15741574 ${isInjectionPrompt ? `<small class="prompt-manager-injection-depth">@ ${escapeHtml(prompt.injection_depth)}</small>` : ''}
15751575 ${isOverriddenPrompt ? '<small class="fa-solid fa-address-card prompt-manager-overridden" title="Pulled from a character card"></small>' : ''}
15761576 </span>