fix: bypass no-reply for moderator bot handoff messages
- Add moderator bypass in before_model_resolve: if senderId equals moderatorUserId,
skip no-reply evaluation to prevent moderator handoff messages from being treated
as regular messages without 🔚
- Add debug log when bypass is triggered
This commit is contained in:
@@ -581,6 +581,18 @@ export default {
|
|||||||
const hasConvMarker = prompt.includes("Conversation info (untrusted metadata):");
|
const hasConvMarker = prompt.includes("Conversation info (untrusted metadata):");
|
||||||
if (live.discordOnly !== false && (!hasConvMarker || derived.channel !== "discord")) return;
|
if (live.discordOnly !== false && (!hasConvMarker || derived.channel !== "discord")) return;
|
||||||
|
|
||||||
|
// Moderator bypass: if sender is the moderator bot, don't trigger no-reply
|
||||||
|
// This prevents moderator handoff messages from being treated as regular messages without 🔚
|
||||||
|
const moderatorUserId = getModeratorUserId(live);
|
||||||
|
if (moderatorUserId && derived.senderId === moderatorUserId) {
|
||||||
|
if (shouldDebugLog(live, derived.channelId)) {
|
||||||
|
api.logger.info(
|
||||||
|
`whispergate: moderator bypass for senderId=${derived.senderId}, skipping no-reply`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let rec = sessionDecision.get(key);
|
let rec = sessionDecision.get(key);
|
||||||
if (!rec || Date.now() - rec.createdAt > DECISION_TTL_MS) {
|
if (!rec || Date.now() - rec.createdAt > DECISION_TTL_MS) {
|
||||||
if (rec) sessionDecision.delete(key);
|
if (rec) sessionDecision.delete(key);
|
||||||
|
|||||||
Reference in New Issue
Block a user