mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 19:38:28 +00:00
refactor!: rename chat providers to channels
This commit is contained in:
@@ -1,29 +1,31 @@
|
||||
import { listProviderPlugins } from "../../providers/plugins/index.js";
|
||||
import type { ProviderChoice } from "../onboard-types.js";
|
||||
import type { ProviderOnboardingAdapter } from "./types.js";
|
||||
import { listChannelPlugins } from "../../channels/plugins/index.js";
|
||||
import type { ChannelChoice } from "../onboard-types.js";
|
||||
import type { ChannelOnboardingAdapter } from "./types.js";
|
||||
|
||||
const PROVIDER_ONBOARDING_ADAPTERS = () =>
|
||||
new Map<ProviderChoice, ProviderOnboardingAdapter>(
|
||||
listProviderPlugins()
|
||||
const CHANNEL_ONBOARDING_ADAPTERS = () =>
|
||||
new Map<ChannelChoice, ChannelOnboardingAdapter>(
|
||||
listChannelPlugins()
|
||||
.map((plugin) =>
|
||||
plugin.onboarding
|
||||
? ([plugin.id as ProviderChoice, plugin.onboarding] as const)
|
||||
? ([plugin.id as ChannelChoice, plugin.onboarding] as const)
|
||||
: null,
|
||||
)
|
||||
.filter(
|
||||
(
|
||||
entry,
|
||||
): entry is readonly [ProviderChoice, ProviderOnboardingAdapter] =>
|
||||
(entry): entry is readonly [ChannelChoice, ChannelOnboardingAdapter] =>
|
||||
Boolean(entry),
|
||||
),
|
||||
);
|
||||
|
||||
export function getProviderOnboardingAdapter(
|
||||
provider: ProviderChoice,
|
||||
): ProviderOnboardingAdapter | undefined {
|
||||
return PROVIDER_ONBOARDING_ADAPTERS().get(provider);
|
||||
export function getChannelOnboardingAdapter(
|
||||
channel: ChannelChoice,
|
||||
): ChannelOnboardingAdapter | undefined {
|
||||
return CHANNEL_ONBOARDING_ADAPTERS().get(channel);
|
||||
}
|
||||
|
||||
export function listProviderOnboardingAdapters(): ProviderOnboardingAdapter[] {
|
||||
return Array.from(PROVIDER_ONBOARDING_ADAPTERS().values());
|
||||
export function listChannelOnboardingAdapters(): ChannelOnboardingAdapter[] {
|
||||
return Array.from(CHANNEL_ONBOARDING_ADAPTERS().values());
|
||||
}
|
||||
|
||||
// Legacy aliases (pre-rename).
|
||||
export const getProviderOnboardingAdapter = getChannelOnboardingAdapter;
|
||||
export const listProviderOnboardingAdapters = listChannelOnboardingAdapters;
|
||||
|
||||
@@ -1 +1 @@
|
||||
export * from "../../providers/plugins/onboarding-types.js";
|
||||
export * from "../../channels/plugins/onboarding-types.js";
|
||||
|
||||
Reference in New Issue
Block a user