File size: 1,442 Bytes
e5e882e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from core.base_agent import BaseAgent
from core.database import db
from typing import Dict, Any

class DesignerAgent(BaseAgent):
    def __init__(self):
        super().__init__("Designer")
        self.create_chain("""

        You are a Software Designer. Your task is to create detailed design specifications from the given user stories.

        

        User Stories:

        {input}

        

        Create a comprehensive design document that includes:

        1. System Architecture

        2. Component Design

        3. Database Schema

        4. API Endpoints

        5. Data Flow Diagrams

        6. Security Considerations

        

        Please provide a detailed, implementable design that follows best practices and design patterns.

        """)
        
    async def create_design(self, user_stories: str) -> Dict[str, Any]:
        """Create design specifications from user stories"""
        result = await self.process({"input": user_stories})
        
        # Store the design in the database
        db.store_artifact(
            "designs",
            result,
            {
                "type": "design",
                "source": "designer",
                "status": "created"
            }
        )
        
        return {
            "status": "success",
            "design": result,
            "message": "Design specifications created successfully"
        }