mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-17 18:01:42 +00:00
Summary: - Merged feat(tencent): add Tencent Hy3 provider (TokenHub and TokenPlan) after ClawSweeper review. Automerge notes: - Ran the ClawSweeper repair loop before final review. - Included post-review commit in the final squash: fix(tencent): preserve TokenHub auth compatibility - Included post-review commit in the final squash: refactor(tencent): unify TokenPlan env/flag naming with TokenHub - Included post-review commit in the final squash: docs: refresh Tencent provider docs metadata - Included post-review commit in the final squash: fix: allow TokenPlan provider config overlays - Included post-review commit in the final squash: docs: dedupe Tencent provider glossary labels - Included post-review commit in the final squash: fix(tencent): repair TokenHub model defaults Validation: - ClawSweeper review passed for head30c9fc130f. - Required merge gates passed before the squash merge. Prepared head SHA:30c9fc130fReview: https://github.com/openclaw/openclaw/pull/99076#issuecomment-4888527271 Co-authored-by: leisang <leisang@tencent.com> Co-authored-by: Mason Huang <masonxhuang@tencent.com> Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: hxy91819
76 lines
2.4 KiB
TypeScript
76 lines
2.4 KiB
TypeScript
// Tencent setup module handles plugin onboarding behavior.
|
|
import {
|
|
applyAgentDefaultModelPrimary,
|
|
applyProviderConfigWithModelCatalog,
|
|
type OpenClawConfig,
|
|
} from "openclaw/plugin-sdk/provider-onboard";
|
|
import {
|
|
buildTokenHubModelDefinition,
|
|
buildTokenPlanModelDefinition,
|
|
TOKENHUB_BASE_URL,
|
|
TOKENHUB_MODEL_CATALOG,
|
|
TOKENHUB_PROVIDER_ID,
|
|
TOKENPLAN_BASE_URL,
|
|
TOKENPLAN_MODEL_CATALOG,
|
|
TOKENPLAN_PROVIDER_ID,
|
|
} from "./api.js";
|
|
|
|
// ---------- TokenHub ----------
|
|
|
|
export const TOKENHUB_DEFAULT_MODEL_REF = `${TOKENHUB_PROVIDER_ID}/hy3`;
|
|
export const TOKENHUB_PREVIEW_MODEL_REF = `${TOKENHUB_PROVIDER_ID}/hy3-preview`;
|
|
|
|
function applyTokenHubProviderConfig(cfg: OpenClawConfig): OpenClawConfig {
|
|
const models = { ...cfg.agents?.defaults?.models };
|
|
models[TOKENHUB_DEFAULT_MODEL_REF] = {
|
|
...models[TOKENHUB_DEFAULT_MODEL_REF],
|
|
alias: models[TOKENHUB_DEFAULT_MODEL_REF]?.alias ?? "Hy3 (TokenHub)",
|
|
};
|
|
models[TOKENHUB_PREVIEW_MODEL_REF] = {
|
|
...models[TOKENHUB_PREVIEW_MODEL_REF],
|
|
alias: models[TOKENHUB_PREVIEW_MODEL_REF]?.alias ?? "Hy3 preview (TokenHub)",
|
|
};
|
|
|
|
return applyProviderConfigWithModelCatalog(cfg, {
|
|
agentModels: models,
|
|
providerId: TOKENHUB_PROVIDER_ID,
|
|
api: "openai-completions",
|
|
baseUrl: TOKENHUB_BASE_URL,
|
|
catalogModels: TOKENHUB_MODEL_CATALOG.map(buildTokenHubModelDefinition),
|
|
});
|
|
}
|
|
|
|
export function applyTokenHubConfig(cfg: OpenClawConfig): OpenClawConfig {
|
|
return applyAgentDefaultModelPrimary(
|
|
applyTokenHubProviderConfig(cfg),
|
|
TOKENHUB_DEFAULT_MODEL_REF,
|
|
);
|
|
}
|
|
|
|
// ---------- TokenPlan ----------
|
|
|
|
export const TOKENPLAN_DEFAULT_MODEL_REF = `${TOKENPLAN_PROVIDER_ID}/hy3`;
|
|
|
|
function applyTokenPlanProviderConfig(cfg: OpenClawConfig): OpenClawConfig {
|
|
const models = { ...cfg.agents?.defaults?.models };
|
|
models[TOKENPLAN_DEFAULT_MODEL_REF] = {
|
|
...models[TOKENPLAN_DEFAULT_MODEL_REF],
|
|
alias: models[TOKENPLAN_DEFAULT_MODEL_REF]?.alias ?? "Hy3 (TokenPlan)",
|
|
};
|
|
|
|
return applyProviderConfigWithModelCatalog(cfg, {
|
|
agentModels: models,
|
|
providerId: TOKENPLAN_PROVIDER_ID,
|
|
api: "openai-completions",
|
|
baseUrl: TOKENPLAN_BASE_URL,
|
|
catalogModels: TOKENPLAN_MODEL_CATALOG.map(buildTokenPlanModelDefinition),
|
|
});
|
|
}
|
|
|
|
export function applyTokenPlanConfig(cfg: OpenClawConfig): OpenClawConfig {
|
|
return applyAgentDefaultModelPrimary(
|
|
applyTokenPlanProviderConfig(cfg),
|
|
TOKENPLAN_DEFAULT_MODEL_REF,
|
|
);
|
|
}
|