media

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const ContentTypeAttachmentRef = "attachment_ref"

ContentTypeAttachmentRef is persisted in session history for stripped attachments.

View Source
const DefaultMaxWorkspaceImageBytes = 10 << 20

DefaultMaxWorkspaceImageBytes caps workspace images loaded for vision.

Variables

This section is empty.

Functions

func DataURL

func DataURL(mime string, data []byte) string

DataURL builds a data URL for vision models.

func DetectMIME

func DetectMIME(path string, data []byte) string

DetectMIME guesses image MIME type from path and magic bytes.

func FormatReadImageResult

func FormatReadImageResult(path, mime string, size int64) string

FormatReadImageResult is the read-tool metadata format hydrated before LLM calls.

func FormatReadImageTooLarge

func FormatReadImageTooLarge(path string, size, max int64) string

FormatReadImageTooLarge explains why a workspace image cannot be viewed.

func IsImage

func IsImage(mimeType, path string) bool

IsImage reports whether a file looks like an image from MIME type and/or path.

func IsImageMIME

func IsImageMIME(mime string) bool

IsImageMIME reports whether a MIME type is an image.

func IsImagePath

func IsImagePath(path string) bool

IsImagePath reports whether a workspace-relative path looks like an image file.

func LoadWorkspaceImage

func LoadWorkspaceImage(ctx context.Context, ws workspace.Service, workRel string, maxBytes int) ([]byte, string, error)

LoadWorkspaceImage reads an image from the tenant work tree. workRel is relative to work/ (e.g. upload/foo.png or work/upload/foo.png).

func NormalizeWorkRel

func NormalizeWorkRel(rel string) string

NormalizeWorkRel strips leading slashes and an optional work/ prefix.

func ParseReadImagePath

func ParseReadImagePath(content string) string

ParseReadImagePath extracts a workspace image path from a read-tool result.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL