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>

319c647e13debb0012d5eb4b0bc2add79d4c6468

Copilot <198982749+Copilot@users.noreply.github.com>

Signed
1 files changed, +3 -2Ignore whitespace
src/vectors/vllm-vectors.js+3 -2
@@ -1,6 +1,8 @@
1import fetch from 'node-fetch';1import fetch from 'node-fetch';
2import urlJoin from 'url-join';
2import { setAdditionalHeadersByType } from '../additional-headers.js';3import { setAdditionalHeadersByType } from '../additional-headers.js';
3import { TEXTGEN_TYPES } from '../constants.js';4import { TEXTGEN_TYPES } from '../constants.js';
5import { trimV1 } from '../util.js';
46
5/**7/**
6 * Gets the vector for the given text from VLLM8 * Gets the vector for the given text from VLLM
@@ -11,8 +13,7 @@ import { TEXTGEN_TYPES } from '../constants.js';
11 * @returns {Promise<number[][]>} - The array of vectors for the texts13 * @returns {Promise<number[][]>} - The array of vectors for the texts
12 */14 */
13export async function getVllmBatchVector(texts, apiUrl, model, directories) {15export async function getVllmBatchVector(texts, apiUrl, model, directories) {
14 const url = new URL(apiUrl);16 const url = new URL(urlJoin(trimV1(apiUrl), '/v1/embeddings'));
15 url.pathname = '/v1/embeddings';
1617
17 const headers = {};18 const headers = {};
18 setAdditionalHeadersByType(headers, TEXTGEN_TYPES.VLLM, apiUrl, directories);19 setAdditionalHeadersByType(headers, TEXTGEN_TYPES.VLLM, apiUrl, directories);