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 @@
1783 <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.">1783 <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.">
1784 Aphrodite only. Determines the order of samplers.1784 Aphrodite only. Determines the order of samplers.
1785 </div>1785 </div>
1786 <div id="sampler_priority_container" class="prompt_order">1786 <div id="sampler_priority_container_aphrodite" class="prompt_order">
1787 <div data-name="dry" draggable="true"><span>DRY</span><small></small></div>1787 <div data-name="dry" draggable="true"><span>DRY</span><small></small></div>
1788 <div data-name="penalties" draggable="true"><span>Penalties</span><small></small></div>1788 <div data-name="penalties" draggable="true"><span>Penalties</span><small></small></div>
1789 <div data-name="no_repeat_ngram" draggable="true"><span>No Repeat Ngram</span><small></small></div>1789 <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) {
571 });571 });
572}572}
573573
574function 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
574jQuery(function () {583jQuery(function () {
575 $('#koboldcpp_order').sortable({584 $('#koboldcpp_order').sortable({
576 delay: getSortableDelay(),585 delay: getSortableDelay(),
@@ -624,6 +633,19 @@ jQuery(function () {
624 },633 },
625 });634 });
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
627 $('#tabby_json_schema').on('input', function () {649 $('#tabby_json_schema').on('input', function () {
628 const json_schema_string = String($(this).val());650 const json_schema_string = String($(this).val());
629651
@@ -643,9 +665,9 @@ jQuery(function () {
643 });665 });
644666
645 $('#aphrodite_default_order').on('click', function () {667 $('#aphrodite_default_order').on('click', function () {
646 sortOobaItemsByOrder(APHRODITE_DEFAULT_ORDER);668 sortAphroditeItemsByOrder(APHRODITE_DEFAULT_ORDER);
647 settings.samplers_priorties = APHRODITE_DEFAULT_ORDER;669 settings.samplers_priorities = APHRODITE_DEFAULT_ORDER;
648 console.log('Default samplers order loaded:', settings.samplers_priorties);670 console.log('Default samplers order loaded:', settings.samplers_priorities);
649 saveSettingsDebounced();671 saveSettingsDebounced();
650 });672 });
651673
@@ -860,8 +882,8 @@ function setSettingByName(setting, value, trigger) {
860 if ('samplers_priority' === setting) {882 if ('samplers_priority' === setting) {
861 value = Array.isArray(value) ? value : APHRODITE_DEFAULT_ORDER;883 value = Array.isArray(value) ? value : APHRODITE_DEFAULT_ORDER;
862 insertMissingArrayItems(APHRODITE_DEFAULT_ORDER, value);884 insertMissingArrayItems(APHRODITE_DEFAULT_ORDER, value);
863 sortOobaItemsByOrder(value);885 sortAphroditeItemsByOrder(value);
864 settings.samplers_priorties = value;886 settings.samplers_priorities = value;
865 return;887 return;
866 }888 }
867889
@@ -1289,7 +1311,7 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate,
1289 'nsigma': settings.nsigma,1311 'nsigma': settings.nsigma,
1290 'custom_token_bans': toIntArray(banned_tokens),1312 'custom_token_bans': toIntArray(banned_tokens),
1291 'no_repeat_ngram_size': settings.no_repeat_ngram_size,1313 'no_repeat_ngram_size': settings.no_repeat_ngram_size,
1292 'sampler_priority': settings.samplers_priorties,1314 'sampler_priority': settings.type === APHRODITE ? settings.samplers_priorities : undefined,
1293 };1315 };
12941316
1295 if (settings.type === OPENROUTER) {1317 if (settings.type === OPENROUTER) {