mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 00:30:23 +00:00
refactor: dedupe cli lowercase helpers
This commit is contained in:
@@ -25,6 +25,7 @@ import { buildOutboundBaseSessionKey } from "../infra/outbound/base-session-key.
|
||||
import type { OutboundDeliveryResult } from "../infra/outbound/deliver.js";
|
||||
import type { PluginRuntime } from "../plugins/runtime/types.js";
|
||||
import type { OpenClawPluginApi } from "../plugins/types.js";
|
||||
import { normalizeLowercaseStringOrEmpty } from "../shared/string-coerce.js";
|
||||
|
||||
export type {
|
||||
AnyAgentTool,
|
||||
@@ -237,8 +238,8 @@ export function getChatChannelMeta(id: ChatChannelId): ChannelMeta {
|
||||
export function stripChannelTargetPrefix(raw: string, ...providers: string[]): string {
|
||||
const trimmed = raw.trim();
|
||||
for (const provider of providers) {
|
||||
const prefix = `${provider.toLowerCase()}:`;
|
||||
if (trimmed.toLowerCase().startsWith(prefix)) {
|
||||
const prefix = `${normalizeLowercaseStringOrEmpty(provider)}:`;
|
||||
if (normalizeLowercaseStringOrEmpty(trimmed).startsWith(prefix)) {
|
||||
return trimmed.slice(prefix.length).trim();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user