diff --git a/core/indexing/embeddings/OllamaEmbeddingsProvider.ts b/core/indexing/embeddings/OllamaEmbeddingsProvider.ts index d7fd6bbe0..dae388582 100644 --- a/core/indexing/embeddings/OllamaEmbeddingsProvider.ts +++ b/core/indexing/embeddings/OllamaEmbeddingsProvider.ts @@ -10,7 +10,13 @@ async function embedOne( customFetch: FetchFunction, ) { const embedding = await withExponentialBackoff(async () => { - const resp = await customFetch(new URL("api/embeddings", options.apiBase), { + let apiBase = options.apiBase!; + + if (!apiBase.endsWith("/")) { + apiBase += "/"; + } + + const resp = await customFetch(new URL("api/embeddings", apiBase), { method: "POST", body: JSON.stringify({ model: options.model,