diff --git a/public/scripts/textgen-settings.js b/public/scripts/textgen-settings.js index 1a2306a72..d93b787f8 100644 --- a/public/scripts/textgen-settings.js +++ b/public/scripts/textgen-settings.js @@ -16,7 +16,7 @@ import { power_user, registerDebugFunction } from './power-user.js'; import { getEventSourceStream } from './sse-stream.js'; import { getCurrentDreamGenModelTokenizer, getCurrentOpenRouterModelTokenizer } from './textgen-models.js'; import { ENCODE_TOKENIZERS, TEXTGEN_TOKENIZERS, getTextTokens, tokenizers } from './tokenizers.js'; -import { getSortableDelay, onlyUnique } from './utils.js'; +import { getSortableDelay, onlyUnique, arraysEqual } from './utils.js'; export const textgen_types = { OOBA: 'ooba', @@ -1316,7 +1316,11 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate, 'nsigma': settings.nsigma, 'custom_token_bans': toIntArray(banned_tokens), 'no_repeat_ngram_size': settings.no_repeat_ngram_size, - 'sampler_priority': settings.type === APHRODITE ? settings.samplers_priorities : undefined, + 'sampler_priority': settings.type === APHRODITE && !arraysEqual( + settings.samplers_priorities, + APHRODITE_DEFAULT_ORDER) + ? settings.samplers_priorities + : undefined, }; if (settings.type === OPENROUTER) { diff --git a/public/scripts/utils.js b/public/scripts/utils.js index a198cb7db..f49333c48 100644 --- a/public/scripts/utils.js +++ b/public/scripts/utils.js @@ -2173,3 +2173,20 @@ export function getCharIndex(char) { if (index === -1) throw new Error(`Character not found: ${char.avatar}`); return index; } + +/** + * Compares two arrays for equality + * @param {any[]} a - The first array + * @param {any[]} b - The second array + * @returns {boolean} True if the arrays are equal, false otherwise + */ +export function arraysEqual(a, b) { + if (a === b) return true; + if (a == null || b == null) return false; + if (a.length !== b.length) return false; + + for (let i = 0; i < a.length; i++) { + if (a[i] !== b[i]) return false; + } + return true; +}