feat: Support gitHub PAT configuration for higher github API accessing rate. (#1374)

* feat: Add github PAT configs, allowing larger github API rates.

* Update comment to English for better clarity

* fix: Remove unused config lines in config.example.yaml and unreferenced declarations in app_config. Fix lint issues and update documentation.

* fix: Remove unused imports, and passed the ruff check.

---------

Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
This commit is contained in:
SCPZ24
2026-03-27 09:54:14 +08:00
committed by GitHub
parent c13793386f
commit 6b13f5c9fb
3 changed files with 17 additions and 3 deletions

View File

@@ -23,3 +23,6 @@ INFOQUEST_API_KEY=your-infoquest-api-key
# SLACK_BOT_TOKEN=your-slack-bot-token
# SLACK_APP_TOKEN=your-slack-app-token
# TELEGRAM_BOT_TOKEN=your-telegram-bot-token
# GitHub API Token
# GITHUB_TOKEN=your-github-token

View File

@@ -284,6 +284,14 @@ title:
model_name: null # Use first model in list
```
### GitHub API Token (Optional for GitHub Deep Research Skill)
The default GitHub API rate limits are quite restrictive. For frequent project research, we recommend configuring a personal access token (PAT) with read-only permissions.
**Configuration Steps**:
1. Uncomment the `GITHUB_TOKEN` line in the `.env` file and add your personal access token
2. Restart the DeerFlow service to apply changes
## Environment Variables
DeerFlow supports environment variable substitution using the `$` prefix:

View File

@@ -4,6 +4,7 @@ GitHub API client for deep research.
Uses requests for HTTP operations.
"""
import os
import json
import sys
from typing import Any, Dict, List, Optional
@@ -57,9 +58,10 @@ class GitHubAPI:
Initialize GitHub API client.
Args:
token: Optional GitHub personal access token for higher rate limits
token:
Optional GitHub personal access token for higher rate limits.
User can set it in .env by uncommenting the line "GITHUB_TOKEN=your-github-token".
"""
self.token = token
self.headers = {
"Accept": "application/vnd.github.v3+json",
"User-Agent": "Deep-Research-Bot/1.0",
@@ -294,7 +296,8 @@ def main():
owner, repo = sys.argv[1], sys.argv[2]
command = sys.argv[3] if len(sys.argv) > 3 else "summary"
api = GitHubAPI()
token = os.getenv("GITHUB_TOKEN")
api = GitHubAPI(token=token)
commands = {
"info": lambda: api.get_repo_info(owner, repo),