mirror of
https://github.com/hanzoai/bot.git
synced 2026-11-01 07:38:30 +00:00
The automated rebrand sed script replaced "OpenClaw" with "Hanzo Bot" (with space) instead of "HanzoBot" in 8,315 TypeScript identifier occurrences across 1,632 files. This fixes all broken class names, type names, function names, and variable names. Co-authored-by: Hanzo Dev <[email protected]>
90 lines
2.9 KiB
TypeScript
90 lines
2.9 KiB
TypeScript
import {
|
|
SGLANG_DEFAULT_API_KEY_ENV_VAR,
|
|
SGLANG_DEFAULT_BASE_URL,
|
|
SGLANG_MODEL_PLACEHOLDER,
|
|
SGLANG_PROVIDER_LABEL,
|
|
} from "openclaw/plugin-sdk/agent-runtime";
|
|
import {
|
|
definePluginEntry,
|
|
type HanzoBotPluginApi,
|
|
type ProviderAuthMethodNonInteractiveContext,
|
|
} from "openclaw/plugin-sdk/core";
|
|
|
|
const PROVIDER_ID = "sglang";
|
|
|
|
async function loadProviderSetup() {
|
|
return await import("openclaw/plugin-sdk/self-hosted-provider-setup");
|
|
}
|
|
|
|
export default definePluginEntry({
|
|
id: "sglang",
|
|
name: "SGLang Provider",
|
|
description: "Bundled SGLang provider plugin",
|
|
register(api: HanzoBotPluginApi) {
|
|
api.registerProvider({
|
|
id: PROVIDER_ID,
|
|
label: "SGLang",
|
|
docsPath: "/providers/sglang",
|
|
envVars: ["SGLANG_API_KEY"],
|
|
auth: [
|
|
{
|
|
id: "custom",
|
|
label: SGLANG_PROVIDER_LABEL,
|
|
hint: "Fast self-hosted OpenAI-compatible server",
|
|
kind: "custom",
|
|
run: async (ctx) => {
|
|
const providerSetup = await loadProviderSetup();
|
|
return await providerSetup.promptAndConfigureOpenAICompatibleSelfHostedProviderAuth({
|
|
cfg: ctx.config,
|
|
prompter: ctx.prompter,
|
|
providerId: PROVIDER_ID,
|
|
providerLabel: SGLANG_PROVIDER_LABEL,
|
|
defaultBaseUrl: SGLANG_DEFAULT_BASE_URL,
|
|
defaultApiKeyEnvVar: SGLANG_DEFAULT_API_KEY_ENV_VAR,
|
|
modelPlaceholder: SGLANG_MODEL_PLACEHOLDER,
|
|
});
|
|
},
|
|
runNonInteractive: async (ctx: ProviderAuthMethodNonInteractiveContext) => {
|
|
const providerSetup = await loadProviderSetup();
|
|
return await providerSetup.configureOpenAICompatibleSelfHostedProviderNonInteractive({
|
|
ctx,
|
|
providerId: PROVIDER_ID,
|
|
providerLabel: SGLANG_PROVIDER_LABEL,
|
|
defaultBaseUrl: SGLANG_DEFAULT_BASE_URL,
|
|
defaultApiKeyEnvVar: SGLANG_DEFAULT_API_KEY_ENV_VAR,
|
|
modelPlaceholder: SGLANG_MODEL_PLACEHOLDER,
|
|
});
|
|
},
|
|
},
|
|
],
|
|
discovery: {
|
|
order: "late",
|
|
run: async (ctx) => {
|
|
const providerSetup = await loadProviderSetup();
|
|
return await providerSetup.discoverOpenAICompatibleSelfHostedProvider({
|
|
ctx,
|
|
providerId: PROVIDER_ID,
|
|
buildProvider: providerSetup.buildSglangProvider,
|
|
});
|
|
},
|
|
},
|
|
wizard: {
|
|
setup: {
|
|
choiceId: "sglang",
|
|
choiceLabel: "SGLang",
|
|
choiceHint: "Fast self-hosted OpenAI-compatible server",
|
|
groupId: "sglang",
|
|
groupLabel: "SGLang",
|
|
groupHint: "Fast self-hosted server",
|
|
methodId: "custom",
|
|
},
|
|
modelPicker: {
|
|
label: "SGLang (custom)",
|
|
hint: "Enter SGLang URL + API key + model",
|
|
methodId: "custom",
|
|
},
|
|
},
|
|
});
|
|
},
|
|
});
|