API Tokenizer: Add support for TabbyAPI

Use Tabby's /v1/token endpoints.

Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
kingbri
2023-11-17 01:48:03 -05:00
parent f31b996cb5
commit 4cfa267b1b
2 changed files with 3 additions and 2 deletions

View File

@@ -3424,7 +3424,7 @@ app.post("/tokenize_via_api", jsonParser, async function (request, response) {
url += '/v1/token-count';
args.body = JSON.stringify({ "prompt": text });
} else {
url += '/v1/internal/encode';
url += request.body.use_tabby ? '/v1/token/encode' : '/v1/internal/encode';
args.body = JSON.stringify({ "text": text });
}