fix: treat local models as deployment key for run gate
PI_DEFAULT_PROVIDER=local with RAKAZO_LOCAL_MODELS had no deployment key, so clearing OpenRouter credentials left needsModel true and blocked sends.
This commit is contained in:
parent
6c7eed7580
commit
4f5d926808
@ -20,4 +20,23 @@ describe("resolveDeploymentModel", () => {
|
|||||||
resolveDeploymentModel({ OPENROUTER_API_KEY: "or-key", PI_DEFAULT_PROVIDER: "anthropic" }),
|
resolveDeploymentModel({ OPENROUTER_API_KEY: "or-key", PI_DEFAULT_PROVIDER: "anthropic" }),
|
||||||
).toEqual({ provider: "anthropic", model: "claude-sonnet-5", key: undefined });
|
).toEqual({ provider: "anthropic", model: "claude-sonnet-5", key: undefined });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("treats configured local models as a keyless deployment", () => {
|
||||||
|
expect(
|
||||||
|
resolveDeploymentModel({
|
||||||
|
PI_DEFAULT_PROVIDER: "local",
|
||||||
|
PI_DEFAULT_MODEL: "qwen3-coder-30b-a3b",
|
||||||
|
RAKAZO_LOCAL_MODELS: "qwen3-coder-30b-a3b",
|
||||||
|
}),
|
||||||
|
).toEqual({
|
||||||
|
provider: "local",
|
||||||
|
model: "qwen3-coder-30b-a3b",
|
||||||
|
key: "local",
|
||||||
|
});
|
||||||
|
expect(resolveDeploymentModel({ PI_DEFAULT_PROVIDER: "local" })).toEqual({
|
||||||
|
provider: "local",
|
||||||
|
model: "qwen3-coder-30b-a3b",
|
||||||
|
key: undefined,
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -11,13 +11,17 @@ export function resolveDeploymentModel(env: NodeJS.ProcessEnv = process.env) {
|
|||||||
// A row per provider that ships a deployment key. A third one adds a row here, not a
|
// A row per provider that ships a deployment key. A third one adds a row here, not a
|
||||||
// branch at each call site — and an unknown provider gets no key rather than another
|
// branch at each call site — and an unknown provider gets no key rather than another
|
||||||
// vendor's, which a ternary on one provider would not give.
|
// vendor's, which a ternary on one provider would not give.
|
||||||
|
// Local OpenAI-compatible servers are keyless; a placeholder still counts as a
|
||||||
|
// deployment key so the model gate and executor fallback treat them as configured.
|
||||||
const keys: Record<string, string | undefined> = {
|
const keys: Record<string, string | undefined> = {
|
||||||
openrouter: env.OPENROUTER_API_KEY,
|
openrouter: env.OPENROUTER_API_KEY,
|
||||||
anthropic: env.ANTHROPIC_API_KEY,
|
anthropic: env.ANTHROPIC_API_KEY,
|
||||||
|
local: env.RAKAZO_LOCAL_MODELS?.trim() ? "local" : undefined,
|
||||||
};
|
};
|
||||||
const models: Record<string, string> = {
|
const models: Record<string, string> = {
|
||||||
openrouter: DEFAULT_OPENROUTER_MODEL_ID,
|
openrouter: DEFAULT_OPENROUTER_MODEL_ID,
|
||||||
anthropic: "claude-sonnet-5",
|
anthropic: "claude-sonnet-5",
|
||||||
|
local: "qwen3-coder-30b-a3b",
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
provider,
|
provider,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user