mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-23 02:45:38 -06:00
0303af17f3
* test: remove low-value implementation assertions * test: refresh native i18n inventory
23 lines
705 B
TypeScript
23 lines
705 B
TypeScript
// Huggingface provider module implements model/runtime integration.
|
|
import type { ModelProviderConfig } from "openclaw/plugin-sdk/provider-model-types";
|
|
import {
|
|
discoverHuggingfaceModels,
|
|
HUGGINGFACE_BASE_URL,
|
|
HUGGINGFACE_MODEL_CATALOG,
|
|
} from "./models.js";
|
|
|
|
export async function buildHuggingfaceProvider(
|
|
discoveryApiKey?: string,
|
|
): Promise<ModelProviderConfig> {
|
|
const resolvedSecret = discoveryApiKey?.trim() ?? "";
|
|
const models =
|
|
resolvedSecret !== ""
|
|
? await discoverHuggingfaceModels(resolvedSecret)
|
|
: HUGGINGFACE_MODEL_CATALOG.map((model) => Object.assign({}, model));
|
|
return {
|
|
baseUrl: HUGGINGFACE_BASE_URL,
|
|
api: "openai-completions",
|
|
models,
|
|
};
|
|
}
|