Documentation
¶
Index ¶
- func CopyToClipboard(imagePath string, imageData []byte) error
- func DisplayImage(imagePath string) error
- func ReadFromClipboard() ([]byte, error)
- func RenderImageToWriter(w io.Writer, path string) error
- func SaveImage(data []byte, outputDir, prompt string) (string, error)
- type DebugProvider
- func (p *DebugProvider) Edit(ctx context.Context, req EditRequest) (*ImageResult, error)
- func (p *DebugProvider) Generate(ctx context.Context, req GenerateRequest) (*ImageResult, error)
- func (p *DebugProvider) Name() string
- func (p *DebugProvider) SupportsEdit() bool
- func (p *DebugProvider) SupportsMultiImage() bool
- type EditRequest
- type FluxProvider
- func (p *FluxProvider) Edit(ctx context.Context, req EditRequest) (*ImageResult, error)
- func (p *FluxProvider) Generate(ctx context.Context, req GenerateRequest) (*ImageResult, error)
- func (p *FluxProvider) Name() string
- func (p *FluxProvider) SupportsEdit() bool
- func (p *FluxProvider) SupportsMultiImage() bool
- type GeminiProvider
- func (p *GeminiProvider) Edit(ctx context.Context, req EditRequest) (*ImageResult, error)
- func (p *GeminiProvider) Generate(ctx context.Context, req GenerateRequest) (*ImageResult, error)
- func (p *GeminiProvider) Name() string
- func (p *GeminiProvider) SupportsEdit() bool
- func (p *GeminiProvider) SupportsMultiImage() bool
- type GenerateRequest
- type ImageProvider
- type ImageResult
- type InputImage
- type OpenAIProvider
- func (p *OpenAIProvider) Edit(ctx context.Context, req EditRequest) (*ImageResult, error)
- func (p *OpenAIProvider) Generate(ctx context.Context, req GenerateRequest) (*ImageResult, error)
- func (p *OpenAIProvider) Name() string
- func (p *OpenAIProvider) SupportsEdit() bool
- func (p *OpenAIProvider) SupportsMultiImage() bool
- type OpenRouterProvider
- func (p *OpenRouterProvider) Edit(ctx context.Context, req EditRequest) (*ImageResult, error)
- func (p *OpenRouterProvider) Generate(ctx context.Context, req GenerateRequest) (*ImageResult, error)
- func (p *OpenRouterProvider) Name() string
- func (p *OpenRouterProvider) SupportsEdit() bool
- func (p *OpenRouterProvider) SupportsMultiImage() bool
- type RenderImageResult
- type TerminalImageCapability
- type XAIProvider
- func (p *XAIProvider) Edit(ctx context.Context, req EditRequest) (*ImageResult, error)
- func (p *XAIProvider) Generate(ctx context.Context, req GenerateRequest) (*ImageResult, error)
- func (p *XAIProvider) Name() string
- func (p *XAIProvider) SupportsEdit() bool
- func (p *XAIProvider) SupportsMultiImage() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyToClipboard ¶
CopyToClipboard copies image to clipboard (platform-aware) Attempts to copy actual image data, not just the path
func DisplayImage ¶
DisplayImage displays the image in terminal using rasterm Returns nil if terminal doesn't support images (graceful degradation)
func ReadFromClipboard ¶
ReadFromClipboard reads image data from the system clipboard Returns the image data and an error if clipboard doesn't contain an image
func RenderImageToWriter ¶ added in v0.0.39
RenderImageToWriter renders an image to a writer using the detected capability This is for one-shot display (e.g., DisplayImage) - uses rasterm directly
Types ¶
type DebugProvider ¶ added in v0.0.39
type DebugProvider struct {
// contains filtered or unexported fields
}
DebugProvider implements ImageProvider for local development without API costs
func NewDebugProvider ¶ added in v0.0.39
func NewDebugProvider(delaySeconds float64) *DebugProvider
NewDebugProvider creates a debug provider with an optional delay (in seconds)
func (*DebugProvider) Edit ¶ added in v0.0.39
func (p *DebugProvider) Edit(ctx context.Context, req EditRequest) (*ImageResult, error)
func (*DebugProvider) Generate ¶ added in v0.0.39
func (p *DebugProvider) Generate(ctx context.Context, req GenerateRequest) (*ImageResult, error)
func (*DebugProvider) Name ¶ added in v0.0.39
func (p *DebugProvider) Name() string
func (*DebugProvider) SupportsEdit ¶ added in v0.0.39
func (p *DebugProvider) SupportsEdit() bool
func (*DebugProvider) SupportsMultiImage ¶ added in v0.0.39
func (p *DebugProvider) SupportsMultiImage() bool
type EditRequest ¶
type EditRequest struct {
Prompt string
InputImages []InputImage // Input images for editing (supports multiple for some providers)
Debug bool
}
EditRequest contains parameters for image editing
type FluxProvider ¶
type FluxProvider struct {
// contains filtered or unexported fields
}
FluxProvider implements ImageProvider using Black Forest Labs' Flux API
func NewFluxProvider ¶
func NewFluxProvider(apiKey, model string) *FluxProvider
func (*FluxProvider) Edit ¶
func (p *FluxProvider) Edit(ctx context.Context, req EditRequest) (*ImageResult, error)
func (*FluxProvider) Generate ¶
func (p *FluxProvider) Generate(ctx context.Context, req GenerateRequest) (*ImageResult, error)
func (*FluxProvider) Name ¶
func (p *FluxProvider) Name() string
func (*FluxProvider) SupportsEdit ¶
func (p *FluxProvider) SupportsEdit() bool
func (*FluxProvider) SupportsMultiImage ¶ added in v0.0.33
func (p *FluxProvider) SupportsMultiImage() bool
type GeminiProvider ¶
type GeminiProvider struct {
// contains filtered or unexported fields
}
GeminiProvider implements ImageProvider using Google's Gemini API
func NewGeminiProvider ¶
func NewGeminiProvider(apiKey string) *GeminiProvider
func (*GeminiProvider) Edit ¶
func (p *GeminiProvider) Edit(ctx context.Context, req EditRequest) (*ImageResult, error)
func (*GeminiProvider) Generate ¶
func (p *GeminiProvider) Generate(ctx context.Context, req GenerateRequest) (*ImageResult, error)
func (*GeminiProvider) Name ¶
func (p *GeminiProvider) Name() string
func (*GeminiProvider) SupportsEdit ¶
func (p *GeminiProvider) SupportsEdit() bool
func (*GeminiProvider) SupportsMultiImage ¶ added in v0.0.33
func (p *GeminiProvider) SupportsMultiImage() bool
type GenerateRequest ¶
GenerateRequest contains parameters for image generation
type ImageProvider ¶
type ImageProvider interface {
// Name returns the provider name for logging
Name() string
// Generate creates a new image from a text prompt
Generate(ctx context.Context, req GenerateRequest) (*ImageResult, error)
// Edit modifies an existing image based on a prompt
Edit(ctx context.Context, req EditRequest) (*ImageResult, error)
// SupportsEdit returns true if the provider supports image editing
SupportsEdit() bool
// SupportsMultiImage returns true if the provider supports multiple input images
SupportsMultiImage() bool
}
ImageProvider is the interface for image generation providers
func NewImageProvider ¶
func NewImageProvider(cfg *config.Config, providerOverride string) (ImageProvider, error)
NewImageProvider creates an image provider based on config
type ImageResult ¶
type ImageResult struct {
Data []byte // Image data (PNG/JPEG)
MimeType string // "image/png", "image/jpeg", etc.
}
ImageResult contains the generated image and metadata
type InputImage ¶ added in v0.0.33
InputImage represents a single input image for editing
type OpenAIProvider ¶
type OpenAIProvider struct {
// contains filtered or unexported fields
}
OpenAIProvider implements ImageProvider using OpenAI's API
func NewOpenAIProvider ¶
func NewOpenAIProvider(apiKey string) *OpenAIProvider
func (*OpenAIProvider) Edit ¶
func (p *OpenAIProvider) Edit(ctx context.Context, req EditRequest) (*ImageResult, error)
func (*OpenAIProvider) Generate ¶
func (p *OpenAIProvider) Generate(ctx context.Context, req GenerateRequest) (*ImageResult, error)
func (*OpenAIProvider) Name ¶
func (p *OpenAIProvider) Name() string
func (*OpenAIProvider) SupportsEdit ¶
func (p *OpenAIProvider) SupportsEdit() bool
func (*OpenAIProvider) SupportsMultiImage ¶ added in v0.0.33
func (p *OpenAIProvider) SupportsMultiImage() bool
type OpenRouterProvider ¶ added in v0.0.24
type OpenRouterProvider struct {
// contains filtered or unexported fields
}
OpenRouterProvider implements ImageProvider using OpenRouter's API
func NewOpenRouterProvider ¶ added in v0.0.24
func NewOpenRouterProvider(apiKey, model string) *OpenRouterProvider
func (*OpenRouterProvider) Edit ¶ added in v0.0.24
func (p *OpenRouterProvider) Edit(ctx context.Context, req EditRequest) (*ImageResult, error)
func (*OpenRouterProvider) Generate ¶ added in v0.0.24
func (p *OpenRouterProvider) Generate(ctx context.Context, req GenerateRequest) (*ImageResult, error)
func (*OpenRouterProvider) Name ¶ added in v0.0.24
func (p *OpenRouterProvider) Name() string
func (*OpenRouterProvider) SupportsEdit ¶ added in v0.0.24
func (p *OpenRouterProvider) SupportsEdit() bool
func (*OpenRouterProvider) SupportsMultiImage ¶ added in v0.0.33
func (p *OpenRouterProvider) SupportsMultiImage() bool
type RenderImageResult ¶ added in v0.0.39
type RenderImageResult struct {
// Upload contains the upload/placement commands that must go directly to terminal
// For Kitty: delete + transmit + placement commands
// For iTerm/Sixel: empty (everything is in Placeholder)
Upload string
// Placeholder contains the displayable portion
// For Kitty: Unicode placeholder characters
// For iTerm/Sixel: full escape sequence
Placeholder string
// Full is Upload + Placeholder (for convenience in non-bubbletea contexts)
Full string
}
RenderImageResult contains the result of rendering an image
func RenderImageToString ¶ added in v0.0.39
func RenderImageToString(path string) (RenderImageResult, error)
RenderImageToString renders an image and returns a string for display For Kitty: returns full upload sequence for first display, placeholder-only for cache For others: returns full escape sequence (same for both) The caller should cache result.Cached and use result.Full for first display.
type TerminalImageCapability ¶ added in v0.0.39
type TerminalImageCapability int
TerminalImageCapability represents the terminal's image rendering capability
const ( CapNone TerminalImageCapability = iota // No image support CapKitty // Kitty graphics protocol CapITerm // iTerm2 inline images CapSixel // Sixel graphics )
func DetectCapability ¶ added in v0.0.39
func DetectCapability() TerminalImageCapability
DetectCapability detects the terminal's image rendering capability Detection order: Kitty -> iTerm -> Sixel -> None
func (TerminalImageCapability) String ¶ added in v0.0.39
func (c TerminalImageCapability) String() string
String returns the capability name
type XAIProvider ¶ added in v0.0.31
type XAIProvider struct {
// contains filtered or unexported fields
}
XAIProvider implements ImageProvider using xAI's Grok image API
func NewXAIProvider ¶ added in v0.0.31
func NewXAIProvider(apiKey, model string) *XAIProvider
func (*XAIProvider) Edit ¶ added in v0.0.31
func (p *XAIProvider) Edit(ctx context.Context, req EditRequest) (*ImageResult, error)
func (*XAIProvider) Generate ¶ added in v0.0.31
func (p *XAIProvider) Generate(ctx context.Context, req GenerateRequest) (*ImageResult, error)
func (*XAIProvider) Name ¶ added in v0.0.31
func (p *XAIProvider) Name() string
func (*XAIProvider) SupportsEdit ¶ added in v0.0.31
func (p *XAIProvider) SupportsEdit() bool
func (*XAIProvider) SupportsMultiImage ¶ added in v0.0.33
func (p *XAIProvider) SupportsMultiImage() bool