GitHub Sentinel is an AI Agent
designed for the era of large language models (LLMs), specializing in intelligent information retrieval and high-value content extraction. It is tailored for users with high-frequency and large-scale information needs, such as open-source enthusiasts, individual developers, and investors.
GitHub Sentinel not only helps users automatically track and analyze the progress of GitHub open-source projects
but also extends its capabilities to other information sources, such as trending topics on Hacker News
, providing a more comprehensive approach to information extraction and analysis.
GitHub Project Tracking and Summary
Hacker News Trending Tech Topic Mining
First, install the required dependencies:
pip install -r requirements.txt
Edit the config.json
file to set up your GitHub Token, Email settings (using Tencent WeCom Email as an example), subscription file, update settings, large model service configurations (supporting OpenAI GPT API and Ollama private large model service) and report types autogenerated by LLMs:
{
"github": {
"token": "your_github_token",
"subscriptions_file": "subscriptions.json",
"progress_frequency_days": 1,
"progress_execution_time": "08:00"
},
"email": {
"smtp_server": "smtp.exmail.qq.com",
"smtp_port": 465,
"from": "[email protected]",
"password": "your_email_password",
"to": "[email protected]"
},
"llm": {
"model_type": "ollama",
"openai_model_name": "gpt-4o-mini",
"ollama_model_name": "llama3",
"ollama_api_url": "http://localhost:11434/api/chat"
},
"report_types": [
"github",
"hacker_news_hours_topic",
"hacker_news_daily_report"
],
"slack": {
"webhook_url": "your_slack_webhook_url"
}
}
For security reasons: The GitHub Token and Email Password settings support using environment variables to avoid configuring sensitive information in plain text, as shown below:
# Github
export GITHUB_TOKEN="github_pat_xxx"
# Email
export EMAIL_PASSWORD="password"
GitHub Sentinel supports the following three running modes:
You can run the application interactively from the command line:
python src/command_tool.py
In this mode, you can manually input commands to manage subscriptions, retrieve updates, and generate reports.
To run the application as a background service (daemon process), it will automatically update periodically according to the relevant configuration.
You can directly use the daemon management script daemon_control.sh to start, check the status, stop, and restart:
Start the service:
$ ./daemon_control.sh start
Starting DaemonProcess...
DaemonProcess started.
config.json
.logs/DaemonProcess.log
file. At the same time, historical cumulative logs will also be appended to the logs/app.log
log file.Check the service status:
$ ./daemon_control.sh status
DaemonProcess is running.
Stop the service:
$ ./daemon_control.sh stop
Stopping DaemonProcess...
DaemonProcess stopped.
Restart the service:
$ ./daemon_control.sh restart
Stopping DaemonProcess...
DaemonProcess stopped.
Starting DaemonProcess...
DaemonProcess started.
To run the application with a Gradio interface, allowing users to interact with the tool via a web interface:
python src/gradio_server.py
http://localhost:7860
, but it can be shared publicly if needed.Ollama is a private large model management tool that supports local and containerized deployment, command-line interaction, and REST API calls.
For detailed instructions on Ollama installation and private large model service deployment, please refer to Ollama Installation and Service Deployment.
To use Ollama for calling private large model services in GitHub Sentinel, follow these steps for installation and configuration:
Install Ollama: Download and install the Ollama service according to the official Ollama documentation. Ollama supports multiple operating systems, including Linux, Windows, and macOS.
Start the Ollama Service: After installation, start the Ollama service with the following command:
ollama serve
By default, the Ollama API will run on http://localhost:11434
.
Configure Ollama for Use in GitHub Sentinel:
In the config.json
file, configure the relevant information for the Ollama API:
{
"llm": {
"model_type": "ollama",
"ollama_model_name": "llama3",
"ollama_api_url": "http://localhost:11434/api/chat"
}
}
Validate the Configuration: Start GitHub Sentinel and generate a report with the following command to verify that the Ollama configuration is correct:
python src/command_tool.py
If the configuration is correct, you will be able to generate reports using the Ollama model.
To ensure the quality and reliability of the code, GitHub Sentinel uses the unittest
module for unit testing. For detailed explanations of unittest
and related tools (such as @patch
and MagicMock
), please refer to Detailed Unit Test Explanation.
validate_tests.sh
validate_tests.sh
is a shell script used to run unit tests and validate the results. It is executed during the Docker image build process to ensure the correctness and stability of the code.
test_results.txt
file.To facilitate building and deploying the GitHub Sentinel project in various environments, we provide Docker support. This support
includes the following files and functionalities:
Dockerfile
The Dockerfile
is a configuration file used to define how to build a Docker image. It describes the steps to build the image, including installing dependencies, copying project files, running unit tests, etc.
python:3.10-slim
as the base image and set the working directory to /app
.requirements.txt
file and install Python dependencies.validate_tests.sh
script.validate_tests.sh
script to ensure that all unit tests pass. If the tests fail, the build process will be aborted.src/main.py
as the entry point.build_image.sh
build_image.sh
is a shell script used to automatically build a Docker image. It retrieves the branch name from the current Git branch and uses it as the tag for the Docker image, facilitating the generation of different Docker images on different branches.
docker build
command to build the Docker image and tag it with the current Git branch name.chmod +x build_image.sh
./build_image.sh
With these scripts and configuration files, you can ensure that Docker images built in different development branches are based on code that has passed unit tests, thereby improving code quality and deployment reliability.
Contributions make the open-source community a wonderful place to learn, inspire, and create. Any contributions you make are greatly appreciated. If you have any suggestions or feature requests, please start an issue to discuss what you would like to change.
This project is licensed under the terms of the Apache-2.0 License. See the LICENSE file for details.
Django Peng - [email protected]
Project Link: https://github.com/DjangoPeng/GitHubSentinel