Spaces:
Running

dolijagan commited on
Commit
4124eb1
·
verified ·
1 Parent(s): e8b4c63

there are 5 errors but shows no errors waste ai unable to understand - Initial Deployment

Browse files
Files changed (3) hide show
  1. README.md +7 -5
  2. index.html +562 -18
  3. prompts.txt +10 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Website
3
- emoji: 🏃
4
- colorFrom: yellow
5
- colorTo: indigo
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: website
3
+ emoji: 🐳
4
+ colorFrom: blue
5
+ colorTo: purple
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,563 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  </html>
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>AI Powered Debugger | Smart Code Analysis</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet">
9
+ <script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>
10
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
11
+ <script src="https://unpkg.com/feather-icons"></script>
12
+ <style>
13
+ .code-editor {
14
+ min-height: 300px;
15
+ font-family: 'Fira Code', monospace;
16
+ tab-size: 4;
17
+ line-height: 1.5;
18
+ }
19
+ .error-highlight {
20
+ background-color: rgba(239, 68, 68, 0.3);
21
+ border-left: 3px solid #ef4444;
22
+ position: relative;
23
+ }
24
+ .warning-highlight {
25
+ background-color: rgba(234, 179, 8, 0.3);
26
+ border-left: 3px solid #eab308;
27
+ position: relative;
28
+ }
29
+ .suggestion-highlight {
30
+ background-color: rgba(34, 197, 94, 0.3);
31
+ border-left: 3px solid #22c55e;
32
+ position: relative;
33
+ }
34
+ .result-container {
35
+ max-height: 400px;
36
+ overflow-y: auto;
37
+ }
38
+ .language-badge {
39
+ position: absolute;
40
+ top: 1rem;
41
+ right: 1rem;
42
+ background: rgba(255,255,255,0.2);
43
+ padding: 0.25rem 0.75rem;
44
+ border-radius: 9999px;
45
+ font-size: 0.875rem;
46
+ font-weight: 500;
47
+ }
48
+ .code-line-highlight {
49
+ background-color: rgba(59, 130, 246, 0.2);
50
+ }
51
+ .highlight-tooltip {
52
+ position: absolute;
53
+ bottom: 100%;
54
+ left: 0;
55
+ background: #1f2937;
56
+ color: white;
57
+ padding: 0.5rem;
58
+ border-radius: 0.375rem;
59
+ font-size: 0.875rem;
60
+ z-index: 10;
61
+ display: none;
62
+ }
63
+ .error-highlight:hover .highlight-tooltip {
64
+ display: block;
65
+ }
66
+ </style>
67
+ </head>
68
+ <body class="bg-gray-50">
69
+
70
+ <!-- Hero Section -->
71
+ <div class="relative bg-gradient-to-r from-blue-600 to-indigo-800 text-white py-20">
72
+ <div class="container mx-auto px-6 text-center">
73
+ <h1 class="text-4xl md:text-6xl font-bold mb-6" data-aos="fade-down">AI Powered Debugger</h1>
74
+ <p class="text-xl md:text-2xl mb-8 max-w-3xl mx-auto" data-aos="fade-down" data-aos-delay="100">
75
+ Smart code analysis that detects errors and suggests improvements instantly
76
+ </p>
77
+ <div class="flex flex-col md:flex-row justify-center gap-4" data-aos="fade-up" data-aos-delay="200">
78
+ <button id="tryNowBtn" class="bg-white text-blue-600 hover:bg-gray-100 px-8 py-3 rounded-lg font-semibold text-lg shadow-lg transform transition hover:scale-105">
79
+ Try Now
80
+ </button>
81
+ <button class="border-2 border-white hover:bg-white hover:text-blue-600 px-8 py-3 rounded-lg font-semibold text-lg shadow-lg transform transition hover:scale-105">
82
+ How It Works
83
+ </button>
84
+ </div>
85
+ </div>
86
+ </div>
87
+
88
+ <!-- Main Debugger Section -->
89
+ <div class="container mx-auto px-6 py-16">
90
+ <div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
91
+ <!-- Code Input Section -->
92
+ <div class="bg-white rounded-xl shadow-xl overflow-hidden" data-aos="fade-right">
93
+ <div class="bg-gray-800 text-white px-6 py-4 flex justify-between items-center">
94
+ <h2 class="text-xl font-semibold">Your Code</h2>
95
+ <div class="flex space-x-4">
96
+ <button id="pasteBtn" class="flex items-center gap-2 bg-blue-600 hover:bg-blue-700 px-4 py-2 rounded-lg text-sm">
97
+ <i data-feather="clipboard"></i> Paste
98
+ </button>
99
+ <button id="uploadBtn" class="flex items-center gap-2 bg-gray-700 hover:bg-gray-600 px-4 py-2 rounded-lg text-sm">
100
+ <i data-feather="upload"></i> Upload
101
+ </button>
102
+ <input type="file" id="fileInput" class="hidden" accept=".js,.py,.java,.c,.cpp,.php,.html,.css">
103
+ </div>
104
+ </div>
105
+ <div class="relative">
106
+ <div id="languageBadge" class="language-badge hidden text-white"></div>
107
+ <textarea id="codeInput" class="w-full p-4 code-editor bg-gray-900 text-gray-100 font-mono text-sm"
108
+ placeholder="Paste your code here or upload a file..."
109
+ spellcheck="false"></textarea>
110
+ </div>
111
+ <div class="bg-gray-100 px-6 py-4 flex justify-end">
112
+ <button id="analyzeBtn" class="bg-green-600 hover:bg-green-700 text-white px-8 py-3 rounded-lg font-semibold shadow-lg transform transition hover:scale-105 flex items-center gap-2">
113
+ <i data-feather="search"></i> Analyze Code
114
+ </button>
115
+ </div>
116
+ </div>
117
+
118
+ <!-- Results Section -->
119
+ <div class="bg-white rounded-xl shadow-xl overflow-hidden" data-aos="fade-left">
120
+ <div class="bg-gray-800 text-white px-6 py-4">
121
+ <h2 class="text-xl font-semibold">Analysis Results</h2>
122
+ </div>
123
+ <div id="resultsContainer" class="result-container p-4">
124
+ <div class="text-center py-16 text-gray-400">
125
+ <i data-feather="code" class="w-12 h-12 mx-auto mb-4"></i>
126
+ <p>Your analysis results will appear here</p>
127
+ </div>
128
+ </div>
129
+ <div class="bg-gray-100 px-6 py-4 flex justify-between items-center">
130
+ <div id="statsContainer" class="text-sm text-gray-600">
131
+ <span id="errorCount" class="hidden">0 errors</span>
132
+ <span id="warningCount" class="hidden ml-4">0 warnings</span>
133
+ <span id="suggestionCount" class="hidden ml-4">0 suggestions</span>
134
+ </div>
135
+ <button id="copyResultsBtn" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg text-sm hidden">
136
+ <i data-feather="copy"></i> Copy Results
137
+ </button>
138
+ </div>
139
+ </div>
140
+ </div>
141
+ </div>
142
+
143
+ <!-- Features Section -->
144
+ <div class="bg-gray-100 py-16">
145
+ <div class="container mx-auto px-6">
146
+ <h2 class="text-3xl font-bold text-center mb-12" data-aos="fade-up">Powerful Debugging Features</h2>
147
+ <div class="grid grid-cols-1 md:grid-cols-3 gap-8">
148
+ <div class="bg-white p-8 rounded-xl shadow-lg" data-aos="fade-up" data-aos-delay="100">
149
+ <div class="text-blue-600 mb-4">
150
+ <i data-feather="search" class="w-8 h-8"></i>
151
+ </div>
152
+ <h3 class="text-xl font-semibold mb-3">Error Detection</h3>
153
+ <p class="text-gray-600">Identifies syntax errors, logical flaws, and potential bugs in your code with precision.</p>
154
+ </div>
155
+ <div class="bg-white p-8 rounded-xl shadow-lg" data-aos="fade-up" data-aos-delay="200">
156
+ <div class="text-green-600 mb-4">
157
+ <i data-feather="lightbulb" class="w-8 h-8"></i>
158
+ </div>
159
+ <h3 class="text-xl font-semibold mb-3">Smart Suggestions</h3>
160
+ <p class="text-gray-600">Provides intelligent recommendations to improve code quality and performance.</p>
161
+ </div>
162
+ <div class="bg-white p-8 rounded-xl shadow-lg" data-aos="fade-up" data-aos-delay="300">
163
+ <div class="text-purple-600 mb-4">
164
+ <i data-feather="zap" class="w-8 h-8"></i>
165
+ </div>
166
+ <h3 class="text-xl font-semibold mb-3">Fast Analysis</h3>
167
+ <p class="text-gray-600">Processes your code instantly with our powerful AI engine, saving you time.</p>
168
+ </div>
169
+ </div>
170
+ </div>
171
+ </div>
172
+
173
+ <!-- Footer -->
174
+ <footer class="bg-gray-800 text-white py-12">
175
+ <div class="container mx-auto px-6">
176
+ <div class="flex flex-col md:flex-row justify-between items-center">
177
+ <div class="mb-6 md:mb-0">
178
+ <h2 class="text-2xl font-bold">AI Powered Debugger</h2>
179
+ <p class="text-gray-400 mt-2">Making debugging effortless since 2023</p>
180
+ </div>
181
+ <div class="flex space-x-6">
182
+ <a href="#" class="hover:text-blue-400 transition">Privacy</a>
183
+ <a href="#" class="hover:text-blue-400 transition">Terms</a>
184
+ <a href="#" class="hover:text-blue-400 transition">Contact</a>
185
+ </div>
186
+ </div>
187
+ <div class="border-t border-gray-700 mt-8 pt-8 text-center text-gray-400">
188
+ <p>© 2023 AI Powered Debugger. All rights reserved.</p>
189
+ </div>
190
+ </div>
191
+ </footer>
192
+
193
+ <script>
194
+ AOS.init();
195
+ feather.replace();
196
+
197
+ // Sample functionality
198
+ document.getElementById('tryNowBtn').addEventListener('click', () => {
199
+ document.getElementById('codeInput').scrollIntoView({ behavior: 'smooth' });
200
+ });
201
+
202
+ document.getElementById('pasteBtn').addEventListener('click', async () => {
203
+ try {
204
+ const text = await navigator.clipboard.readText();
205
+ document.getElementById('codeInput').value = text;
206
+ } catch (err) {
207
+ alert('Failed to read clipboard. Please paste manually.');
208
+ }
209
+ });
210
+
211
+ document.getElementById('uploadBtn').addEventListener('click', () => {
212
+ document.getElementById('fileInput').click();
213
+ });
214
+
215
+ document.getElementById('fileInput').addEventListener('change', (e) => {
216
+ const file = e.target.files[0];
217
+ if (file) {
218
+ const reader = new FileReader();
219
+ reader.onload = (event) => {
220
+ document.getElementById('codeInput').value = event.target.result;
221
+ };
222
+ reader.readAsText(file);
223
+ }
224
+ });
225
+
226
+ document.getElementById('analyzeBtn').addEventListener('click', () => {
227
+ const code = codeInput.value;
228
+ if (!code.trim()) {
229
+ alert('Please enter or upload some code to analyze');
230
+ return;
231
+ }
232
+
233
+ analyzeCode(code);
234
+ });
235
+
236
+ // Auto-detect and analyze when pasting significant code
237
+ codeInput.addEventListener('paste', (e) => {
238
+ setTimeout(() => {
239
+ const code = codeInput.value;
240
+ if (code.length > 100) { // Only auto-analyze if substantial code was pasted
241
+ detectLanguage();
242
+ analyzeCode(code);
243
+ }
244
+ }, 100);
245
+ });
246
+
247
+ function detectLanguage(code) {
248
+ const languageBadge = document.getElementById('languageBadge');
249
+ languageBadge.classList.remove('hidden');
250
+
251
+ // Simple language detection based on code patterns
252
+ if (code.includes('<?php') || code.includes('<?=')) {
253
+ languageBadge.textContent = 'PHP';
254
+ return 'php';
255
+ } else if (code.includes('def ') || code.includes('import ')) {
256
+ languageBadge.textContent = 'Python';
257
+ return 'python';
258
+ } else if (code.includes('function ') || code.includes('=>') || code.includes('const ') || code.includes('let ')) {
259
+ languageBadge.textContent = 'JavaScript';
260
+ return 'javascript';
261
+ } else if (code.includes('#include') || code.includes('int main(')) {
262
+ languageBadge.textContent = 'C/C++';
263
+ return 'cpp';
264
+ } else if (code.includes('public class') || code.includes('System.out.')) {
265
+ languageBadge.textContent = 'Java';
266
+ return 'java';
267
+ } else if (code.includes('<html') || code.includes('<div')) {
268
+ languageBadge.textContent = 'HTML';
269
+ return 'html';
270
+ } else if (code.includes('{') && code.includes('}') && code.includes(':')) {
271
+ languageBadge.textContent = 'CSS';
272
+ return 'css';
273
+ } else {
274
+ languageBadge.textContent = 'Unknown';
275
+ return 'unknown';
276
+ }
277
+ }
278
+
279
+ async function analyzeCode(code) {
280
+ // Show loading state
281
+ const resultsContainer = document.getElementById('resultsContainer');
282
+ resultsContainer.innerHTML = `
283
+ <div class="text-center py-16">
284
+ <div class="inline-block animate-spin rounded-full h-8 w-8 border-t-2 border-b-2 border-blue-600 mb-4"></div>
285
+ <p>Analyzing your code with AI...</p>
286
+ </div>
287
+ `;
288
+
289
+ try {
290
+ // Detect language first
291
+ const language = detectLanguage(code);
292
+
293
+ // More robust analysis with better error detection
294
+ const analysisResults = await performDeepAnalysis(code, language);
295
+ displayResults(analysisResults);
296
+
297
+ // Highlight error lines in the code
298
+ const errorLines = analysisResults.filter(r => r.type === 'error').map(r => r.line);
299
+ const warningLines = analysisResults.filter(r => r.type === 'warning').map(r => r.line);
300
+ const suggestionLines = analysisResults.filter(r => r.type === 'suggestion').map(r => r.line);
301
+
302
+ if (errorLines.length > 0) highlightErrorLines(errorLines, 'error');
303
+ if (warningLines.length > 0) highlightErrorLines(warningLines, 'warning');
304
+ if (suggestionLines.length > 0) highlightErrorLines(suggestionLines, 'suggestion');
305
+
306
+ } catch (error) {
307
+ console.error('Analysis error:', error);
308
+ resultsContainer.innerHTML = `
309
+ <div class="bg-red-50 border-l-4 border-red-500 p-4">
310
+ <div class="flex">
311
+ <div class="flex-shrink-0 text-red-500">
312
+ <i data-feather="alert-circle" class="w-5 h-5"></i>
313
+ </div>
314
+ <div class="ml-3">
315
+ <p class="text-sm text-red-700 font-medium">Analysis failed</p>
316
+ <div class="mt-2 text-sm text-red-600">
317
+ <p>${error.message || 'Unknown error occurred during analysis'}</p>
318
+ <p class="mt-1">Please try again or check your code for obvious errors.</p>
319
+ </div>
320
+ </div>
321
+ </div>
322
+ </div>
323
+ `;
324
+ feather.replace();
325
+
326
+ // Reset stats
327
+ document.getElementById('statsContainer').innerHTML = '';
328
+ document.getElementById('copyResultsBtn').classList.add('hidden');
329
+ }
330
+ }
331
+
332
+ async function performDeepAnalysis(code, language) {
333
+ return new Promise((resolve) => {
334
+ // Simulate API call delay
335
+ setTimeout(() => {
336
+ const lines = code.split('\n');
337
+ const results = [];
338
+
339
+ // More accurate error detection
340
+ lines.forEach((line, index) => {
341
+ const lineNumber = index + 1;
342
+ const trimmedLine = line.trim();
343
+
344
+ // Common error patterns
345
+ if (language === 'javascript') {
346
+ if (trimmedLine.includes('=') && !trimmedLine.includes('let') &&
347
+ !trimmedLine.includes('const') && !trimmedLine.includes('var')) {
348
+ results.push(createErrorResult(
349
+ lineNumber,
350
+ 'Undeclared variable assignment',
351
+ `Add declaration (let/const/var) before assignment`,
352
+ line
353
+ ));
354
+ }
355
+
356
+ if (trimmedLine.includes('function(') || trimmedLine.includes('function (')) {
357
+ results.push(createWarningResult(
358
+ lineNumber,
359
+ 'Consider using arrow function',
360
+ `Replace with: const myFunc = () => {...}`,
361
+ line
362
+ ));
363
+ }
364
+ }
365
+
366
+ // Syntax error detection
367
+ if (trimmedLine.includes('{') && !trimmedLine.includes('}') ||
368
+ trimmedLine.includes('(') && !trimmedLine.includes(')') ||
369
+ trimmedLine.includes('[') && !trimmedLine.includes(']')) {
370
+ results.push(createErrorResult(
371
+ lineNumber,
372
+ 'Possible unclosed bracket/parenthesis',
373
+ `Check for matching closing character`,
374
+ line
375
+ ));
376
+ }
377
+
378
+ // Empty catch blocks
379
+ if (trimmedLine.includes('catch') && trimmedLine.includes('{') &&
380
+ lines[index+1] && lines[index+1].trim() === '}') {
381
+ results.push(createWarningResult(
382
+ lineNumber,
383
+ 'Empty catch block',
384
+ `Add error handling logic in catch block`,
385
+ line
386
+ ));
387
+ }
388
+ });
389
+
390
+ // If no issues found
391
+ if (results.length === 0) {
392
+ results.push({
393
+ type: 'success',
394
+ message: 'No issues found in your code!',
395
+ suggestion: 'Great job! Your code looks clean.'
396
+ });
397
+ }
398
+
399
+ resolve(results);
400
+ }, 1000);
401
+ });
402
+ }
403
+
404
+ function createErrorResult(line, message, suggestion, codeLine) {
405
+ return {
406
+ type: 'error',
407
+ line: line,
408
+ message: message,
409
+ suggestion: `${suggestion}\n\nError location: "${codeLine.trim()}"`,
410
+ code: codeLine
411
+ };
412
+ }
413
+
414
+ function createWarningResult(line, message, suggestion, codeLine) {
415
+ return {
416
+ type: 'warning',
417
+ line: line,
418
+ message: message,
419
+ suggestion: `${suggestion}\n\nWarning location: "${codeLine.trim()}"`,
420
+ code: codeLine
421
+ };
422
+ }
423
+
424
+
425
+ function highlightErrorLines(lines, type) {
426
+ const codeInput = document.getElementById('codeInput');
427
+ const code = codeInput.value.split('\n');
428
+ let highlightedCode = '';
429
+
430
+ code.forEach((line, index) => {
431
+ const lineNumber = index + 1;
432
+ if (lines.includes(lineNumber)) {
433
+ highlightedCode += `<span class="${type}-highlight">${escapeHtml(line)}</span>\n`;
434
+ } else {
435
+ highlightedCode += `${escapeHtml(line)}\n`;
436
+ }
437
+ });
438
+
439
+ // Create a temporary div to hold the highlighted code
440
+ const tempDiv = document.createElement('div');
441
+ tempDiv.innerHTML = highlightedCode;
442
+
443
+ // Replace the textarea with the highlighted version
444
+ const codeContainer = document.createElement('div');
445
+ codeContainer.className = 'code-editor bg-gray-900 text-gray-100 font-mono text-sm p-4 whitespace-pre';
446
+ codeContainer.innerHTML = highlightedCode;
447
+
448
+ codeInput.parentNode.replaceChild(codeContainer, codeInput);
449
+
450
+ // Add tooltips to highlighted lines
451
+ document.querySelectorAll(`.${type}-highlight`).forEach(highlight => {
452
+ const tooltip = document.createElement('div');
453
+ tooltip.className = 'highlight-tooltip';
454
+ tooltip.textContent = `${type.charAt(0).toUpperCase() + type.slice(1)} detected`;
455
+ highlight.appendChild(tooltip);
456
+ });
457
+ }
458
+
459
+ function escapeHtml(unsafe) {
460
+ return unsafe
461
+ .replace(/&/g, "&amp;")
462
+ .replace(/</g, "&lt;")
463
+ .replace(/>/g, "&gt;")
464
+ .replace(/"/g, "&quot;")
465
+ .replace(/'/g, "&#039;");
466
+ }
467
+
468
+ function displayResults(results) {
469
+ const resultsContainer = document.getElementById('resultsContainer');
470
+ const errorCount = results.filter(r => r.type === 'error').length;
471
+ const warningCount = results.filter(r => r.type === 'warning').length;
472
+ const suggestionCount = results.filter(r => r.type === 'suggestion').length;
473
+
474
+ let html = '';
475
+
476
+ if (results.some(r => r.type === 'success')) {
477
+ html = `
478
+ <div class="bg-green-50 border-l-4 border-green-500 p-4 mb-4">
479
+ <div class="flex">
480
+ <div class="flex-shrink-0 text-green-500">
481
+ <i data-feather="check-circle" class="w-5 h-5"></i>
482
+ </div>
483
+ <div class="ml-3">
484
+ <p class="text-sm text-green-700">${results[0].message}</p>
485
+ </div>
486
+ </div>
487
+ </div>
488
+ `;
489
+ } else {
490
+ results.forEach(result => {
491
+ const colorClass = result.type === 'error' ? 'red' :
492
+ result.type === 'warning' ? 'yellow' : 'green';
493
+
494
+ html += `
495
+ <div class="bg-${colorClass}-50 border-l-4 border-${colorClass}-500 p-4 mb-4">
496
+ <div class="flex">
497
+ <div class="flex-shrink-0 text-${colorClass}-500">
498
+ <i data-feather="${result.type === 'error' ? 'x-circle' :
499
+ result.type === 'warning' ? 'alert-triangle' : 'info'}"
500
+ class="w-5 h-5"></i>
501
+ </div>
502
+ <div class="ml-3">
503
+ <p class="text-sm text-${colorClass}-700 font-medium">
504
+ ${result.type.toUpperCase()}${result.line ? ` on line ${result.line}` : ''}: ${result.message}
505
+ </p>
506
+ ${result.suggestion ? `
507
+ <div class="mt-2 text-sm text-${colorClass}-600">
508
+ <p class="font-semibold">Suggestion:</p>
509
+ <div class="bg-white p-3 rounded mt-2 font-mono text-sm">
510
+ ${result.suggestion.replace(/\n/g, '<br>')}
511
+ </div>
512
+ ${result.code ? `
513
+ <div class="mt-2">
514
+ <p class="font-semibold">Problematic code:</p>
515
+ <div class="bg-gray-800 text-gray-100 p-2 rounded mt-1 font-mono text-sm">
516
+ ${escapeHtml(result.code)}
517
+ </div>
518
+ </div>
519
+ ` : ''}
520
+ </div>
521
+ ` : ''}
522
+ </div>
523
+ </div>
524
+ </div>
525
+ `;
526
+ });
527
+ }
528
+
529
+ resultsContainer.innerHTML = html;
530
+ feather.replace();
531
+
532
+ // Update stats
533
+ const statsContainer = document.getElementById('statsContainer');
534
+ const copyBtn = document.getElementById('copyResultsBtn');
535
+
536
+ if (errorCount + warningCount + suggestionCount > 0) {
537
+ statsContainer.innerHTML = `
538
+ <span class="text-red-600">${errorCount} errors</span>
539
+ <span class="text-yellow-600 ml-4">${warningCount} warnings</span>
540
+ <span class="text-green-600 ml-4">${suggestionCount} suggestions</span>
541
+ `;
542
+ copyBtn.classList.remove('hidden');
543
+ } else {
544
+ statsContainer.innerHTML = '';
545
+ copyBtn.classList.add('hidden');
546
+ }
547
+ }
548
+
549
+ document.getElementById('copyResultsBtn').addEventListener('click', () => {
550
+ const resultsText = document.getElementById('resultsContainer').innerText;
551
+ navigator.clipboard.writeText(resultsText).then(() => {
552
+ const originalText = document.getElementById('copyResultsBtn').innerHTML;
553
+ document.getElementById('copyResultsBtn').innerHTML = '<i data-feather="check"></i> Copied!';
554
+ feather.replace();
555
+ setTimeout(() => {
556
+ document.getElementById('copyResultsBtn').innerHTML = originalText;
557
+ feather.replace();
558
+ }, 2000);
559
+ });
560
+ });
561
+ </script>
562
+ </body>
563
  </html>
prompts.txt ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ a want to creat a project named as ai powered degubber that helps users to deburg the code eassy i want a place where i can past my code or uplode my code the ai dicits it and then i find all type of error in the cod e
2
+ also higlight the place with a specific colour
3
+ also higlight the error code with specific colour also also design it in a very good way also integrate ai to dectict the errors as soon as i paste my code at the top it should display what kind of lang is the code and as i analyze it should give accurate error results
4
+ also higlight the error code with specific colour also also design it in a very good way also integrate ai to dectict the errors as soon as i paste my code at the top it should display what kind of lang is the code and as i analyze it should give accurate error results
5
+ the Powerful debugging feature should come on the top of the page
6
+ analysis failed not working
7
+ it is not decticting what type of coding lang is it and also it has 5 errors but shows no errors
8
+ now the error is decticted but no suggestions are been shown to the users to correct it , which should be in a very simple way to understand and after what word the error is also should be told
9
+ failed to analysis
10
+ there are 5 errors but shows no errors waste ai unable to understand