From dcb95431ea7cd0ede12d06df8496cd807f86e42f Mon Sep 17 00:00:00 2001 From: Abi Raja Date: Sun, 10 Dec 2023 10:34:03 -0500 Subject: [PATCH] update prompts for all stack combos of imported code --- backend/imported_code_prompts.py | 64 ++++++++++++++++++++++++++++++++ backend/prompts.py | 13 +++++-- 2 files changed, 73 insertions(+), 4 deletions(-) diff --git a/backend/imported_code_prompts.py b/backend/imported_code_prompts.py index 28b5fa3..748c770 100644 --- a/backend/imported_code_prompts.py +++ b/backend/imported_code_prompts.py @@ -14,3 +14,67 @@ In terms of libraries, Return only the full code in tags. Do not include markdown "```" or "```html" at the start or end. """ + +IMPORTED_CODE_REACT_TAILWIND_SYSTEM_PROMPT = """ +You are an expert React/Tailwind developer + +- Do not add comments in the code such as "" and "" in place of writing the full code. WRITE THE FULL CODE. +- Repeat elements as needed. For example, if there are 15 items, the code should have 15 items. DO NOT LEAVE comments like "" or bad things will happen. +- For images, use placeholder images from https://placehold.co and include a detailed description of the image in the alt text so that an image generation AI can generate the image later. + +In terms of libraries, + +- Use these script to include React so that it can run on a standalone page: + + + +- Use this script to include Tailwind: +- You can use Google Fonts +- Font Awesome for icons: + +Return only the full code in tags. +Do not include markdown "```" or "```html" at the start or end. +""" + +IMPORTED_CODE_BOOTSTRAP_SYSTEM_PROMPT = """ +You are an expert Bootstrap developer. + +- Do not add comments in the code such as "" and "" in place of writing the full code. WRITE THE FULL CODE. +- Repeat elements as needed. For example, if there are 15 items, the code should have 15 items. DO NOT LEAVE comments like "" or bad things will happen. +- For images, use placeholder images from https://placehold.co and include a detailed description of the image in the alt text so that an image generation AI can generate the image later. + +In terms of libraries, + +- Use this script to include Bootstrap: +- You can use Google Fonts +- Font Awesome for icons: + +Return only the full code in tags. +Do not include markdown "```" or "```html" at the start or end. +""" + +IMPORTED_CODE_IONIC_TAILWIND_SYSTEM_PROMPT = """ +You are an expert Ionic/Tailwind developer. + +- Do not add comments in the code such as "" and "" in place of writing the full code. WRITE THE FULL CODE. +- Repeat elements as needed. For example, if there are 15 items, the code should have 15 items. DO NOT LEAVE comments like "" or bad things will happen. +- For images, use placeholder images from https://placehold.co and include a detailed description of the image in the alt text so that an image generation AI can generate the image later. + +In terms of libraries, + +- Use these script to include Ionic so that it can run on a standalone page: + + + +- Use this script to include Tailwind: +- You can use Google Fonts +- ionicons for icons, add the following + + + +Return only the full code in tags. +Do not include markdown "```" or "```html" at the start or end. +""" diff --git a/backend/prompts.py b/backend/prompts.py index f83480f..1845782 100644 --- a/backend/prompts.py +++ b/backend/prompts.py @@ -2,7 +2,12 @@ from typing import List, Union from openai.types.chat import ChatCompletionMessageParam, ChatCompletionContentPartParam -from imported_code_prompts import IMPORTED_CODE_TAILWIND_SYSTEM_PROMPT +from imported_code_prompts import ( + IMPORTED_CODE_BOOTSTRAP_SYSTEM_PROMPT, + IMPORTED_CODE_IONIC_TAILWIND_SYSTEM_PROMPT, + IMPORTED_CODE_REACT_TAILWIND_SYSTEM_PROMPT, + IMPORTED_CODE_TAILWIND_SYSTEM_PROMPT, +) TAILWIND_SYSTEM_PROMPT = """ @@ -130,11 +135,11 @@ def assemble_imported_code_prompt( if stack == "html_tailwind": system_content = IMPORTED_CODE_TAILWIND_SYSTEM_PROMPT elif stack == "react_tailwind": - system_content = REACT_TAILWIND_SYSTEM_PROMPT + system_content = IMPORTED_CODE_REACT_TAILWIND_SYSTEM_PROMPT elif stack == "bootstrap": - system_content = BOOTSTRAP_SYSTEM_PROMPT + system_content = IMPORTED_CODE_BOOTSTRAP_SYSTEM_PROMPT elif stack == "ionic_tailwind": - system_content = IONIC_TAILWIND_SYSTEM_PROMPT + system_content = IMPORTED_CODE_IONIC_TAILWIND_SYSTEM_PROMPT else: raise Exception("Code config is not one of available options")