mirror of
				https://github.com/SillyTavern/SillyTavern.git
				synced 2025-06-05 21:59:27 +02:00 
			
		
		
		
	Add pygmalion formatting dropdown
This commit is contained in:
		| @@ -999,10 +999,6 @@ | |||||||
|                             <input id="always-force-name2-checkbox" type="checkbox" /> |                             <input id="always-force-name2-checkbox" type="checkbox" /> | ||||||
|                             Always add character's name to prompt |                             Always add character's name to prompt | ||||||
|                         </label> |                         </label> | ||||||
|                         <label class="checkbox_label" for="force-pygmalion-formatting-checkbox"> |  | ||||||
|                             <input id="force-pygmalion-formatting-checkbox" type="checkbox" /> |  | ||||||
|                             Pygmalion Formatting for All Models |  | ||||||
|                         </label> |  | ||||||
|                         <label class="checkbox_label" for="multigen"> |                         <label class="checkbox_label" for="multigen"> | ||||||
|                             <input id="multigen" type="checkbox" /> |                             <input id="multigen" type="checkbox" /> | ||||||
|                             <span> |                             <span> | ||||||
| @@ -1019,6 +1015,14 @@ | |||||||
|                         <label class="checkbox_label" for="collapse-newlines-checkbox"><input id="collapse-newlines-checkbox" type="checkbox" /> |                         <label class="checkbox_label" for="collapse-newlines-checkbox"><input id="collapse-newlines-checkbox" type="checkbox" /> | ||||||
|                             Remove Empty New Lines from Output |                             Remove Empty New Lines from Output | ||||||
|                         </label> |                         </label> | ||||||
|  |                         <div> | ||||||
|  |                             <h4>Pygmalion Formatting</h4> | ||||||
|  |                             <select id="pygmalion_formatting"> | ||||||
|  |                                 <option value="-1">Disabled for all models</option> | ||||||
|  |                                 <option value="0">Automatic (based on model name)</option> | ||||||
|  |                                 <option value="1">Enabled for all models</option> | ||||||
|  |                             </select> | ||||||
|  |                         </div> | ||||||
|                     </div> |                     </div> | ||||||
|                     <div id="anchors-block"> |                     <div id="anchors-block"> | ||||||
|                         <h4> |                         <h4> | ||||||
| @@ -1371,7 +1375,7 @@ | |||||||
|                                     <div id="delete_button" class="menu_button fa-solid fa-trash-can " title="Delete Character"></div> |                                     <div id="delete_button" class="menu_button fa-solid fa-trash-can " title="Delete Character"></div> | ||||||
|                                 </div> |                                 </div> | ||||||
|                             </div> |                             </div> | ||||||
|                             <div id="result_info"></div> |                             <div title="Token counts may be inaccurate and provided just for reference." id="result_info"></div> | ||||||
|                         </div> |                         </div> | ||||||
|                         <hr> |                         <hr> | ||||||
|                         <div id="description_div" class="margin-bot-10px"> |                         <div id="description_div" class="margin-bot-10px"> | ||||||
|   | |||||||
| @@ -45,6 +45,7 @@ import { | |||||||
|     playMessageSound, |     playMessageSound, | ||||||
|     sortCharactersList, |     sortCharactersList, | ||||||
|     power_user, |     power_user, | ||||||
|  |     pygmalion_options, | ||||||
| } from "./scripts/power-user.js"; | } from "./scripts/power-user.js"; | ||||||
|  |  | ||||||
| import { | import { | ||||||
| @@ -508,7 +509,8 @@ async function getStatus() { | |||||||
|                 if (online_status == undefined) { |                 if (online_status == undefined) { | ||||||
|                     online_status = "no_connection"; |                     online_status = "no_connection"; | ||||||
|                 } |                 } | ||||||
|                 if (online_status.toLowerCase().indexOf("pygmalion") != -1 || (online_status !== "no_connection" && power_user.force_pygmalion_formatting)) { |                 if ((online_status.toLowerCase().indexOf("pygmalion") != -1 && power_user.pygmalion_formatting == pygmalion_options.AUTO) | ||||||
|  |                  || (online_status !== "no_connection" && power_user.pygmalion_formatting == pygmalion_options.ENABLED)) { | ||||||
|                     is_pygmalion = true; |                     is_pygmalion = true; | ||||||
|                     online_status += " (Pyg. formatting on)"; |                     online_status += " (Pyg. formatting on)"; | ||||||
|                 } else { |                 } else { | ||||||
| @@ -2188,10 +2190,8 @@ function saveReply(type, getMessage, this_mes_is_name) { | |||||||
|         } else { |         } else { | ||||||
|             chat[chat.length - 1]['mes'] = getMessage; |             chat[chat.length - 1]['mes'] = getMessage; | ||||||
|         } |         } | ||||||
|         is_send_press = false; |  | ||||||
|     } else { |     } else { | ||||||
|         console.log('entering chat update routine for non-swipe post'); |         console.log('entering chat update routine for non-swipe post'); | ||||||
|         is_send_press = false; |  | ||||||
|         chat[chat.length] = {}; |         chat[chat.length] = {}; | ||||||
|         chat[chat.length - 1]['name'] = name2; |         chat[chat.length - 1]['name'] = name2; | ||||||
|         chat[chat.length - 1]['is_user'] = false; |         chat[chat.length - 1]['is_user'] = false; | ||||||
|   | |||||||
| @@ -26,7 +26,7 @@ const defaultSettings = { | |||||||
|     shortMemoryStep: 16, |     shortMemoryStep: 16, | ||||||
|     longMemoryStep: 8, |     longMemoryStep: 8, | ||||||
|     repetitionPenaltyStep: 0.05, |     repetitionPenaltyStep: 0.05, | ||||||
|     repetitionPenalty: 1.0, |     repetitionPenalty: 1.2, | ||||||
|     maxRepetitionPenalty: 2.0, |     maxRepetitionPenalty: 2.0, | ||||||
|     minRepetitionPenalty: 1.0, |     minRepetitionPenalty: 1.0, | ||||||
|     temperature: 1.0, |     temperature: 1.0, | ||||||
| @@ -327,15 +327,15 @@ $(document).ready(function () { | |||||||
|                     <div class="inline-drawer-icon fa-solid fa-circle-chevron-down down"></div> |                     <div class="inline-drawer-icon fa-solid fa-circle-chevron-down down"></div> | ||||||
|                 </div> |                 </div> | ||||||
|                 <div class="inline-drawer-content"> |                 <div class="inline-drawer-content"> | ||||||
|                     <label for="memory_short_length">Memory summarization [short-term] length (<span id="memory_short_length_tokens"></span> tokens)</label> |                     <label for="memory_short_length">Buffer <small>[short-term]</small> length (<span id="memory_short_length_tokens"></span> tokens)</label> | ||||||
|                     <input id="memory_short_length" type="range" value="${defaultSettings.shortMemoryLength}" min="${defaultSettings.minShortMemory}" max="${defaultSettings.maxShortMemory}" step="${defaultSettings.shortMemoryStep}" /> |                     <input id="memory_short_length" type="range" value="${defaultSettings.shortMemoryLength}" min="${defaultSettings.minShortMemory}" max="${defaultSettings.maxShortMemory}" step="${defaultSettings.shortMemoryStep}" /> | ||||||
|                     <label for="memory_long_length">Memory context [long-term] length (<span id="memory_long_length_tokens"></span> tokens)</label> |                     <label for="memory_long_length">Summary <small>[long-term]</small> length (<span id="memory_long_length_tokens"></span> tokens)</label> | ||||||
|                     <input id="memory_long_length" type="range" value="${defaultSettings.longMemoryLength}" min="${defaultSettings.minLongMemory}" max="${defaultSettings.maxLongMemory}" step="${defaultSettings.longMemoryStep}" /> |                     <input id="memory_long_length" type="range" value="${defaultSettings.longMemoryLength}" min="${defaultSettings.minLongMemory}" max="${defaultSettings.maxLongMemory}" step="${defaultSettings.longMemoryStep}" /> | ||||||
|                     <label for="memory_temperature">Summarization temperature (<span id="memory_temperature_value"></span>)</label> |                     <label for="memory_temperature">Temperature (<span id="memory_temperature_value"></span>)</label> | ||||||
|                     <input id="memory_temperature" type="range" value="${defaultSettings.temperature}" min="${defaultSettings.minTemperature}" max="${defaultSettings.maxTemperature}" step="${defaultSettings.temperatureStep}" /> |                     <input id="memory_temperature" type="range" value="${defaultSettings.temperature}" min="${defaultSettings.minTemperature}" max="${defaultSettings.maxTemperature}" step="${defaultSettings.temperatureStep}" /> | ||||||
|                     <label for="memory_repetition_penalty">Summarization repetition penalty (<span id="memory_repetition_penalty_value"></span>)</label> |                     <label for="memory_repetition_penalty">Repetition penalty (<span id="memory_repetition_penalty_value"></span>)</label> | ||||||
|                     <input id="memory_repetition_penalty" type="range" value="${defaultSettings.repetitionPenalty}" min="${defaultSettings.minRepetitionPenalty}" max="${defaultSettings.maxRepetitionPenalty}" step="${defaultSettings.repetitionPenaltyStep}" /> |                     <input id="memory_repetition_penalty" type="range" value="${defaultSettings.repetitionPenalty}" min="${defaultSettings.minRepetitionPenalty}" max="${defaultSettings.maxRepetitionPenalty}" step="${defaultSettings.repetitionPenaltyStep}" /> | ||||||
|                     <label for="memory_length_penalty">Summarization length penalty (<span id="memory_length_penalty_value"></span>)</label> |                     <label for="memory_length_penalty">Length penalty <small>[higher = longer summaries]</small> (<span id="memory_length_penalty_value"></span>)</label> | ||||||
|                     <input id="memory_length_penalty" type="range" value="${defaultSettings.lengthPenalty}" min="${defaultSettings.minLengthPenalty}" max="${defaultSettings.maxLengthPenalty}" step="${defaultSettings.lengthPenaltyStep}" /> |                     <input id="memory_length_penalty" type="range" value="${defaultSettings.lengthPenalty}" min="${defaultSettings.minLengthPenalty}" max="${defaultSettings.maxLengthPenalty}" step="${defaultSettings.lengthPenaltyStep}" /> | ||||||
|                 </div> |                 </div> | ||||||
|             </div> |             </div> | ||||||
|   | |||||||
| @@ -14,6 +14,7 @@ export { | |||||||
|     playMessageSound, |     playMessageSound, | ||||||
|     sortCharactersList, |     sortCharactersList, | ||||||
|     power_user, |     power_user, | ||||||
|  |     pygmalion_options, | ||||||
| }; | }; | ||||||
|  |  | ||||||
| const avatar_styles = { | const avatar_styles = { | ||||||
| @@ -31,9 +32,15 @@ const sheld_width = { | |||||||
|     w1000px: 1, |     w1000px: 1, | ||||||
| } | } | ||||||
|  |  | ||||||
|  | const pygmalion_options = { | ||||||
|  |     DISABLED: -1, | ||||||
|  |     AUTO: 0, | ||||||
|  |     ENABLED: 1, | ||||||
|  | } | ||||||
|  |  | ||||||
| let power_user = { | let power_user = { | ||||||
|     collapse_newlines: false, |     collapse_newlines: false, | ||||||
|     force_pygmalion_formatting: false, |     pygmalion_formatting: pygmalion_options.AUTO, | ||||||
|     pin_examples: false, |     pin_examples: false, | ||||||
|     disable_description_formatting: false, |     disable_description_formatting: false, | ||||||
|     disable_scenario_formatting: false, |     disable_scenario_formatting: false, | ||||||
| @@ -270,7 +277,7 @@ function loadPowerUserSettings(settings, data) { | |||||||
|     power_user.font_scale = Number(localStorage.getItem(storage_keys.font_scale) ?? 1); |     power_user.font_scale = Number(localStorage.getItem(storage_keys.font_scale) ?? 1); | ||||||
|     power_user.blur_strength = Number(localStorage.getItem(storage_keys.blur_strength) ?? 10); |     power_user.blur_strength = Number(localStorage.getItem(storage_keys.blur_strength) ?? 10); | ||||||
|  |  | ||||||
|     $("#force-pygmalion-formatting-checkbox").prop("checked", power_user.force_pygmalion_formatting); |     $(`#pygmalion_formatting option[value=${power_user.pygmalion_formatting}]`).prop("checked", true); | ||||||
|     $("#collapse-newlines-checkbox").prop("checked", power_user.collapse_newlines); |     $("#collapse-newlines-checkbox").prop("checked", power_user.collapse_newlines); | ||||||
|     $("#pin-examples-checkbox").prop("checked", power_user.pin_examples); |     $("#pin-examples-checkbox").prop("checked", power_user.pin_examples); | ||||||
|     $("#disable-description-formatting-checkbox").prop("checked", power_user.disable_description_formatting); |     $("#disable-description-formatting-checkbox").prop("checked", power_user.disable_description_formatting); | ||||||
| @@ -333,8 +340,8 @@ $(document).ready(() => { | |||||||
|         saveSettingsDebounced(); |         saveSettingsDebounced(); | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     $("#force-pygmalion-formatting-checkbox").change(function () { |     $("#pygmalion_formatting").change(function (e) { | ||||||
|         power_user.force_pygmalion_formatting = !!$(this).prop("checked"); |         power_user.pygmalion_formatting = Number($(this).find(":selected").val()); | ||||||
|         saveSettingsDebounced(); |         saveSettingsDebounced(); | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1156,6 +1156,7 @@ input[type=search]:focus::-webkit-search-cancel-button { | |||||||
|     color: var(--white30a); |     color: var(--white30a); | ||||||
|     display: flex; |     display: flex; | ||||||
|     font-size: calc(var(--mainFontSize) - 0.2rem); |     font-size: calc(var(--mainFontSize) - 0.2rem); | ||||||
|  |     font-weight: bold; | ||||||
| } | } | ||||||
|  |  | ||||||
| /* Focus */ | /* Focus */ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user