Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GithubGPT - Analyse and converse with any Github profile [Deployed Link in PR] #46

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions community/github-analyzer/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from flask import Flask, render_template, request, jsonify
from tuneai_integration import analyze_github_profile

app = Flask(__name__)

@app.route('/')
def index():
return render_template('index.html')

@app.route('/chat', methods=['POST'])
def chat():
user_input = request.json.get("message")
tuneAI_response = analyze_github_profile(user_input)
# tuneAI_response = "okay broooo"
# For simplicity, echoing user input (replace this with any processing logic you need)
bot_response = f"{tuneAI_response}"
return jsonify({"response": bot_response})

if __name__ == "__main__":
# app.run(debug=True)
app.run(port=7788)
Binary file added community/github-analyzer/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions community/github-analyzer/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# GitHubGPT 🤖

## Overview

GitHubGPT is your github analyser tool that utilizes the power of the TuneAI API and analyze any GitHub profiles. It provides users with insights and information about specific GitHub users based on their username queries. The application combines a user-friendly interface with the capabilities of a conversational AI, making it easy to interact with GitHub data.

## Questions to test with githubGPT

- Should I hire `sayak9495` for python role?
- What is the most reviewed repo by `abhishekmishragithub`?
- Tell me top 3 language used by `palnabarun`

## How It Works

1. **User Input**: Users can enter a GitHub username or a query that includes the username.
2. **Processing**: The application extracts the username and sends a request to the TuneAI API for analysis.
3. **Response Handling**: The response is processed and displayed in a user-friendly format.
4. **Continuous Interaction**: Users can ask follow-up questions or provide new queries.

## Demo

![](https://raw.githubusercontent.com/Sayak9495/cookbook/refs/heads/main/community/github-analyzer/demo.gif)

## Usage

To run GitHubGPT locally using `pyenv`, follow these steps:

1. **Clone the repository**:
```bash
git clone https://github.com/sayak9495/cookbook.git
```
2. **Move to GithubGPT**:
```bash
cd cookbook/community/github-analyzer
```
3. **Install Requirements.TXT**:
```bash
python3 install -r requirements.txt
```
4. **Run**:
```bash
python3 app.py
```
5. **Note**:
```bash
Add os-env variables for the required key
```
122 changes: 122 additions & 0 deletions community/github-analyzer/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
alembic==1.13.2
androguard==4.1.2
-e git+https://github.com/mitmproxy/android-unpinner.git@7968f0b9cd9e93e84f38faba63b118b8b48aff72#egg=android_unpinner
apkInspector==1.3.1
asn1crypto==1.5.1
asttokens==2.4.1
banal==1.0.6
beautifulsoup4==4.12.3
boto3==1.34.10
botocore==1.34.10
bs4==0.0.2
certifi==2022.9.24
charset-normalizer==2.1.1
cli_helpers==2.3.1
click==7.1.2
colorama==0.4.6
colour==0.1.5
config==0.5.1
configobj==5.0.8
configparser==5.3.0
contourpy==1.2.1
cycler==0.12.1
Cython==3.0.10
dataset==1.6.2
decorator==5.1.1
delegator.py==0.1.1
distlib==0.3.6
dnspython==1.16.0
executing==2.0.1
filelock==3.8.0
Flask==1.1.2
Flask-CKEditor==0.4.4.1
Flask-WTF==0.14.3
fonttools==4.53.0
frida==16.4.10
frida-tools==12.5.0
glcontext==2.5.0
gunicorn==20.0.4
idna==3.4
ipython==8.25.0
isosurfaces==0.1.2
itsdangerous==1.1.0
jedi==0.19.1
Jinja2==2.11.3
jmespath==1.0.1
kiwisolver==1.4.5
litecli==1.11.0
loguru==0.7.2
lxml==5.3.0
Mako==1.3.5
-e git+https://github.com/3b1b/manim.git@88c7e9d2c96be1ea729b089c06cabb1bd3b2c187#egg=manimgl
ManimPango==0.4.4
mapbox-earcut==1.0.1
markdown-it-py==3.0.0
MarkupSafe==1.1.1
matplotlib==3.9.0
matplotlib-inline==0.1.7
matplotlib-venn==0.11.10
mdurl==0.1.2
moderngl==5.10.0
moderngl-window==2.4.6
mpmath==1.3.0
multipledispatch==1.0.0
mutf8==1.0.6
mysql-connector==2.2.9
networkx==3.3
numpy==1.26.4
objection==1.11.0
oscrypto==1.3.0
packaging==24.0
parso==0.8.4
pbr==5.11.0
pexpect==4.9.0
pillow==10.3.0
platformdirs==2.5.4
prompt_toolkit==3.0.45
ptyprocess==0.7.0
pure-eval==0.2.2
pydot==3.0.1
pydub==0.25.1
pygame==2.5.2
pyglet==2.0.15
Pygments==2.18.0
pymongo==3.11.0
pyobjc-core==10.3
pyobjc-framework-Cocoa==10.3
PyOpenGL==3.1.7
pyparsing==3.1.2
pyperclip==1.8.2
pyrr==0.10.3
python-dateutil==2.8.2
PyYAML==6.0.1
requests==2.28.1
rich==13.7.1
rich-click==1.8.3
s3transfer==0.10.0
scipy==1.13.1
screeninfo==0.8.1
semver==2.13.0
six==1.16.0
skia-pathops==0.8.0.post1
soupsieve==2.5
sql==2022.4.0
SQLAlchemy==1.4.53
sqlparse==0.5.1
stack-data==0.6.3
stevedore==4.1.1
svgelements==1.9.6
sympy==1.12.1
tabulate==0.9.0
tqdm==4.66.4
traitlets==5.14.3
typing_extensions==4.12.0
urllib3==1.26.12
validators==0.28.3
venny4py==1.0.2
virtualenv==20.16.7
virtualenv-clone==0.5.7
virtualenvwrapper==4.8.4
wcwidth==0.2.13
Werkzeug==1.0.1
WTForms==2.3.1
179 changes: 179 additions & 0 deletions community/github-analyzer/templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GithubGPT 🦾</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f3e6ff; /* Light purple background */
color: #333;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.chat-container {
width: 100%;
max-width: 600px;
background-color: #fff;
border-radius: 8px;
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
padding: 20px;
}
.chat-header {
text-align: center;
font-size: 1.5rem;
font-weight: bold;
margin-bottom: 20px;
color: #5d3fd3; /* Heading color */
}
.chat-box {
height: 300px;
border: 1px solid #ddd;
border-radius: 5px;
padding: 10px;
overflow-y: auto;
margin-bottom: 10px;
background-color: #f9f9f9;
word-wrap: break-word; /* Ensures long words or sentences wrap within the box */
white-space: pre-wrap; /* Allows the content to wrap inside the box */
}
.chat-input {
width: 100%;
padding: 10px;
border-radius: 5px;
border: 1px solid #ddd;
font-size: 1rem;
width: -webkit-fill-available;
}
.send-button {
background-color: #5d3fd3;
color: white;
border: none;
padding: 10px;
font-size: 1rem;
border-radius: 5px;
cursor: pointer;
margin-top: 10px;
width: 100%;
}
.loader {
display: none;
margin: 10px auto;
border: 8px solid #f3f3f3; /* Light grey */
border-top: 8px solid #5d3fd3; /* Purple */
border-radius: 50%;
width: 40px;
height: 40px;
animation: spin 1s linear infinite; /* Animation */
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.message {
margin-bottom: 10px;
word-wrap: break-word; /* Ensures the message text wraps inside the container */
overflow-wrap: break-word; /* Ensures long words break and wrap */
white-space: pre-wrap; /* Preserves formatting like newlines */
}
.bot {
color: #5d3fd3;
font-weight: bold;
}
.language-markdown {
flex: auto;
display: flex;
overflow-wrap: break-word; /* Allows long words to wrap */
word-wrap: break-word; /* Ensures long words break and wrap */
white-space: pre-wrap; /* Preserves whitespace and wraps */
}
.language-markdown pre {
margin: 0; /* Remove default margin */
overflow: auto; /* Allow overflow for other reasons, but we will wrap */
}
.language-markdown code {
white-space: pre-wrap; /* Preserve newlines and wrap */
overflow-wrap: break-word; /* Allows long words to wrap */
}
</style>
</head>
<body>
<div class="chat-container">
<div class="chat-header">GithubGPT 🤖</div>
<div id="chat-box" class="chat-box"></div>
<div id="loader" class="loader"></div>
<input id="chat-input" type="text" class="chat-input" placeholder="Type your github-analyze query - 'Should I hire sayak9495 for ruby dev role?'" autocomplete="off">
<button id="send-button" class="send-button">Send</button>
</div>

<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script>
document.getElementById("send-button").addEventListener("click", function() {
sendMessage();
});

document.getElementById("chat-input").addEventListener("keypress", function(event) {
if (event.key === "Enter") {
sendMessage();
}
});

function sendMessage() {
const chatBox = document.getElementById("chat-box");
const userMessage = document.getElementById("chat-input").value;
if (!userMessage) return;

// Display user message in chat
const userMessageElement = document.createElement("div");
userMessageElement.classList.add("message");
userMessageElement.innerHTML = `<strong>You:</strong> ${userMessage}`;
chatBox.appendChild(userMessageElement);

// Clear the input field
document.getElementById("chat-input").value = "";

// Scroll chat to bottom
chatBox.scrollTop = chatBox.scrollHeight;

// Show loader
document.getElementById("loader").style.display = "block";

// Send user message to the server
fetch('/chat', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ message: userMessage })
})
.then(response => response.json())
.then(data => {
// Convert markdown response to HTML
const formattedResponse = marked.parse(data.response);

// Display bot response in chat
const botMessageElement = document.createElement("div");
botMessageElement.classList.add("message", "bot");
botMessageElement.innerHTML = `<strong>GithubGPT:</strong> ${formattedResponse}`;
chatBox.appendChild(botMessageElement);

// Scroll chat to bottom
chatBox.scrollTop = chatBox.scrollHeight;

// Hide loader
document.getElementById("loader").style.display = "none";
})
.catch(error => {
console.error('Error:', error);
// Hide loader in case of error
document.getElementById("loader").style.display = "none";
});
}
</script>
</body>
</html>
Loading