fix(auto-reply): fix streaming block reply media handling

This commit is contained in:
Peter Steinberger
2026-01-12 22:58:21 +00:00
parent 2e08a868a7
commit a8680f9a09
2 changed files with 19 additions and 12 deletions

View File

@@ -565,7 +565,8 @@ export async function runReplyAgent(params: {
} }
text = stripped.text; text = stripped.text;
} }
if (isSilentReplyText(text, SILENT_REPLY_TOKEN)) return { skip: true }; if (isSilentReplyText(text, SILENT_REPLY_TOKEN))
return { skip: true };
return { text, skip: false }; return { text, skip: false };
}; };
const handlePartialForTyping = async ( const handlePartialForTyping = async (
@@ -713,8 +714,8 @@ export async function runReplyAgent(params: {
blockStreamingEnabled && opts?.onBlockReply blockStreamingEnabled && opts?.onBlockReply
? async (payload) => { ? async (payload) => {
const { text, skip } = normalizeStreamingText(payload); const { text, skip } = normalizeStreamingText(payload);
const hasMedia = (payload.mediaUrls?.length ?? 0) > 0; if (skip && (payload.mediaUrls?.length ?? 0) === 0)
if (skip && !hasMedia) return; return;
const taggedPayload = applyReplyTagsToPayload( const taggedPayload = applyReplyTagsToPayload(
{ {
text, text,

View File

@@ -629,13 +629,15 @@ export async function applyInlineDirectivesFastLane(params: {
provider: string; provider: string;
model: string; model: string;
initialModelLabel: string; initialModelLabel: string;
formatModelSwitchEvent: (label: string, alias?: string) => string; formatModelSwitchEvent: (label: string, alias?: string) => string;
agentCfg?: NonNullable<ClawdbotConfig["agents"]>["defaults"]; agentCfg?: NonNullable<ClawdbotConfig["agents"]>["defaults"];
modelState: { modelState: {
resolveDefaultThinkingLevel: () => Promise<ThinkLevel>; resolveDefaultThinkingLevel: () => Promise<ThinkLevel | undefined>;
allowedModelKeys: Set<string>; allowedModelKeys: Set<string>;
allowedModelCatalog: Awaited< allowedModelCatalog: Awaited<
ReturnType<typeof import("../../agents/model-catalog.js").loadModelCatalog> ReturnType<
typeof import("../../agents/model-catalog.js").loadModelCatalog
>
>; >;
resetModelOverride: boolean; resetModelOverride: boolean;
}; };
@@ -1357,7 +1359,9 @@ export async function handleDirectiveOnly(params: {
} }
} }
if (directives.hasQueueDirective && directives.queueMode) { if (directives.hasQueueDirective && directives.queueMode) {
parts.push(formatDirectiveAck(`Queue mode set to ${directives.queueMode}.`)); parts.push(
formatDirectiveAck(`Queue mode set to ${directives.queueMode}.`),
);
} else if (directives.hasQueueDirective && directives.queueReset) { } else if (directives.hasQueueDirective && directives.queueReset) {
parts.push(formatDirectiveAck("Queue mode reset to default.")); parts.push(formatDirectiveAck("Queue mode reset to default."));
} }
@@ -1373,7 +1377,9 @@ export async function handleDirectiveOnly(params: {
parts.push(formatDirectiveAck(`Queue cap set to ${directives.cap}.`)); parts.push(formatDirectiveAck(`Queue cap set to ${directives.cap}.`));
} }
if (directives.hasQueueDirective && directives.dropPolicy) { if (directives.hasQueueDirective && directives.dropPolicy) {
parts.push(formatDirectiveAck(`Queue drop set to ${directives.dropPolicy}.`)); parts.push(
formatDirectiveAck(`Queue drop set to ${directives.dropPolicy}.`),
);
} }
const ack = parts.join(" ").trim(); const ack = parts.join(" ").trim();
if (!ack && directives.hasStatusDirective) return undefined; if (!ack && directives.hasStatusDirective) return undefined;