mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-31 04:12:10 +03:00
llama-cpp was missing from the local-provider group in buildUrl(), so it fell through to the OpenAI baseUrl and returned an OpenAI 401. Add the case to resolve the connection's providerSpecificData.baseUrl. Co-authored-by: tjengbudi <tjengbudi@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
58a9573904
commit
a2fd56c313
@@ -205,6 +205,7 @@ export class DefaultExecutor extends BaseExecutor {
|
||||
const baseUrl = credentials?.providerSpecificData?.baseUrl || this.config.baseUrl;
|
||||
return normalizeOpenAIChatUrl(baseUrl);
|
||||
}
|
||||
case "llama-cpp":
|
||||
case "lm-studio":
|
||||
case "modal":
|
||||
case "reka":
|
||||
|
||||
20
tests/unit/llama-cpp-local-url.test.ts
Normal file
20
tests/unit/llama-cpp-local-url.test.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
import { DefaultExecutor } from "@omniroute/open-sse/executors/default.ts";
|
||||
|
||||
// Regression for issue #3136: a `llama-cpp` local provider connection must send
|
||||
// requests to the user's configured local baseUrl, not OpenAI's API. Before the
|
||||
// fix, `llama-cpp` was missing from the local-provider case group in buildUrl(),
|
||||
// so it fell through to the registry/default path and (because llama-cpp is not
|
||||
// in the registry → DefaultExecutor falls back to PROVIDERS.openai) resolved to
|
||||
// https://api.openai.com/v1/... — producing OpenAI-worded 401 "no api key" errors.
|
||||
test("llama-cpp buildUrl routes to the configured local baseUrl, not OpenAI", () => {
|
||||
const executor = new DefaultExecutor("llama-cpp");
|
||||
const url = executor.buildUrl("some-model", true, 0, {
|
||||
providerSpecificData: { baseUrl: "http://127.0.0.1:8080/v1" },
|
||||
});
|
||||
|
||||
assert.equal(url, "http://127.0.0.1:8080/v1/chat/completions");
|
||||
assert.ok(!url.includes("api.openai.com"), `expected local URL, got ${url}`);
|
||||
});
|
||||
Reference in New Issue
Block a user