Upload 4 files
Browse files- .gitignore +47 -0
- app.py +814 -0
- prompt.py +247 -0
- requirements.txt +3 -0
.gitignore
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Python
|
| 2 |
+
__pycache__/
|
| 3 |
+
*.py[cod]
|
| 4 |
+
*$py.class
|
| 5 |
+
*.so
|
| 6 |
+
.Python
|
| 7 |
+
env/
|
| 8 |
+
venv/
|
| 9 |
+
ENV/
|
| 10 |
+
build/
|
| 11 |
+
develop-eggs/
|
| 12 |
+
dist/
|
| 13 |
+
downloads/
|
| 14 |
+
eggs/
|
| 15 |
+
.eggs/
|
| 16 |
+
lib/
|
| 17 |
+
lib64/
|
| 18 |
+
parts/
|
| 19 |
+
sdist/
|
| 20 |
+
var/
|
| 21 |
+
wheels/
|
| 22 |
+
*.egg-info/
|
| 23 |
+
.installed.cfg
|
| 24 |
+
*.egg
|
| 25 |
+
|
| 26 |
+
# Environment
|
| 27 |
+
.env
|
| 28 |
+
.venv
|
| 29 |
+
|
| 30 |
+
# IDE
|
| 31 |
+
.vscode/
|
| 32 |
+
.idea/
|
| 33 |
+
*.swp
|
| 34 |
+
*.swo
|
| 35 |
+
*~
|
| 36 |
+
|
| 37 |
+
# Gradio
|
| 38 |
+
flagged/
|
| 39 |
+
*.txt
|
| 40 |
+
!requirements.txt
|
| 41 |
+
|
| 42 |
+
# OS
|
| 43 |
+
.DS_Store
|
| 44 |
+
Thumbs.db
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from huggingface_hub import InferenceClient
|
| 3 |
+
import os
|
| 4 |
+
from datetime import datetime
|
| 5 |
+
|
| 6 |
+
# Import all prompts and constants from prompts.py
|
| 7 |
+
from prompts import (
|
| 8 |
+
SEARCH_START, DIVIDER, REPLACE_END,
|
| 9 |
+
TITLE_PAGE_START, TITLE_PAGE_END,
|
| 10 |
+
NEW_PAGE_START, NEW_PAGE_END,
|
| 11 |
+
UPDATE_PAGE_START, UPDATE_PAGE_END,
|
| 12 |
+
WEB_DEV_QUESTIONS, PROMPT_FOR_IMAGE_GENERATION,
|
| 13 |
+
INITIAL_SYSTEM_PROMPT, FOLLOW_UP_SYSTEM_PROMPT,
|
| 14 |
+
PROMPT_ENGINEER_SYSTEM_PROMPT, SUGGESTED_ANSWERS,
|
| 15 |
+
HTML_TEMPLATE_EXAMPLE, CDN_LINKS,
|
| 16 |
+
AVAILABLE_MODELS, DEFAULT_MODEL
|
| 17 |
+
)
|
| 18 |
+
|
| 19 |
+
# Initialize the Hugging Face Inference Client
|
| 20 |
+
client = InferenceClient(token=os.getenv("HF_TOKEN"))
|
| 21 |
+
|
| 22 |
+
class WebsitePromptEnhancer:
|
| 23 |
+
def __init__(self):
|
| 24 |
+
self.context = []
|
| 25 |
+
self.current_question_idx = 0
|
| 26 |
+
self.user_responses = {}
|
| 27 |
+
self.initial_prompt = ""
|
| 28 |
+
self.is_update = False
|
| 29 |
+
|
| 30 |
+
def reset(self):
|
| 31 |
+
self.context = []
|
| 32 |
+
self.current_question_idx = 0
|
| 33 |
+
self.user_responses = {}
|
| 34 |
+
self.initial_prompt = ""
|
| 35 |
+
self.is_update = False
|
| 36 |
+
|
| 37 |
+
def start_enhancement(self, initial_prompt):
|
| 38 |
+
self.reset()
|
| 39 |
+
self.initial_prompt = initial_prompt
|
| 40 |
+
self.current_question_idx = 0
|
| 41 |
+
return self.get_next_question()
|
| 42 |
+
|
| 43 |
+
def get_next_question(self):
|
| 44 |
+
if self.current_question_idx < len(WEB_DEV_QUESTIONS):
|
| 45 |
+
return WEB_DEV_QUESTIONS[self.current_question_idx]
|
| 46 |
+
return None
|
| 47 |
+
|
| 48 |
+
def get_suggested_answer(self):
|
| 49 |
+
"""Generate suggested answer based on context"""
|
| 50 |
+
if self.current_question_idx < len(WEB_DEV_QUESTIONS):
|
| 51 |
+
return SUGGESTED_ANSWERS.get(self.current_question_idx, "")
|
| 52 |
+
return ""
|
| 53 |
+
|
| 54 |
+
def process_answer(self, answer):
|
| 55 |
+
if self.current_question_idx < len(WEB_DEV_QUESTIONS):
|
| 56 |
+
question = WEB_DEV_QUESTIONS[self.current_question_idx]
|
| 57 |
+
self.user_responses[question] = answer
|
| 58 |
+
self.context.append(f"Q: {question}\nA: {answer}")
|
| 59 |
+
|
| 60 |
+
# Check if it's an update request
|
| 61 |
+
if self.current_question_idx == len(WEB_DEV_QUESTIONS) - 1:
|
| 62 |
+
if "update" in answer.lower() or "modify" in answer.lower() or "change" in answer.lower():
|
| 63 |
+
self.is_update = True
|
| 64 |
+
|
| 65 |
+
self.current_question_idx += 1
|
| 66 |
+
|
| 67 |
+
next_q = self.get_next_question()
|
| 68 |
+
return next_q
|
| 69 |
+
|
| 70 |
+
def generate_enhanced_prompt(self, model_name=DEFAULT_MODEL):
|
| 71 |
+
# Extract structured information from responses
|
| 72 |
+
website_type = self.user_responses.get(WEB_DEV_QUESTIONS[0], "website")
|
| 73 |
+
purpose = self.user_responses.get(WEB_DEV_QUESTIONS[1], "general purpose")
|
| 74 |
+
audience = self.user_responses.get(WEB_DEV_QUESTIONS[2], "general audience")
|
| 75 |
+
sections = self.user_responses.get(WEB_DEV_QUESTIONS[3], "Home, About, Contact")
|
| 76 |
+
color_scheme = self.user_responses.get(WEB_DEV_QUESTIONS[4], "modern and professional")
|
| 77 |
+
features = self.user_responses.get(WEB_DEV_QUESTIONS[5], "responsive design")
|
| 78 |
+
update_type = self.user_responses.get(WEB_DEV_QUESTIONS[6], "new website")
|
| 79 |
+
|
| 80 |
+
# Determine if it's an update or new website
|
| 81 |
+
is_update = "update" in update_type.lower() or "modify" in update_type.lower()
|
| 82 |
+
|
| 83 |
+
enhancement_prompt = f"""Create a detailed prompt for an AI code agent to build a professional website based on these requirements:
|
| 84 |
+
|
| 85 |
+
Project: {self.initial_prompt}
|
| 86 |
+
Type: {website_type}
|
| 87 |
+
Purpose: {purpose}
|
| 88 |
+
Target Audience: {audience}
|
| 89 |
+
Required Sections/Pages: {sections}
|
| 90 |
+
Design Theme: {color_scheme}
|
| 91 |
+
Features: {features}
|
| 92 |
+
Request Type: {"Update existing website" if is_update else "Create new website"}
|
| 93 |
+
|
| 94 |
+
Generate a comprehensive, production-ready specification following the AI code agent format.
|
| 95 |
+
The output should be a clean prompt (no Q&A) that includes:
|
| 96 |
+
1. Clear project description
|
| 97 |
+
2. Required pages/sections with specific details
|
| 98 |
+
3. Design specifications (colors, layout, typography)
|
| 99 |
+
4. Feature requirements with implementation details
|
| 100 |
+
5. Technical stack specifications (TailwindCSS, Feather Icons, AOS, Vanta.js)
|
| 101 |
+
6. Responsive design requirements
|
| 102 |
+
7. Accessibility guidelines
|
| 103 |
+
8. Image placeholder usage (static.photos)
|
| 104 |
+
|
| 105 |
+
The prompt should be ready to paste directly into an AI code agent system."""
|
| 106 |
+
|
| 107 |
+
try:
|
| 108 |
+
messages = [
|
| 109 |
+
{"role": "system", "content": PROMPT_ENGINEER_SYSTEM_PROMPT},
|
| 110 |
+
{"role": "user", "content": enhancement_prompt}
|
| 111 |
+
]
|
| 112 |
+
|
| 113 |
+
response = client.chat_completion(
|
| 114 |
+
messages=messages,
|
| 115 |
+
model=model_name,
|
| 116 |
+
max_tokens=3000,
|
| 117 |
+
temperature=0.7,
|
| 118 |
+
stream=False
|
| 119 |
+
)
|
| 120 |
+
|
| 121 |
+
enhanced_prompt = response.choices[0].message.content
|
| 122 |
+
return self._format_for_code_agent(enhanced_prompt, is_update)
|
| 123 |
+
|
| 124 |
+
except Exception as e:
|
| 125 |
+
try:
|
| 126 |
+
full_prompt = f"{PROMPT_ENGINEER_SYSTEM_PROMPT}\n\n{enhancement_prompt}"
|
| 127 |
+
response = client.text_generation(
|
| 128 |
+
full_prompt,
|
| 129 |
+
model=model_name,
|
| 130 |
+
max_new_tokens=3000,
|
| 131 |
+
temperature=0.7,
|
| 132 |
+
return_full_text=False
|
| 133 |
+
)
|
| 134 |
+
return self._format_for_code_agent(response, is_update)
|
| 135 |
+
except Exception as e2:
|
| 136 |
+
return self._create_fallback_prompt(
|
| 137 |
+
website_type, purpose, audience, sections,
|
| 138 |
+
color_scheme, features, is_update
|
| 139 |
+
)
|
| 140 |
+
|
| 141 |
+
def _format_for_code_agent(self, prompt, is_update=False):
|
| 142 |
+
"""Format the prompt to work with the AI code agent system"""
|
| 143 |
+
|
| 144 |
+
formatted_prompt = f"""# AI Code Agent Prompt - Website Generation
|
| 145 |
+
|
| 146 |
+
{prompt}
|
| 147 |
+
|
| 148 |
+
---
|
| 149 |
+
|
| 150 |
+
## Technical Requirements for AI Code Agent
|
| 151 |
+
|
| 152 |
+
### Technology Stack
|
| 153 |
+
- **CSS Framework:** TailwindCSS (CDN: {CDN_LINKS['tailwind']})
|
| 154 |
+
- **Icons:** Feather Icons ({CDN_LINKS['feather_icons']})
|
| 155 |
+
- **Scroll Animations:** AOS.js ({CDN_LINKS['aos_css']})
|
| 156 |
+
- **Interactive Animations:** Vanta.js ({CDN_LINKS['vanta_globe']})
|
| 157 |
+
- **Additional:** Anime.js for advanced animations
|
| 158 |
+
|
| 159 |
+
### Image Placeholders
|
| 160 |
+
{PROMPT_FOR_IMAGE_GENERATION}
|
| 161 |
+
|
| 162 |
+
### Output Format Instructions
|
| 163 |
+
{"**For Updates/Modifications:**" if is_update else "**For New Website:**"}
|
| 164 |
+
|
| 165 |
+
{'Use the UPDATE_PAGE format:' if is_update else 'Use the TITLE_PAGE format:'}"""
|
| 166 |
+
|
| 167 |
+
if is_update:
|
| 168 |
+
formatted_prompt += f"""
|
| 169 |
+
1. Start with: {UPDATE_PAGE_START}
|
| 170 |
+
2. Specify the page name (e.g., index.html)
|
| 171 |
+
3. Close with: {UPDATE_PAGE_END}
|
| 172 |
+
4. Use SEARCH/REPLACE blocks:
|
| 173 |
+
- {SEARCH_START}
|
| 174 |
+
- (exact code to replace)
|
| 175 |
+
- {DIVIDER}
|
| 176 |
+
- (new code)
|
| 177 |
+
- {REPLACE_END}
|
| 178 |
+
|
| 179 |
+
For new pages during update:
|
| 180 |
+
1. Start with: {NEW_PAGE_START}
|
| 181 |
+
2. Specify page name (e.g., about.html)
|
| 182 |
+
3. Close with: {NEW_PAGE_END}
|
| 183 |
+
4. Provide complete HTML in ```html``` blocks
|
| 184 |
+
5. Update navigation links in all existing pages"""
|
| 185 |
+
else:
|
| 186 |
+
formatted_prompt += f"""
|
| 187 |
+
1. Start with: {TITLE_PAGE_START}
|
| 188 |
+
2. Add page name (e.g., index.html)
|
| 189 |
+
3. Close with: {TITLE_PAGE_END}
|
| 190 |
+
4. Provide complete HTML in ```html``` blocks
|
| 191 |
+
5. First file must be index.html
|
| 192 |
+
6. Include all required CDN links in <head>
|
| 193 |
+
7. Initialize all libraries in <body>"""
|
| 194 |
+
|
| 195 |
+
formatted_prompt += f"""
|
| 196 |
+
|
| 197 |
+
### Required Code Structure
|
| 198 |
+
|
| 199 |
+
**Every HTML file must include:**
|
| 200 |
+
|
| 201 |
+
```html
|
| 202 |
+
{HTML_TEMPLATE_EXAMPLE}
|
| 203 |
+
```
|
| 204 |
+
|
| 205 |
+
### Design Guidelines
|
| 206 |
+
- Mobile-first responsive design using TailwindCSS
|
| 207 |
+
- Use semantic HTML5 elements
|
| 208 |
+
- Implement smooth scroll animations with AOS
|
| 209 |
+
- Add interactive animations where appropriate (Vanta.js)
|
| 210 |
+
- Use Feather icons for all icons: <i data-feather="icon-name"></i>
|
| 211 |
+
- Ensure accessibility (ARIA labels, semantic tags)
|
| 212 |
+
- Cross-browser compatibility
|
| 213 |
+
- Performance optimized
|
| 214 |
+
|
| 215 |
+
### Navigation
|
| 216 |
+
- For multi-page websites: Use <a href="page.html"> (no onclick)
|
| 217 |
+
- Ensure all pages have consistent navigation
|
| 218 |
+
- Mobile-responsive hamburger menu
|
| 219 |
+
|
| 220 |
+
### Ready for AI Code Agent
|
| 221 |
+
This prompt is formatted for direct use with AI code agents.
|
| 222 |
+
Simply paste it into your AI coding assistant to generate the website."""
|
| 223 |
+
return formatted_prompt
|
| 224 |
+
|
| 225 |
+
def _create_fallback_prompt(self, website_type, purpose, audience, sections, color_scheme, features, is_update=False):
|
| 226 |
+
"""Create a detailed fallback prompt in code agent format"""
|
| 227 |
+
|
| 228 |
+
sections_list = [s.strip() for s in sections.split(',')]
|
| 229 |
+
|
| 230 |
+
fallback = f"""# AI Code Agent Prompt - Professional Website Project Overview
|
| 231 |
+
Create a professional {website_type} website optimized for {audience}.
|
| 232 |
+
|
| 233 |
+
Primary Goal: {purpose}
|
| 234 |
+
|
| 235 |
+
Design Theme: {color_scheme} with modern UI/UX
|
| 236 |
+
|
| 237 |
+
Required Pages/Sections
|
| 238 |
+
"""
|
| 239 |
+
for i, section in enumerate(sections_list, 1):
|
| 240 |
+
fallback += f"{i}. **{section.strip()}** - Complete page with relevant content\n"
|
| 241 |
+
|
| 242 |
+
fallback += f"""Feature Requirements
|
| 243 |
+
{features}
|
| 244 |
+
|
| 245 |
+
Core Features:
|
| 246 |
+
✅ Fully responsive design (mobile, tablet, desktop)
|
| 247 |
+
✅ Smooth scroll animations using AOS.js
|
| 248 |
+
✅ Modern icons using Feather Icons
|
| 249 |
+
✅ Interactive animations with Vanta.js (hero section)
|
| 250 |
+
✅ TailwindCSS for all styling
|
| 251 |
+
✅ Contact forms with validation (if applicable)
|
| 252 |
+
✅ Image galleries with lightbox effect
|
| 253 |
+
✅ Smooth navigation with active states
|
| 254 |
+
✅ Loading animations and transitions
|
| 255 |
+
✅ Accessibility compliant (WCAG 2.1)
|
| 256 |
+
|
| 257 |
+
## Technology Stack
|
| 258 |
+
### Required Libraries (CDN)
|
| 259 |
+
<!-- TailwindCSS -->
|
| 260 |
+
<script src="{CDN_LINKS['tailwind']}"></script>
|
| 261 |
+
|
| 262 |
+
<!-- AOS Scroll Animations -->
|
| 263 |
+
<link href="{CDN_LINKS['aos_css']}" rel="stylesheet">
|
| 264 |
+
<script src="{CDN_LINKS['aos_js']}"></script>
|
| 265 |
+
|
| 266 |
+
<!-- Feather Icons -->
|
| 267 |
+
<script src="{CDN_LINKS['feather_icons_min']}"></script>
|
| 268 |
+
<script src="{CDN_LINKS['feather_icons']}"></script>
|
| 269 |
+
|
| 270 |
+
<!-- Anime.js -->
|
| 271 |
+
<script src="{CDN_LINKS['anime_js']}"></script>
|
| 272 |
+
|
| 273 |
+
<!-- Vanta.js (for hero backgrounds) -->
|
| 274 |
+
<script src="{CDN_LINKS['vanta_globe']}"></script>
|
| 275 |
+
|
| 276 |
+
## Design Specifications
|
| 277 |
+
### Color Scheme
|
| 278 |
+
Primary theme: {color_scheme}
|
| 279 |
+
|
| 280 |
+
Suggested TailwindCSS Colors:
|
| 281 |
+
- Primary: bg-blue-600, text-blue-600
|
| 282 |
+
- Secondary: bg-gray-800, text-gray-800
|
| 283 |
+
- Accent: bg-purple-500, text-purple-500
|
| 284 |
+
- Background: bg-white, bg-gray-50
|
| 285 |
+
- Text: text-gray-900, text-gray-600
|
| 286 |
+
|
| 287 |
+
### Typography
|
| 288 |
+
- Headings: Bold, large (text-4xl, text-5xl, font-bold)
|
| 289 |
+
- Body: Readable size (text-base, text-lg)
|
| 290 |
+
- Use TailwindCSS typography utilities
|
| 291 |
+
|
| 292 |
+
### Layout Structure
|
| 293 |
+
- Header: Fixed/sticky navigation with logo and menu
|
| 294 |
+
- Hero Section: Full-screen with Vanta.js background animation
|
| 295 |
+
- Content Sections: Alternating layouts with AOS animations
|
| 296 |
+
- Footer: Links, social media, copyright
|
| 297 |
+
|
| 298 |
+
### Responsive Breakpoints
|
| 299 |
+
- Mobile: sm: (640px)
|
| 300 |
+
- Tablet: md: (768px)
|
| 301 |
+
- Desktop: lg: (1024px)
|
| 302 |
+
- Large: xl: (1280px)
|
| 303 |
+
|
| 304 |
+
### Image Guidelines
|
| 305 |
+
Use Static.Photos for Placeholders
|
| 306 |
+
{PROMPT_FOR_IMAGE_GENERATION}
|
| 307 |
+
|
| 308 |
+
Recommended Usage:
|
| 309 |
+
- Hero images: http://static.photos/abstract/1200x630/1
|
| 310 |
+
- Portfolio/Gallery: http://static.photos/technology/640x360/[1-10]
|
| 311 |
+
- Team photos: http://static.photos/people/320x240/[1-5]
|
| 312 |
+
- Background images: http://static.photos/minimal/1024x576/42
|
| 313 |
+
|
| 314 |
+
### Animation Requirements
|
| 315 |
+
#### AOS Scroll Animations
|
| 316 |
+
Use on all major sections:
|
| 317 |
+
<div data-aos="fade-up" data-aos-duration="1000">
|
| 318 |
+
Content here
|
| 319 |
+
</div>
|
| 320 |
+
Available Effects: fade-up, fade-down, fade-left, fade-right, zoom-in, flip-up
|
| 321 |
+
|
| 322 |
+
#### Vanta.js Hero Background
|
| 323 |
+
Implement on hero section:
|
| 324 |
+
<script>
|
| 325 |
+
VANTA.GLOBE({{
|
| 326 |
+
el: "#hero",
|
| 327 |
+
mouseControls: true,
|
| 328 |
+
touchControls: true,
|
| 329 |
+
gyroControls: false,
|
| 330 |
+
minHeight: 200.00,
|
| 331 |
+
minWidth: 200.00,
|
| 332 |
+
scale: 1.00,
|
| 333 |
+
scaleMobile: 1.00,
|
| 334 |
+
color: 0x3b82f6,
|
| 335 |
+
backgroundColor: 0x0f172a
|
| 336 |
+
}})
|
| 337 |
+
</script>
|
| 338 |
+
|
| 339 |
+
#### Feather Icons Usage
|
| 340 |
+
<i data-feather="menu"></i>
|
| 341 |
+
<i data-feather="mail"></i>
|
| 342 |
+
<i data-feather="phone"></i>
|
| 343 |
+
<i data-feather="github"></i>
|
| 344 |
+
|
| 345 |
+
### Code Structure Format
|
| 346 |
+
{"Update Format (Modifying Existing Pages)" if is_update else "New Website Format"}
|
| 347 |
+
{"Use UPDATE_PAGE blocks:" if is_update else "Use TITLE_PAGE blocks:"}"""
|
| 348 |
+
|
| 349 |
+
if is_update:
|
| 350 |
+
fallback += f"""
|
| 351 |
+
{UPDATE_PAGE_START}index.html{UPDATE_PAGE_END}
|
| 352 |
+
|
| 353 |
+
{SEARCH_START}
|
| 354 |
+
<h1>Old Title</h1>
|
| 355 |
+
{DIVIDER}
|
| 356 |
+
<h1 class="text-4xl font-bold text-blue-600">New Title</h1>
|
| 357 |
+
{REPLACE_END}
|
| 358 |
+
|
| 359 |
+
For adding new pages:
|
| 360 |
+
{NEW_PAGE_START}about.html{NEW_PAGE_END}
|
| 361 |
+
```html
|
| 362 |
+
{HTML_TEMPLATE_EXAMPLE}
|
| 363 |
+
```"""
|
| 364 |
+
else:
|
| 365 |
+
fallback += f"""
|
| 366 |
+
{TITLE_PAGE_START}index.html{TITLE_PAGE_END}
|
| 367 |
+
```html
|
| 368 |
+
{HTML_TEMPLATE_EXAMPLE}
|
| 369 |
+
```"""
|
| 370 |
+
|
| 371 |
+
fallback += """
|
| 372 |
+
## Quality Standards
|
| 373 |
+
### Code Quality
|
| 374 |
+
- Clean, well-commented code
|
| 375 |
+
- Proper indentation and formatting
|
| 376 |
+
- Semantic HTML5 elements
|
| 377 |
+
- Modular CSS with TailwindCSS utilities
|
| 378 |
+
- Efficient JavaScript
|
| 379 |
+
|
| 380 |
+
### Accessibility
|
| 381 |
+
- ARIA labels on interactive elements
|
| 382 |
+
- Alt text on all images
|
| 383 |
+
- Proper heading hierarchy (h1-h6)
|
| 384 |
+
- Keyboard navigation support
|
| 385 |
+
- Sufficient color contrast
|
| 386 |
+
|
| 387 |
+
### Performance
|
| 388 |
+
- Optimized images
|
| 389 |
+
- Minified assets where possible
|
| 390 |
+
- Efficient animations
|
| 391 |
+
- Fast loading times (<3 seconds)
|
| 392 |
+
- Mobile-optimized
|
| 393 |
+
|
| 394 |
+
### Browser Compatibility
|
| 395 |
+
- Chrome, Firefox, Safari, Edge (latest 2 versions)
|
| 396 |
+
- iOS Safari and Chrome Mobile
|
| 397 |
+
- Graceful degradation for older browsers
|
| 398 |
+
|
| 399 |
+
## Deliverable
|
| 400 |
+
Create a complete, production-ready website that:
|
| 401 |
+
✅ Follows all format requirements for the AI code agent
|
| 402 |
+
✅ Includes all specified pages/sections
|
| 403 |
+
✅ Uses TailwindCSS for ALL styling
|
| 404 |
+
✅ Implements animations (AOS, Vanta.js)
|
| 405 |
+
✅ Uses Feather Icons for all icons
|
| 406 |
+
✅ Uses static.photos for all images
|
| 407 |
+
✅ Is fully responsive (mobile-first)
|
| 408 |
+
✅ Is accessible (WCAG 2.1 AA)
|
| 409 |
+
✅ Has clean, professional code
|
| 410 |
+
✅ Is ready for immediate deployment
|
| 411 |
+
|
| 412 |
+
Generate the complete website code now following the format specified above."""
|
| 413 |
+
return fallback
|
| 414 |
+
|
| 415 |
+
# Initialize enhancer
|
| 416 |
+
enhancer = WebsitePromptEnhancer()
|
| 417 |
+
|
| 418 |
+
# Gradio Interface Functions
|
| 419 |
+
def submit_answer(answer):
|
| 420 |
+
if not answer.strip():
|
| 421 |
+
return (
|
| 422 |
+
"",
|
| 423 |
+
"",
|
| 424 |
+
"",
|
| 425 |
+
gr.update(interactive=False),
|
| 426 |
+
gr.update(interactive=False),
|
| 427 |
+
gr.update(visible=False),
|
| 428 |
+
"⚠️ Please enter your initial website idea first!",
|
| 429 |
+
"",
|
| 430 |
+
gr.update(visible=False)
|
| 431 |
+
)
|
| 432 |
+
|
| 433 |
+
next_question = enhancer.process_answer(answer)
|
| 434 |
+
|
| 435 |
+
if next_question:
|
| 436 |
+
suggestion = enhancer.get_suggested_answer()
|
| 437 |
+
return (
|
| 438 |
+
next_question,
|
| 439 |
+
suggestion,
|
| 440 |
+
"",
|
| 441 |
+
gr.update(interactive=True),
|
| 442 |
+
gr.update(interactive=True),
|
| 443 |
+
gr.update(visible=False),
|
| 444 |
+
f"✅ Progress: {enhancer.current_question_idx}/{len(WEB_DEV_QUESTIONS)} questions answered",
|
| 445 |
+
"",
|
| 446 |
+
gr.update(visible=False)
|
| 447 |
+
)
|
| 448 |
+
else:
|
| 449 |
+
return (
|
| 450 |
+
"🎉 All questions completed! Click 'Generate Enhanced Prompt' below.",
|
| 451 |
+
"",
|
| 452 |
+
"",
|
| 453 |
+
gr.update(interactive=False),
|
| 454 |
+
gr.update(interactive=False),
|
| 455 |
+
gr.update(visible=True),
|
| 456 |
+
"✅ All questions answered! Ready to generate your AI Code Agent prompt.",
|
| 457 |
+
"",
|
| 458 |
+
gr.update(visible=False)
|
| 459 |
+
)
|
| 460 |
+
|
| 461 |
+
def start_process(initial_prompt):
|
| 462 |
+
if not initial_prompt.strip():
|
| 463 |
+
return (
|
| 464 |
+
"",
|
| 465 |
+
"",
|
| 466 |
+
"",
|
| 467 |
+
gr.update(interactive=False),
|
| 468 |
+
gr.update(interactive=False),
|
| 469 |
+
gr.update(visible=False),
|
| 470 |
+
"⚠️ Please enter your initial website idea first!",
|
| 471 |
+
"",
|
| 472 |
+
gr.update(visible=False)
|
| 473 |
+
)
|
| 474 |
+
|
| 475 |
+
next_question = enhancer.start_enhancement(initial_prompt)
|
| 476 |
+
suggestion = enhancer.get_suggested_answer()
|
| 477 |
+
|
| 478 |
+
return (
|
| 479 |
+
next_question,
|
| 480 |
+
suggestion,
|
| 481 |
+
"",
|
| 482 |
+
gr.update(interactive=True),
|
| 483 |
+
gr.update(interactive=True),
|
| 484 |
+
gr.update(visible=False),
|
| 485 |
+
f"✅ Progress: {enhancer.current_question_idx}/{len(WEB_DEV_QUESTIONS)} questions answered",
|
| 486 |
+
"",
|
| 487 |
+
gr.update(visible=False)
|
| 488 |
+
)
|
| 489 |
+
|
| 490 |
+
def generate_final_prompt(model_choice):
|
| 491 |
+
try:
|
| 492 |
+
status_msg = "🔄 Generating AI Code Agent prompt... Please wait."
|
| 493 |
+
yield "", status_msg, gr.update(visible=False)
|
| 494 |
+
enhanced = enhancer.generate_enhanced_prompt(model_choice)
|
| 495 |
+
|
| 496 |
+
yield enhanced, "✅ AI Code Agent prompt generated! Copy and paste into your AI code agent to generate the website.", gr.update(visible=True)
|
| 497 |
+
except Exception as e:
|
| 498 |
+
yield f"Error: {str(e)}", "❌ Generation failed. Please try again or use a different model.", gr.update(visible=False)
|
| 499 |
+
|
| 500 |
+
def save_prompt_to_file(prompt_text):
|
| 501 |
+
"""Save the prompt to a text file and return the file path"""
|
| 502 |
+
if not prompt_text or prompt_text.strip() == "":
|
| 503 |
+
return None
|
| 504 |
+
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
| 505 |
+
filename = f"ai_code_agent_prompt_{timestamp}.txt"
|
| 506 |
+
|
| 507 |
+
with open(filename, "w", encoding="utf-8") as f:
|
| 508 |
+
f.write("=" * 80 + "\n")
|
| 509 |
+
f.write("AI CODE AGENT - WEBSITE DEVELOPMENT PROMPT\n")
|
| 510 |
+
f.write(f"Generated: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n")
|
| 511 |
+
f.write("=" * 80 + "\n\n")
|
| 512 |
+
f.write(prompt_text)
|
| 513 |
+
f.write("\n\n" + "=" * 80 + "\n")
|
| 514 |
+
f.write("Paste this prompt into your AI Code Agent to generate the website\n")
|
| 515 |
+
f.write("Compatible with: Custom AI Code Agents, Cursor, Bolt.new, v0.dev, etc.\n")
|
| 516 |
+
f.write("=" * 80 + "\n")
|
| 517 |
+
|
| 518 |
+
return filename
|
| 519 |
+
|
| 520 |
+
# Custom CSS
|
| 521 |
+
custom_css = """
|
| 522 |
+
.container {max-width: 1200px; margin: auto; padding: 20px;}
|
| 523 |
+
.header {
|
| 524 |
+
text-align: center;
|
| 525 |
+
margin-bottom: 30px;
|
| 526 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 527 |
+
padding: 30px;
|
| 528 |
+
border-radius: 15px;
|
| 529 |
+
color: white;
|
| 530 |
+
}
|
| 531 |
+
.question-box {
|
| 532 |
+
background: #f0f7ff;
|
| 533 |
+
padding: 20px;
|
| 534 |
+
border-radius: 10px;
|
| 535 |
+
margin: 10px 0;
|
| 536 |
+
border-left: 4px solid #667eea;
|
| 537 |
+
}
|
| 538 |
+
.status-box {
|
| 539 |
+
background: #e8f5e9;
|
| 540 |
+
padding: 15px;
|
| 541 |
+
border-radius: 8px;
|
| 542 |
+
margin: 10px 0;
|
| 543 |
+
font-weight: 500;
|
| 544 |
+
}
|
| 545 |
+
.suggestion-box {
|
| 546 |
+
background: #fff3e0;
|
| 547 |
+
padding: 10px;
|
| 548 |
+
border-radius: 5px;
|
| 549 |
+
font-size: 0.9em;
|
| 550 |
+
color: #e65100;
|
| 551 |
+
}
|
| 552 |
+
.download-btn {
|
| 553 |
+
background: #4CAF50 !important;
|
| 554 |
+
}
|
| 555 |
+
.code-agent-badge {
|
| 556 |
+
background: #667eea;
|
| 557 |
+
color: white;
|
| 558 |
+
padding: 5px 15px;
|
| 559 |
+
border-radius: 20px;
|
| 560 |
+
font-size: 0.85em;
|
| 561 |
+
display: inline-block;
|
| 562 |
+
margin: 5px;
|
| 563 |
+
}
|
| 564 |
+
"""
|
| 565 |
+
|
| 566 |
+
# Build Interface
|
| 567 |
+
with gr.Blocks(css=custom_css, theme=gr.themes.Soft(), title="AI Code Agent Prompt Enhancer") as demo:
|
| 568 |
+
gr.Markdown("""
|
| 569 |
+
# 🚀 AI Code Agent Prompt Enhancer
|
| 570 |
+
### Transform Ideas into Professional AI Code Agent Prompts
|
| 571 |
+
Generate detailed, production-ready prompts optimized for AI code agent systems.
|
| 572 |
+
|
| 573 |
+
<div style="text-align: center; margin: 10px 0;">
|
| 574 |
+
<span class="code-agent-badge">✨ TailwindCSS</span>
|
| 575 |
+
<span class="code-agent-badge">🎨 Feather Icons</span>
|
| 576 |
+
<span class="code-agent-badge">📱 AOS Animations</span>
|
| 577 |
+
<span class="code-agent-badge">🌟 Vanta.js</span>
|
| 578 |
+
<span class="code-agent-badge">🖼️ Static.photos</span>
|
| 579 |
+
</div>
|
| 580 |
+
""", elem_classes="header")
|
| 581 |
+
|
| 582 |
+
with gr.Row():
|
| 583 |
+
with gr.Column(scale=2):
|
| 584 |
+
initial_prompt = gr.Textbox(
|
| 585 |
+
label="💡 Your Website Idea",
|
| 586 |
+
placeholder="Example: 'Create a modern portfolio website for a photographer with gallery and contact form'",
|
| 587 |
+
lines=3,
|
| 588 |
+
info="Describe what kind of website you want to create"
|
| 589 |
+
)
|
| 590 |
+
with gr.Column(scale=1):
|
| 591 |
+
start_btn = gr.Button(
|
| 592 |
+
"🎯 Start Enhancement",
|
| 593 |
+
variant="primary",
|
| 594 |
+
size="lg"
|
| 595 |
+
)
|
| 596 |
+
|
| 597 |
+
status_text = gr.Markdown("👆 Enter your idea above and click 'Start Enhancement'", elem_classes="status-box")
|
| 598 |
+
|
| 599 |
+
gr.Markdown("---")
|
| 600 |
+
|
| 601 |
+
with gr.Row():
|
| 602 |
+
with gr.Column():
|
| 603 |
+
current_question = gr.Textbox(
|
| 604 |
+
label="❓ Current Question",
|
| 605 |
+
interactive=False,
|
| 606 |
+
lines=2,
|
| 607 |
+
elem_classes="question-box"
|
| 608 |
+
)
|
| 609 |
+
|
| 610 |
+
suggestion_text = gr.Textbox(
|
| 611 |
+
label="💭 Suggestion",
|
| 612 |
+
interactive=False,
|
| 613 |
+
lines=2,
|
| 614 |
+
elem_classes="suggestion-box"
|
| 615 |
+
)
|
| 616 |
+
|
| 617 |
+
answer_input = gr.Textbox(
|
| 618 |
+
label="✍️ Your Answer",
|
| 619 |
+
placeholder="Type your answer here...",
|
| 620 |
+
lines=4,
|
| 621 |
+
interactive=False
|
| 622 |
+
)
|
| 623 |
+
|
| 624 |
+
submit_btn = gr.Button(
|
| 625 |
+
"Submit Answer ➡️",
|
| 626 |
+
interactive=False,
|
| 627 |
+
variant="primary"
|
| 628 |
+
)
|
| 629 |
+
|
| 630 |
+
gr.Markdown("---")
|
| 631 |
+
|
| 632 |
+
with gr.Row():
|
| 633 |
+
model_choice = gr.Dropdown(
|
| 634 |
+
choices=AVAILABLE_MODELS,
|
| 635 |
+
value=DEFAULT_MODEL,
|
| 636 |
+
label="🤖 Select AI Model",
|
| 637 |
+
info="Choose the model for prompt generation"
|
| 638 |
+
)
|
| 639 |
+
|
| 640 |
+
generate_btn = gr.Button(
|
| 641 |
+
"✨ Generate AI Code Agent Prompt",
|
| 642 |
+
variant="primary",
|
| 643 |
+
size="lg",
|
| 644 |
+
visible=False
|
| 645 |
+
)
|
| 646 |
+
|
| 647 |
+
enhanced_output = gr.Textbox(
|
| 648 |
+
label="🎨 AI Code Agent Prompt (Ready to Use)",
|
| 649 |
+
lines=30,
|
| 650 |
+
show_copy_button=True,
|
| 651 |
+
placeholder="Your AI code agent prompt will appear here...",
|
| 652 |
+
info="Copy this prompt and paste it into your AI code agent system"
|
| 653 |
+
)
|
| 654 |
+
|
| 655 |
+
download_btn = gr.File(
|
| 656 |
+
label="📥 Download Prompt as Text File",
|
| 657 |
+
visible=False
|
| 658 |
+
)
|
| 659 |
+
|
| 660 |
+
gr.Markdown("""
|
| 661 |
+
---
|
| 662 |
+
## 📋 How to Use
|
| 663 |
+
|
| 664 |
+
### Step 1: Create Your Prompt
|
| 665 |
+
1. **Enter Your Idea** - Describe your website concept
|
| 666 |
+
2. **Answer Questions** - Respond to guided questions (7 total)
|
| 667 |
+
3. **Generate Prompt** - Click to create your AI code agent prompt
|
| 668 |
+
4. **Download/Copy** - Save or copy the generated prompt
|
| 669 |
+
|
| 670 |
+
### Step 2: Use with AI Code Agent
|
| 671 |
+
1. **Copy the generated prompt**
|
| 672 |
+
2. **Paste into your AI code agent** (Cursor, Bolt.new, v0.dev, custom agents)
|
| 673 |
+
3. **Get production-ready code** with proper formatting
|
| 674 |
+
|
| 675 |
+
---
|
| 676 |
+
|
| 677 |
+
## 🎯 What You Get
|
| 678 |
+
|
| 679 |
+
✅ **Clean, Professional Prompt** - No Q&A clutter, just specifications
|
| 680 |
+
✅ **AI Code Agent Format** - Uses TITLE_PAGE, UPDATE_PAGE, SEARCH/REPLACE blocks
|
| 681 |
+
✅ **TailwindCSS Integration** - Modern, responsive styling
|
| 682 |
+
✅ **Animation Ready** - AOS scroll animations + Vanta.js backgrounds
|
| 683 |
+
✅ **Icon System** - Feather Icons integrated
|
| 684 |
+
✅ **Image Placeholders** - Static.photos for all images
|
| 685 |
+
✅ **Production Ready** - Complete technical specifications
|
| 686 |
+
✅ **Downloadable** - Save for future use
|
| 687 |
+
|
| 688 |
+
---
|
| 689 |
+
|
| 690 |
+
## 🔧 Compatible Systems
|
| 691 |
+
|
| 692 |
+
This tool generates prompts compatible with:
|
| 693 |
+
- ✨ **Custom AI Code Agents** (using the TITLE_PAGE/UPDATE_PAGE format)
|
| 694 |
+
- ✨ **Cursor AI** - Paste and generate
|
| 695 |
+
- ✨ **Bolt.new** - Direct integration
|
| 696 |
+
- ✨ **v0.dev** - Component generation
|
| 697 |
+
- ✨ **GitHub Copilot** - Enhanced context
|
| 698 |
+
- ✨ **Any LLM** - ChatGPT, Claude, Gemini
|
| 699 |
+
|
| 700 |
+
---
|
| 701 |
+
|
| 702 |
+
## 📚 Output Format
|
| 703 |
+
|
| 704 |
+
The generated prompts use a specific format for AI code agents:
|
| 705 |
+
|
| 706 |
+
### For New Websites:
|
| 707 |
+
```
|
| 708 |
+
<<<<<<< START_TITLE index.html >>>>>>> END_TITLE
|
| 709 |
+
```html
|
| 710 |
+
<!DOCTYPE html>
|
| 711 |
+
...complete HTML code...
|
| 712 |
+
```
|
| 713 |
+
```
|
| 714 |
+
|
| 715 |
+
### For Updates:
|
| 716 |
+
```
|
| 717 |
+
<<<<<<< UPDATE_PAGE_START index.html >>>>>>> UPDATE_PAGE_END
|
| 718 |
+
<<<<<<< SEARCH
|
| 719 |
+
<h1>Old Content</h1>
|
| 720 |
+
=======
|
| 721 |
+
<h1 class="text-4xl font-bold">New Content</h1>
|
| 722 |
+
>>>>>>> REPLACE
|
| 723 |
+
```
|
| 724 |
+
|
| 725 |
+
---
|
| 726 |
+
|
| 727 |
+
## 💡 Pro Tips
|
| 728 |
+
|
| 729 |
+
- 📝 Be specific in your answers for better results
|
| 730 |
+
- 🎨 Mention preferred colors, styles, and layouts
|
| 731 |
+
- 📱 Specify if you need mobile-first design
|
| 732 |
+
- 🔄 Indicate if updating existing code or creating new
|
| 733 |
+
- ⚡ The more detail you provide, the better the output
|
| 734 |
+
|
| 735 |
+
---
|
| 736 |
+
|
| 737 |
+
## 🛠️ Technical Stack Included
|
| 738 |
+
|
| 739 |
+
Every generated prompt includes:
|
| 740 |
+
- **TailwindCSS** - Utility-first CSS framework
|
| 741 |
+
- **Feather Icons** - Beautiful icon set
|
| 742 |
+
- **AOS.js** - Scroll animation library
|
| 743 |
+
- **Vanta.js** - Animated backgrounds
|
| 744 |
+
- **Anime.js** - Advanced animations
|
| 745 |
+
- **Static.photos** - Professional placeholder images
|
| 746 |
+
|
| 747 |
+
---
|
| 748 |
+
|
| 749 |
+
Made with ❤️ for developers | Optimized for AI Code Agents
|
| 750 |
+
""")
|
| 751 |
+
|
| 752 |
+
# Event Handlers
|
| 753 |
+
start_btn.click(
|
| 754 |
+
fn=start_process,
|
| 755 |
+
inputs=[initial_prompt],
|
| 756 |
+
outputs=[
|
| 757 |
+
current_question,
|
| 758 |
+
suggestion_text,
|
| 759 |
+
answer_input,
|
| 760 |
+
answer_input,
|
| 761 |
+
submit_btn,
|
| 762 |
+
generate_btn,
|
| 763 |
+
status_text,
|
| 764 |
+
enhanced_output,
|
| 765 |
+
download_btn
|
| 766 |
+
]
|
| 767 |
+
)
|
| 768 |
+
|
| 769 |
+
submit_btn.click(
|
| 770 |
+
fn=submit_answer,
|
| 771 |
+
inputs=[answer_input],
|
| 772 |
+
outputs=[
|
| 773 |
+
current_question,
|
| 774 |
+
suggestion_text,
|
| 775 |
+
answer_input,
|
| 776 |
+
answer_input,
|
| 777 |
+
submit_btn,
|
| 778 |
+
generate_btn,
|
| 779 |
+
status_text,
|
| 780 |
+
enhanced_output,
|
| 781 |
+
download_btn
|
| 782 |
+
]
|
| 783 |
+
)
|
| 784 |
+
|
| 785 |
+
answer_input.submit(
|
| 786 |
+
fn=submit_answer,
|
| 787 |
+
inputs=[answer_input],
|
| 788 |
+
outputs=[
|
| 789 |
+
current_question,
|
| 790 |
+
suggestion_text,
|
| 791 |
+
answer_input,
|
| 792 |
+
answer_input,
|
| 793 |
+
submit_btn,
|
| 794 |
+
generate_btn,
|
| 795 |
+
status_text,
|
| 796 |
+
enhanced_output,
|
| 797 |
+
download_btn
|
| 798 |
+
]
|
| 799 |
+
)
|
| 800 |
+
|
| 801 |
+
generate_btn.click(
|
| 802 |
+
fn=generate_final_prompt,
|
| 803 |
+
inputs=[model_choice],
|
| 804 |
+
outputs=[enhanced_output, status_text, download_btn]
|
| 805 |
+
)
|
| 806 |
+
|
| 807 |
+
enhanced_output.change(
|
| 808 |
+
fn=save_prompt_to_file,
|
| 809 |
+
inputs=[enhanced_output],
|
| 810 |
+
outputs=[download_btn]
|
| 811 |
+
)
|
| 812 |
+
|
| 813 |
+
if __name__ == "__main__":
|
| 814 |
+
demo.launch()
|
prompt.py
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
AI Code Agent System Prompts and Constants
|
| 3 |
+
This file contains all the prompts and format constants used by the AI code agent system.
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
# ============================================================================
|
| 7 |
+
# CODE AGENT FORMAT CONSTANTS
|
| 8 |
+
# ============================================================================
|
| 9 |
+
|
| 10 |
+
SEARCH_START = "<<<<<<< SEARCH"
|
| 11 |
+
DIVIDER = "======="
|
| 12 |
+
REPLACE_END = ">>>>>>> REPLACE"
|
| 13 |
+
TITLE_PAGE_START = "<<<<<<< START_TITLE "
|
| 14 |
+
TITLE_PAGE_END = " >>>>>>> END_TITLE"
|
| 15 |
+
NEW_PAGE_START = "<<<<<<< NEW_PAGE_START "
|
| 16 |
+
NEW_PAGE_END = " >>>>>>> NEW_PAGE_END"
|
| 17 |
+
UPDATE_PAGE_START = "<<<<<<< UPDATE_PAGE_START "
|
| 18 |
+
UPDATE_PAGE_END = " >>>>>>> UPDATE_PAGE_END"
|
| 19 |
+
|
| 20 |
+
# ============================================================================
|
| 21 |
+
# QUESTIONS FOR USER INPUT
|
| 22 |
+
# ============================================================================
|
| 23 |
+
|
| 24 |
+
WEB_DEV_QUESTIONS = [
|
| 25 |
+
"What type of website do you want? (e.g., portfolio, e-commerce, blog, landing page, dashboard)",
|
| 26 |
+
"What is the main purpose/goal of this website?",
|
| 27 |
+
"Who is the target audience?",
|
| 28 |
+
"What are the main sections/pages needed? (e.g., Home, About, Contact, Services)",
|
| 29 |
+
"What color scheme or theme do you prefer? (e.g., modern, minimalist, corporate, vibrant)",
|
| 30 |
+
"Do you need any specific features? (e.g., contact form, gallery, animations, responsive design)",
|
| 31 |
+
"Is this a new website or an update to existing pages?"
|
| 32 |
+
]
|
| 33 |
+
|
| 34 |
+
# ============================================================================
|
| 35 |
+
# SUGGESTED ANSWERS
|
| 36 |
+
# ============================================================================
|
| 37 |
+
|
| 38 |
+
SUGGESTED_ANSWERS = {
|
| 39 |
+
0: "e.g., Portfolio website, Business landing page, Personal blog, E-commerce store",
|
| 40 |
+
1: "e.g., Showcase my work, Attract clients, Share knowledge, Sell products",
|
| 41 |
+
2: "e.g., Potential clients, General public, Specific industry professionals",
|
| 42 |
+
3: "e.g., Home, About Me, Portfolio/Projects, Services, Contact",
|
| 43 |
+
4: "e.g., Blue and white (professional), Dark theme (modern), Pastel colors (creative)",
|
| 44 |
+
5: "e.g., Contact form, Image gallery, Smooth scrolling, Animations, Mobile responsive",
|
| 45 |
+
6: "e.g., New website (creates from scratch) or Update existing pages (modifies existing code)"
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
# ============================================================================
|
| 49 |
+
# IMAGE GENERATION PROMPT
|
| 50 |
+
# ============================================================================
|
| 51 |
+
|
| 52 |
+
PROMPT_FOR_IMAGE_GENERATION = """If you want to use image placeholder, http://Static.photos Usage:
|
| 53 |
+
Format: http://static.photos/[category]/[dimensions]/[seed] where dimensions must be one of: 200x200, 320x240, 640x360, 1024x576, or 1200x630; seed can be any number (1-999+) for consistent images or omit for random; categories include: nature, office, people, technology, minimal, abstract, aerial, blurred, bokeh, gradient, monochrome, vintage, white, black, blue, red, green, yellow, cityscape, workspace, food, travel, textures, industry, indoor, outdoor, studio, finance, medical, season, holiday, event, sport, science, legal, estate, restaurant, retail, wellness, agriculture, construction, craft, cosmetic, automotive, gaming, or education.
|
| 54 |
+
Examples: http://static.photos/red/320x240/133 (red-themed with seed 133), http://static.photos/640x360 (random category and image), http://static.photos/nature/1200x630/42 (nature-themed with seed 42)."""
|
| 55 |
+
|
| 56 |
+
# ============================================================================
|
| 57 |
+
# INITIAL SYSTEM PROMPT (For Creating New Websites)
|
| 58 |
+
# ============================================================================
|
| 59 |
+
|
| 60 |
+
INITIAL_SYSTEM_PROMPT = f"""You are an expert UI/UX and Front-End Developer.
|
| 61 |
+
You create website in a way a designer would, using ONLY HTML, CSS and Javascript.
|
| 62 |
+
Try to create the best UI possible. Important: Make the website responsive by using TailwindCSS. Use it as much as you can, if you can't use it, use custom css (make sure to import tailwind with <script src="https://cdn.tailwindcss.com"></script> in the head).
|
| 63 |
+
Also try to elaborate as much as you can, to create something unique, with a great design.
|
| 64 |
+
If you want to use ICONS import Feather Icons (Make sure to add <script src="https://unpkg.com/feather-icons"></script> and <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script> in the head., and <script>feather.replace();</script> in the body. Ex : <i data-feather="user"></i>).
|
| 65 |
+
For scroll animations you can use: AOS.com (Make sure to add <link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet"> and <script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script> and <script>AOS.init();</script>).
|
| 66 |
+
For interactive animations you can use: Vanta.js (Make sure to add <script src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.globe.min.js"></script> and <script>VANTA.GLOBE({{...</script> in the body.).
|
| 67 |
+
You can create multiple pages website at once (following the format rules below) or a Single Page Application. If the user doesn't ask for a specific version, you have to determine the best version for the user, depending on the request. (Try to avoid the Single Page Application if the user asks for multiple pages.)
|
| 68 |
+
{PROMPT_FOR_IMAGE_GENERATION}
|
| 69 |
+
No need to explain what you did. Just return the expected result. AVOID Chinese characters in the code if not asked by the user.
|
| 70 |
+
Return the results in a ```html``` markdown. Format the results like:
|
| 71 |
+
1. Start with {TITLE_PAGE_START}.
|
| 72 |
+
2. Add the name of the page without special character, such as spaces or punctuation, using the .html format only, right after the start tag.
|
| 73 |
+
3. Close the start tag with the {TITLE_PAGE_END}.
|
| 74 |
+
4. Start the HTML response with the triple backticks, like ```html.
|
| 75 |
+
5. Insert the following html there.
|
| 76 |
+
6. Close with the triple backticks, like ```.
|
| 77 |
+
7. Retry if another pages.
|
| 78 |
+
Example Code:
|
| 79 |
+
{TITLE_PAGE_START}index.html{TITLE_PAGE_END}
|
| 80 |
+
```html
|
| 81 |
+
<!DOCTYPE html>
|
| 82 |
+
<html lang="en">
|
| 83 |
+
<head>
|
| 84 |
+
<meta charset="UTF-8">
|
| 85 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 86 |
+
<title>Index</title>
|
| 87 |
+
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
|
| 88 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 89 |
+
<link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet">
|
| 90 |
+
<script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>
|
| 91 |
+
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
| 92 |
+
<script src="https://cdn.jsdelivr.net/npm/animejs/lib/anime.iife.min.js"></script>
|
| 93 |
+
<script src="https://unpkg.com/feather-icons"></script>
|
| 94 |
+
</head>
|
| 95 |
+
<body>
|
| 96 |
+
<h1>Hello World</h1>
|
| 97 |
+
<script>AOS.init();</script>
|
| 98 |
+
<script>const {{ animate }} = anime;</script>
|
| 99 |
+
<script>feather.replace();</script>
|
| 100 |
+
</body>
|
| 101 |
+
</html>
|
| 102 |
+
IMPORTANT: The first file should be always named index.html."""
|
| 103 |
+
|
| 104 |
+
# ============================================================================
|
| 105 |
+
# FOLLOW-UP SYSTEM PROMPT (For Updating Existing Websites)
|
| 106 |
+
# ============================================================================
|
| 107 |
+
FOLLOW_UP_SYSTEM_PROMPT = f"""You are an expert UI/UX and Front-End Developer modifying an existing HTML files.
|
| 108 |
+
The user wants to apply changes and probably add new features/pages to the website, based on their request.
|
| 109 |
+
You MUST output ONLY the changes required using the following UPDATE_PAGE_START and SEARCH/REPLACE format. Do NOT output the entire file.
|
| 110 |
+
If it's a new page, you MUST applied the following NEW_PAGE_START and UPDATE_PAGE_END format.
|
| 111 |
+
{PROMPT_FOR_IMAGE_GENERATION}
|
| 112 |
+
Do NOT explain the changes or what you did, just return the expected results.
|
| 113 |
+
Update Format Rules:
|
| 114 |
+
|
| 115 |
+
1. Start with {UPDATE_PAGE_START}
|
| 116 |
+
2. Provide the name of the page you are modifying.
|
| 117 |
+
3. Close the start tag with the {UPDATE_PAGE_END}.
|
| 118 |
+
4. Start with {SEARCH_START}
|
| 119 |
+
5. Provide the exact lines from the current code that need to be replaced.
|
| 120 |
+
6. Use {DIVIDER} to separate the search block from the replacement.
|
| 121 |
+
7. Provide the new lines that should replace the original lines.
|
| 122 |
+
8. End with {REPLACE_END}
|
| 123 |
+
9. You can use multiple SEARCH/REPLACE blocks if changes are needed in different parts of the file.
|
| 124 |
+
10. To insert code, use an empty SEARCH block (only {SEARCH_START} and {DIVIDER} on their lines) if inserting at the very beginning, otherwise provide the line before the insertion point in the SEARCH block and include that line plus the new lines in the REPLACE block.
|
| 125 |
+
11. To delete code, provide the lines to delete in the SEARCH block and leave the REPLACE block empty (only {DIVIDER} and {REPLACE_END} on their lines).
|
| 126 |
+
12. IMPORTANT: The SEARCH block must exactly match the current code, including indentation and whitespace.
|
| 127 |
+
Example Modifying Code:
|
| 128 |
+
Some explanation...
|
| 129 |
+
{UPDATE_PAGE_START}index.html{UPDATE_PAGE_END}
|
| 130 |
+
{SEARCH_START}
|
| 131 |
+
<h1>Old Title</h1>
|
| 132 |
+
{DIVIDER}
|
| 133 |
+
<h1>New Title</h1>
|
| 134 |
+
{REPLACE_END}
|
| 135 |
+
{SEARCH_START}
|
| 136 |
+
</body>
|
| 137 |
+
{DIVIDER}
|
| 138 |
+
<script>console.log("Added script");</script>
|
| 139 |
+
</body>
|
| 140 |
+
{REPLACE_END}
|
| 141 |
+
Example Deleting Code:
|
| 142 |
+
Removing the paragraph...
|
| 143 |
+
{UPDATE_PAGE_START}index.html{UPDATE_PAGE_END}
|
| 144 |
+
{SEARCH_START}
|
| 145 |
+
<p>This paragraph will be deleted.</p>
|
| 146 |
+
{DIVIDER}
|
| 147 |
+
{REPLACE_END}
|
| 148 |
+
The user can also ask to add a new page, in this case you should return the new page in the following format:
|
| 149 |
+
1. Start with {NEW_PAGE_START}.
|
| 150 |
+
2. Add the name of the page without special character, such as spaces or punctuation, using the .html format only, right after the start tag.
|
| 151 |
+
3. Close the start tag with the {NEW_PAGE_END}.
|
| 152 |
+
4. Start the HTML response with the triple backticks, like ```html.
|
| 153 |
+
5. Insert the following html there.
|
| 154 |
+
6. Close with the triple backticks, like ```.
|
| 155 |
+
7. Retry if another pages.
|
| 156 |
+
Example Code:
|
| 157 |
+
{NEW_PAGE_START}about.html{NEW_PAGE_END}
|
| 158 |
+
<!DOCTYPE html>
|
| 159 |
+
<html lang="en">
|
| 160 |
+
<head>
|
| 161 |
+
<meta charset="UTF-8">
|
| 162 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 163 |
+
<title>About</title>
|
| 164 |
+
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
|
| 165 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 166 |
+
<link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet">
|
| 167 |
+
<script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>
|
| 168 |
+
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
| 169 |
+
<script src="https://cdn.jsdelivr.net/npm/animejs/lib/anime.iife.min.js"></script>
|
| 170 |
+
<script src="https://unpkg.com/feather-icons"></script>
|
| 171 |
+
</head>
|
| 172 |
+
<body>
|
| 173 |
+
<h1>About Page</h1>
|
| 174 |
+
<script>AOS.init();</script>
|
| 175 |
+
<script>const {{ animate }} = anime;</script>
|
| 176 |
+
<script>feather.replace();</script>
|
| 177 |
+
</body>
|
| 178 |
+
</html>
|
| 179 |
+
IMPORTANT: While creating a new page, UPDATE ALL THE OTHERS (using the UPDATE_PAGE_START and SEARCH/REPLACE format) pages to add or replace the link to the new page, otherwise the user will not be able to navigate to the new page. (Dont use onclick to navigate, only href)
|
| 180 |
+
No need to explain what you did. Just return the expected result."""
|
| 181 |
+
|
| 182 |
+
# ============================================================================
|
| 183 |
+
# PROMPT ENGINEER SYSTEM PROMPT
|
| 184 |
+
# ============================================================================
|
| 185 |
+
PROMPT_ENGINEER_SYSTEM_PROMPT = """You are an expert web development prompt engineer. Your job is to create highly detailed,
|
| 186 |
+
professional prompts that will work with AI code agents to generate production-ready, deployable websites.
|
| 187 |
+
|
| 188 |
+
The prompts you create must follow a specific format for an AI code agent system that uses:
|
| 189 |
+
|
| 190 |
+
TailwindCSS for styling
|
| 191 |
+
Feather Icons for icons
|
| 192 |
+
AOS for scroll animations
|
| 193 |
+
Vanta.js for interactive animations
|
| 194 |
+
Static.photos for placeholder images
|
| 195 |
+
Create prompts that are clean, detailed, and ready to paste into an AI code agent.
|
| 196 |
+
Do NOT include Q&A format in the output - only the final detailed specification."""
|
| 197 |
+
|
| 198 |
+
# ============================================================================
|
| 199 |
+
# HTML TEMPLATE EXAMPLE
|
| 200 |
+
# ============================================================================
|
| 201 |
+
HTML_TEMPLATE_EXAMPLE = """<!DOCTYPE html>
|
| 202 |
+
|
| 203 |
+
<html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Page Title</title> <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
|
| 204 |
+
<!-- TailwindCSS -->
|
| 205 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 206 |
+
|
| 207 |
+
<!-- AOS Animations -->
|
| 208 |
+
<link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet">
|
| 209 |
+
<script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>
|
| 210 |
+
|
| 211 |
+
<!-- Feather Icons -->
|
| 212 |
+
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
| 213 |
+
<script src="https://unpkg.com/feather-icons"></script>
|
| 214 |
+
|
| 215 |
+
<!-- Anime.js -->
|
| 216 |
+
<script src="https://cdn.jsdelivr.net/npm/animejs/lib/anime.iife.min.js"></script>
|
| 217 |
+
</head> <body> <!-- Your content here -->
|
| 218 |
+
<!-- Initialize libraries -->
|
| 219 |
+
<script>AOS.init();</script>
|
| 220 |
+
<script>feather.replace();</script>
|
| 221 |
+
</body> </html>"""
|
| 222 |
+
|
| 223 |
+
# ============================================================================
|
| 224 |
+
# CDN LINKS
|
| 225 |
+
# ============================================================================
|
| 226 |
+
CDN_LINKS = {
|
| 227 |
+
"tailwind": "https://cdn.tailwindcss.com",
|
| 228 |
+
"aos_css": "https://unpkg.com/aos@2.3.1/dist/aos.css",
|
| 229 |
+
"aos_js": "https://unpkg.com/aos@2.3.1/dist/aos.js",
|
| 230 |
+
"feather_icons": "https://unpkg.com/feather-icons",
|
| 231 |
+
"feather_icons_min": "https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js",
|
| 232 |
+
"anime_js": "https://cdn.jsdelivr.net/npm/animejs/lib/anime.iife.min.js",
|
| 233 |
+
"vanta_globe": "https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.globe.min.js"
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
# ============================================================================
|
| 237 |
+
# AVAILABLE MODELS
|
| 238 |
+
# ============================================================================
|
| 239 |
+
AVAILABLE_MODELS = [
|
| 240 |
+
"meta-llama/Llama-3.2-1B-Instruct",
|
| 241 |
+
"meta-llama/Llama-3.2-3B-Instruct",
|
| 242 |
+
"microsoft/Phi-3.5-mini-instruct",
|
| 243 |
+
"HuggingFaceH4/zephyr-7b-beta",
|
| 244 |
+
"mistralai/Mistral-7B-Instruct-v0.3"
|
| 245 |
+
]
|
| 246 |
+
|
| 247 |
+
DEFAULT_MODEL = "meta-llama/Llama-3.2-1B-Instruct"
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio>=4.0.0
|
| 2 |
+
huggingface-hub>=0.19.0
|
| 3 |
+
python-dotenv>=1.0.0
|