feat: treat NO/empty as gateway no-reply
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -74,12 +74,16 @@ export function registerMessageSentHook(deps: MessageSentDeps): void {
|
||||
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.
|
||||
// Treat explicit NO_REPLY/HEARTBEAT_OK/NO and empty responses as no-reply.
|
||||
const wasNoReply = isNoReply;
|
||||
|
||||
if (key && sessionTurnHandled.has(key)) {
|
||||
|
||||
Reference in New Issue
Block a user