Generating Text Content Using AI
Liferay DXP 2023.Q4+/Portal 7.4 GA98+
Web content 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 feature in the Web Content editor. Once configured, you can begin generating content to work with, in a few clicks.
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 the Control Panel tab → Instance Settings (under Configuration).
-
Click AI Creator under Content and Data.
-
Paste your OpenAI API key into the API Key field.
-
Click Save.
Adding an API Key to a Specific Site
By adding an API key in the scope of a specific site, 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.
-
Click Save.
You can enable or disable the AI Creator button by toggling the Enable OpenAI to Create Content checkbox. If you choose to disable the feature, the button does not appear in the Web Content editor.
Using AI Creator
After enabling the feature flag and configuring the API Key, AI Creator becomes available in the web content editor. To begin generating content, follow these steps:
-
Open the Global Menu() and select your site on the right.
-
Open the Product Menu () and select the Web Content app under Content & Data.
-
Click Add () to create a Basic Web Content article.
-
Click AI Creator.
-
In the AI Creator modal window, fill in these three fields:
- Description: The desired content (e.g. “A blog post about the sleeping habits of cats”).
- Tone: The tone for your text. There are five options available: Neutral, Casual, Friendly, Formal, and Academic.
- Word Count: An approximate word count for your text.
-
Click Create.
-
(Optional) If you don’t like the AI-generated content, you can click Try Again to regenerate the content.
ImportantEach request to generate content consumes OpenAI API tokens. When your limit is reached, a generic error message will appear.
-
Click Add to insert the content into your web content article.
You can now begin working with your generated content.