mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 17:20:42 +00:00
* Feat: LM Studio Integration * Format * Support usage in streaming true Fix token count * Add custom window check * Drop max tokens fallback * tweak docs Update generated * Avoid error if stale header does not resolve * Fix test * Fix test * Fix rebase issues Trim code * Fix tests Drop keyless Fixes * Fix linter issues in tests * Update generated artifacts * Do not have fatal header resoltuion for discovery * Do the same for API key as well * fix: honor lmstudio preload runtime auth * fix: clear stale lmstudio header auth * fix: lazy-load lmstudio runtime facade * fix: preserve lmstudio shared synthetic auth * fix: clear stale lmstudio header auth in discovery * fix: prefer lmstudio header auth for discovery * fix: honor lmstudio header auth in warmup paths * fix: clear stale lmstudio profile auth * fix: ignore lmstudio env auth on header migration * fix: use local lmstudio setup seam * fix: resolve lmstudio rebase fallout --------- Co-authored-by: Frank Yang <frank.ekn@gmail.com>
45 lines
1.7 KiB
TypeScript
45 lines
1.7 KiB
TypeScript
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
|
|
const loadBundledPluginPublicSurfaceModuleSync = vi.hoisted(() => vi.fn());
|
|
|
|
vi.mock("./facade-runtime.js", async () => {
|
|
const actual = await vi.importActual<typeof import("./facade-runtime.js")>("./facade-runtime.js");
|
|
return {
|
|
...actual,
|
|
loadBundledPluginPublicSurfaceModuleSync,
|
|
};
|
|
});
|
|
|
|
describe("plugin-sdk lmstudio-runtime", () => {
|
|
beforeEach(() => {
|
|
loadBundledPluginPublicSurfaceModuleSync.mockReset();
|
|
});
|
|
|
|
it("keeps the lmstudio runtime facade cold until a helper is used", async () => {
|
|
const module = await import("./lmstudio-runtime.js");
|
|
|
|
expect(loadBundledPluginPublicSurfaceModuleSync).not.toHaveBeenCalled();
|
|
expect(module.LMSTUDIO_PROVIDER_ID).toBe("lmstudio");
|
|
expect(module.LMSTUDIO_DEFAULT_EMBEDDING_MODEL).toBe("text-embedding-nomic-embed-text-v1.5");
|
|
expect(loadBundledPluginPublicSurfaceModuleSync).not.toHaveBeenCalled();
|
|
});
|
|
|
|
it("delegates lmstudio helpers through the bundled runtime facade", async () => {
|
|
const resolveLmstudioInferenceBase = vi.fn().mockReturnValue("http://localhost:1234/v1");
|
|
loadBundledPluginPublicSurfaceModuleSync.mockReturnValue({
|
|
resolveLmstudioInferenceBase,
|
|
});
|
|
|
|
const module = await import("./lmstudio-runtime.js");
|
|
|
|
expect(module.resolveLmstudioInferenceBase("http://localhost:1234/api/v1/")).toBe(
|
|
"http://localhost:1234/v1",
|
|
);
|
|
expect(loadBundledPluginPublicSurfaceModuleSync).toHaveBeenCalledWith({
|
|
dirName: "lmstudio",
|
|
artifactBasename: "runtime-api.js",
|
|
});
|
|
expect(resolveLmstudioInferenceBase).toHaveBeenCalledWith("http://localhost:1234/api/v1/");
|
|
});
|
|
});
|