From 4972e65603c83c2345c46ed2591a12c13118b5a6 Mon Sep 17 00:00:00 2001 From: Darin Kotter Date: Thu, 12 Dec 2024 10:44:18 -0700 Subject: [PATCH] Add a link to our example prompts doc from the settings screen. Modify the default prompt a bit --- .../Features/DescriptiveTextGenerator.php | 2 +- .../provider-settings/openai-chatgpt.js | 22 +++++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/includes/Classifai/Features/DescriptiveTextGenerator.php b/includes/Classifai/Features/DescriptiveTextGenerator.php index 8242f64c1..180410194 100644 --- a/includes/Classifai/Features/DescriptiveTextGenerator.php +++ b/includes/Classifai/Features/DescriptiveTextGenerator.php @@ -27,7 +27,7 @@ class DescriptiveTextGenerator extends Feature { * * @var string */ - public $prompt = 'You are an assistant that generates descriptions of images that are used on a website. You will be provided with an image and will describe the main item you see in the image, giving details but staying concise. There is no need to say "the image contains" or similar, just describe what is actually in the image. This text will be important for screen readers, so make sure it is descriptive and accurate but not overly verbose.'; + public $prompt = 'You are an assistant that generates descriptions of images that are used on a website. You will be provided with an image and will describe the main item you see in the image, giving details but staying concise. There is no need to say "the image contains" or similar, just describe what is actually in the image. This text will be important for screen readers, so make sure it is descriptive and accurate but not overly verbose. Before returning the text, re-evaluate your response and ensure you are following the above points, in particular ensuring the text is concise.'; /** * Constructor. diff --git a/src/js/settings/components/provider-settings/openai-chatgpt.js b/src/js/settings/components/provider-settings/openai-chatgpt.js index 1721dab71..e4de4faa8 100644 --- a/src/js/settings/components/provider-settings/openai-chatgpt.js +++ b/src/js/settings/components/provider-settings/openai-chatgpt.js @@ -51,6 +51,23 @@ export const OpenAIChatGPTSettings = ( { isConfigured = false } ) => { { __( 'in order to get your API key.', 'classifai' ) } ); + const promptExamples = ( + <> + { __( 'Add a custom prompt, if desired. ', 'classifai' ) } + { __( 'See our ', 'classifai' ) } + + { __( 'documentation', 'classifai' ) } + + { __( + ' for some example prompts you can try that have been tested for specific use cases.', + 'classifai' + ) } + + ); return ( <> @@ -93,10 +110,7 @@ export const OpenAIChatGPTSettings = ( { isConfigured = false } ) => { ) && (