Documentation
¶
Overview ¶
Package media provides shared utility functions for building and describing messenger.Attachment values across platform adapters.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DescribeAttachments ¶
func DescribeAttachments(attachments []messenger.Attachment, baseDir ...string) string
DescribeAttachments generates a human-readable text description of the given attachments. This is used to augment user messages so the LLM knows about any attached files. Includes local file paths when available so the LLM can use read_file to access the content.
When baseDir is non-empty, absolute LocalPaths that fall under baseDir are converted to relative paths so the file tool (which rejects absolute paths) can resolve them. Paths outside baseDir are left absolute as a fallback.
Example output: "[Attached: report.pdf (application/pdf, 1.2 MB) → .genie/whatsapp/media/report.pdf]"
func ExtFromMIME ¶
ExtFromMIME returns a file extension (including the dot) for the given MIME type. Returns ".bin" if the MIME type is unknown.
func FormatFileSize ¶
FormatFileSize returns a human-readable file size string.
func MIMEFromFilename ¶
MIMEFromFilename returns a MIME type based on the file extension. Returns "application/octet-stream" if the extension is unknown.
func NameFromMIME ¶
NameFromMIME generates a filename from a MIME type and a prefix. Used when the platform doesn't provide a filename (e.g., images, audio). Example: NameFromMIME("image/jpeg", "image") → "image.jpg"
Types ¶
This section is empty.