diff --git a/servers/fastapi/api/v1/ppt/endpoints/prompts.py b/servers/fastapi/api/v1/ppt/endpoints/prompts.py index 6554d6ec..ddf12a5f 100644 --- a/servers/fastapi/api/v1/ppt/endpoints/prompts.py +++ b/servers/fastapi/api/v1/ppt/endpoints/prompts.py @@ -1,19 +1,26 @@ GENERATE_HTML_SYSTEM_PROMPT = """ -You need to generate html and tailwind code for given presentation slide image. You need to think through each design elements and then decide where each element should go. +You need to generate html and tailwind code for given presentation slide image. Generated code will be used as template for different content. You need to think through each design elements and then decide where each element should go. Follow these rules strictly: - Make sure the design from html and tailwind is exact to the slide. - Make sure all components are in their own place. -- Make sure size of elements are exact. -- Smallest of elements should be noted of and should be added as it is. +- Make sure size of elements are exact. Check sizes of images and other elements from OXML and convert them to pixels. +- Make sure all components should be noted of and should be added as it is. - Image's and icons's size and position should be added exactly as it is. -- Read through the OXML data of slide and then match exact position ans size of elements. Make sure to convert between dimension and pixels. +- Read through the OXML data of slide and then match exact position ans size of elements. Make sure to convert between dimension and pixels. +- Make sure the vertical and horizonal spacing between elements are same as in the image. Try to get spacing from the OXML document as well. Make sure no elements overflows because of high spacing. +- Do not use absolute position unless absolutely necessary. Use flex, grid and spacing to properly arrange components. +- First, layout everything using flex or grid. Try to fit all the components using this layout. Finally, if you cannot layout any element without flex and grid, then only use absolute to place the element. +- Analyze each text's available space and it's design, and give minimum characters to fill in the text for the space and context and maximum that the space can handle. Be conservative with how many characters text space can handle. Make sure no text overflows and decide as to not disrupt the slide. Do this for every text. +- Bullet elements or bullet cards (one with pointers) should be placed one after another and should be flexible to hold more or less bullet points than in the image. Analyze the number of bullet points the slide can handle and add style properties accordingly. Also add a comment below the bullets for min and max bullet points supported. Make sure the number you quote should fit in the available space. Don't be too ambitious. +- For each text add font size and font family as tailwind property. Preferably pick them from OXML and convert dimensions instead of guessing from given image. +- Make sure that no elements overflow or exceed slide bounding in any way. - Properly export shapes as exact SVG. - Add relevant font in tailwind to all texts. -- Wrap the output code inside these classes: \"relative w-full rounded-sm max-w-[1280px] shadow-lg max-h-[720px] aspect-video bg-white relative z-20 mx-auto overflow-hidden\". -- For image everywhere use /static/images/placeholder.jpg +- Wrap the output code inside these classes: \\\"relative w-full rounded-sm max-w-[1280px] shadow-lg max-h-[720px] aspect-video bg-white relative z-20 mx-auto overflow-hidden\\\". +- For image everywhere use https://images.pexels.com/photos/31527637/pexels-photo-31527637.jpeg - Image should never be inside of a SVG. -- Give out only HTML and Tailwind code. No other texts or explanations. - """ +- Give out only HTML and Tailwind code. No other texts or explanations. +""" HTML_TO_REACT_SYSTEM_PROMPT = """ Convert given static HTML and Tailwind slide to a TSX React component so that it can be dynamically populated. Follow these rules strictly while converting: @@ -27,6 +34,8 @@ Convert given static HTML and Tailwind slide to a TSX React component so that it 7) For image and icons schema should be compulsorily declared with two dunder fields for prompt and url separately. 8) Component name at the end should always yo 'dynamicSlideLayout'. 9) **Import or export statements should not be present in the output.** + - Don't give "import {React} from 'react'" + - Don't give "import {z} from 'zod'" 10) Always use double quotes for strings. 11) Layout Id, layout name and layout description should be declared and should describe the structure of the layout not its purpose. Do not describe numbers of any items in the layout. -layoutDescription should not have any purpose for elements in it, so use '...cards' instead of '...goal cards' and '...bullet points' instead of '...solution bullet points'. @@ -35,7 +44,7 @@ Convert given static HTML and Tailwind slide to a TSX React component so that it -Layout Id examples: header-description-bullet-points-slide, header-description-image-slide -Layout Name examples: HeaderDescriptionBulletPointsLayout, HeaderDescriptionImageLayout -Layout Description examples: A slide with a header, description, and bullet points and A slide with a header, description, and image - +12. Only give Code and nothing else. No other text or comments. For example: Input:
Effects of Global Warming

Global warming triggers a cascade of effects on our planet. These changes impact everything from our oceans to our ecosystems.
Rising Sea Levels
Rising sea levels threaten coastal communities and ecosystems due to melting glaciers and thermal expansion.
Intense Heatwaves
Heatwaves are becoming more frequent and intense, posing significant risks to human health and agriculture.
Changes in Precipitation
Altered precipitation patterns lead to increased droughts in some regions and severe flooding in others, affecting water resources.