mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add "Best match" tokenizer option
This commit is contained in:
@ -546,6 +546,25 @@ async function getClientVersion() {
|
||||
}
|
||||
}
|
||||
|
||||
function getTokenizerBestMatch() {
|
||||
if (main_api === 'novel') {
|
||||
if (nai_settings.model_novel.includes('krake') || nai_settings.model_novel.includes('euterpe')) {
|
||||
return tokenizers.CLASSIC;
|
||||
}
|
||||
if (nai_settings.model_novel.includes('clio')) {
|
||||
return tokenizers.NERD;
|
||||
}
|
||||
if (nai_settings.model_novel.includes('kayra')) {
|
||||
return tokenizers.NERD2;
|
||||
}
|
||||
}
|
||||
if (main_api === 'kobold' || main_api === 'textgenerationwebui' || main_api === 'koboldhorde') {
|
||||
return tokenizers.LLAMA;
|
||||
}
|
||||
|
||||
return power_user.NONE;
|
||||
}
|
||||
|
||||
function getTokenCount(str, padding = undefined) {
|
||||
if (typeof str !== 'string') {
|
||||
return 0;
|
||||
@ -563,6 +582,10 @@ function getTokenCount(str, padding = undefined) {
|
||||
}
|
||||
}
|
||||
|
||||
if (tokenizerType === tokenizers.BEST_MATCH) {
|
||||
tokenizerType = getTokenizerBestMatch();
|
||||
}
|
||||
|
||||
if (padding === undefined) {
|
||||
padding = 0;
|
||||
}
|
||||
@ -7729,7 +7752,7 @@ $(document).ready(function () {
|
||||
const enabled = $("#use-mancer-api-checkbox").prop("checked");
|
||||
$("#mancer-api-ui").toggle(enabled);
|
||||
api_use_mancer_webui = enabled;
|
||||
saveSettingsDebounced();
|
||||
saveSettingsDebounced();
|
||||
getStatus();
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user