Horde doesn't support API tokenizers

This commit is contained in:
Cohee 2023-12-10 16:21:06 +02:00
parent f54bf99006
commit 9acef0fae6
1 changed files with 3 additions and 2 deletions

View File

@ -211,7 +211,6 @@ export function getTokenizerBestMatch(forApi) {
function currentRemoteTokenizerAPI() {
switch (main_api) {
case 'kobold':
case 'koboldhorde':
return tokenizers.API_KOBOLD;
case 'textgenerationwebui':
return tokenizers.API_TEXTGENERATIONWEBUI;
@ -240,7 +239,7 @@ function callTokenizer(type, str) {
const endpointUrl = TOKENIZER_URLS[type]?.count;
if (!endpointUrl) {
console.warn('Unknown tokenizer type', type);
return callTokenizer(tokenizers.NONE, str);
return apiFailureTokenCount(str);
}
return countTokensFromServer(endpointUrl, str);
}
@ -654,11 +653,13 @@ export function getTextTokens(tokenizerType, str) {
default: {
const tokenizerEndpoints = TOKENIZER_URLS[tokenizerType];
if (!tokenizerEndpoints) {
apiFailureTokenCount(str);
console.warn('Unknown tokenizer type', tokenizerType);
return [];
}
let endpointUrl = tokenizerEndpoints.encode;
if (!endpointUrl) {
apiFailureTokenCount(str);
console.warn('This tokenizer type does not support encoding', tokenizerType);
return [];
}