fix the JS issue where both ooba and aphro were using the same container ID

add108b8216820a38a49e89a04c055c17d77d088

AlpinDale <alpindale@gmail.com>

2 files changed, +29 -7Ignore whitespace
public/index.html+1 -1
@@ -1783,7 +1783,7 @@
17831783 <div class="toggle-description widthUnset" data-i18n="Aphrodite only. Determines the order of samplers. Skew is always applied post-softmax, so it's not included here.">
17841784 Aphrodite only. Determines the order of samplers.
17851785 </div>
17861786 <div id="sampler_priority_containersampler_priority_container_aphrodite" class="prompt_order">
17871787 <div data-name="dry" draggable="true"><span>DRY</span><small></small></div>
17881788 <div data-name="penalties" draggable="true"><span>Penalties</span><small></small></div>
17891789 <div data-name="no_repeat_ngram" draggable="true"><span>No Repeat Ngram</span><small></small></div>
public/scripts/textgen-settings.js+28 -6
@@ -571,6 +571,15 @@ function sortOobaItemsByOrder(orderArray) {
571571 });
572572}
573573
574+function sortAphroditeItemsByOrder(orderArray) {
575+ const $container = $('#sampler_priority_container_aphrodite');
576+
577+ orderArray.forEach((name) => {
578+ const $item = $container.find(`[data-name="${name}"]`).detach();
579+ $container.append($item);
580+ });
581+}
582+
574583jQuery(function () {
575584 $('#koboldcpp_order').sortable({
576585 delay: getSortableDelay(),
@@ -624,6 +633,19 @@ jQuery(function () {
624633 },
625634 });
626635
636+ $('#sampler_priority_container_aphrodite').sortable({
637+ delay: getSortableDelay(),
638+ stop: function () {
639+ const order = [];
640+ $('#sampler_priority_container_aphrodite').children().each(function () {
641+ order.push($(this).data('name'));
642+ });
643+ settings.samplers_priorities = order;
644+ console.log('Samplers reordered:', settings.samplers_priorities);
645+ saveSettingsDebounced();
646+ },
647+ });
648+
627649 $('#tabby_json_schema').on('input', function () {
628650 const json_schema_string = String($(this).val());
629651
@@ -643,9 +665,9 @@ jQuery(function () {
643665 });
644666
645667 $('#aphrodite_default_order').on('click', function () {
646668 sortOobaItemsByOrdersortAphroditeItemsByOrder(APHRODITE_DEFAULT_ORDER);
647669 settings.samplers_priortiessamplers_priorities = APHRODITE_DEFAULT_ORDER;
648670 console.log('Default samplers order loaded:', settings.samplers_priortiessamplers_priorities);
649671 saveSettingsDebounced();
650672 });
651673
@@ -860,8 +882,8 @@ function setSettingByName(setting, value, trigger) {
860882 if ('samplers_priority' === setting) {
861883 value = Array.isArray(value) ? value : APHRODITE_DEFAULT_ORDER;
862884 insertMissingArrayItems(APHRODITE_DEFAULT_ORDER, value);
863885 sortOobaItemsByOrdersortAphroditeItemsByOrder(value);
864886 settings.samplers_priortiessamplers_priorities = value;
865887 return;
866888 }
867889
@@ -1289,7 +1311,7 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate,
12891311 'nsigma': settings.nsigma,
12901312 'custom_token_bans': toIntArray(banned_tokens),
12911313 'no_repeat_ngram_size': settings.no_repeat_ngram_size,
12921314 'sampler_priority': settings.samplers_priortiestype === APHRODITE ? settings.samplers_priorities : undefined,
12931315 };
12941316
12951317 if (settings.type === OPENROUTER) {