mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 11:31:26 +00:00
fix: fix: transcribe audio before mention check in groups with requireMention (openclaw#9973) thanks @mcinteerj
Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test Co-authored-by: mcinteerj <3613653+mcinteerj@users.noreply.github.com>
This commit is contained in:
@@ -90,18 +90,24 @@ export function matchesMentionWithExplicit(params: {
|
||||
text: string;
|
||||
mentionRegexes: RegExp[];
|
||||
explicit?: ExplicitMentionSignal;
|
||||
transcript?: string;
|
||||
}): boolean {
|
||||
const cleaned = normalizeMentionText(params.text ?? "");
|
||||
const explicit = params.explicit?.isExplicitlyMentioned === true;
|
||||
const explicitAvailable = params.explicit?.canResolveExplicit === true;
|
||||
const hasAnyMention = params.explicit?.hasAnyMention === true;
|
||||
|
||||
// Check transcript if text is empty and transcript is provided
|
||||
const transcriptCleaned = params.transcript ? normalizeMentionText(params.transcript) : "";
|
||||
const textToCheck = cleaned || transcriptCleaned;
|
||||
|
||||
if (hasAnyMention && explicitAvailable) {
|
||||
return explicit || params.mentionRegexes.some((re) => re.test(cleaned));
|
||||
return explicit || params.mentionRegexes.some((re) => re.test(textToCheck));
|
||||
}
|
||||
if (!cleaned) {
|
||||
if (!textToCheck) {
|
||||
return explicit;
|
||||
}
|
||||
return explicit || params.mentionRegexes.some((re) => re.test(cleaned));
|
||||
return explicit || params.mentionRegexes.some((re) => re.test(textToCheck));
|
||||
}
|
||||
|
||||
export function stripStructuralPrefixes(text: string): string {
|
||||
|
||||
Reference in New Issue
Block a user