From 6b13f5c9fb052b2efee1e76edc5af91b9244a74d Mon Sep 17 00:00:00 2001 From: SCPZ24 <1845371061@qq.com> Date: Fri, 27 Mar 2026 09:54:14 +0800 Subject: [PATCH] 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 --- .env.example | 3 +++ backend/docs/CONFIGURATION.md | 8 ++++++++ skills/public/github-deep-research/scripts/github_api.py | 9 ++++++--- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.env.example b/.env.example index 08ccc87..6da7517 100644 --- a/.env.example +++ b/.env.example @@ -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 diff --git a/backend/docs/CONFIGURATION.md b/backend/docs/CONFIGURATION.md index 19359a3..5721fff 100644 --- a/backend/docs/CONFIGURATION.md +++ b/backend/docs/CONFIGURATION.md @@ -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: diff --git a/skills/public/github-deep-research/scripts/github_api.py b/skills/public/github-deep-research/scripts/github_api.py index 41fc76e..978f886 100644 --- a/skills/public/github-deep-research/scripts/github_api.py +++ b/skills/public/github-deep-research/scripts/github_api.py @@ -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),