Fix missing model name in tokenize requests for llama.cpp (fixes #4962) (#5344) * Fix missing model name in tokenize requests for llama.cpp (fixes #4962) The new router mode of llama.cpp allows to switch models on the fly, what is already supported by SillyTavern. The call to the `/tokenize` endpoint did not contain the model name, and failed in router mode. This patch adds the `model` parameter similar to the implementation for other backends. * fix: migrate vllm and aphrodite to new payload field --------- Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>

d306194c5171a6885ec1cb615ab266c89d054f56

allo- <allo@laxu.de>

Signed
2 files changed, +5 -7Ignore whitespace
public/scripts/tokenizers.js+1 -2
@@ -954,8 +954,7 @@ function getTextgenAPITokenizationParams(str) {
954954 text: str,
955955 api_type: textgen_settings.type,
956956 url: getTextGenServer(),
957957 vllm_modelmodel: textgen_settings.vllm_modelgetTextGenModel(),
958- aphrodite_model: textgen_settings.aphrodite_model,
959958 };
960959}
961960
src/endpoints/tokenizers.js+4 -5
@@ -1077,8 +1077,7 @@ router.post('/remote/textgenerationwebui/encode', async function (request, respo
10771077 }
10781078 const text = String(request.body.text) || '';
10791079 const baseUrl = String(request.body.url);
10801080 const vllmModelmodel = String(request.body.vllm_modelmodel) || '';
1081- const aphroditeModel = String(request.body.aphrodite_model) || '';
10821081
10831082 try {
10841083 const args = {
@@ -1102,15 +1101,15 @@ router.post('/remote/textgenerationwebui/encode', async function (request, respo
11021101 break;
11031102 case TEXTGEN_TYPES.LLAMACPP:
11041103 url += '/tokenize';
11051104 args.body = JSON.stringify({ 'model': model, 'content': text });
11061105 break;
11071106 case TEXTGEN_TYPES.VLLM:
11081107 url += '/tokenize';
11091108 args.body = JSON.stringify({ 'model': vllmModelmodel, 'prompt': text });
11101109 break;
11111110 case TEXTGEN_TYPES.APHRODITE:
11121111 url += '/v1/tokenize';
11131112 args.body = JSON.stringify({ 'model': aphroditeModelmodel, 'prompt': text });
11141113 break;
11151114 default:
11161115 url += '/v1/internal/encode';