mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
refactor(providers): drop unused onboarding wrappers
This commit is contained in:
@@ -4,14 +4,13 @@ import { describe, expect, it } from "vitest";
|
||||
import { buildCohereCatalogModels, COHERE_BASE_URL, COHERE_MODEL_CATALOG } from "./models.js";
|
||||
import {
|
||||
applyCohereConfig,
|
||||
applyCohereProviderConfig,
|
||||
COHERE_DEFAULT_MODEL_ID,
|
||||
COHERE_DEFAULT_MODEL_REF,
|
||||
} from "./onboard.js";
|
||||
|
||||
describe("Cohere onboarding", () => {
|
||||
it("registers the manifest catalog through the compatibility endpoint", () => {
|
||||
const result = applyCohereProviderConfig({});
|
||||
it("registers the manifest catalog through the onboarding preset", () => {
|
||||
const result = applyCohereConfig({});
|
||||
const provider = result.models?.providers?.cohere;
|
||||
|
||||
expect(provider).toMatchObject({
|
||||
|
||||
@@ -18,10 +18,6 @@ const coherePresetAppliers = createModelCatalogPresetAppliers({
|
||||
}),
|
||||
});
|
||||
|
||||
export function applyCohereProviderConfig(cfg: OpenClawConfig): OpenClawConfig {
|
||||
return coherePresetAppliers.applyProviderConfig(cfg);
|
||||
}
|
||||
|
||||
export function applyCohereConfig(cfg: OpenClawConfig): OpenClawConfig {
|
||||
return coherePresetAppliers.applyConfig(cfg);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import {
|
||||
KILOCODE_DEFAULT_MODEL_ID,
|
||||
} from "./api.js";
|
||||
import {
|
||||
applyKilocodeProviderConfig,
|
||||
applyKilocodeConfig,
|
||||
KILOCODE_BASE_URL,
|
||||
KILOCODE_DEFAULT_MODEL_REF,
|
||||
@@ -56,16 +55,16 @@ describe("Kilo Gateway provider config", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("applyKilocodeProviderConfig", () => {
|
||||
describe("applyKilocodeConfig", () => {
|
||||
it("registers kilocode provider with correct baseUrl and api", () => {
|
||||
const result = applyKilocodeProviderConfig(emptyCfg);
|
||||
const result = applyKilocodeConfig(emptyCfg);
|
||||
const provider = requireKilocodeProvider(result);
|
||||
expect(provider.baseUrl).toBe(KILOCODE_BASE_URL);
|
||||
expect(provider.api).toBe("openai-completions");
|
||||
});
|
||||
|
||||
it("includes the default model in the provider model list", () => {
|
||||
const result = applyKilocodeProviderConfig(emptyCfg);
|
||||
const result = applyKilocodeConfig(emptyCfg);
|
||||
const provider = result.models?.providers?.kilocode;
|
||||
const models = provider?.models;
|
||||
expect(Array.isArray(models)).toBe(true);
|
||||
@@ -74,7 +73,7 @@ describe("Kilo Gateway provider config", () => {
|
||||
});
|
||||
|
||||
it("surfaces the full Kilo model catalog", () => {
|
||||
const result = applyKilocodeProviderConfig(emptyCfg);
|
||||
const result = applyKilocodeConfig(emptyCfg);
|
||||
const provider = result.models?.providers?.kilocode;
|
||||
const modelIds = provider?.models?.map((m) => m.id) ?? [];
|
||||
for (const modelId of KILOCODE_MODEL_IDS) {
|
||||
@@ -83,7 +82,7 @@ describe("Kilo Gateway provider config", () => {
|
||||
});
|
||||
|
||||
it("appends missing catalog models to existing Kilo provider config", () => {
|
||||
const result = applyKilocodeProviderConfig({
|
||||
const result = applyKilocodeConfig({
|
||||
models: {
|
||||
providers: {
|
||||
kilocode: {
|
||||
@@ -101,7 +100,7 @@ describe("Kilo Gateway provider config", () => {
|
||||
});
|
||||
|
||||
it("sets Kilo Gateway alias in agent default models", () => {
|
||||
const result = applyKilocodeProviderConfig(emptyCfg);
|
||||
const result = applyKilocodeConfig(emptyCfg);
|
||||
const agentModel = result.agents?.defaults?.models?.[KILOCODE_DEFAULT_MODEL_REF];
|
||||
expect(agentModel).toEqual({ alias: "Kilo Gateway" });
|
||||
});
|
||||
@@ -116,7 +115,7 @@ describe("Kilo Gateway provider config", () => {
|
||||
},
|
||||
},
|
||||
};
|
||||
const result = applyKilocodeProviderConfig(cfg);
|
||||
const result = applyKilocodeConfig(cfg);
|
||||
const agentModel = result.agents?.defaults?.models?.[KILOCODE_DEFAULT_MODEL_REF];
|
||||
expect(agentModel?.alias).toBe("My Custom Alias");
|
||||
});
|
||||
@@ -129,20 +128,18 @@ describe("Kilo Gateway provider config", () => {
|
||||
},
|
||||
},
|
||||
};
|
||||
const result = applyKilocodeProviderConfig(cfg);
|
||||
const result = applyKilocodeConfig(cfg);
|
||||
expect(resolveAgentModelPrimaryValue(result.agents?.defaults?.model)).toBe("openai/gpt-5");
|
||||
});
|
||||
});
|
||||
|
||||
describe("applyKilocodeConfig", () => {
|
||||
it("sets kilocode as the default model", () => {
|
||||
const result = applyKilocodeConfig(emptyCfg);
|
||||
expect(resolveAgentModelPrimaryValue(result.agents?.defaults?.model)).toBe(
|
||||
KILOCODE_DEFAULT_MODEL_REF,
|
||||
);
|
||||
const provider = requireKilocodeProvider(result);
|
||||
expect(provider.baseUrl).toBe(KILOCODE_BASE_URL);
|
||||
});
|
||||
it("sets kilocode as the default model", () => {
|
||||
const result = applyKilocodeConfig(emptyCfg);
|
||||
expect(resolveAgentModelPrimaryValue(result.agents?.defaults?.model)).toBe(
|
||||
KILOCODE_DEFAULT_MODEL_REF,
|
||||
);
|
||||
const provider = requireKilocodeProvider(result);
|
||||
expect(provider.baseUrl).toBe(KILOCODE_BASE_URL);
|
||||
});
|
||||
|
||||
describe("env var resolution", () => {
|
||||
|
||||
@@ -19,10 +19,6 @@ const kilocodePresetAppliers = createModelCatalogPresetAppliers({
|
||||
}),
|
||||
});
|
||||
|
||||
export function applyKilocodeProviderConfig(cfg: OpenClawConfig): OpenClawConfig {
|
||||
return kilocodePresetAppliers.applyProviderConfig(cfg);
|
||||
}
|
||||
|
||||
export function applyKilocodeConfig(cfg: OpenClawConfig): OpenClawConfig {
|
||||
return kilocodePresetAppliers.applyConfig(cfg);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ import { resolveAgentModelPrimaryValue } from "openclaw/plugin-sdk/provider-onbo
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
applyKimiCodeConfig,
|
||||
applyKimiCodeProviderConfig,
|
||||
KIMI_CODING_MODEL_REF,
|
||||
KIMI_MODEL_REF,
|
||||
} from "./onboard.js";
|
||||
@@ -15,7 +14,7 @@ describe("kimi coding onboard", () => {
|
||||
});
|
||||
|
||||
it("adds the Kimi coding provider defaults", () => {
|
||||
const cfg = applyKimiCodeProviderConfig({});
|
||||
const cfg = applyKimiCodeConfig({});
|
||||
const provider = cfg.models?.providers?.kimi;
|
||||
|
||||
expect(provider).toEqual({
|
||||
|
||||
@@ -34,10 +34,6 @@ const kimiCodingPresetAppliers = createDefaultModelPresetAppliers({
|
||||
},
|
||||
});
|
||||
|
||||
export function applyKimiCodeProviderConfig(cfg: OpenClawConfig): OpenClawConfig {
|
||||
return kimiCodingPresetAppliers.applyProviderConfig(cfg);
|
||||
}
|
||||
|
||||
export function applyKimiCodeConfig(cfg: OpenClawConfig): OpenClawConfig {
|
||||
return kimiCodingPresetAppliers.applyConfig(cfg);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user