diff --git a/public/scripts/textgen-settings.js b/public/scripts/textgen-settings.js index 0fc6ea370..0f731cec9 100644 --- a/public/scripts/textgen-settings.js +++ b/public/scripts/textgen-settings.js @@ -24,7 +24,7 @@ import { getActiveManualApiSamplers, loadApiSelectedSamplers, isSamplerManualPri import { SECRET_KEYS, writeSecret } from './secrets.js'; import { getEventSourceStream } from './sse-stream.js'; import { getCurrentDreamGenModelTokenizer, getCurrentOpenRouterModelTokenizer, loadAphroditeModels, loadDreamGenModels, loadFeatherlessModels, loadGenericModels, loadInfermaticAIModels, loadLlamaCppModels, loadMancerModels, loadOllamaModels, loadOpenRouterModels, loadTabbyModels, loadTogetherAIModels, loadVllmModels } from './textgen-models.js'; -import { ENCODE_TOKENIZERS, TEXTGEN_TOKENIZERS, TOKENIZER_SUPPORTED_KEY, getTextTokens, tokenizers } from './tokenizers.js'; +import { ENCODE_TOKENIZERS, TEXTGEN_TOKENIZERS, TOKENIZER_SUPPORTED_KEY, getTextTokens, getTokenizerBestMatch, tokenizers } from './tokenizers.js'; import { AbortReason } from './util/AbortReason.js'; import { getSortableDelay, onlyUnique, arraysEqual, isObject } from './utils.js'; @@ -403,6 +403,11 @@ function convertPresets(presets) { } function getTokenizerForTokenIds() { + const bestMatchTokenizer = getTokenizerBestMatch('textgenerationwebui'); + if (bestMatchTokenizer === tokenizers.API_TEXTGENERATIONWEBUI) { + return tokenizers.API_CURRENT; + } + if (power_user.tokenizer === tokenizers.API_CURRENT && TEXTGEN_TOKENIZERS.includes(textgenerationwebui_settings.type)) { return tokenizers.API_CURRENT; } @@ -658,6 +663,9 @@ async function getStatusTextgen() { return resultCheckStatus(); } + // Clear logit bias cache + BIAS_CACHE.delete(BIAS_KEY); + if ([textgen_types.GENERIC, textgen_types.OOBA].includes(textgenerationwebui_settings.type) && textgenerationwebui_settings.bypass_status_check) { setOnlineStatus(t`Status check bypassed`); return resultCheckStatus();