mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-27 21:07:01 -06:00
1348387076
Move llama.cpp chat and local embeddings onto a verified externally managed llama-server runtime. Remove the in-process native runtime, forked embedding workers, and node-llama-cpp dependency while preserving guided setup, local GGUF models, tool-capable agent runs, diagnostics, and operator docs.
53 lines
1.8 KiB
TypeScript
53 lines
1.8 KiB
TypeScript
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-contracts";
|
|
import { describe, expect, it } from "vitest";
|
|
import { legacyConfigRules, normalizeCompatibilityConfig } from "./doctor-contract-api.js";
|
|
|
|
describe("llama.cpp doctor migration", () => {
|
|
it("moves the shipped local URL to an absolute managed service", () => {
|
|
const cfg: OpenClawConfig = {
|
|
models: {
|
|
providers: {
|
|
"llama-cpp": {
|
|
baseUrl: "local://llama-cpp",
|
|
api: "openai-completions",
|
|
models: [],
|
|
},
|
|
},
|
|
},
|
|
};
|
|
|
|
const result = normalizeCompatibilityConfig({ cfg });
|
|
const provider = result.config.models?.providers?.["llama-cpp"];
|
|
expect(provider).toMatchObject({
|
|
baseUrl: "http://127.0.0.1:19432/v1",
|
|
localService: {
|
|
command: expect.stringMatching(/llama-server(?:\.exe)?$/u),
|
|
args: expect.arrayContaining(["--models-preset", "--metrics"]),
|
|
healthUrl: "http://127.0.0.1:19432/health",
|
|
},
|
|
});
|
|
expect(
|
|
provider?.localService?.command.startsWith("/") ||
|
|
/^[A-Z]:\\/iu.test(provider?.localService?.command ?? ""),
|
|
).toBe(true);
|
|
expect(result.changes).toHaveLength(1);
|
|
expect(normalizeCompatibilityConfig({ cfg: result.config }).changes).toEqual([]);
|
|
});
|
|
|
|
it("does not rewrite explicit HTTP llama.cpp servers", () => {
|
|
const cfg: OpenClawConfig = {
|
|
models: {
|
|
providers: {
|
|
"llama-cpp": {
|
|
baseUrl: "http://gpu-box.local:8080/v1",
|
|
api: "openai-completions",
|
|
models: [],
|
|
},
|
|
},
|
|
},
|
|
};
|
|
expect(normalizeCompatibilityConfig({ cfg })).toEqual({ config: cfg, changes: [] });
|
|
expect(legacyConfigRules[0]?.match?.("http://gpu-box.local:8080/v1")).toBe(false);
|
|
});
|
|
});
|