Skip to content

Commit

Permalink
add image
Browse files Browse the repository at this point in the history
  • Loading branch information
yunwei37 committed Jun 15, 2023
1 parent 780dbad commit d2669e6
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 32 deletions.
105 changes: 74 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,95 @@
# chatgpt-github-stat-plugin

ChatGPT plugin to help you get insight to Github Repos and Users

### Project setup
When prompted for your website domain, type in 'https://chat-gpt-github-stat-plugin.vercel.app'

1. Run the server
## Usage and Examples

set the env `REACT_APP_GITHUB_ACCESS_TOKEN` as your github token and run the server:
Here are the same use cases expressed in more natural language:

```sh
export REACT_APP_GITHUB_ACCESS_TOKEN=<your github token>
npm run build
npm start
# If you run this in dev mode, the memory may not persist well as the server will randomly restart sometimes
```
1. **Getting information about a specific GitHub repository**

2. Set up your GPT Plugin in the ChatGPT Plugin UI.
You can ask for information about:

When prompted for your website domain, type in 'https://chat-gpt-github-stat-plugin.vercel.app'
- a specific GitHub repository, such as the number of stars, forks, and issues, the primary language used in the repository, license, etc.
- the history of a specific GitHub repository, such as the number of stars over time.
- the topic of repositories.
- the README of a repository.

### Usage
For example:

Ask for your list of todos:
> Can you tell me the statistics for the https://github.com/Significant-Gravitas/Auto-GPT? Should I use it in my project? Tell me your analysis.
```sh
what are my todos?
# or anything like that
```
![info](public/info.png)

Add a todo:
You can ask questions about whether you should use a specific repository in your project, how to improve a specific repository as a maintainer, etc.

```sh
add book flight to my todos
```
You can easily get the charts of the history of a repository by using the charts plugin in ChatGPT:

Summarize todos:
![chart](public/stat-chart.png)

```
How many todos do I have left?
```
2. **Getting information about a GitHub user**

You can ask for information about:

- a specific GitHub user, such as the number of followers, the number of repositories, the number of contributions, total stars, total pull requests, followers etc.
- the ranks of a specific GitHub user, Available ranks are S+ (top 1%), S (top 25%), A++ (top 45%), A+ (top 60%), and B+ (everyone). The values are calculated by using the cumulative distribution function using commits, contributions, issues, stars, pull requests, followers, and owned repositories.

For example:

> Can you show me how the activity of the GitHub user 'torvalds'? Tell me about him now.
![user](public/user-info.png)

3. **Comparing two repositories**

You can compare two repositories by asking for information about both repositories. What's more, you can use charts plugin in ChatGPT to visualize the comparison.

> Can you compare the 'react' repository from 'facebook' and the 'angular.js' repository from 'angular' on GitHub? Use charts to compare them, and give me a report. Think step by step on how to do it. You can put the same stats of two repo in one chart and compare them.
Or any other questions you might have.
![compare](public/compare.png)

### Configuration
charts:

To add more routes:
![compare](public/compare-chart.png)

1. Create new route in `pages/api` directory.
4. **Tracking the growth of a repository over time**

You can easily track the growth of a repository over time and then using the charts plugin in ChatGPT to visualize the growth, with a single prompt.

> Can you read the star history and stats of https://github.com/eunomia-bpf/wasm-bpf , analyze the result, and build charts for sthe starhistory(a linear representation of dates on a horizontal scale), and the statistics? Think step by step and choose the right ways. To create a linear horizontal axis based on the provided dates, you can follow these steps:
>
> Determine the range of dates: Identify the earliest and latest dates in the dataset.
> Calculate the time span: Calculate the duration or time span between the earliest and latest dates.
> Determine the scale: Decide on an appropriate scale for the horizontal axis based on the time span. You can choose a suitable unit of measurement, such as days, and divide the horizontal space evenly based on the number of days in the time span.
> Assign positions to the dates: Assign positions or coordinates on the horizontal axis to each date based on their relative distances from the starting point.
![star-history](public/history.png)

and charts:

![star-history](public/history-chart.png)

5. **Analyzing the activity of a user over time**

> tell me about https://github.com/Himself65 and alalyze his repo, what does the activity of a him over time?
![user-repo](public/user-repo.png)

## Project setup

1. Run the server

set the env `REACT_APP_GITHUB_ACCESS_TOKEN` as your github token and run the server:

```sh
export REACT_APP_GITHUB_ACCESS_TOKEN=<your github token>
npm run build
npm start
# If you run this in dev mode, the memory may not persist well as the server will randomly restart sometimes
```

2. Set up your GPT Plugin in the ChatGPT Plugin UI.

2. Update `openapi.yaml` with new path

3. Update `openapi.yaml` with schema for any data model coming back or being passed in.
2 changes: 1 addition & 1 deletion lib/repoStats/getRepoReadme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export async function getRepoReadme(owner: string, repo: string): Promise<string
if (readmeResponse.ok) {
readmeData = await readmeResponse.text();
} else {
throw new Error("README not found on main or master branch.");
return "README not found on main or master branch.";
}
}
/// Limit the README to 8KB
Expand Down
Binary file added public/compare-chart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/compare.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/history-chart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/history.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/info.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/stat-chart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/user-info.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/user-repo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

1 comment on commit d2669e6

@vercel
Copy link

@vercel vercel bot commented on d2669e6 Jun 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.