File size: 5,351 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
import streamlit as st
import asyncio
from agents.project_manager import ProjectManagerAgent
import json
from typing import Dict, Any

# Initialize the project manager
project_manager = ProjectManagerAgent()

# Set page config
st.set_page_config(
    page_title="AI Development Pod",
    page_icon="πŸ€–",
    layout="wide"
)

# Custom CSS
st.markdown("""

    <style>

    .main {

        padding: 2rem;

    }

    .stButton>button {

        width: 100%;

    }

    .stTextArea>div>div>textarea {

        height: 200px;

    }

    .progress-bar {

        height: 10px;

        background-color: #f0f0f0;

        border-radius: 5px;

        margin: 10px 0;

    }

    .progress-bar-fill {

        height: 100%;

        background-color: #4CAF50;

        border-radius: 5px;

        transition: width 0.3s ease-in-out;

    }

    </style>

""", unsafe_allow_html=True)

# Title and description
st.title("πŸ€– AI Development Pod")
st.markdown("""

    This is an AI-powered virtual development team that can handle your software project from requirements to testing.

    Simply enter your project requirements and let the AI team do the rest!

""")

# Sidebar for navigation
st.sidebar.title("Navigation")
page = st.sidebar.radio("Go to", ["Start Project", "Project Status", "Quality Check"])

def display_progress(messages: list):
    """Display progress based on workflow messages"""
    steps = {
        "User stories created successfully": 20,
        "Design created successfully": 40,
        "Code generated successfully": 60,
        "Test cases created successfully": 80,
        "Tests executed successfully": 100
    }
    
    current_progress = 0
    for message in messages:
        if message in steps:
            current_progress = max(current_progress, steps[message])
    
    st.markdown(f"""

        <div class="progress-bar">

            <div class="progress-bar-fill" style="width: {current_progress}%"></div>

        </div>

        <p style="text-align: center;">{current_progress}% Complete</p>

    """, unsafe_allow_html=True)
    
    for message in messages:
        st.info(message)

async def run_project(requirements: str) -> Dict[str, Any]:
    """Run the project workflow"""
    return await project_manager.start_project(requirements)

async def get_project_status() -> Dict[str, Any]:
    """Get the project status"""
    return await project_manager.get_status()

async def run_quality_check() -> Dict[str, Any]:
    """Run the quality check"""
    return await project_manager.check_quality()

if page == "Start Project":
    st.header("Start New Project")
    
    # Project requirements input
    requirements = st.text_area(
        "Enter your project requirements:",
        placeholder="Describe your project requirements in detail...",
        height=200
    )
    
    if st.button("Start Project"):
        if requirements:
            with st.spinner("Processing your project..."):
                # Run the async function
                result = asyncio.run(run_project(requirements))
                
                # Display progress
                display_progress(result["messages"])
                
                # Display results in tabs
                tab1, tab2, tab3, tab4 = st.tabs(["User Stories", "Design", "Code", "Test Results"])
                
                with tab1:
                    st.subheader("User Stories")
                    st.markdown(result["user_stories"])
                
                with tab2:
                    st.subheader("Design")
                    st.markdown(result["design"])
                
                with tab3:
                    st.subheader("Generated Code")
                    st.code(result["code"], language="python")
                
                with tab4:
                    st.subheader("Test Results")
                    st.markdown(result["test_results"])
        else:
            st.error("Please enter project requirements")

elif page == "Project Status":
    st.header("Project Status")
    
    if st.button("Check Status"):
        with st.spinner("Getting project status..."):
            status = asyncio.run(get_project_status())
            
            # Display status metrics
            col1, col2, col3, col4 = st.columns(4)
            
            with col1:
                st.metric("User Stories", status["data"]["user_stories"])
            with col2:
                st.metric("Designs", status["data"]["designs"])
            with col3:
                st.metric("Code Files", status["data"]["code"])
            with col4:
                st.metric("Test Results", status["data"]["test_results"])

elif page == "Quality Check":
    st.header("Quality Check")
    
    if st.button("Run Quality Check"):
        with st.spinner("Running quality check..."):
            quality_report = asyncio.run(run_quality_check())
            
            st.subheader("Quality Report")
            st.markdown(quality_report["quality_report"])

# Footer
st.markdown("---")
st.markdown("""

    <div style='text-align: center'>

        <p>AI Development Pod - Powered by Groq's Gemma2-9b-it and LangGraph</p>

    </div>

""", unsafe_allow_html=True)