mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 16:34:59 +00:00
fix(auto-reply): land #31080 from @scoootscooob
Co-authored-by: scoootscooob <zhentongfan@gmail.com>
This commit is contained in:
@@ -17,6 +17,16 @@ export function isSilentReplyText(
|
||||
return new RegExp(`^\\s*${escaped}\\s*$`).test(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Strip a trailing silent reply token from mixed-content text.
|
||||
* Returns the remaining text with the token removed (trimmed).
|
||||
* If the result is empty, the entire message should be treated as silent.
|
||||
*/
|
||||
export function stripSilentToken(text: string, token: string = SILENT_REPLY_TOKEN): string {
|
||||
const escaped = escapeRegExp(token);
|
||||
return text.replace(new RegExp(`(?:^|\\s+)${escaped}\\s*$`), "").trim();
|
||||
}
|
||||
|
||||
export function isSilentReplyPrefixText(
|
||||
text: string | undefined,
|
||||
token: string = SILENT_REPLY_TOKEN,
|
||||
|
||||
Reference in New Issue
Block a user