mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add "unset" value for PM prompt role, refactor icons display
This commit is contained in:
@@ -28,6 +28,10 @@
|
|||||||
color: var(--white50a);
|
color: var(--white50a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#completion_prompt_manager #completion_prompt_manager_list .completion_prompt_manager_prompt .completion_prompt_manager_prompt_name .fa-solid[data-role] {
|
||||||
|
vertical-align: unset;
|
||||||
|
}
|
||||||
|
|
||||||
#completion_prompt_manager #completion_prompt_manager_list .completion_prompt_manager_prompt_invisible {
|
#completion_prompt_manager #completion_prompt_manager_list .completion_prompt_manager_prompt_invisible {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
@@ -6115,6 +6115,7 @@
|
|||||||
</label>
|
</label>
|
||||||
<div class="text_muted" data-i18n="To whom this message will be attributed.">To whom this message will be attributed.</div>
|
<div class="text_muted" data-i18n="To whom this message will be attributed.">To whom this message will be attributed.</div>
|
||||||
<select id="completion_prompt_manager_popup_entry_form_role" class="text_pole" name="role">
|
<select id="completion_prompt_manager_popup_entry_form_role" class="text_pole" name="role">
|
||||||
|
<option data-i18n="Default (unset)" value="">Default (unset)</option>
|
||||||
<option data-i18n="System" value="system">System</option>
|
<option data-i18n="System" value="system">System</option>
|
||||||
<option data-i18n="User" value="user">User</option>
|
<option data-i18n="User" value="user">User</option>
|
||||||
<option data-i18n="AI Assistant" value="assistant">AI Assistant</option>
|
<option data-i18n="AI Assistant" value="assistant">AI Assistant</option>
|
||||||
|
@@ -1208,7 +1208,7 @@ class PromptManager {
|
|||||||
const forbidOverridesBlock = document.getElementById(this.configuration.prefix + 'prompt_manager_forbid_overrides_block');
|
const forbidOverridesBlock = document.getElementById(this.configuration.prefix + 'prompt_manager_forbid_overrides_block');
|
||||||
|
|
||||||
nameField.value = prompt.name ?? '';
|
nameField.value = prompt.name ?? '';
|
||||||
roleField.value = prompt.role ?? 'system';
|
roleField.value = prompt.role ?? '';
|
||||||
promptField.value = prompt.content ?? '';
|
promptField.value = prompt.content ?? '';
|
||||||
promptField.disabled = prompt.marker ?? false;
|
promptField.disabled = prompt.marker ?? false;
|
||||||
injectionPositionField.value = prompt.injection_position ?? INJECTION_POSITION.RELATIVE;
|
injectionPositionField.value = prompt.injection_position ?? INJECTION_POSITION.RELATIVE;
|
||||||
@@ -1543,6 +1543,7 @@ class PromptManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const encodedName = escapeHtml(prompt.name);
|
const encodedName = escapeHtml(prompt.name);
|
||||||
|
const isRolePrompt = !!prompt.role;
|
||||||
const isMarkerPrompt = prompt.marker && prompt.injection_position !== INJECTION_POSITION.ABSOLUTE;
|
const isMarkerPrompt = prompt.marker && prompt.injection_position !== INJECTION_POSITION.ABSOLUTE;
|
||||||
const isSystemPrompt = !prompt.marker && prompt.system_prompt && prompt.injection_position !== INJECTION_POSITION.ABSOLUTE && !prompt.forbid_overrides;
|
const isSystemPrompt = !prompt.marker && prompt.system_prompt && prompt.injection_position !== INJECTION_POSITION.ABSOLUTE && !prompt.forbid_overrides;
|
||||||
const isImportantPrompt = !prompt.marker && prompt.system_prompt && prompt.injection_position !== INJECTION_POSITION.ABSOLUTE && prompt.forbid_overrides;
|
const isImportantPrompt = !prompt.marker && prompt.system_prompt && prompt.injection_position !== INJECTION_POSITION.ABSOLUTE && prompt.forbid_overrides;
|
||||||
@@ -1552,36 +1553,16 @@ class PromptManager {
|
|||||||
const importantClass = isImportantPrompt ? `${prefix}prompt_manager_important` : '';
|
const importantClass = isImportantPrompt ? `${prefix}prompt_manager_important` : '';
|
||||||
|
|
||||||
//add role icons to the right of prompt name
|
//add role icons to the right of prompt name
|
||||||
|
const promptRoles = {
|
||||||
const hasRole = !!prompt.role;
|
system: { roleIcon: 'fa-cog', roleTitle: 'Prompt will be sent as System' },
|
||||||
let roleIcon, roleTitle;
|
assistant: { roleIcon: 'fa-robot', roleTitle: 'Prompt will be sent as Assistant' },
|
||||||
if (hasRole) {
|
user: { roleIcon: 'fa-user', roleTitle: 'Prompt will be sent as User' },
|
||||||
switch (prompt.role) {
|
};
|
||||||
case 'system':
|
const roleIcon = isRolePrompt ? promptRoles[prompt.role]?.roleIcon : '';
|
||||||
roleIcon = 'fa-cog';
|
const roleTitle = isRolePrompt ? promptRoles[prompt.role]?.roleTitle : '';
|
||||||
roleTitle = 'Prompt will be sent as System';
|
|
||||||
break;
|
|
||||||
case 'assistant':
|
|
||||||
roleIcon = 'fa-robot';
|
|
||||||
roleTitle = 'Prompt will be sent as Assistant';
|
|
||||||
break;
|
|
||||||
case 'user':
|
|
||||||
roleIcon = 'fa-user';
|
|
||||||
roleTitle = 'Prompt will be sent as User';
|
|
||||||
}
|
|
||||||
|
|
||||||
// not sure if this makes sense to include as 'markers' should not be sendable except by System, included in case I'm wrong.
|
|
||||||
// if it shouldn't be changeable, we should remove that dropdown from editor for Marker prompts.
|
|
||||||
/*
|
|
||||||
if (isMarkerPrompt && prompt.role !== 'user' && prompt.role !== 'assistant' && prompt.role !== 'system') {
|
|
||||||
roleIcon = 'fa-cog';
|
|
||||||
roleTitle = 'ST Global Prompt is sent as System by default (but can be changed in Editor)';
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
listItemHtml += `
|
listItemHtml += `
|
||||||
<li class="${prefix}prompt_manager_prompt ${draggableClass} ${enabledClass} ${markerClass} ${importantClass}" data-pm-identifier="${prompt.identifier}">
|
<li class="${prefix}prompt_manager_prompt ${draggableClass} ${enabledClass} ${markerClass} ${importantClass}" data-pm-identifier="${escapeHtml(prompt.identifier)}">
|
||||||
<span class="${prefix}prompt_manager_prompt_name" data-pm-name="${encodedName}">
|
<span class="${prefix}prompt_manager_prompt_name" data-pm-name="${encodedName}">
|
||||||
${isMarkerPrompt ? '<span class="fa-fw fa-solid fa-thumb-tack" title="Marker"></span>' : ''}
|
${isMarkerPrompt ? '<span class="fa-fw fa-solid fa-thumb-tack" title="Marker"></span>' : ''}
|
||||||
${isSystemPrompt ? '<span class="fa-fw fa-solid fa-square-poll-horizontal" title="Global Prompt"></span>' : ''}
|
${isSystemPrompt ? '<span class="fa-fw fa-solid fa-square-poll-horizontal" title="Global Prompt"></span>' : ''}
|
||||||
@@ -1589,14 +1570,14 @@ class PromptManager {
|
|||||||
${isUserPrompt ? '<span class="fa-fw fa-solid fa-user" title="Preset Prompt"></span>' : ''}
|
${isUserPrompt ? '<span class="fa-fw fa-solid fa-user" title="Preset Prompt"></span>' : ''}
|
||||||
${isInjectionPrompt ? '<span class="fa-fw fa-solid fa-syringe" title="In-Chat Injection"></span>' : ''}
|
${isInjectionPrompt ? '<span class="fa-fw fa-solid fa-syringe" title="In-Chat Injection"></span>' : ''}
|
||||||
${this.isPromptInspectionAllowed(prompt) ? `<a title="${encodedName}" class="prompt-manager-inspect-action">${encodedName}</a>` : `<span title="${encodedName}">${encodedName}</span>`}
|
${this.isPromptInspectionAllowed(prompt) ? `<a title="${encodedName}" class="prompt-manager-inspect-action">${encodedName}</a>` : `<span title="${encodedName}">${encodedName}</span>`}
|
||||||
${hasRole ? `<span class='fa-solid ${roleIcon}' title='${roleTitle}'></span>` : ''}
|
${isRolePrompt ? `<span data-role="${escapeHtml(prompt.role)}" class="fa-xs fa-solid ${roleIcon}" title="${roleTitle}"></span>` : ''}
|
||||||
${isInjectionPrompt ? `<small class="prompt-manager-injection-depth">@ ${prompt.injection_depth}</small>` : ''}
|
${isInjectionPrompt ? `<small class="prompt-manager-injection-depth">@ ${escapeHtml(prompt.injection_depth)}</small>` : ''}
|
||||||
${isOverriddenPrompt ? '<small class="fa-solid fa-address-card prompt-manager-overridden" title="Pulled from a character card"></small>' : ''}
|
${isOverriddenPrompt ? '<small class="fa-solid fa-address-card prompt-manager-overridden" title="Pulled from a character card"></small>' : ''}
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span>
|
||||||
<span class="prompt_manager_prompt_controls">
|
<span class="prompt_manager_prompt_controls">
|
||||||
${detachSpanHtml}
|
${detachSpanHtml}
|
||||||
${ editSpanHtml }
|
${editSpanHtml}
|
||||||
${toggleSpanHtml}
|
${toggleSpanHtml}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
Reference in New Issue
Block a user