diff --git a/internal/acp/orchestrator.go b/internal/acp/orchestrator.go index 016ac17..6337295 100644 --- a/internal/acp/orchestrator.go +++ b/internal/acp/orchestrator.go @@ -1025,17 +1025,28 @@ func openClawNonEmptyPathAttachments(params map[string]any) []any { if len(rawAttachments) == 0 { return nil } + inlineAttachmentNames := map[string]bool{} + for _, raw := range shared.ListArg(params, "inlineAttachments") { + name := strings.TrimSpace(shared.StringArg(shared.AsMap(raw), "name", "")) + if name != "" { + inlineAttachmentNames[name] = true + } + } attachments := make([]any, 0, len(rawAttachments)) for _, raw := range rawAttachments { attachment := shared.AsMap(raw) if len(attachment) == 0 { continue } + name := strings.TrimSpace(shared.StringArg(attachment, "name", "attachment")) + if inlineAttachmentNames[name] { + continue + } if strings.TrimSpace(shared.StringArg(attachment, "path", "")) == "" { continue } attachments = append(attachments, map[string]any{ - "name": strings.TrimSpace(shared.StringArg(attachment, "name", "attachment")), + "name": name, "description": strings.TrimSpace(shared.StringArg(attachment, "description", "")), "path": strings.TrimSpace(shared.StringArg(attachment, "path", "")), }) diff --git a/internal/acp/routing_test.go b/internal/acp/routing_test.go index 1e595a5..83f5da3 100644 --- a/internal/acp/routing_test.go +++ b/internal/acp/routing_test.go @@ -2549,6 +2549,13 @@ func TestOpenClawChatSendParamsVideoInlineImagesUsePromptPathsOnly(t *testing.T) "threadId": "thread-video-attachments", "taskPrompt": "制作视频", "workingDirectory": workspace, + "attachments": []any{ + map[string]any{ + "name": "01-single-machine.png", + "description": "image/png", + "path": "/Users/shenlan/Pictures/01-single-machine.png", + }, + }, "inlineAttachments": []any{ map[string]any{ "name": "01-single-machine.png", @@ -2599,6 +2606,9 @@ func TestOpenClawChatSendParamsVideoInlineImagesUsePromptPathsOnly(t *testing.T) if !strings.Contains(message, "制作视频") { t.Fatalf("expected message to preserve video prompt, got %q", message) } + if strings.Contains(message, "/Users/shenlan/Pictures/01-single-machine.png") { + t.Fatalf("OpenClaw message must use materialized remote paths, got %q", message) + } } func TestOpenClawChatSendParamsMaterializesInlineAttachmentsInRemoteHint(t *testing.T) {