Fix vLLM vector embeddings URL construction to preserve custom API path prefixes (#5350)

* Initial plan

* fix: use trimV1 and url-join for vLLM vector embeddings URL construction

Fixes URL path construction in vllm-vectors.js to preserve custom API
path prefixes (e.g. /compatible-mode/v1). Previously url.pathname
assignment would overwrite the entire path, stripping any prefix.

Now uses the same trimV1 + urlJoin pattern as llamacpp-vectors.js.

Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com>
Agent-Logs-Url: https://github.com/SillyTavern/SillyTavern/sessions/f708dd66-8961-4c23-8b8b-3ab868bf676a

* Revert package-lock

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com>
This commit is contained in:
Copilot
2026-03-25 00:12:52 +02:00
committed by GitHub
parent a794a3780a
commit 319c647e13
+3 -2
View File
@@ -1,6 +1,8 @@
import fetch from 'node-fetch';
import urlJoin from 'url-join';
import { setAdditionalHeadersByType } from '../additional-headers.js';
import { TEXTGEN_TYPES } from '../constants.js';
import { trimV1 } from '../util.js';
/**
* Gets the vector for the given text from VLLM
@@ -11,8 +13,7 @@ import { TEXTGEN_TYPES } from '../constants.js';
* @returns {Promise<number[][]>} - The array of vectors for the texts
*/
export async function getVllmBatchVector(texts, apiUrl, model, directories) {
const url = new URL(apiUrl);
url.pathname = '/v1/embeddings';
const url = new URL(urlJoin(trimV1(apiUrl), '/v1/embeddings'));
const headers = {};
setAdditionalHeadersByType(headers, TEXTGEN_TYPES.VLLM, apiUrl, directories);