From 319c647e13debb0012d5eb4b0bc2add79d4c6468 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Wed, 25 Mar 2026 00:12:52 +0200 Subject: [PATCH] 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> --- src/vectors/vllm-vectors.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/vectors/vllm-vectors.js b/src/vectors/vllm-vectors.js index 436bc57c4..fbf03e980 100644 --- a/src/vectors/vllm-vectors.js +++ b/src/vectors/vllm-vectors.js @@ -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} - 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);