Spaces:
Runtime error
Runtime error
Update agents/software_engineer_agent.py
Browse files
agents/software_engineer_agent.py
CHANGED
|
@@ -18,16 +18,65 @@ def run(state: dict) -> dict:
|
|
| 18 |
|
| 19 |
# Enhance the prompt with UI implementation guidelines
|
| 20 |
enhanced_prompt = f"""
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
Original requirements: {prompt}
|
| 32 |
"""
|
| 33 |
|
|
|
|
| 18 |
|
| 19 |
# Enhance the prompt with UI implementation guidelines
|
| 20 |
enhanced_prompt = f"""
|
| 21 |
+
Objective
|
| 22 |
+
|
| 23 |
+
Generate modern, responsive, and accessible UI code that is visually appealing and adheres to current frontend development best practices.
|
| 24 |
+
|
| 25 |
+
1. Styling Framework: Tailwind CSS
|
| 26 |
+
• Use Tailwind CSS utility classes for styling all elements.
|
| 27 |
+
• Apply spacing, typography, sizing, and layout using Tailwind classes.
|
| 28 |
+
• Follow a mobile-first design approach.
|
| 29 |
+
• Use Tailwind’s built-in responsive breakpoints (sm, md, lg, xl, 2xl) to adapt layouts for different screen sizes.
|
| 30 |
+
|
| 31 |
+
2. Layout Techniques
|
| 32 |
+
• Use CSS Grid for complex, multi-column or two-dimensional layouts.
|
| 33 |
+
• Use Flexbox for flexible alignment of components like navigation bars, cards, buttons, and modals.
|
| 34 |
+
• Maintain consistent spacing with utility classes such as gap, space-x, space-y, p-*, and m-*.
|
| 35 |
+
|
| 36 |
+
3. Semantic HTML
|
| 37 |
+
• Use semantic HTML tags appropriately: <header>, <nav>, <main>, <section>, <article>, <footer>, etc.
|
| 38 |
+
• Avoid unnecessary <div> elements to prevent cluttered and unstructured markup.
|
| 39 |
+
• Ensure proper nesting and hierarchy of elements.
|
| 40 |
+
|
| 41 |
+
4. Accessibility
|
| 42 |
+
• Add ARIA labels, role attributes, and alt text where needed for screen reader support.
|
| 43 |
+
• Ensure keyboard accessibility with tabindex, proper focus states, and interactive elements being navigable.
|
| 44 |
+
• Use <label> elements properly linked to form fields via the for attribute.
|
| 45 |
+
|
| 46 |
+
5. Responsive Design
|
| 47 |
+
• Use Tailwind’s responsive utilities to adjust layouts across various screen sizes.
|
| 48 |
+
• Design components to be fully usable on both desktop and mobile devices.
|
| 49 |
+
• Use collapsible or toggleable UI patterns (e.g., hamburger menus) for smaller viewports.
|
| 50 |
+
|
| 51 |
+
6. Theming and Styling Consistency
|
| 52 |
+
• Define and use CSS variables (--primary-color, --font-family, etc.) for theme consistency across components.
|
| 53 |
+
• Maintain a clear visual hierarchy with consistent font sizes, weights, and colors.
|
| 54 |
+
• Customize Tailwind’s theme configuration if needed for project-specific design tokens.
|
| 55 |
+
|
| 56 |
+
7. JavaScript and Interactivity
|
| 57 |
+
• Add interactivity using plain JavaScript, Alpine.js, or React if specified.
|
| 58 |
+
• Implement common UI components such as modals, dropdowns, tooltips, accordions with appropriate open/close behavior.
|
| 59 |
+
• Provide user feedback through form validations, dynamic updates, and transitions.
|
| 60 |
+
|
| 61 |
+
8. Loading and Error States
|
| 62 |
+
• Implement loading states using spinners, skeleton screens, or placeholders while data is being fetched or actions are processing.
|
| 63 |
+
• Show error states using alerts, banners, or toast messages when applicable.
|
| 64 |
+
• Use conditional rendering or state flags to handle visibility and transitions between states.
|
| 65 |
+
|
| 66 |
+
9. Component Structure and Reusability
|
| 67 |
+
• Break down the UI into modular, reusable components (e.g., Button, Card, Modal, Form).
|
| 68 |
+
• Each component should:
|
| 69 |
+
• Be self-contained with a clear purpose.
|
| 70 |
+
• Accept inputs or props when necessary.
|
| 71 |
+
• Maintain responsive and accessible markup by default.
|
| 72 |
+
|
| 73 |
+
10. Code Quality Standards
|
| 74 |
+
• Write clean, readable, and maintainable code.
|
| 75 |
+
• Remove unused classes, scripts, or markup.
|
| 76 |
+
• Follow consistent naming conventions and indentation rules.
|
| 77 |
+
• Add comments only when necessary for clarity.
|
| 78 |
+
|
| 79 |
+
|
| 80 |
Original requirements: {prompt}
|
| 81 |
"""
|
| 82 |
|