aphrodite: send an empty sampler priority list if using the default order

This commit is contained in:
AlpinDale
2024-12-09 14:05:33 +00:00
parent 66f02f59c0
commit bcbfcb87b5
2 changed files with 23 additions and 2 deletions

View File

@ -16,7 +16,7 @@ import { power_user, registerDebugFunction } from './power-user.js';
import { getEventSourceStream } from './sse-stream.js'; import { getEventSourceStream } from './sse-stream.js';
import { getCurrentDreamGenModelTokenizer, getCurrentOpenRouterModelTokenizer } from './textgen-models.js'; import { getCurrentDreamGenModelTokenizer, getCurrentOpenRouterModelTokenizer } from './textgen-models.js';
import { ENCODE_TOKENIZERS, TEXTGEN_TOKENIZERS, getTextTokens, tokenizers } from './tokenizers.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 = { export const textgen_types = {
OOBA: 'ooba', OOBA: 'ooba',
@ -1316,7 +1316,11 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate,
'nsigma': settings.nsigma, 'nsigma': settings.nsigma,
'custom_token_bans': toIntArray(banned_tokens), 'custom_token_bans': toIntArray(banned_tokens),
'no_repeat_ngram_size': settings.no_repeat_ngram_size, '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) { if (settings.type === OPENROUTER) {

View File

@ -2173,3 +2173,20 @@ export function getCharIndex(char) {
if (index === -1) throw new Error(`Character not found: ${char.avatar}`); if (index === -1) throw new Error(`Character not found: ${char.avatar}`);
return index; 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;
}