Merge pull request #3165 from AlpinDale/default_order aphrodite: send an empty list if using the default sampler priority
Signed| @@ -16,7 +16,7 @@ import { power_user, registerDebugFunction } from './power-user.js'; | |||
| 16 | import { getEventSourceStream } from './sse-stream.js'; | 16 | import { getEventSourceStream } from './sse-stream.js'; |
| 17 | import { getCurrentDreamGenModelTokenizer, getCurrentOpenRouterModelTokenizer } from './textgen-models.js'; | 17 | import { getCurrentDreamGenModelTokenizer, getCurrentOpenRouterModelTokenizer } from './textgen-models.js'; |
| 18 | import { ENCODE_TOKENIZERS, TEXTGEN_TOKENIZERS, getTextTokens, tokenizers } from './tokenizers.js'; | 18 | import { ENCODE_TOKENIZERS, TEXTGEN_TOKENIZERS, getTextTokens, tokenizers } from './tokenizers.js'; |
| 19 | import { getSortableDelay, onlyUnique } from './utils.js'; | 19 | import { getSortableDelay, onlyUnique, arraysEqual } from './utils.js'; |
| 20 | 20 | ||
| 21 | export const textgen_types = { | 21 | export const textgen_types = { |
| 22 | OOBA: 'ooba', | 22 | OOBA: 'ooba', |
| @@ -1316,7 +1316,11 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate, | |||
| 1316 | 'nsigma': settings.nsigma, | 1316 | 'nsigma': settings.nsigma, |
| 1317 | 'custom_token_bans': toIntArray(banned_tokens), | 1317 | 'custom_token_bans': toIntArray(banned_tokens), |
| 1318 | 'no_repeat_ngram_size': settings.no_repeat_ngram_size, | 1318 | 'no_repeat_ngram_size': settings.no_repeat_ngram_size, |
| 1319 | 'sampler_priority': settings.type === APHRODITE ? settings.samplers_priorities : undefined, | 1319 | 'sampler_priority': settings.type === APHRODITE && !arraysEqual( |
| 1320 | settings.samplers_priorities, | ||
| 1321 | APHRODITE_DEFAULT_ORDER) | ||
| 1322 | ? settings.samplers_priorities | ||
| 1323 | : undefined, | ||
| 1320 | }; | 1324 | }; |
| 1321 | 1325 | ||
| 1322 | if (settings.type === OPENROUTER) { | 1326 | if (settings.type === OPENROUTER) { |
| @@ -2173,3 +2173,20 @@ export function getCharIndex(char) { | |||
| 2173 | if (index === -1) throw new Error(`Character not found: ${char.avatar}`); | 2173 | if (index === -1) throw new Error(`Character not found: ${char.avatar}`); |
| 2174 | return index; | 2174 | return index; |
| 2175 | } | 2175 | } |
| 2176 | |||
| 2177 | /** | ||
| 2178 | * Compares two arrays for equality | ||
| 2179 | * @param {any[]} a - The first array | ||
| 2180 | * @param {any[]} b - The second array | ||
| 2181 | * @returns {boolean} True if the arrays are equal, false otherwise | ||
| 2182 | */ | ||
| 2183 | export function arraysEqual(a, b) { | ||
| 2184 | if (a === b) return true; | ||
| 2185 | if (a == null || b == null) return false; | ||
| 2186 | if (a.length !== b.length) return false; | ||
| 2187 | |||
| 2188 | for (let i = 0; i < a.length; i++) { | ||
| 2189 | if (a[i] !== b[i]) return false; | ||
| 2190 | } | ||
| 2191 | return true; | ||
| 2192 | } | ||