Vaibhav Srivastav
commited on
Commit
·
41aa58e
1
Parent(s):
e359f8f
up
Browse files- dist/index.js +0 -0
- index.html +42 -1
- src/index.js +56 -1
- style/style.css +89 -0
dist/index.js
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
index.html
CHANGED
|
@@ -22,7 +22,7 @@
|
|
| 22 |
<svg height="32" aria-hidden="true" viewBox="0 0 16 16" version="1.1" width="32" class="octicon octicon-mark-github">
|
| 23 |
<path fill="#24292f" d="M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"></path>
|
| 24 |
</svg>
|
| 25 |
-
<span class="ml-4 text-gray-900 font-semibold">Issue Generator</span>
|
| 26 |
</div>
|
| 27 |
<div class="flex items-center space-x-2">
|
| 28 |
<label for="model-selection" class="text-sm text-gray-600">Model:</label>
|
|
@@ -56,6 +56,39 @@
|
|
| 56 |
<button id="generate" class="github-button">
|
| 57 |
Generate Structured Issue
|
| 58 |
</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
</div>
|
| 60 |
|
| 61 |
<div class="space-y-4">
|
|
@@ -72,6 +105,14 @@
|
|
| 72 |
</div>
|
| 73 |
</div>
|
| 74 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
<script src="./dist/index.js" type="module"></script>
|
| 76 |
</body>
|
| 77 |
</html>
|
|
|
|
| 22 |
<svg height="32" aria-hidden="true" viewBox="0 0 16 16" version="1.1" width="32" class="octicon octicon-mark-github">
|
| 23 |
<path fill="#24292f" d="M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"></path>
|
| 24 |
</svg>
|
| 25 |
+
<span class="ml-4 text-gray-900 font-semibold">Github Issue Generator running locally w/ SmolLM2 & WebGPU</span>
|
| 26 |
</div>
|
| 27 |
<div class="flex items-center space-x-2">
|
| 28 |
<label for="model-selection" class="text-sm text-gray-600">Model:</label>
|
|
|
|
| 56 |
<button id="generate" class="github-button">
|
| 57 |
Generate Structured Issue
|
| 58 |
</button>
|
| 59 |
+
|
| 60 |
+
<div class="bg-white rounded-md shadow-sm border border-gray-200 p-4">
|
| 61 |
+
<h3 class="text-sm font-medium text-gray-900 mb-2">Issue Preview</h3>
|
| 62 |
+
<div id="issue-preview" class="hidden">
|
| 63 |
+
<div class="issue-title-row flex items-center gap-2 mb-4">
|
| 64 |
+
<svg class="octicon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">
|
| 65 |
+
<path d="M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path><path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Z"></path>
|
| 66 |
+
</svg>
|
| 67 |
+
<h1 id="preview-title" class="text-xl font-semibold"></h1>
|
| 68 |
+
</div>
|
| 69 |
+
|
| 70 |
+
<div class="issue-metadata flex flex-wrap gap-2 mb-4">
|
| 71 |
+
<span id="preview-priority" class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium"></span>
|
| 72 |
+
<span id="preview-time" class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-800">
|
| 73 |
+
<svg class="mr-1.5 h-3 w-3" viewBox="0 0 16 16" fill="currentColor">
|
| 74 |
+
<path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm9.78-2.22-3.89 3.89-1.78-1.78a.75.75 0 0 0-1.06 1.06l2.3 2.3a.75.75 0 0 0 1.06 0l4.4-4.4a.75.75 0 0 0-1.06-1.06Z"></path>
|
| 75 |
+
</svg>
|
| 76 |
+
<span id="preview-time-text"></span>
|
| 77 |
+
</span>
|
| 78 |
+
</div>
|
| 79 |
+
|
| 80 |
+
<div id="preview-labels" class="flex flex-wrap gap-2 mb-4"></div>
|
| 81 |
+
|
| 82 |
+
<div class="issue-description prose max-w-none mb-4">
|
| 83 |
+
<div id="preview-description" class="text-gray-700 whitespace-pre-wrap"></div>
|
| 84 |
+
</div>
|
| 85 |
+
|
| 86 |
+
<div class="issue-assignees flex items-center gap-2 pt-4 border-t">
|
| 87 |
+
<span class="text-sm text-gray-600">Assignees:</span>
|
| 88 |
+
<div id="preview-assignees" class="flex -space-x-2"></div>
|
| 89 |
+
</div>
|
| 90 |
+
</div>
|
| 91 |
+
</div>
|
| 92 |
</div>
|
| 93 |
|
| 94 |
<div class="space-y-4">
|
|
|
|
| 105 |
</div>
|
| 106 |
</div>
|
| 107 |
</div>
|
| 108 |
+
<footer class="mt-8 py-6 border-t border-gray-200">
|
| 109 |
+
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 flex items-center justify-center text-sm text-gray-600">
|
| 110 |
+
Made with <span class="mx-1 text-red-500">♥</span> using
|
| 111 |
+
<a href="https://webllm.mlc.ai/" class="mx-1 text-blue-600 hover:text-blue-800 hover:underline" target="_blank" rel="noopener">MLC Web LLM</a>
|
| 112 |
+
&
|
| 113 |
+
<a href="https://github.com/huggingface/smollm" class="mx-1 text-blue-600 hover:text-blue-800 hover:underline" target="_blank" rel="noopener">SmolLM2</a>
|
| 114 |
+
</div>
|
| 115 |
+
</footer>
|
| 116 |
<script src="./dist/index.js" type="module"></script>
|
| 117 |
</body>
|
| 118 |
</html>
|
src/index.js
CHANGED
|
@@ -45,7 +45,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
| 45 |
theme: "ace/theme/github",
|
| 46 |
wrap: true,
|
| 47 |
});
|
| 48 |
-
|
| 49 |
// Set default schema
|
| 50 |
jsonSchemaEditor.setValue(`{
|
| 51 |
"title": "GitHubIssue",
|
|
@@ -148,6 +148,13 @@ Please include appropriate labels, priority level, and time estimation.`;
|
|
| 148 |
language: "json",
|
| 149 |
}).value;
|
| 150 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
if (usage) {
|
| 152 |
const statsTextParts = [];
|
| 153 |
if (usage.extra.prefill_tokens_per_s) {
|
|
@@ -165,3 +172,51 @@ Please include appropriate labels, priority level, and time estimation.`;
|
|
| 165 |
}
|
| 166 |
};
|
| 167 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
theme: "ace/theme/github",
|
| 46 |
wrap: true,
|
| 47 |
});
|
| 48 |
+
|
| 49 |
// Set default schema
|
| 50 |
jsonSchemaEditor.setValue(`{
|
| 51 |
"title": "GitHubIssue",
|
|
|
|
| 148 |
language: "json",
|
| 149 |
}).value;
|
| 150 |
|
| 151 |
+
try {
|
| 152 |
+
const issueData = JSON.parse(finalMessage);
|
| 153 |
+
updateIssuePreview(issueData);
|
| 154 |
+
} catch (error) {
|
| 155 |
+
console.error('Failed to parse issue data:', error);
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
if (usage) {
|
| 159 |
const statsTextParts = [];
|
| 160 |
if (usage.extra.prefill_tokens_per_s) {
|
|
|
|
| 172 |
}
|
| 173 |
};
|
| 174 |
});
|
| 175 |
+
|
| 176 |
+
function updateIssuePreview(issueData) {
|
| 177 |
+
const preview = document.getElementById('issue-preview');
|
| 178 |
+
|
| 179 |
+
// Update title
|
| 180 |
+
document.getElementById('preview-title').textContent = issueData.title;
|
| 181 |
+
|
| 182 |
+
// Update priority badge
|
| 183 |
+
const priorityBadge = document.getElementById('preview-priority');
|
| 184 |
+
priorityBadge.textContent = issueData.priority.toUpperCase();
|
| 185 |
+
priorityBadge.className = `inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium priority-${issueData.priority}`;
|
| 186 |
+
|
| 187 |
+
// Update estimated time
|
| 188 |
+
document.getElementById('preview-time-text').textContent = issueData.estimated_time;
|
| 189 |
+
|
| 190 |
+
// Update labels
|
| 191 |
+
const labelsContainer = document.getElementById('preview-labels');
|
| 192 |
+
labelsContainer.innerHTML = '';
|
| 193 |
+
issueData.labels.forEach(label => {
|
| 194 |
+
const labelEl = document.createElement('span');
|
| 195 |
+
labelEl.className = `issue-label label-${label}`;
|
| 196 |
+
labelEl.textContent = label;
|
| 197 |
+
labelsContainer.appendChild(labelEl);
|
| 198 |
+
});
|
| 199 |
+
|
| 200 |
+
// Update description
|
| 201 |
+
document.getElementById('preview-description').textContent = issueData.description;
|
| 202 |
+
|
| 203 |
+
// Update assignees
|
| 204 |
+
const assigneesContainer = document.getElementById('preview-assignees');
|
| 205 |
+
assigneesContainer.innerHTML = '';
|
| 206 |
+
if (issueData.assignees && issueData.assignees.length > 0) {
|
| 207 |
+
issueData.assignees.forEach(assignee => {
|
| 208 |
+
const avatarEl = document.createElement('div');
|
| 209 |
+
avatarEl.className = 'assignee-avatar';
|
| 210 |
+
avatarEl.textContent = assignee.charAt(0).toUpperCase();
|
| 211 |
+
assigneesContainer.appendChild(avatarEl);
|
| 212 |
+
});
|
| 213 |
+
} else {
|
| 214 |
+
assigneesContainer.innerHTML = '<span class="text-sm text-gray-500">No assignees</span>';
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
// Show the preview with animation
|
| 218 |
+
preview.classList.remove('hidden');
|
| 219 |
+
// Force a reflow
|
| 220 |
+
preview.offsetHeight;
|
| 221 |
+
preview.classList.add('visible');
|
| 222 |
+
}
|
style/style.css
CHANGED
|
@@ -200,4 +200,93 @@ body {
|
|
| 200 |
padding-left: 1rem;
|
| 201 |
padding-right: 1rem;
|
| 202 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 203 |
}
|
|
|
|
| 200 |
padding-left: 1rem;
|
| 201 |
padding-right: 1rem;
|
| 202 |
}
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
/* Priority badges */
|
| 206 |
+
.priority-critical {
|
| 207 |
+
background-color: #cf222e;
|
| 208 |
+
color: white;
|
| 209 |
+
}
|
| 210 |
+
|
| 211 |
+
.priority-high {
|
| 212 |
+
background-color: #bc4c00;
|
| 213 |
+
color: white;
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
.priority-medium {
|
| 217 |
+
background-color: #bf8700;
|
| 218 |
+
color: white;
|
| 219 |
+
}
|
| 220 |
+
|
| 221 |
+
.priority-low {
|
| 222 |
+
background-color: #1a7f37;
|
| 223 |
+
color: white;
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
/* Label styles */
|
| 227 |
+
.issue-label {
|
| 228 |
+
padding: 2px 8px;
|
| 229 |
+
border-radius: 2em;
|
| 230 |
+
font-size: 12px;
|
| 231 |
+
font-weight: 500;
|
| 232 |
+
white-space: nowrap;
|
| 233 |
+
}
|
| 234 |
+
|
| 235 |
+
.label-bug {
|
| 236 |
+
background-color: #ffebe9;
|
| 237 |
+
color: #cf222e;
|
| 238 |
+
}
|
| 239 |
+
|
| 240 |
+
.label-enhancement {
|
| 241 |
+
background-color: #ddf4ff;
|
| 242 |
+
color: #0969da;
|
| 243 |
+
}
|
| 244 |
+
|
| 245 |
+
.label-documentation {
|
| 246 |
+
background-color: #fff8c5;
|
| 247 |
+
color: #9a6700;
|
| 248 |
+
}
|
| 249 |
+
|
| 250 |
+
.label-security {
|
| 251 |
+
background-color: #ffeff7;
|
| 252 |
+
color: #bf3989;
|
| 253 |
+
}
|
| 254 |
+
|
| 255 |
+
.label-high-priority {
|
| 256 |
+
background-color: #fff1e5;
|
| 257 |
+
color: #bc4c00;
|
| 258 |
+
}
|
| 259 |
+
|
| 260 |
+
/* Assignee avatars */
|
| 261 |
+
.assignee-avatar {
|
| 262 |
+
width: 24px;
|
| 263 |
+
height: 24px;
|
| 264 |
+
border-radius: 50%;
|
| 265 |
+
background-color: #f6f8fa;
|
| 266 |
+
border: 2px solid white;
|
| 267 |
+
display: flex;
|
| 268 |
+
align-items: center;
|
| 269 |
+
justify-content: center;
|
| 270 |
+
font-size: 12px;
|
| 271 |
+
color: #57606a;
|
| 272 |
+
font-weight: 500;
|
| 273 |
+
}
|
| 274 |
+
|
| 275 |
+
/* Issue description styling */
|
| 276 |
+
.issue-description {
|
| 277 |
+
font-size: 14px;
|
| 278 |
+
line-height: 1.5;
|
| 279 |
+
color: #24292f;
|
| 280 |
+
}
|
| 281 |
+
|
| 282 |
+
/* Transition for the preview */
|
| 283 |
+
#issue-preview {
|
| 284 |
+
transition: all 0.3s ease-in-out;
|
| 285 |
+
opacity: 0;
|
| 286 |
+
transform: translateY(10px);
|
| 287 |
+
}
|
| 288 |
+
|
| 289 |
+
#issue-preview.visible {
|
| 290 |
+
opacity: 1;
|
| 291 |
+
transform: translateY(0);
|
| 292 |
}
|