MCPcopy
hub / github.com/docker/docker-agent / ProcessAttachment

Function ProcessAttachment

pkg/chat/attach.go:50–53  ·  view source on GitHub ↗

ProcessAttachment converts a raw [MessagePart] into a [Document] with fully resolved Source.InlineData or Source.InlineText. It is called once when a message is assembled — never at inference time. Supported input types: - [MessagePartTypeFile]: reads the file from the local filesystem, detects it

(_ context.Context, part MessagePart)

Source from the content-addressed store, hash-verified

48// transcoding to any image/* InlineData. A Document with no inline content
49// is an error.
50func ProcessAttachment(_ context.Context, part MessagePart) (Document, error) {
51 doc, _, err := ProcessAttachmentWithMetadata(part)
52 return doc, err
53}
54
55// ProcessAttachmentWithMetadata is like [ProcessAttachment] but also returns
56// the [ImageResizeResult] when the attachment was an image that went through

Calls 1