31 lines
1.1 KiB
TypeScript
Raw Permalink Normal View History

import {
buildHuggingfaceModelDefinition,
HUGGINGFACE_BASE_URL,
HUGGINGFACE_MODEL_CATALOG,
} from "openclaw/plugin-sdk/provider-models";
import {
2026-03-18 23:58:49 +00:00
applyProviderConfigWithModelCatalogPreset,
type OpenClawConfig,
} from "openclaw/plugin-sdk/provider-onboard";
export const HUGGINGFACE_DEFAULT_MODEL_REF = "huggingface/deepseek-ai/DeepSeek-R1";
2026-03-18 23:58:49 +00:00
function applyHuggingfacePreset(cfg: OpenClawConfig, primaryModelRef?: string): OpenClawConfig {
return applyProviderConfigWithModelCatalogPreset(cfg, {
providerId: "huggingface",
api: "openai-completions",
baseUrl: HUGGINGFACE_BASE_URL,
catalogModels: HUGGINGFACE_MODEL_CATALOG.map(buildHuggingfaceModelDefinition),
2026-03-18 23:58:49 +00:00
aliases: [{ modelRef: HUGGINGFACE_DEFAULT_MODEL_REF, alias: "Hugging Face" }],
primaryModelRef,
});
}
2026-03-18 23:58:49 +00:00
export function applyHuggingfaceProviderConfig(cfg: OpenClawConfig): OpenClawConfig {
return applyHuggingfacePreset(cfg);
}
export function applyHuggingfaceConfig(cfg: OpenClawConfig): OpenClawConfig {
2026-03-18 23:58:49 +00:00
return applyHuggingfacePreset(cfg, HUGGINGFACE_DEFAULT_MODEL_REF);
}