diff --git a/public/scripts/textgen-settings.js b/public/scripts/textgen-settings.js index 1ab36234b..9496bd05e 100644 --- a/public/scripts/textgen-settings.js +++ b/public/scripts/textgen-settings.js @@ -14,7 +14,7 @@ import { BIAS_CACHE, createNewLogitBiasEntry, displayLogitBias, getLogitBiasList import { power_user, registerDebugFunction } from './power-user.js'; import EventSourceStream from './sse-stream.js'; -import { getCurrentOpenRouterModelTokenizer } from './textgen-models.js'; +import { getCurrentDreamGenModelTokenizer, getCurrentOpenRouterModelTokenizer } from './textgen-models.js'; import { SENTENCEPIECE_TOKENIZERS, TEXTGEN_TOKENIZERS, getTextTokens, tokenizers } from './tokenizers.js'; import { getSortableDelay, onlyUnique } from './utils.js'; @@ -319,6 +319,10 @@ function getTokenizerForTokenIds() { return getCurrentOpenRouterModelTokenizer(); } + if (settings.type === DREAMGEN) { + return getCurrentDreamGenModelTokenizer(); + } + return tokenizers.LLAMA; } diff --git a/public/scripts/tokenizers.js b/public/scripts/tokenizers.js index 9fcc8f6e9..03ae0b7f4 100644 --- a/public/scripts/tokenizers.js +++ b/public/scripts/tokenizers.js @@ -5,9 +5,9 @@ import { groups, selected_group } from './group-chats.js'; import { getStringHash } from './utils.js'; import { kai_flags } from './kai-settings.js'; import { textgen_types, textgenerationwebui_settings as textgen_settings, getTextGenServer } from './textgen-settings.js'; -import { getCurrentOpenRouterModelTokenizer, openRouterModels } from './textgen-models.js'; +import { getCurrentDreamGenModelTokenizer, getCurrentOpenRouterModelTokenizer, openRouterModels } from './textgen-models.js'; -const { OOBA, TABBY, KOBOLDCPP, APHRODITE, LLAMACPP, OPENROUTER } = textgen_types; +const { OOBA, TABBY, KOBOLDCPP, APHRODITE, LLAMACPP, OPENROUTER, DREAMGEN } = textgen_types; export const CHARACTERS_PER_TOKEN_RATIO = 3.35; const TOKENIZER_WARNING_KEY = 'tokenizationWarningShown'; @@ -206,6 +206,9 @@ export function getTokenizerBestMatch(forApi) { if (forApi === 'textgenerationwebui' && textgen_settings.type === OPENROUTER) { return getCurrentOpenRouterModelTokenizer(); } + if (forApi === 'textgenerationwebui' && textgen_settings.type === DREAMGEN) { + return getCurrentDreamGenModelTokenizer(); + } } return tokenizers.LLAMA;