parthib07's picture
Upload 52 files
e5e882e verified
raw
history blame
5.35 kB
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)