|
1 month ago | |
---|---|---|
.. | ||
.github/workflows | 1 month ago | |
docs | 1 month ago | |
src | 1 month ago | |
tests | 1 month ago | |
themes | 1 month ago | |
.dockerignore | 1 month ago | |
.env.example | 1 month ago | |
.gitignore | 1 month ago | |
Dockerfile | 1 month ago | |
LICENSE | 1 month ago | |
Makefile | 1 month ago | |
README.md | 1 month ago | |
docker-compose.yml | 1 month ago | |
gradio_theme.py | 1 month ago | |
pytest.ini | 1 month ago | |
requirements.txt | 1 month ago | |
run-docker.sh | 1 month ago | |
run.py | 1 month ago | |
setup.py | 1 month ago |
README.md
CodeXchange AI
A powerful tool for converting and executing code between different programming languages using AI models.
Overview
CodeXchangeAI is a Python application that leverages various AI models to translate code between programming languages while maintaining functionality and idiomatic patterns.
Key Features
- Multi-language code conversion
- Real-time code execution
- Multiple AI model support (GPT, Claude, DeepSeek, GROQ, Gemini)
- File upload/download functionality
- Syntax highlighting
- Detailed logging system
- Docker support
Quick Start
# Clone the repository
git clone git@github.com:alakob/ai_code_converter.git
cd ai_code_converter
# Configure environment
cp .env.example .env
# Edit .env with your API keys
Using the Docker Wrapper Script (Recommended)
For a more convenient way to run the application with Docker, you can use the provided wrapper script:
# Make the script executable
chmod +x run-docker.sh
# Run the application
./run-docker.sh # Build and run normally
./run-docker.sh -d # Run in detached mode
./run-docker.sh -p 8080 # Run on port 8080
./run-docker.sh -s # Stop the container
./run-docker.sh -h # Show help message
CI/CD Pipeline
CodeXchange AI uses GitHub Actions for continuous integration and deployment. The pipeline includes:
Automated Testing
- Runs Python tests on multiple Python versions (3.9, 3.10, 3.11)
- Performs code linting and style checks
- Generates test coverage reports
Docker Image Validation
- Builds the Docker image to verify Dockerfile integrity
- Performs vulnerability scanning with Trivy
- Validates container startup and dependencies
Deployment Automation
- Automatically deploys to staging environment when changes are pushed to develop branch
- Creates production releases with semantic versioning
- Publishes Docker images to Docker Hub
Setting Up for Development
To use the CI/CD pipeline in your fork, you'll need to add these secrets to your GitHub repository:
DOCKERHUB_USERNAME
: Your Docker Hub usernameDOCKERHUB_TOKEN
: A Docker Hub access token (not your password)
See the CI/CD documentation for detailed setup instructions.
The wrapper script provides several options for customizing the Docker deployment:
Usage: ./run-docker.sh [OPTIONS]
Options:
-b, --build Build the Docker image without running the container
-d, --detach Run container in detached mode (background)
-e, --env FILE Specify an environment file (default: .env)
-p, --port PORT Specify the port to expose (default: 7860)
-l, --logs Follow the container logs after starting
-s, --stop Stop the running container
-r, --restart Restart the container
-D, --down Stop and remove the container
-k, --keys Check for API keys and show setup instructions if missing
-h, --help Display this help message
-v, --version Display script version
Examples:
- Run on a different port:
./run-docker.sh -p 8080
- Run in background:
./run-docker.sh -d
- Stop the application:
./run-docker.sh -s
- View logs:
./run-docker.sh -l
The application will be available at http://localhost:7860
Manual Installation
# Create and activate virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Configure environment
cp .env.example .env
# Edit .env with your API keys
# Run the application
python run.py
Using Make Commands
The project includes a Makefile with useful commands to streamline development:
# Install dependencies
make install
# Run the application
make run
# Run with development settings (hot-reloading)
make dev
# Build Docker container
make docker-build
# Run Docker container
make docker-run
# Or use the Docker wrapper script for more options
./run-docker.sh
# Run tests
make test
# Clean Python cache and build artifacts
make clean
Basic Usage
- Select source and target programming languages
- Enter or upload source code
- Choose AI model and temperature
- Click "Convert" to translate the code
- Use "Run" buttons to execute original or converted code
- Download the results including compiled binaries (for compiled languages)
Supported Languages
Currently supports 17 programming languages including Python, JavaScript, Java, C++, Julia, Go, Ruby, Swift, Rust, C#, TypeScript, R, Perl, Lua, PHP, Kotlin, and SQL.
See Supported Languages for detailed information on each language.
Documentation
For detailed documentation, please refer to the docs directory:
- Supported Languages - Details on all supported programming languages
- Configuration Guide - How to configure the application
- Development Guide - Guide for developers extending the application
- Contributing Guidelines - How to contribute to the project
- Project Structure - Overview of the codebase architecture
- Architecture Diagram - Visual representation of the application architecture
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- OpenAI for GPT models
- Anthropic for Claude
- Google for Gemini
- DeepSeek and GROQ for their AI models
- The Gradio team for the web interface framework