MCPcopy Index your code
hub / github.com/docker/docker-agent / ProcessAttachmentWithMetadata

Function ProcessAttachmentWithMetadata

pkg/chat/attach.go:62–73  ·  view source on GitHub ↗

ProcessAttachmentWithMetadata is like [ProcessAttachment] but also returns the [ImageResizeResult] when the attachment was an image that went through [ResizeImage]. The metadata is nil for non-image attachments. Callers that need to emit a dimension note (for model coordinate-mapping) should use th

(part MessagePart)

Source from the content-addressed store, hash-verified

60// should use this variant and call [FormatDimensionNote] on the returned
61// metadata.
62func ProcessAttachmentWithMetadata(part MessagePart) (Document, *ImageResizeResult, error) {
63 switch part.Type {
64 case MessagePartTypeFile:
65 return processFilePart(part)
66 case MessagePartTypeImageURL:
67 return processImageURLPart(part)
68 case MessagePartTypeDocument:
69 return processDocumentPart(part)
70 default:
71 return Document{}, nil, fmt.Errorf("ProcessAttachment: unsupported part type %q", part.Type)
72 }
73}
74
75// processFilePart handles MessagePartTypeFile: reads from disk, detects MIME,
76// routes to text-inline or binary-inline as appropriate.

Callers 3

processFileAttachmentMethod · 0.92
ProcessAttachmentFunction · 0.85

Calls 3

processFilePartFunction · 0.85
processImageURLPartFunction · 0.85
processDocumentPartFunction · 0.85

Tested by

no test coverage detected