Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -230,44 +230,14 @@ bot = GitHubBot()
|
|
230 |
# HTML and CSS integration
|
231 |
custom_html = """
|
232 |
<!DOCTYPE html>
|
233 |
-
<html>
|
234 |
<head>
|
235 |
-
<title>GitHub Issue Manager</title>
|
236 |
<meta charset="UTF-8">
|
237 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
238 |
-
<
|
239 |
-
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/full.css"
|
|
|
240 |
<style>
|
241 |
-
body {
|
242 |
-
background: linear-gradient(to bottom right, #121212, #303030) !important;
|
243 |
-
color: #e0e0e0;
|
244 |
-
font-family: 'Roboto', sans-serif;
|
245 |
-
overflow-x: hidden; /* Prevent horizontal scrollbar */
|
246 |
-
|
247 |
-
}
|
248 |
-
.card {
|
249 |
-
border-radius: 1.5rem;
|
250 |
-
box-shadow: 0 15px 25px rgba(0, 0, 0, 0.2);
|
251 |
-
margin-bottom: 20px;
|
252 |
-
}
|
253 |
-
.input, .select, .textarea {
|
254 |
-
border: 2px solid #4a4a4a;
|
255 |
-
border-radius: 0.75rem;
|
256 |
-
padding-inline: 1.5rem;
|
257 |
-
padding-block: 0.75rem;
|
258 |
-
}
|
259 |
-
h1, h2, h3 {
|
260 |
-
color: #e0e0e0;
|
261 |
-
}
|
262 |
-
.output-area {
|
263 |
-
padding: 1.5rem;
|
264 |
-
border-radius: 0.75rem;
|
265 |
-
}
|
266 |
-
.btn {
|
267 |
-
border-radius: 0.75rem;
|
268 |
-
padding-block: 0.75rem;
|
269 |
-
padding-inline: 1.5rem;
|
270 |
-
}
|
271 |
.btn-primary {
|
272 |
background-color: #7928CA;
|
273 |
color: white;
|
@@ -280,173 +250,146 @@ custom_html = """
|
|
280 |
}
|
281 |
</style>
|
282 |
</head>
|
283 |
-
<body
|
284 |
-
<div class="container mx-auto p-4"
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
|
|
299 |
</div>
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
308 |
</div>
|
309 |
-
|
|
|
310 |
<label class="label">
|
311 |
-
<span class="label-text">
|
312 |
</label>
|
313 |
-
<textarea class="textarea textarea-primary"
|
314 |
</div>
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
<div class="card bg-gray-800 p-8 mt-4" >
|
327 |
-
<label class="label">
|
328 |
-
<span class="label-text">Output</span>
|
329 |
-
</label>
|
330 |
-
<textarea class="textarea textarea-primary h-48" id="output-textarea" readonly></textarea>
|
331 |
-
</div>
|
332 |
-
<!-- URL to Extract -->
|
333 |
-
<div class="card bg-gray-800 p-8 mt-4">
|
334 |
-
<div class="form-control">
|
335 |
-
<label class="label">
|
336 |
-
<span class="label-text">URL</span>
|
337 |
-
</label>
|
338 |
-
<input type="text" placeholder="Enter a URL to extract information" class="input input-bordered input-primary" id="url-textbox">
|
339 |
-
</div>
|
340 |
-
<div class="form-control">
|
341 |
-
<button class="btn btn-primary" id="extract-info">Extract Info</button>
|
342 |
</div>
|
343 |
</div>
|
344 |
-
|
345 |
-
<script>
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
}
|
420 |
-
});
|
421 |
-
extractInfoButton.addEventListener('click', async () => {
|
422 |
-
const url = urlTextbox.value;
|
423 |
-
if (!url) {
|
424 |
-
outputTextarea.value = "Please provide a URL.";
|
425 |
-
return;
|
426 |
-
}
|
427 |
-
try {
|
428 |
-
const response = await fetch('/extract_info', {
|
429 |
-
method: 'POST',
|
430 |
-
headers: {
|
431 |
-
'Content-Type': 'application/json',
|
432 |
-
},
|
433 |
-
body: JSON.stringify({ url: url }),
|
434 |
});
|
435 |
-
|
436 |
-
throw new Error(`HTTP error! status: ${response.status}`);
|
437 |
-
}
|
438 |
-
const data = await response.json();
|
439 |
-
if (data.error) {
|
440 |
-
outputTextarea.value = data.error;
|
441 |
-
} else {
|
442 |
-
outputTextarea.value = JSON.stringify(data, null, 2);
|
443 |
-
}
|
444 |
-
} catch (error) {
|
445 |
-
outputTextarea.value = `Error extracting info: ${error.message}`;
|
446 |
-
}
|
447 |
-
});
|
448 |
-
|
449 |
-
</script>
|
450 |
</body>
|
451 |
</html>
|
452 |
"""
|
|
|
230 |
# HTML and CSS integration
|
231 |
custom_html = """
|
232 |
<!DOCTYPE html>
|
233 |
+
<html lang="en">
|
234 |
<head>
|
|
|
235 |
<meta charset="UTF-8">
|
236 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
237 |
+
<title>GitHub Issue Manager</title>
|
238 |
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/full.css">
|
239 |
+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js"></script>
|
240 |
<style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
.btn-primary {
|
242 |
background-color: #7928CA;
|
243 |
color: white;
|
|
|
250 |
}
|
251 |
</style>
|
252 |
</head>
|
253 |
+
<body>
|
254 |
+
<div id="app" class="container mx-auto p-4">
|
255 |
+
<h1 class="text-4xl md:text-5xl font-extrabold text-center mb-8">GitHub Issue Manager</h1>
|
256 |
+
|
257 |
+
<div class="card bg-gray-800 p-8">
|
258 |
+
<div class="form-control">
|
259 |
+
<label class="label">
|
260 |
+
<span class="label-text">GitHub Token</span>
|
261 |
+
</label>
|
262 |
+
<input type="password" placeholder="Enter your GitHub Personal Access Token" class="input input-bordered input-primary" v-model="githubToken">
|
263 |
+
</div>
|
264 |
+
<div class="form-control">
|
265 |
+
<label class="label">
|
266 |
+
<span class="label-text">Repository URL</span>
|
267 |
+
</label>
|
268 |
+
<input type="text" placeholder="Enter the full GitHub repository URL" class="input input-bordered input-primary" v-model="repoUrl">
|
269 |
+
</div>
|
270 |
</div>
|
271 |
+
|
272 |
+
<div class="card bg-gray-800 p-8">
|
273 |
+
<div class="flex justify-between gap-4">
|
274 |
+
<button class="btn btn-primary" @click="fetchIssues">Fetch Issues</button>
|
275 |
+
<select class="select select-primary w-full max-w-xs" v-model="selectedIssue">
|
276 |
+
<option disabled="" selected="">Select Issue</option>
|
277 |
+
<option v-for="issue in issues" :key="issue.id" :value="issue">{{ issue.title }}</option>
|
278 |
+
</select>
|
279 |
+
</div>
|
280 |
+
<div class="form-control mt-4">
|
281 |
+
<label class="label">
|
282 |
+
<span class="label-text">Resolution</span>
|
283 |
+
</label>
|
284 |
+
<textarea class="textarea textarea-primary" placeholder="Enter the resolution details" v-model="resolution"></textarea>
|
285 |
+
</div>
|
286 |
+
<div class="form-control mt-4">
|
287 |
+
<label class="label">
|
288 |
+
<span class="label-text">Forked Repository URL</span>
|
289 |
+
</label>
|
290 |
+
<input type="text" placeholder="URL to your forked repository (Optional)" class="input input-bordered input-primary" v-model="forkedRepoUrl">
|
291 |
+
</div>
|
292 |
+
<div class="form-control mt-4">
|
293 |
+
<button class="btn btn-success" @click="resolveIssue">Resolve Issue</button>
|
294 |
+
</div>
|
295 |
</div>
|
296 |
+
|
297 |
+
<div class="card bg-gray-800 p-8 mt-4">
|
298 |
<label class="label">
|
299 |
+
<span class="label-text">Output</span>
|
300 |
</label>
|
301 |
+
<textarea class="textarea textarea-primary h-48" v-model="output" readonly></textarea>
|
302 |
</div>
|
303 |
+
|
304 |
+
<div class="card bg-gray-800 p-8 mt-4">
|
305 |
+
<div class="form-control">
|
306 |
+
<label class="label">
|
307 |
+
<span class="label-text">URL</span>
|
308 |
+
</label>
|
309 |
+
<input type="text" placeholder="Enter a URL to extract information" class="input input-bordered input-primary" v-model="url">
|
310 |
+
</div>
|
311 |
+
<div class="form-control">
|
312 |
+
<button class="btn btn-primary" @click="extractInfo">Extract Info</button>
|
313 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
314 |
</div>
|
315 |
</div>
|
316 |
+
|
317 |
+
<script>
|
318 |
+
new Vue({
|
319 |
+
el: '#app',
|
320 |
+
data: {
|
321 |
+
githubToken: '',
|
322 |
+
repoUrl: '',
|
323 |
+
issues: [],
|
324 |
+
selectedIssue: '',
|
325 |
+
resolution: '',
|
326 |
+
forkedRepoUrl: '',
|
327 |
+
output: '',
|
328 |
+
url: ''
|
329 |
+
},
|
330 |
+
methods: {
|
331 |
+
fetchIssues() {
|
332 |
+
fetch('/fetch-issues', {
|
333 |
+
method: 'POST',
|
334 |
+
headers: {
|
335 |
+
'Content-Type': 'application/json'
|
336 |
+
},
|
337 |
+
body: JSON.stringify({
|
338 |
+
githubToken: this.githubToken,
|
339 |
+
repoUrl: this.repoUrl
|
340 |
+
})
|
341 |
+
})
|
342 |
+
.then(response => response.json())
|
343 |
+
.then(data => {
|
344 |
+
this.issues = data.issues;
|
345 |
+
})
|
346 |
+
.catch(error => {
|
347 |
+
console.error(error);
|
348 |
+
});
|
349 |
+
},
|
350 |
+
resolveIssue() {
|
351 |
+
fetch('/resolve-issue', {
|
352 |
+
method: 'POST',
|
353 |
+
headers: {
|
354 |
+
'Content-Type': 'application/json'
|
355 |
+
},
|
356 |
+
body: JSON.stringify({
|
357 |
+
githubToken: this.githubToken,
|
358 |
+
repoUrl: this.repoUrl,
|
359 |
+
issue: this.selectedIssue,
|
360 |
+
resolution: this.resolution,
|
361 |
+
forkedRepoUrl: this.forkedRepoUrl
|
362 |
+
})
|
363 |
+
})
|
364 |
+
.then(response => response.json())
|
365 |
+
.then(data => {
|
366 |
+
this.output = data.output;
|
367 |
+
})
|
368 |
+
.catch(error => {
|
369 |
+
console.error(error);
|
370 |
+
});
|
371 |
+
},
|
372 |
+
extractInfo() {
|
373 |
+
fetch('/extract-info', {
|
374 |
+
method: 'POST',
|
375 |
+
headers: {
|
376 |
+
'Content-Type': 'application/json'
|
377 |
+
},
|
378 |
+
body: JSON.stringify({
|
379 |
+
url: this.url
|
380 |
+
})
|
381 |
+
})
|
382 |
+
.then(response => response.json())
|
383 |
+
.then(data => {
|
384 |
+
this.output = data.output;
|
385 |
+
})
|
386 |
+
.catch(error => {
|
387 |
+
console.error(error);
|
388 |
+
});
|
389 |
+
}
|
390 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
391 |
});
|
392 |
+
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
393 |
</body>
|
394 |
</html>
|
395 |
"""
|