This project is an AI-powered code generator assistant that works through a simple web interface. Users can enter a prompt, and the AI model generates Python code based on that prompt, using the provided Job class as a foundation.
- Web interface for entering prompts
- AI-powered code generation using Gemini API
- Generated code based on the provided Job class template
- Meaningful title generation for each code snippet
- Kubernetes deployment support
-
Model Integration
- Uses Gemini API for code generation
- Custom system prompt to guide the AI response format
-
Python Integration
- Flask web application for the user interface
- OpenAI API integration for AI model access
-
Output Processing
- Parses code blocks from the model response
- Extracts and displays the title
-
Deployment
- Docker containerization
- Kubernetes deployment configuration
- Python 3.8+
- Docker
- Kubernetes cluster or Minikube
- Gemini API key
- Clone the repository
- Create a
.envfile with your Gemini API key:GEMINI_API_KEY=your_api_key_here - Install dependencies:
pip install -r requirements.txt - Run the application:
python app.py
docker build -t ai-code-generator .
This project provides automatic code synchronization from GitHub to GitLab, Docker image creation with GitLab CI/CD pipeline, and automatic deployment to a Kubernetes cluster. Tüm bağlantılar ve pipeline ayarları yeni GitLab projesine göre güncellenmiştir.
- Code changes are automatically mirrored from GitHub to GitLab using GitHub Actions. For details, see the
CI_CD_SETUP.mdfile. - For details, see the
CI_CD_KURULUM.mdfile.
- The code is built, tested, and the Docker image is automatically created and pushed to the registry.
- After the pipeline is completed, automatic deployment to the Kubernetes cluster is performed.
- Pipeline configuration:
.gitlab-ci.yml - GitLab repository:
git@gitlab.com:GITLAB_KULLANICI_ADI/YENI_PROJE_ADI.git
- The
Dockerfileis located in the project root directory. - The Docker image is automatically built and used during the pipeline.
- Deployment and service definitions are located in the
kubernetes/directory. - The necessary config and secret settings for automatic deployment to the Kubernetes cluster are used in the pipeline.
- For all integration and automation steps, please review the
CI_CD_KURULUM.mdfile.
To deploy this project on Kubernetes, follow these steps:
- Create the Namespace:
kubectl create namespace ai-applications
- Add your OpenAI API key as a Kubernetes secret:
kubectl create secret generic openai-api-secret --from-literal=api-key=YOUR_OPENAI_API_KEY -n ai-applications
- Build and push the Docker image:
docker build -t ai-code-generator . # For Minikube: minikube image load ai-code-generator # Or for Docker Hub: docker tag ai-code-generator yourusername/ai-code-generator docker push yourusername/ai-code-generator
- Update the image name in
kubernetes/deployment.yamlif using an external registry. - Apply the Kubernetes manifests:
kubectl apply -f kubernetes/deployment.yaml kubectl apply -f kubernetes/service.yaml
- Check the status of your deployment and service:
kubectl get pods -n ai-applications kubectl get svc -n ai-applications kubectl get ingress -n ai-applications
Make sure the namespace and secret names in your manifests match those you created above. The OpenAI API key should be base64 encoded if you edit the secret manifest directly.
- Access the web interface
- Enter your prompt in the text area
- Click "Generate Code"
- View the generated code and title
.
├── app.py # Main Flask application
├── templates/ # HTML templates
│ └── index.html # Main web interface
├── static/ # Static assets
│ └── style.css # CSS styles
├── config.py # Configuration settings
├── ai_service.py # AI integration service
├── models/ # Model definitions
│ └── job.py # Job class implementation
├── Dockerfile # Docker configuration
├── kubernetes/ # Kubernetes configuration
│ ├── deployment.yaml # Deployment configuration
│ └── service.yaml # Service configuration
├── requirements.txt # Python dependencies
└── .env # Environment variables (not in git)
MIT