Fix workflow continuation and provider setup gaps
This commit is contained in:
@@ -30,3 +30,45 @@ test("upsertProviderConfig creates models.json and merges provider config", () =
|
||||
assert.equal(parsed.providers.custom.authHeader, true);
|
||||
assert.deepEqual(parsed.providers.custom.models, [{ id: "llama3.1:8b" }]);
|
||||
});
|
||||
|
||||
test("upsertProviderConfig writes LiteLLM proxy config with master key", () => {
|
||||
const dir = mkdtempSync(join(tmpdir(), "feynman-litellm-"));
|
||||
const modelsPath = join(dir, "models.json");
|
||||
|
||||
const result = upsertProviderConfig(modelsPath, "litellm", {
|
||||
baseUrl: "http://localhost:4000/v1",
|
||||
apiKey: "LITELLM_MASTER_KEY",
|
||||
api: "openai-completions",
|
||||
authHeader: true,
|
||||
models: [{ id: "gpt-4o" }],
|
||||
});
|
||||
assert.deepEqual(result, { ok: true });
|
||||
|
||||
const parsed = JSON.parse(readFileSync(modelsPath, "utf8")) as any;
|
||||
assert.equal(parsed.providers.litellm.baseUrl, "http://localhost:4000/v1");
|
||||
assert.equal(parsed.providers.litellm.apiKey, "LITELLM_MASTER_KEY");
|
||||
assert.equal(parsed.providers.litellm.api, "openai-completions");
|
||||
assert.equal(parsed.providers.litellm.authHeader, true);
|
||||
assert.deepEqual(parsed.providers.litellm.models, [{ id: "gpt-4o" }]);
|
||||
});
|
||||
|
||||
test("upsertProviderConfig writes LiteLLM proxy config without master key", () => {
|
||||
const dir = mkdtempSync(join(tmpdir(), "feynman-litellm-"));
|
||||
const modelsPath = join(dir, "models.json");
|
||||
|
||||
const result = upsertProviderConfig(modelsPath, "litellm", {
|
||||
baseUrl: "http://localhost:4000/v1",
|
||||
apiKey: "local",
|
||||
api: "openai-completions",
|
||||
authHeader: false,
|
||||
models: [{ id: "llama3" }],
|
||||
});
|
||||
assert.deepEqual(result, { ok: true });
|
||||
|
||||
const parsed = JSON.parse(readFileSync(modelsPath, "utf8")) as any;
|
||||
assert.equal(parsed.providers.litellm.baseUrl, "http://localhost:4000/v1");
|
||||
assert.equal(parsed.providers.litellm.apiKey, "local");
|
||||
assert.equal(parsed.providers.litellm.api, "openai-completions");
|
||||
assert.equal(parsed.providers.litellm.authHeader, false);
|
||||
assert.deepEqual(parsed.providers.litellm.models, [{ id: "llama3" }]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user