mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-02 13:01:34 +00:00
* fix(providers): refresh onboarding defaults * fix(moonshot): import manifest default from catalog
42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
// Moonshot setup module handles plugin onboarding behavior.
|
|
import {
|
|
createDefaultModelPresetAppliers,
|
|
type OpenClawConfig,
|
|
} from "openclaw/plugin-sdk/provider-onboard";
|
|
import {
|
|
buildMoonshotProvider,
|
|
MOONSHOT_BASE_URL,
|
|
MOONSHOT_CN_BASE_URL,
|
|
MOONSHOT_DEFAULT_MODEL_ID,
|
|
MOONSHOT_DEFAULT_MODEL_REF,
|
|
} from "./provider-catalog.js";
|
|
|
|
const moonshotPresetAppliers = createDefaultModelPresetAppliers<[string]>({
|
|
primaryModelRef: MOONSHOT_DEFAULT_MODEL_REF,
|
|
resolveParams: (_cfg: OpenClawConfig, baseUrl: string) => {
|
|
const defaultModel = buildMoonshotProvider().models.find(
|
|
(model) => model.id === MOONSHOT_DEFAULT_MODEL_ID,
|
|
);
|
|
if (!defaultModel) {
|
|
return null;
|
|
}
|
|
|
|
return {
|
|
providerId: "moonshot",
|
|
api: "openai-completions",
|
|
baseUrl,
|
|
defaultModel,
|
|
defaultModelId: MOONSHOT_DEFAULT_MODEL_ID,
|
|
aliases: [{ modelRef: MOONSHOT_DEFAULT_MODEL_REF, alias: "Kimi" }],
|
|
};
|
|
},
|
|
});
|
|
|
|
export function applyMoonshotConfig(cfg: OpenClawConfig): OpenClawConfig {
|
|
return moonshotPresetAppliers.applyConfig(cfg, MOONSHOT_BASE_URL);
|
|
}
|
|
|
|
export function applyMoonshotConfigCn(cfg: OpenClawConfig): OpenClawConfig {
|
|
return moonshotPresetAppliers.applyConfig(cfg, MOONSHOT_CN_BASE_URL);
|
|
}
|