This project generates fairy tale character and background images using MidJourney and allows users to monitor the progress of image creation. Since MidJourney doesn't provide an official API, this server interacts with the MidJourney Proxy (novicezk/midjourney-proxy) to handle messages from the MidJourney Discord server.
- Selecting options for the protagonist's appearance (e.g., hairstyle, facial expression).

- Creating a character that closely resembles a hand-drawn sketch.

- Image Generation Request: Accepts
studentTaskId, fairy tale ID, and prompts for both characters and backgrounds from the client. - Main Character Image Creation: Generates the main character image first to maintain consistent style across all images.
- Asynchronous Image Generation: Once the reference image is ready, other character and background images are processed in parallel, without waiting for all images to complete.
- Image Progress Monitoring: Clients can query the API periodically to check the
progress,imageUrl, and the overallcompletedorerrorstatus.
- Client Request: The server receives
studentTaskId, fairy tale ID, and prompts for characters and background. - Main Character Image Creation: The server sends an image creation request to the MidJourney Proxy for the main character, which serves as a reference image for the rest.
- Asynchronous Image Creation: Once the reference image is ready, other images (characters and background) are processed concurrently in the background.
- Post-processing: After image generation, images may go through post-processing such as background removal or blurring.
-
IMAGINE Request:
- The server sends an
IMAGINErequest to the MidJourney Proxy. - The server fetches the status periodically and updates Firebase with the success/failure status until the process is complete.
- The server sends an
-
UPSCALE Request:
- After the
IMAGINErequest generates four images, the server requests to upscale a specific index. - The
UPSCALErequest is also handled by periodically fetching its status, and the final image is saved.
- After the
Handles the initial request to generate character and background images using the provided prompts.
Returns the current progress, image URL, and completion/error status for the images being generated.
Allows the client to regenerate a specific image by providing the imageId. This API triggers the creation of only the selected image without affecting the others.
MidJourney Proxy Config Updates
- Timeout Configuration: Resolved issues where some image generation progress wasn't being properly tracked. Set IMAGINE timeout to 2 minutes and UPSCALE timeout to 30 seconds.
- Concurrency Adjustments: Adjusted
coreSizeandqueueSizebased on the MidJourney Pro Plan, allowing for 12 concurrent tasks.