refactor: add provider onboarding preset appliers

This commit is contained in:
Peter Steinberger
2026-03-23 01:39:10 +00:00
parent 956fe72b39
commit 7d032ed38c
16 changed files with 368 additions and 178 deletions

View File

@@ -1,29 +1,27 @@
import { KILOCODE_BASE_URL, KILOCODE_DEFAULT_MODEL_REF } from "openclaw/plugin-sdk/provider-models";
import {
applyProviderConfigWithModelCatalogPreset,
createModelCatalogPresetAppliers,
type OpenClawConfig,
} from "openclaw/plugin-sdk/provider-onboard";
import { buildKilocodeProvider } from "./provider-catalog.js";
export { KILOCODE_BASE_URL, KILOCODE_DEFAULT_MODEL_REF };
export function applyKilocodeProviderConfig(cfg: OpenClawConfig): OpenClawConfig {
return applyProviderConfigWithModelCatalogPreset(cfg, {
const kilocodePresetAppliers = createModelCatalogPresetAppliers({
primaryModelRef: KILOCODE_DEFAULT_MODEL_REF,
resolveParams: (_cfg: OpenClawConfig) => ({
providerId: "kilocode",
api: "openai-completions",
baseUrl: KILOCODE_BASE_URL,
catalogModels: buildKilocodeProvider().models ?? [],
aliases: [{ modelRef: KILOCODE_DEFAULT_MODEL_REF, alias: "Kilo Gateway" }],
});
}),
});
export function applyKilocodeProviderConfig(cfg: OpenClawConfig): OpenClawConfig {
return kilocodePresetAppliers.applyProviderConfig(cfg);
}
export function applyKilocodeConfig(cfg: OpenClawConfig): OpenClawConfig {
return applyProviderConfigWithModelCatalogPreset(cfg, {
providerId: "kilocode",
api: "openai-completions",
baseUrl: KILOCODE_BASE_URL,
catalogModels: buildKilocodeProvider().models ?? [],
aliases: [{ modelRef: KILOCODE_DEFAULT_MODEL_REF, alias: "Kilo Gateway" }],
primaryModelRef: KILOCODE_DEFAULT_MODEL_REF,
});
return kilocodePresetAppliers.applyConfig(cfg);
}