feat: treat NO/empty as gateway no-reply

This commit is contained in:
nav
2026-03-10 13:42:50 +00:00
parent 13d5b95081
commit e6b20e9d52
3 changed files with 13 additions and 7 deletions

View File

@@ -115,14 +115,16 @@ export function registerBeforeMessageWriteHook(deps: BeforeMessageWriteDeps): vo
const policy = resolvePolicy(live, channelId, policyState.channelPolicies as Record<string, any>);
const trimmed = content.trim();
const isNoReply = /^NO_REPLY$/i.test(trimmed) || /^HEARTBEAT_OK$/i.test(trimmed);
const isNoReply =
trimmed.length === 0 ||
/^NO$/i.test(trimmed) ||
/^NO_REPLY$/i.test(trimmed) ||
/^HEARTBEAT_OK$/i.test(trimmed);
const lastChar = trimmed.length > 0 ? Array.from(trimmed).pop() || "" : "";
const hasEndSymbol = !!lastChar && policy.endSymbols.includes(lastChar);
const waitId = live.waitIdentifier || "👤";
const hasWaitIdentifier = !!lastChar && lastChar === waitId;
// Only treat explicit NO_REPLY/HEARTBEAT_OK keywords as no-reply.
// Empty content is NOT treated as no-reply — it may come from intermediate
// model responses (e.g. thinking-only blocks) that are not final answers.
// Treat explicit NO_REPLY/HEARTBEAT_OK/NO and empty responses as no-reply.
const wasNoReply = isNoReply;
const turnDebug = getTurnDebugInfo(channelId);