mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-19 14:55:40 +08:00
Feat: data source test connection with unified connector validation (#14992)
This commit is contained in:
@@ -358,6 +358,18 @@ class GithubConnector(CheckpointedConnectorWithPermSyncGH[GithubConnectorCheckpo
|
||||
self.include_issues = include_issues
|
||||
self.github_client: Github | None = None
|
||||
|
||||
@classmethod
|
||||
def build_connector(cls, config: dict[str, Any]) -> "GithubConnector":
|
||||
credentials = config.get("credentials") or {}
|
||||
connector = cls(
|
||||
repo_owner=config.get("repository_owner"),
|
||||
repositories=config.get("repository_name"),
|
||||
include_prs=config.get("include_pull_requests", True),
|
||||
include_issues=config.get("include_issues", True),
|
||||
)
|
||||
connector.load_credentials({"github_access_token": credentials["github_access_token"]})
|
||||
return connector
|
||||
|
||||
def load_credentials(self, credentials: dict[str, Any]) -> dict[str, Any] | None:
|
||||
# defaults to 30 items per page, can be set to as high as 100
|
||||
token = credentials["github_access_token"]
|
||||
|
||||
Reference in New Issue
Block a user