mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-12 09:41:11 +00:00
perf: avoid plugin index for target normalization
This commit is contained in:
@@ -15,8 +15,11 @@ let resolveNormalizedTargetInput: TargetNormalizationModule["resolveNormalizedTa
|
||||
let normalizeTargetForProvider: TargetNormalizationModule["normalizeTargetForProvider"];
|
||||
let resetTargetNormalizerCacheForTests: TargetNormalizationModule["__testing"]["resetTargetNormalizerCacheForTests"];
|
||||
|
||||
vi.mock("../../channels/registry.js", () => ({
|
||||
normalizeAnyChannelId: (...args: unknown[]) => normalizeChannelIdMock(...args),
|
||||
}));
|
||||
|
||||
vi.mock("../../channels/plugins/index.js", () => ({
|
||||
normalizeChannelId: (...args: unknown[]) => normalizeChannelIdMock(...args),
|
||||
getChannelPlugin: (...args: unknown[]) => getChannelPluginMock(...args),
|
||||
}));
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { getChannelPlugin, normalizeChannelId } from "../../channels/plugins/index.js";
|
||||
import { getChannelPlugin } from "../../channels/plugins/index.js";
|
||||
import type { ChannelDirectoryEntryKind, ChannelId } from "../../channels/plugins/types.js";
|
||||
import { normalizeAnyChannelId } from "../../channels/registry.js";
|
||||
import type { OpenClawConfig } from "../../config/config.js";
|
||||
import { getActivePluginChannelRegistryVersion } from "../../plugins/runtime.js";
|
||||
import { normalizeOptionalString } from "../../shared/string-coerce.js";
|
||||
@@ -47,7 +48,7 @@ export function normalizeTargetForProvider(provider: string, raw?: string): stri
|
||||
if (!fallback) {
|
||||
return undefined;
|
||||
}
|
||||
const providerId = normalizeChannelId(provider);
|
||||
const providerId = normalizeAnyChannelId(provider);
|
||||
const normalizer = providerId ? resolveTargetNormalizer(providerId) : undefined;
|
||||
return normalizeOptionalString(normalizer?.(raw) ?? fallback);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user