-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
80 lines (71 loc) · 1.6 KB
/
index.html
File metadata and controls
80 lines (71 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<!DOCTYPE html>
<html>
<head>
<title>GitGrade</title>
<style>
body {
font-family: Arial;
background: #0f172a;
color: white;
padding: 40px;
}
input, button {
padding: 10px;
width: 100%;
margin-top: 10px;
font-size: 16px;
}
button {
background: #22c55e;
border: none;
cursor: pointer;
}
.card {
background: #020617;
padding: 20px;
margin-top: 20px;
border-radius: 8px;
}
pre {
white-space: pre-wrap;
}
</style>
</head>
<body>
<h1>🚀 GitGrade</h1>
<p>AI-powered GitHub Repository Evaluation</p>
<input id="repo" placeholder="Paste GitHub repository URL" />
<button onclick="analyze()">Analyze</button>
<div id="result"></div>
<script>
async function analyze() {
const repo = document.getElementById("repo").value;
document.getElementById("result").innerHTML = "⏳ Analyzing...";
try {
const res = await fetch("/analyze", {
method: "POST",
headers: {"Content-Type": "application/json"},
body: JSON.stringify({ repo_url: repo })
});
if (!res.ok) {
throw new Error(`API Error: ${res.status}`);
}
const data = await res.json();
document.getElementById("result").innerHTML = `
<div class="card">
<h2>Score: ${data.score}/100</h2>
<pre>${data.ai_feedback}</pre>
</div>
`;
} catch (error) {
document.getElementById("result").innerHTML = `
<div class="card" style="color: #ff6b6b;">
<h2>Error</h2>
<pre>${error.message}</pre>
</div>
`;
}
}
</script>
</body>
</html>