An AI-powered assistant that helps generate FlyonUI components from descriptions and images. Built with Streamlit, OpenAI GPT-4 Vision, and OpenCV.
- 💬 Chat interface for component requests
- 🖼️ Image upload and analysis
- 🎨 Color scheme detection
- 📐 UI element recognition
- 💻 Code generation with FlyonUI components
- 🔄 Persistent chat history
- Python 3.12+
- Docker and Docker Compose
- OpenAI API key
- Clone the repository:
git clone <your-repo-url>
cd ragent
- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Create a
.env
file in the project root:
OPENAI_API_KEY=your_api_key_here
- Start the PostgreSQL database with pgvector:
docker-compose up -d
- Start the Streamlit app:
streamlit run streamlit_app.py
- Open your browser and navigate to:
http://localhost:8501
-
Text-based Generation
- Type your component requirements in the chat
- The assistant will generate FlyonUI component code
-
Image-based Generation
- Upload a UI design image in the sidebar
- The assistant will analyze the design using OpenCV
- Request specific components based on the design
-
Chat History
- Your conversation history is preserved
- Use the "Clear Chat" button to start fresh
- Start database:
docker-compose up -d
- Stop database:
docker-compose down
- View logs:
docker-compose logs -f
ragent/
├── streamlit_app.py # Main Streamlit application
├── ui_agents.py # FlyonUI agent implementation
├── docker-compose.yml # Docker configuration
├── requirements.txt # Python dependencies
└── .env # Environment variables
-
Database Connection Issues
- Ensure Docker is running
- Check if the database container is up:
docker ps
- Verify the connection settings in
ui_agents.py
-
Image Analysis Issues
- Ensure OpenCV is properly installed
- Check image format (supported: PNG, JPG, JPEG)
- Verify OpenAI API key is set correctly
Feel free to submit issues and enhancement requests!