mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 08:47:40 +00:00
fix(discord): add media dedup production code for messaging tool pipeline
Wire media URL tracking through the embedded agent pipeline so that media already sent via messaging tools is not delivered again by the reply dispatcher. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
committed by
Peter Steinberger
parent
c7681c3cff
commit
838259331f
@@ -145,6 +145,11 @@ export async function handleToolExecutionStart(
|
||||
ctx.state.pendingMessagingTexts.set(toolCallId, text);
|
||||
ctx.log.debug(`Tracking pending messaging text: tool=${toolName} len=${text.length}`);
|
||||
}
|
||||
// Track media URL from messaging tool args (pending until tool_execution_end)
|
||||
const mediaUrl = argsRecord.mediaUrl ?? argsRecord.path ?? argsRecord.filePath;
|
||||
if (mediaUrl && typeof mediaUrl === "string") {
|
||||
ctx.state.pendingMessagingMediaUrls.set(toolCallId, mediaUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -248,6 +253,14 @@ export async function handleToolExecutionEnd(
|
||||
ctx.trimMessagingToolSent();
|
||||
}
|
||||
}
|
||||
const pendingMediaUrl = ctx.state.pendingMessagingMediaUrls.get(toolCallId);
|
||||
if (pendingMediaUrl) {
|
||||
ctx.state.pendingMessagingMediaUrls.delete(toolCallId);
|
||||
if (!isToolError) {
|
||||
ctx.state.messagingToolSentMediaUrls.push(pendingMediaUrl);
|
||||
ctx.trimMessagingToolSent();
|
||||
}
|
||||
}
|
||||
|
||||
// Track committed reminders only when cron.add completed successfully.
|
||||
if (!isToolError && toolName === "cron" && isCronAddAction(startData?.args)) {
|
||||
|
||||
Reference in New Issue
Block a user