Generating Images Using AI
Liferay DXP 2024.Q2+/Portal 7.4 GA120+
The Documents and Media application provides integration with OpenAI’s ChatGPT engine using the AI Creator tool. With an OpenAI API key configured for your instance or site, you can use the AI Creator tool and generate images throughout the portal.
Enabling AI Creator
To begin, you must add an API key to authenticate your access to ChatGPT. You can add it to a Liferay instance through Instance Settings or add it to a specific site.
Adding an API Key to a Liferay Instance
-
Open the Global Menu () and navigate to Control Panel → Instance Settings under Configuration.
-
Click AI Creator under Content and Data.
-
Paste your OpenAI API key into the API Key field.
-
Select Enable DALL-E to Create Images.
-
Click Save.
Adding an API Key to a Specific Site
By adding an API key at the site scope, you can use different keys for each site or disable a key in a specific site.
-
Open the Product Menu () and select Configuration → Site Settings.
-
Click AI Creator under Content and Data.
-
Paste your OpenAI API key into the API Key field.
-
Select Enable DALL-E to Create Images.
-
Click Save.
You can enable or disable the Create AI Image button by toggling the Enable DALL-E to Create Images checkbox. If you choose to disable the feature, the Create AI Image button does not appear when creating a new document.
Using The AI Creator
After enabling the feature flag and configuring the API Key, the Create AI Image button becomes available wherever you can add a new image, either in your Documents and Media application (1) or through the item selector on the Documents and Media tab (e.g., when adding an image in your WYSIWYG editors) (2).
-
Open the Site Menu () and navigate to Content & Data → Documents and Media.
-
Click New and select Create AI Image.
-
In the modal window, fill out the form (see below for field descriptions).
ImportantEach request to generate content consumes OpenAI API tokens. When you reach your limit, a generic error message appears.
-
Click Add Selected.
-
(Optional) If you don’t like the AI-generated content, click Try Again to regenerate it.
Note that regenerating the images replaces existing ones. If you wish to keep any of the current images, be sure to save them before starting the image generation process again.
Description: The prompt or textual description that outlines the desired content, theme, or concept for the generated image.
Image Size: Choose an image size: 256x256, 512x512, or 1024x1024.
Number of Images to Generate: Determine how many images you want to create per request, up to a maximum of four images.
You can now begin using your generated images.