oo

Generating Images Using AI

Liferay DXP 2024.Q2+/Portal 7.4 GA120+

Important

ChatGPT integration for Documents and Media is currently behind a release feature flag (LPD-10793). Read Release Feature Flags for more information.

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

  1. Open the Global Menu (Global Menu) and navigate to Control PanelInstance Settings under Configuration.

  2. Click AI Creator under Content and Data.

  3. Paste your OpenAI API key into the API Key field.

  4. Select Enable DALL-E to Create Images.

  5. 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.

  1. Open the Product Menu (Product Menu icon) and select ConfigurationSite Settings.

  2. Click AI Creator under Content and Data.

  3. Paste your OpenAI API key into the API Key field.

  4. Select Enable DALL-E to Create Images.

  5. Click Save.

Note

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).

After enabling the feature flag, you can see the Create AI Image option.

  1. Open the Site Menu (Site Menu icon) and navigate to Content & DataDocuments and Media.

  2. Click New and select Create AI Image.

  3. In the modal window, fill out the form (see below for field descriptions).

    Important

    Each request to generate content consumes OpenAI API tokens. When you reach your limit, a generic error message appears.

    You can choose the content, the image size, and the number of images to generate.

  4. Click Add Selected.

  5. (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.