Your best AI assistant for GitHub repositories, it not only helps you automatically translate issues/discussions/PRs/commits into the specified language, but also performs code review and automatic code fixes by vectorizing the entire project to generate detailed context and submitting it to the AI, similar to the implementation of cursor.
- Automatically translate specified issues/discussions/PRs/commits to English or a designated language
- Batch translate all issues/discussions/PRs of a repository to English or a designated language
- Option to use GPT series or GEMINI series models for translation (or any model compatible with OpenAI interface)
- Retain the original text alongside the English translation
- Automatically add markers after translation to English to prevent duplicate translations
- Built-in webhook server for automatic translation of issues/discussions/PRs/commits to English or other languages
- Support for pre-translation by modifying JSON files in the data directory
- Use of asynchronous coroutines for translation to improve efficiency
- Provide two translation backends, with options to use sentence splitting translation or direct translation, and the ability to extend translation backends
- Support for manual or webhook-triggered automatic code review of submitted PRs or commits, providing suggestions for fixes and optimizations, for example: here
- Supports code review based on code tree segmentation and vectorization, similar to the implementation of cursor. By providing the AI with sufficient context, it can offer more accurate code review and fix suggestions.
Deploy on Ubuntu 20.04:
git clone https://github.com/ZLMediaKit/Github-AI-Assistant.git
cd translation_issues
chmod +x ./run.sh
sudo ./run.sh
Deploy on other systems:
git clone https://github.com/ZLMediaKit/Github-AI-Assistant.git
cd translation_issues
# Install python3.11 or later
# Create a virtual environment
python3 -m venv venv
# Activate the virtual environment
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
Enable webhook server and auto-start on boot:
sudo ./run.sh auto_start
View help:
./run.sh --help
View help for a specific command:
./run.sh trans_issues --help
Set environment variables:
./run.sh update_env
[Note: If you are using the GEMINI-PRO model, keep OPENAI_API_KEY empty, as it will prioritize translation using the GPT4 model.]
Translate a specific issue:
./run.sh trans_issues --input-url https://github.com/your-org/your-repository/issues/1
[Note: If you haven't set environment variables in .env, you will need to specify parameters such as github-token, model_name and api_key]
./run.sh trans_issues --input-url https://github.com/your-org/your-repository/issues/1 --github-token ghp_xxx --model_name gemini/gemini-1.5-flash --api_key xxxx
Translate a specific discussion:
./run.sh trans_discussions --input-url https://github.com/your-org/your-repository/discussions/1
Translate a specific PR:
./run.sh trans_pr --input-url https://github.com/your-org/your-repository/pull/1
Batch translate all issues/discussions/pull requests of a specific repository:
# Translate issues, limit 10 translations per batch
./run.sh batch_trans --input-url https://github.com/your-org/your-repository --query-filter issue --query-limit 10
# Translate discussions, limit 10 translations per batch
./run.sh batch_trans --input-url https://github.com/your-org/your-repository --query-filter discussion --query-limit 10
# Translate pull requests, limit 10 translations per batch
./run.sh batch_trans --input-url https://github.com/your-org/your-repository --query-filter pr --query-limit 10
Use AI to review the specified PR or commit:
# Review PR
./run.sh review_pr --input-url https://github.com/ZLMediaKit/ZLMediaKit/pull/3758
# Review commit
./run.sh review_commit --input-url https://github.com/ZLMediaKit/ZLMediaKit/commit/e322db0a044fec82c66cc4e0b0daaa5e3b75b079
Start the GitHub webhook server:
./run.sh webhook start
After enabling the webhook server, you need to configure a webhook in GitHub. Please refer to this guide for configuration.
The Payload URL for the webhook is: http://your-ip:port/api/v1/hooks
Currently, only Python and C/C++ code reviews are supported. If you need to review code in other languages, please extend the CodeElementAnalyzer
class.
The current embedding model used is jinaai/jina-embeddings-v2-base-code
, but you can choose other models according to your needs.
The current vector database used is milvus/milvus
, but you can choose other databases according to your needs.
You can edit the EMBEDDING_MODEL
and MILVUS_URI
in the .env
file to select your model and database.
EMBEDDING_MODEL=jinaai/jina-embeddings-v2-base-code
MILVUS_URI=milvus://
Then, you need to vectorize the codebase and build the index:
./run make_project_index --repo-url https://github.com/ZLMediaKit/ZLToolKit
Once the project is vectorized and the index is built, code reviews will prioritize using the vectorized method. Other functionalities remain the same as regular code reviews, without any modifications needed.
However, please note that if it is for testing purposes, you do not need to set MILVUS_URI
in the .env
file, as it will automatically use the lite version of the vector database. For production environments, you must deploy the Milvus database and set MILVUS_URI
.