diff options
Diffstat (limited to 'src/client/apis/gpt/customization.ts')
-rw-r--r-- | src/client/apis/gpt/customization.ts | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/client/apis/gpt/customization.ts b/src/client/apis/gpt/customization.ts index f9dabd863..38458f22c 100644 --- a/src/client/apis/gpt/customization.ts +++ b/src/client/apis/gpt/customization.ts @@ -71,8 +71,8 @@ export const gptTrailSlideCustomization = async (inputText: string) => { }; // palette / styling -export const generatePalette = async (inputData: any) => { - let prompt = 'Dash is a hypermedia web application that allows users to organize documents of different media types into collections. I want you to come up with a cohesive color palette for a collection.'; +export const generatePalette = async (inputData: any, useImageData: boolean) => { + let prompt = 'Dash is a hypermedia web application that allows users to organize documents of different media types into collections. I want you to come up with cohesive color palettes for a collection.'; prompt += 'I am going to give you a json object of this format:' + JSON.stringify({ collectionDescription: 'string', documents: 'Document[]', imageColors: 'string[]' }) + @@ -82,7 +82,10 @@ export const generatePalette = async (inputData: any) => { textSize: 'number', textContent: 'string', }) + - '. Finally, imageColors are the main hex colors of the images in the collection. You are going to generate three distinct variants of color palettes for the user to choose from based mostly on collectionDescription, and loosely on the text content and text size of the documents. You should slightly take imageColors into account, but primarly focus on crafting a palette that matches the text content. The variants should start with a light palette and grow increasingly more intense and vibrant. Return a json array of three objects in this format:' + + (useImageData ? '. Finally, imageColors are the main hex colors of the images in the collection.' : '. Ignore imageColors.') + + 'You are going to generate three distinct variants of color palettes for the user to choose from based mostly on collectionDescription, and loosely on the text content and text size of the documents.' + + (useImageData && 'You should slightly take imageColors into account, but primarly focus on crafting a palette that matches the text content.') + + 'The variants should start with a light palette and grow increasingly more intense and vibrant. Return a json array of three objects in this format:' + JSON.stringify({ collectionBackgroundColor: 'string', documentsWithColors: 'DocumentWithColor[]', @@ -92,9 +95,9 @@ export const generatePalette = async (inputData: any) => { id: 'number', color: 'string', }) + - ", and each element’s color is based on the theme of the overall color palette and also by its document’s textContent. Please pay attention to aesthetics of how each document's color complement the background and each other and choose a variety of colors when appropriate. Respond with only the JSON array."; + ", and each element’s color is based on the theme of the overall color palette and also by its document’s textContent. Please pay attention to aesthetics of how each document's color complement the background and each other and choose a variety of colors when appropriate. Important: Respond with only the JSON array and no other text."; - // console.log('Prompt', prompt); + console.log('Prompt', prompt); try { const response = await openai.createChatCompletion({ model: 'gpt-4', |