feat(FN-3195): document llama.cpp provider setup and onboarding

Docs(FN-3195): adds llama.cpp provider setup and onboarding documentation to the main and dashboard READMEs.

Fusion-Task-Id: FN-3195
This commit is contained in:
Fusion
2026-05-04 10:12:43 -07:00
committed by gsxdsm
parent e9f2a4cfb5
commit b7ac46ecef
37 changed files with 1440 additions and 38 deletions

View File

@@ -0,0 +1,65 @@
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import {
resetLlamaResolverCache,
resolveLlamaServerApiKey,
resolveLlamaServerUrl,
} from "../resolver.js";
const readFileMock = vi.fn();
vi.mock("node:fs/promises", () => ({
readFile: (...args: unknown[]) => readFileMock(...args),
}));
describe("resolveLlamaServerUrl", () => {
const originalEnv = process.env;
beforeEach(() => {
vi.resetAllMocks();
resetLlamaResolverCache();
process.env = { ...originalEnv };
delete process.env.LLAMA_SERVER_URL;
});
afterEach(() => {
process.env = originalEnv;
});
it("uses project config first", async () => {
readFileMock.mockResolvedValueOnce('{"url":"http://localhost:8081/"}');
const url = await resolveLlamaServerUrl("/tmp/project");
expect(url).toBe("http://localhost:8081");
});
it("falls back to env var", async () => {
readFileMock.mockRejectedValueOnce(new Error("missing"));
process.env.LLAMA_SERVER_URL = "http://localhost:9999/";
const url = await resolveLlamaServerUrl("/tmp/project");
expect(url).toBe("http://localhost:9999");
});
it("falls back to default", async () => {
readFileMock.mockRejectedValue(new Error("missing"));
const url = await resolveLlamaServerUrl("/tmp/project");
expect(url).toBe("http://127.0.0.1:8080");
});
});
describe("resolveLlamaServerApiKey", () => {
beforeEach(() => {
vi.resetAllMocks();
});
it("returns undefined when not configured", async () => {
readFileMock.mockRejectedValueOnce(new Error("missing"));
await expect(resolveLlamaServerApiKey()).resolves.toBeUndefined();
});
it("returns provider key for llama-server", async () => {
readFileMock.mockResolvedValueOnce(
JSON.stringify({
"llama-server": { type: "api_key", key: "secret-token" },
}),
);
await expect(resolveLlamaServerApiKey()).resolves.toBe("secret-token");
});
});