mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-14 06:17:41 +00:00
fix(tools): prevent duplicate media delivery from write_file
Tell LLM that auto-delivered files should not be sent again via message tool, preventing double sends (document + photo) on Telegram.
This commit is contained in:
1 parent
517e6c89ab
commit
31ff5eefca
1 file changed
+10
-2
@@ -173,7 +173,11 @@ func (t *WriteFileTool) Execute(ctx context.Context, args map[string]any) *Resul
|
||||
t.workspaceIntc.AfterWrite(ctx, resolved, "write")
|
||||
}
|
||||
|
||||
result := SilentResult(fmt.Sprintf("File written: %s (%d bytes)", path, len(content)))
|
||||
msg := fmt.Sprintf("File written: %s (%d bytes)", path, len(content))
|
||||
if deliver {
|
||||
msg += ". File will be automatically delivered to the user — do NOT send it again via message tool."
|
||||
}
|
||||
result := SilentResult(msg)
|
||||
result.Deliverable = content
|
||||
if deliver {
|
||||
result.Media = []bus.MediaFile{{Path: resolved}}
|
||||
@@ -191,7 +195,11 @@ func (t *WriteFileTool) executeInSandbox(ctx context.Context, path, content, san
|
||||
return ErrorResult(fmt.Sprintf("failed to write file: %v", err))
|
||||
}
|
||||
|
||||
result := SilentResult(fmt.Sprintf("File written: %s (%d bytes)", path, len(content)))
|
||||
msg := fmt.Sprintf("File written: %s (%d bytes)", path, len(content))
|
||||
if deliver {
|
||||
msg += ". File will be automatically delivered to the user — do NOT send it again via message tool."
|
||||
}
|
||||
result := SilentResult(msg)
|
||||
result.Deliverable = content
|
||||
if deliver {
|
||||
// Sandbox workspace is bind-mounted — resolve to host path for delivery
|
||||
|
||||
Reference in new issue
Block a user