spec.md
4.63 KB
ADDED Requirements
Requirement: Automatic Image History Storage
The system SHALL automatically save all generated images and their metadata to local storage when image generation is successful.
Scenario: Image generation auto-save
- WHEN image generation is completed successfully
- THEN the system SHALL automatically save the generated image to a timestamped directory
- AND save the prompt text and generation parameters
- AND copy any reference images used
- AND update the global history index
Scenario: Directory structure creation
- WHEN creating a new history record
- THEN the system SHALL create a directory named with YYYYMMDDHHMMSS timestamp format
-
AND ensure the directory structure is:
/images/{timestamp}/generated.png, reference1.jpg, reference2.jpg, metadata.json
Requirement: History Record Management
The system SHALL provide functionality to manage and browse image generation history.
Scenario: History index loading
- WHEN the application starts or the history tab is opened
-
THEN the system SHALL load the history index from
history_index.json - AND display a list of all historical generation records sorted by timestamp
Scenario: History record deletion
- WHEN the user selects a history record and chooses to delete it
- THEN the system SHALL remove the record from the index
- AND delete the corresponding directory and all its files
- AND confirm the deletion action with the user
Requirement: History Browser Interface
The system SHALL provide a user interface to browse and interact with image generation history.
Scenario: History list display
- WHEN the history tab is opened
- THEN the system SHALL display a list of historical records
- AND show thumbnail previews of generated images
- AND display prompt text, generation date, and parameters for each record
Scenario: History item selection
- WHEN the user clicks on a history item
- THEN the system SHALL load the corresponding image into the main preview area
- AND display the original prompt text in the prompt input field
- AND restore the generation parameters (aspect ratio, size, model)
Requirement: Local Image Loading
The system SHALL enable loading previously generated images from local history.
Scenario: Load image from history
- WHEN a history item is selected
- THEN the system SHALL load the full-resolution image from local storage
- AND display it in the preview area with the same functionality as newly generated images
- AND enable download and full-screen viewing options
Scenario: Reference image restoration
- WHEN loading a history item that had reference images
- THEN the system SHALL display the reference images in the reference area
- AND allow the user to modify or remove them before generating new images
Requirement: Configuration and Settings
The system SHALL provide configuration options for history management.
Scenario: History storage location
- WHEN the application starts
- THEN the system SHALL create the images directory in the application's data directory
- AND allow users to configure a custom storage location through settings
Scenario: History limits configuration
- WHEN the number of history records exceeds the configured limit
- THEN the system SHALL automatically remove the oldest records
- AND provide user settings to configure the maximum number of history records
Requirement: History Data Persistence
The system SHALL ensure history data persists across application sessions.
Scenario: Data persistence
- WHEN the application is closed and reopened
- THEN the system SHALL preserve all saved history records
- AND maintain the same directory structure and file organization
- AND recover gracefully if the history index file is corrupted
MODIFIED Requirements
Requirement: Image Generation Workflow
The system SHALL integrate history saving into the existing image generation workflow.
Scenario: Enhanced image generation completion
- WHEN image generation is completed successfully
- THEN the system SHALL perform all existing success behaviors (display image, enable download)
- AND additionally save the image and metadata to local history
- AND update the history index with the new record
Scenario: Error handling in history saving
- WHEN history saving encounters an error
- THEN the system SHALL not affect the image generation success state
- AND log the error without interrupting user experience
- AND continue with normal image display and download functionality