Alim111 commited on
Commit
69f9fa4
·
verified ·
1 Parent(s): b275748
Files changed (2) hide show
  1. README.md +9 -5
  2. index.html +567 -19
README.md CHANGED
@@ -1,10 +1,14 @@
1
  ---
2
- title: Codecraft Ai Assistant Pro
3
- emoji: 🏢
4
- colorFrom: indigo
5
- colorTo: green
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: CodeCraft AI Assistant Pro 🤖
3
+ colorFrom: pink
4
+ colorTo: blue
5
+ emoji: 🐳
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite-v3
10
  ---
11
 
12
+ # Welcome to your new DeepSite project!
13
+ This project was created with [DeepSite](https://deepsite.hf.co).
14
+
index.html CHANGED
@@ -1,19 +1,567 @@
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="az">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>CodeCraft AI Assistant Pro</title>
7
+ <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
8
+ <script src="https://cdn.tailwindcss.com"></script>
9
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
10
+ <script src="https://unpkg.com/feather-icons"></script>
11
+ <script>
12
+ tailwind.config = {
13
+ theme: {
14
+ extend: {
15
+ colors: {
16
+ primary: {
17
+ 50: '#f0f9ff',
18
+ 100: '#e0f2fe',
19
+ 200: '#bae6fd',
20
+ 300: '#7dd3fc',
21
+ 400: '#38bdf8',
22
+ 500: '#0ea5e9',
23
+ 600: '#0284c7',
24
+ 700: '#0369a1',
25
+ 800: '#075985',
26
+ 900: '#0c4a6e',
27
+ },
28
+ secondary: {
29
+ 50: '#fdf4ff',
30
+ 100: '#fae8ff',
31
+ 200: '#f5d0fe',
32
+ 300: '#f0abfc',
33
+ 400: '#e879f9',
34
+ 500: '#d946ef',
35
+ 600: '#c026d3',
36
+ 700: '#a21caf',
37
+ 800: '#86198f',
38
+ 900: '#701a75',
39
+ }
40
+ }
41
+ }
42
+ }
43
+ }
44
+ </script>
45
+ <style>
46
+ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
47
+
48
+ body {
49
+ font-family: 'Inter', sans-serif;
50
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
51
+ min-height: 100vh;
52
+ }
53
+
54
+ .glass-effect {
55
+ background: rgba(255, 255, 255, 0.25);
56
+ backdrop-filter: blur(10px);
57
+ border: 1px solid rgba(255, 255, 255, 0.18);
58
+ }
59
+
60
+ .neon-glow {
61
+ box-shadow: 0 0 20px rgba(14, 165, 233, 0.3);
62
+ }
63
+
64
+ .code-block pre {
65
+ background: #1e293b;
66
+ color: #e2e8f0;
67
+ border-radius: 8px;
68
+ padding: 16px;
69
+ margin: 8px 0;
70
+ overflow-x: auto;
71
+ font-family: 'Fira Code', monospace;
72
+ position: relative;
73
+ }
74
+
75
+ .typing-indicator {
76
+ display: inline-flex;
77
+ align-items: center;
78
+ gap: 4px;
79
+ }
80
+
81
+ .typing-dot {
82
+ width: 8px;
83
+ height: 8px;
84
+ background: #0ea5e9;
85
+ border-radius: 50%;
86
+ animation: typing 1.4s infinite ease-in-out;
87
+ }
88
+
89
+ .typing-dot:nth-child(1) { animation-delay: -0.32s; }
90
+ .typing-dot:nth-child(2) { animation-delay: -0.16s; }
91
+
92
+ @keyframes typing {
93
+ 0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
94
+ 40% { transform: scale(1); opacity: 1; }
95
+ }
96
+
97
+ .message-bubble {
98
+ max-width: 85%;
99
+ padding: 12px 16px;
100
+ border-radius: 18px;
101
+ margin: 8px 0;
102
+ word-wrap: break-word;
103
+ }
104
+
105
+ .user-message {
106
+ background: linear-gradient(135deg, #0ea5e9, #38bdf8);
107
+ color: white;
108
+ margin-left: auto;
109
+ border-bottom-right-radius: 4px;
110
+ }
111
+
112
+ .ai-message {
113
+ background: rgba(255, 255, 255, 0.9);
114
+ color: #1f2937;
115
+ margin-right: auto;
116
+ border-bottom-left-radius: 4px;
117
+ }
118
+
119
+ .floating-animation {
120
+ animation: float 6s ease-in-out infinite;
121
+ }
122
+
123
+ @keyframes float {
124
+ 0%, 100% { transform: translateY(0px); }
125
+ 50% { transform: translateY(-20px); }
126
+ }
127
+
128
+ .pulse-ring {
129
+ animation: pulse-ring 2s ease-out infinite;
130
+ }
131
+
132
+ @keyframes pulse-ring {
133
+ 0% { transform: scale(0.8); opacity: 1; }
134
+ 100% { transform: scale(2.2); opacity: 0; }
135
+ }
136
+ </style>
137
+ </head>
138
+ <body class="min-h-screen flex items-center justify-center p-4">
139
+ <div class="w-full max-w-4xl">
140
+ <!-- Header Section -->
141
+ <div class="text-center mb-8">
142
+ <div class="inline-block relative">
143
+ <div class="w-24 h-24 bg-gradient-to-br from-primary-400 to-secondary-500 rounded-2xl flex items-center justify-center text-white text-4xl mb-4 mx-auto floating-animation neon-glow">
144
+ 🤖
145
+ </div>
146
+ <div class="absolute inset-0 rounded-2xl pulse-ring border-2 border-primary-400"></div>
147
+ </div>
148
+ <h1 class="text-4xl font-bold text-white mb-2">CodeCraft AI Assistant Pro</h1>
149
+ <p class="text-primary-100 text-lg">Azərbaycan dilində proqramlaşdırma köməkçisi</p>
150
+ </div>
151
+
152
+ <!-- Main Container -->
153
+ <div class="glass-effect rounded-3xl shadow-2xl overflow-hidden">
154
+ <!-- Tab Navigation -->
155
+ <div class="flex bg-white/20 border-b border-white/20">
156
+ <button data-tab="asistant" class="flex-1 py-4 text-white font-medium transition-all duration-300 relative tab-btn active">
157
+ <div class="flex items-center justify-center gap-2">
158
+ <i data-feather="message-circle"></i>
159
+ <span>Köməkçi</span>
160
+ </div>
161
+ <div class="absolute bottom-0 left-1/2 transform -translate-x-1/2 w-16 h-1 bg-primary-400 rounded-t-full transition-all duration-300"></div>
162
+ </button>
163
+ <button data-tab="projects" class="flex-1 py-4 text-white/70 font-medium transition-all duration-300 relative tab-btn">
164
+ <div class="flex items-center justify-center gap-2">
165
+ <i data-feather="play"></i>
166
+ <span>Nümayiş</span>
167
+ </div>
168
+ </button>
169
+ <button data-tab="code" class="flex-1 py-4 text-white/70 font-medium transition-all duration-300 relative tab-btn">
170
+ <div class="flex items-center justify-center gap-2">
171
+ <i data-feather="code"></i>
172
+ <span>Kodlar</span>
173
+ </div>
174
+ </button>
175
+ </div>
176
+
177
+ <!-- Tab Contents -->
178
+ <div class="min-h-[500px]">
179
+ <!-- Assistant Tab -->
180
+ <div id="tab-content-asistant" class="tab-content active p-6">
181
+ <div class="max-w-2xl mx-auto">
182
+ <!-- Chat Header -->
183
+ <div class="flex items-center gap-4 mb-6">
184
+ <div class="w-12 h-12 bg-gradient-to-br from-primary-400 to-secondary-500 rounded-xl flex items-center justify-center text-white text-2xl">
185
+ <i data-feather="cpu"></i>
186
+ </div>
187
+ <div>
188
+ <h3 class="text-white font-semibold text-lg">AI Köməkçi</h3>
189
+ <p class="text-primary-100 text-sm">HTML, CSS, JavaScript kodları yaradın</p>
190
+ </div>
191
+ </div>
192
+
193
+ <!-- Chat Log -->
194
+ <div id="chat-log" class="bg-white/10 rounded-2xl p-4 mb-4 min-h-[300px] max-h-[400px] overflow-y-auto">
195
+ <div class="ai-message message-bubble">
196
+ Salam! Mən sizin proqramlaşdırma köməkçinizəm. 📝<br>
197
+ HTML, CSS və JavaScript kodları yarada bilərəm. Nə etmək istəyirsiniz?
198
+ </div>
199
+ </div>
200
+
201
+ <!-- Chat Input -->
202
+ <form id="chat-form" class="flex gap-2">
203
+ <button type="button" id="reset-all" class="px-4 py-3 bg-red-500/20 text-red-100 rounded-xl hover:bg-red-500/30 transition-colors border border-red-400/30">
204
+ <i data-feather="refresh-cw" class="w-4 h-4"></i>
205
+ </button>
206
+ <div class="flex-1 relative">
207
+ <input type="text" id="chat-input" placeholder="AI-ya yazın..."
208
+ class="w-full px-4 py-3 bg-white/20 text-white placeholder-white/60 rounded-xl border border-white/20 focus:border-primary-400 focus:outline-none transition-colors">
209
+ </div>
210
+ <button type="button" id="prompt-optimize" class="px-4 py-3 bg-secondary-500 text-white rounded-xl hover:bg-secondary-600 transition-colors">
211
+ <i data-feather="edit-3" class="w-4 h-4"></i>
212
+ </button>
213
+ <button type="submit" class="px-4 py-3 bg-primary-500 text-white rounded-xl hover:bg-primary-600 transition-colors">
214
+ <i data-feather="send" class="w-4 h-4"></i>
215
+ </button>
216
+ </form>
217
+ </div>
218
+ </div>
219
+
220
+ <!-- Projects Tab -->
221
+ <div id="tab-content-projects" class="tab-content hidden">
222
+ <div id="output-game" class="output-full min-h-[500px] flex items-center justify-center bg-gray-900">
223
+ <div class="text-center text-white">
224
+ <i data-feather="play-circle" class="w-16 h-16 mx-auto mb-4 text-primary-400"></i>
225
+ <h3 class="text-xl font-semibold mb-2">Kod Nümayişi</h3>
226
+ <p class="text-gray-300">Kodlar bölməsində yazılan kodlar burada nümayiş olunacaq</p>
227
+ </div>
228
+ </div>
229
+ </div>
230
+
231
+ <!-- Code Tab -->
232
+ <div id="tab-content-code" class="tab-content hidden p-6">
233
+ <div class="grid md:grid-cols-3 gap-6">
234
+ <div class="code-block">
235
+ <div class="flex items-center justify-between mb-3">
236
+ <label class="text-white font-semibold flex items-center gap-2">
237
+ <i data-feather="file-text" class="w-4 h-4"></i>
238
+ HTML
239
+ </label>
240
+ <button class="copy-btn px-3 py-1 bg-primary-500 text-white rounded-lg hover:bg-primary-600 transition-colors text-sm" data-target="html-code">
241
+ Köçür
242
+ </button>
243
+ </div>
244
+ <textarea id="html-code" placeholder="HTML kodu burada görünəcək"
245
+ class="w-full h-64 bg-gray-800 text-gray-100 rounded-lg p-4 font-mono text-sm resize-none focus:outline-none focus:ring-2 focus:ring-primary-500"></textarea>
246
+ </div>
247
+
248
+ <div class="code-block">
249
+ <div class="flex items-center justify-between mb-3">
250
+ <label class="text-white font-semibold flex items-center gap-2">
251
+ <i data-feather="pen-tool" class="w-4 h-4"></i>
252
+ CSS
253
+ </label>
254
+ <button class="copy-btn px-3 py-1 bg-primary-500 text-white rounded-lg hover:bg-primary-600 transition-colors text-sm" data-target="css-code">
255
+ Köçür
256
+ </button>
257
+ </div>
258
+ <textarea id="css-code" placeholder="CSS kodu burada görünəcək"
259
+ class="w-full h-64 bg-gray-800 text-gray-100 rounded-lg p-4 font-mono text-sm resize-none focus:outline-none focus:ring-2 focus:ring-primary-500"></textarea>
260
+ </div>
261
+
262
+ <div class="code-block">
263
+ <div class="flex items-center justify-between mb-3">
264
+ <label class="text-white font-semibold flex items-center gap-2">
265
+ <i data-feather="code" class="w-4 h-4"></i>
266
+ JavaScript
267
+ </label>
268
+ <button class="copy-btn px-3 py-1 bg-primary-500 text-white rounded-lg hover:bg-primary-600 transition-colors text-sm" data-target="js-code">
269
+ Köçür
270
+ </button>
271
+ </div>
272
+ <textarea id="js-code" placeholder="JavaScript kodu burada görünəcək"
273
+ class="w-full h-64 bg-gray-800 text-gray-100 rounded-lg p-4 font-mono text-sm resize-none focus:outline-none focus:ring-2 focus:ring-primary-500"></textarea>
274
+ </div>
275
+ </div>
276
+ </div>
277
+ </div>
278
+ </div>
279
+
280
+ <!-- Toast Notification -->
281
+ <div id="copy-toast" class="fixed bottom-4 left-1/2 transform -translate-x-1/2 bg-primary-500 text-white px-6 py-3 rounded-lg shadow-lg hidden z-50">
282
+ Kod köçürüldü! ✅
283
+ </div>
284
+ </div>
285
+
286
+ <script>
287
+ // Initialize Feather Icons
288
+ feather.replace();
289
+
290
+ // Tab Navigation
291
+ document.querySelectorAll('.tab-btn').forEach(btn => {
292
+ btn.addEventListener('click', () => {
293
+ // Remove active class from all tabs
294
+ document.querySelectorAll('.tab-btn').forEach(b => {
295
+ b.classList.remove('active');
296
+ b.querySelector('div:last-child').classList.add('hidden');
297
+ });
298
+
299
+ // Add active class to clicked tab
300
+ btn.classList.add('active');
301
+ btn.querySelector('div:last-child').classList.remove('hidden');
302
+
303
+ // Hide all tab contents
304
+ document.querySelectorAll('.tab-content').forEach(tab => {
305
+ tab.classList.add('hidden');
306
+ tab.classList.remove('active');
307
+ });
308
+
309
+ // Show selected tab content
310
+ const tabId = btn.getAttribute('data-tab');
311
+ document.getElementById(`tab-content-${tabId}`).classList.remove('hidden');
312
+ document.getElementById(`tab-content-${tabId}`).classList.add('active');
313
+
314
+ // Update preview if projects tab is selected
315
+ if (tabId === 'projects') {
316
+ updateGameOutput();
317
+ }
318
+ });
319
+ });
320
+
321
+ // Copy functionality
322
+ document.querySelectorAll('.copy-btn').forEach(btn => {
323
+ btn.addEventListener('click', function() {
324
+ const target = this.getAttribute('data-target');
325
+ const code = document.getElementById(target).value;
326
+ navigator.clipboard.writeText(code).then(() => {
327
+ showCopyToast();
328
+ });
329
+ });
330
+ });
331
+
332
+ // Toast notification
333
+ function showCopyToast() {
334
+ const toast = document.getElementById('copy-toast');
335
+ toast.classList.remove('hidden');
336
+ setTimeout(() => {
337
+ toast.classList.add('hidden');
338
+ }, 2000);
339
+ }
340
+
341
+ // Update game output preview
342
+ function updateGameOutput() {
343
+ const html = document.getElementById('html-code').value;
344
+ const css = document.getElementById('css-code').value;
345
+ const js = document.getElementById('js-code').value;
346
+
347
+ const outputEl = document.getElementById('output-game');
348
+ if (html || css || js) {
349
+ const code = `
350
+ <!DOCTYPE html>
351
+ <html>
352
+ <head>
353
+ <style>${css}</style>
354
+ </head>
355
+ <body>${html}
356
+ <script>
357
+ try {
358
+ ${js}
359
+ } catch(e) {
360
+ console.error('JavaScript error:', e);
361
+ }
362
+ <\/script>
363
+ </body>
364
+ </html>`;
365
+
366
+ outputEl.innerHTML = '';
367
+ const iframe = document.createElement('iframe');
368
+ iframe.style.width = '100%';
369
+ iframe.style.height = '100%';
370
+ iframe.style.border = 'none';
371
+ iframe.srcdoc = code;
372
+ outputEl.appendChild(iframe);
373
+ }
374
+ }
375
+
376
+ // Real-time preview update
377
+ ['html-code', 'css-code', 'js-code'].forEach(id => {
378
+ document.getElementById(id).addEventListener('input', () => {
379
+ if (document.querySelector('.tab-btn.active').getAttribute('data-tab') === 'projects') {
380
+ updateGameOutput();
381
+ }
382
+ });
383
+ });
384
+
385
+ // Chat functionality
386
+ document.getElementById('chat-form').addEventListener('submit', function(e) {
387
+ e.preventDefault();
388
+ const input = document.getElementById('chat-input');
389
+ const message = input.value.trim();
390
+
391
+ if (message) {
392
+ // Add user message
393
+ addMessage(message, 'user');
394
+ input.value = '';
395
+
396
+ // Simulate AI response
397
+ simulateAIResponse(message);
398
+ }
399
+ });
400
+
401
+ // Reset functionality
402
+ document.getElementById('reset-all').addEventListener('click', function() {
403
+ document.getElementById('chat-log').innerHTML = `
404
+ <div class="ai-message message-bubble">
405
+ Salam! Mən sizin proqramlaşdırma köməkçinizəm. 📝<br>
406
+ HTML, CSS və JavaScript kodları yarada bilərəm. Nə etmək istəyirsiniz?
407
+ </div>
408
+ `;
409
+
410
+ ['html-code', 'css-code', 'js-code'].forEach(id => {
411
+ document.getElementById(id).value = '';
412
+ });
413
+
414
+ updateGameOutput();
415
+ });
416
+
417
+ // Prompt optimize
418
+ document.getElementById('prompt-optimize').addEventListener('click', function() {
419
+ const input = document.getElementById('chat-input');
420
+ const message = input.value.trim();
421
+
422
+ if (message) {
423
+ addMessage(message + ' (Detallı göndərildi)', 'user');
424
+ input.value = '';
425
+
426
+ // Simulate optimized AI response
427
+ simulateOptimizedAIResponse(message);
428
+ }
429
+ });
430
+
431
+ // Helper functions
432
+ function addMessage(text, sender) {
433
+ const chatLog = document.getElementById('chat-log');
434
+ const messageDiv = document.createElement('div');
435
+ messageDiv.className = `${sender}-message message-bubble`;
436
+ messageDiv.innerHTML = `<b>${sender === 'user' ? 'Siz' : 'AI'}:</b> ${escapeHTML(text)}`;
437
+ chatLog.appendChild(messageDiv);
438
+ chatLog.scrollTop = chatLog.scrollHeight;
439
+ }
440
+
441
+ function escapeHTML(str) {
442
+ return str.replace(/[&<>"']/g, function(m) {
443
+ return ({
444
+ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;'
445
+ })[m];
446
+ });
447
+ }
448
+
449
+ function simulateAIResponse(userMessage) {
450
+ const chatLog = document.getElementById('chat-log');
451
+ const typingDiv = document.createElement('div');
452
+ typingDiv.className = 'ai-message message-bubble';
453
+ typingDiv.innerHTML = '<div class="typing-indicator"><span>AI cavab hazırlayır</span><div class="typing-dot"></div><div class="typing-dot"></div><div class="typing-dot"></div></div>';
454
+ chatLog.appendChild(typingDiv);
455
+ chatLog.scrollTop = chatLog.scrollHeight;
456
+
457
+ setTimeout(() => {
458
+ chatLog.removeChild(typingDiv);
459
+
460
+ // Sample AI response based on user input
461
+ let response = '';
462
+ if (userMessage.toLowerCase().includes('html') || userMessage.toLowerCase().includes('css') || userMessage.toLowerCase().includes('javascript')) {
463
+ response = `Sizin sorğunuza uyğun olaraq, aşağıdakı kodları təqdim edirəm:\n\n` +
464
+ `**HTML kodu:**\n\`\`\`html\n<!DOCTYPE html>\n<html>\n<head>\n <title>Salam Dünya</title>\n</head>\n<body>\n <h1>Salam, Dünya!</h1>\n</body>\n</html>\n\`\`\`\n\n` +
465
+ `**CSS kodu:**\n\`\`\`css\nbody {\n font-family: Arial, sans-serif;\n background: linear-gradient(135deg, #667eea, #764ba2);\n margin: 0;\n padding: 20px;\n}\n\nh1 {\n color: white;\n text-align: center;\n}\n\`\`\`\n\n` +
466
+ `**JavaScript kodu:**\n\`\`\`javascript\ndocument.addEventListener('DOMContentLoaded', function() {\n console.log('Salam Dünya proqramı işə düşdü!');\n \n const h1 = document.querySelector('h1');\n h1.addEventListener('click', function() {\n alert('Salam, Dünya!');\n });\n});\n\`\`\``;
467
+ } else {
468
+ response = `Sizin sorğunuzu başa düşdüm! Daha dəqiq kömək üçün aşağıdakı kimi sorğu verə bilərsiniz:\n\n` +
469
+ `"Mənə bir navbar yaradın, HTML, CSS və JavaScript kodlarını ayrıca verin."\n\n` +
470
+ `Və ya:\n\n` +
471
+ `"Responsive kart dizaynı üçün kod yazın. HTML, CSS və JavaScript kodlarını tam verin."`;
472
+ }
473
+
474
+ addMessage(response, 'ai');
475
+
476
+ // Auto-fill code editors if code blocks are detected
477
+ if (response.includes('html')) {
478
+ const htmlMatch = response.match(/html\n([\s\S]*?)(?=\n```|$)/);
479
+ if (htmlMatch) document.getElementById('html-code').value = htmlMatch[1].trim();
480
+
481
+ const cssMatch = response.match(/css\n([\s\S]*?)(?=\n```|$)/);
482
+ if (cssMatch) document.getElementById('css-code').value = cssMatch[1].trim();
483
+
484
+ const jsMatch = response.match(/javascript\n([\s\S]*?)(?=\n```|$)/);
485
+ if (jsMatch) document.getElementById('js-code').value = jsMatch[1].trim();
486
+
487
+ updateGameOutput();
488
+ }
489
+ }, 2000);
490
+ }
491
+
492
+ function simulateOptimizedAIResponse(userMessage) {
493
+ const chatLog = document.getElementById('chat-log');
494
+ const typingDiv = document.createElement('div');
495
+ typingDiv.className = 'ai-message message-bubble';
496
+ typingDiv.innerHTML = '<div class="typing-indicator"><span>AI sorğunu optimallaşdırır</span><div class="typing-dot"></div><div class="typing-dot"></div><div class="typing-dot"></div></div>';
497
+ chatLog.appendChild(typingDiv);
498
+ chatLog.scrollTop = chatLog.scrollHeight;
499
+
500
+ setTimeout(() => {
501
+ chatLog.removeChild(typingDiv);
502
+
503
+ const optimizedPrompt = `Optimallaşdırılmış sorğu: "${userMessage}"\n\n` +
504
+ `Daha dəqiq cavab üçün sorğunu aşağıdakı kimi təkmilləşdirə bilərsiniz:\n\n` +
505
+ `"${userMessage}. HTML, CSS və JavaScript kodlarını tam, ayrıca və başlıqlı kod bloklarında göndərin."\n\n` +
506
+ `Bu formatda sorğu verdikdə, daha dəqiq və tam kodlar alacaqsınız.`;
507
+
508
+ addMessage(optimizedPrompt, 'ai');
509
+ }, 1500);
510
+ }
511
+
512
+ // Initialize with sample code
513
+ document.addEventListener('DOMContentLoaded', function() {
514
+ const sampleHTML = `<!DOCTYPE html>
515
+ <html lang="az">
516
+ <head>
517
+ <meta charset="UTF-8">
518
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
519
+ <title>Salam Dünya</title>
520
+ </head>
521
+ <body>
522
+ <h1>Salam, Dünya! 👋</h1>
523
+ <p>Bu, AI tərəfindən yaradılmış nümunə səhifədir.</p>
524
+ </body>
525
+ </html>`;
526
+
527
+ const sampleCSS = `body {
528
+ font-family: 'Inter', sans-serif;
529
+ background: linear-gradient(135deg, #667eea, #764ba2);
530
+ margin: 0;
531
+ padding: 40px;
532
+ min-height: 100vh;
533
+ display: flex;
534
+ flex-direction: column;
535
+ align-items: center;
536
+ justify-content: center;
537
+ color: white;
538
+ text-align: center;
539
+ }
540
+
541
+ h1 {
542
+ font-size: 3rem;
543
+ margin-bottom: 1rem;
544
+ text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
545
+ }
546
+
547
+ p {
548
+ font-size: 1.2rem;
549
+ opacity: 0.9;
550
+ }`;
551
+
552
+ const sampleJS = `document.addEventListener('DOMContentLoaded', function() {
553
+ console.log('Salam Dünya səhifəsi uğurla yükləndi!');
554
+
555
+ const h1 = document.querySelector('h1');
556
+ h1.addEventListener('click', function() {
557
+ this.style.transform = 'scale(1.1)';
558
+ this.style.transition = 'transform 0.3s ease';
559
+
560
+ setTimeout(() => {
561
+ this.style.transform = 'scale(1)';
562
+ }, 300);
563
+ });
564
+
565
+ // Rəng dəyişmə effekti
566
+ let colorIndex = 0;
567
+ const colors = ['#ff6b6b', '#