llms.py
Media Generation

Media Gallery

Explore the Media Gallery for managing and viewing generated images and audio files

The gallery extension intercepts all generated image, audio & file assets and uploaded files in ~/.llms/cache file storage whose metadata is maintained in a SQLite database.

Dedicated UIs are available for quickly browsing and navigating or generated images / audio files with optimized UIs for viewing portrait, square and landscape images.

Portrait Images

Square Images

Landscape Images

Audio Generations

Generated Asset Interception

The Gallery extension automatically monitors the creation of new cache entries. Whenever a file is saved to the LLMs cache (located at ~/.llms/cache), the extension captures its metadata and stores it in the gallery database.

This includes:

  • Generated Images: Images created by AI models (e.g: Gemini/Nano Banana, Open AI, chutes.ai)
  • Generated Audio: Audio files generated by text-to-speech or audio models.
  • Uploaded Files: Any files uploaded through the UI.

All metadata is stored in a dedicated SQLite database located at ~/.llms/user/default/gallery/gallery.sqlite, in the media table.

User Interface

The Gallery UI provides a rich, interactive way to explore your generated assets. You can access it via the Gallery tab in the sidebar or by navigating to /gallery.

The image view offers a responsive grid layout optimized for different aspect ratios.

  • Filtering:
    • By Format: Easily switch between Portrait, Square, and Landscape views to see images in their best light.
    • Search: Real-time search by prompt, model name, or other metadata.
  • Interactions:
    • Lightbox: Click any image to view it in full screen.
    • Details: View comprehensive metadata including the prompt used, generation model, dimensions, file size, creation date, and generation cost.
    • Download: extensive download options.
    • Remix: Quickly re-use the prompt and settings of an existing image to generate a new one.
    • Delete: Remove unwanted images from the gallery.

The audio view presents a list layout designed for easy listening and management.

  • Playback: Integrated audio player to preview generated sounds directly in the list.
  • Metadata: Displays the caption/prompt, model, and creation time.
  • Actions:
    • Remix: Regenerate audio using the same prompt.
    • Delete: Remove audio files.

Storage Data model

The media table tracks extensive information about each asset to support the search and filtering capabilities:

ColumnDescription
urlRelative path to the file in ~/.llms/cache
typeAsset type (image, audio, video)
promptThe prompt used to generate the asset
modelThe AI model used
aspect_ratioAspect ratio (e.g., "1:1", "16:9")
costGeneration cost
metadataAdditional JSON metadata
createdTimestamp of creation

This local database ensures your gallery remains fast and responsive, even with a large collection of generated assets.