Port1k commited on
Commit
fc6cece
Β·
verified Β·
1 Parent(s): 3ab063b

make the better design make better user interface , make the logo just empty circle , make cool website , improve the system

Browse files
Files changed (2) hide show
  1. README.md +9 -5
  2. index.html +561 -19
README.md CHANGED
@@ -1,10 +1,14 @@
1
  ---
2
- title: Undefined
3
- emoji: ⚑
4
- colorFrom: green
5
- colorTo: yellow
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: undefined
3
+ colorFrom: yellow
4
+ colorTo: gray
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,561 @@
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>Zenh AI</title>
7
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
8
+ <style>
9
+ :root {
10
+ --primary: #6e48aa;
11
+ --secondary: #9d50bb;
12
+ --accent: #4776e6;
13
+ --dark: #121212;
14
+ --darker: #0a0a0a;
15
+ --light: #f8f9fa;
16
+ --gray: #2d3748;
17
+ --light-gray: #4a5568;
18
+ }
19
+ * {
20
+ box-sizing: border-box;
21
+ margin: 0;
22
+ padding: 0;
23
+ }
24
+ body {
25
+ font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
26
+ background: linear-gradient(135deg, var(--darker), var(--dark));
27
+ color: var(--light);
28
+ margin: 0;
29
+ padding: 0;
30
+ display: flex;
31
+ flex-direction: column;
32
+ height: 100vh;
33
+ overflow: hidden;
34
+ line-height: 1.6;
35
+ }
36
+ .header {
37
+ display: flex;
38
+ align-items: center;
39
+ justify-content: center;
40
+ margin: 20px 0 30px;
41
+ gap: 15px;
42
+ }
43
+ .logo {
44
+ width: 48px;
45
+ height: 48px;
46
+ background: transparent;
47
+ border-radius: 50%;
48
+ display: flex;
49
+ align-items: center;
50
+ justify-content: center;
51
+ border: 2px solid var(--primary);
52
+ position: relative;
53
+ animation: pulse 3s infinite ease-in-out;
54
+ }
55
+ .logo::after {
56
+ content: '';
57
+ position: absolute;
58
+ width: 100%;
59
+ height: 100%;
60
+ border-radius: 50%;
61
+ border: 2px solid transparent;
62
+ border-top-color: var(--accent);
63
+ animation: spin 2s linear infinite;
64
+ }
65
+ @keyframes pulse {
66
+ 0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(110, 72, 170, 0.4); }
67
+ 50% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(110, 72, 170, 0); }
68
+ }
69
+ @keyframes spin {
70
+ 0% { transform: rotate(0deg); }
71
+ 100% { transform: rotate(360deg); }
72
+ }
73
+ h1 {
74
+ margin: 0;
75
+ font-size: 28px;
76
+ font-weight: 700;
77
+ color: var(--light);
78
+ background: linear-gradient(to right, var(--primary), var(--accent));
79
+ -webkit-background-clip: text;
80
+ background-clip: text;
81
+ color: transparent;
82
+ letter-spacing: 0.5px;
83
+ }
84
+ #mode-selector {
85
+ display: flex;
86
+ justify-content: center;
87
+ margin-bottom: 25px;
88
+ gap: 15px;
89
+ }
90
+ .mode-button {
91
+ padding: 12px 24px;
92
+ background: linear-gradient(135deg, var(--dark), var(--gray));
93
+ color: var(--light);
94
+ border: none;
95
+ border-radius: 12px;
96
+ cursor: pointer;
97
+ transition: all 0.3s ease;
98
+ font-weight: 500;
99
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
100
+ position: relative;
101
+ overflow: hidden;
102
+ z-index: 1;
103
+ }
104
+ .mode-button::before {
105
+ content: '';
106
+ position: absolute;
107
+ top: 0;
108
+ left: 0;
109
+ width: 100%;
110
+ height: 100%;
111
+ background: linear-gradient(135deg, var(--primary), var(--accent));
112
+ z-index: -1;
113
+ opacity: 0;
114
+ transition: opacity 0.3s ease;
115
+ }
116
+ .mode-button.active, .mode-button:hover {
117
+ color: white;
118
+ transform: translateY(-2px);
119
+ box-shadow: 0 6px 12px rgba(110, 72, 170, 0.3);
120
+ }
121
+ .mode-button.active::before, .mode-button:hover::before {
122
+ opacity: 1;
123
+ }
124
+ #mode-instructions {
125
+ text-align: center;
126
+ color: var(--light);
127
+ font-size: 14px;
128
+ margin-bottom: 25px;
129
+ padding: 15px;
130
+ background: rgba(30, 30, 30, 0.7);
131
+ border-radius: 12px;
132
+ opacity: 0;
133
+ transform: translateY(10px);
134
+ transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.1);
135
+ backdrop-filter: blur(10px);
136
+ border: 1px solid rgba(255, 255, 255, 0.1);
137
+ max-width: 800px;
138
+ margin-left: auto;
139
+ margin-right: auto;
140
+ width: 90%;
141
+ }
142
+ #mode-instructions.visible {
143
+ opacity: 1;
144
+ transform: translateY(0);
145
+ box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
146
+ }
147
+ #chat-container {
148
+ flex: 1;
149
+ overflow-y: auto;
150
+ padding: 25px;
151
+ border-radius: 20px;
152
+ background: rgba(25, 25, 25, 0.7);
153
+ box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
154
+ margin-bottom: 20px;
155
+ scroll-behavior: smooth;
156
+ transition: all 0.5s ease;
157
+ backdrop-filter: blur(10px);
158
+ border: 1px solid rgba(255, 255, 255, 0.1);
159
+ margin-left: auto;
160
+ margin-right: auto;
161
+ width: 95%;
162
+ max-width: 1000px;
163
+ }
164
+ #chat-container.fade {
165
+ opacity: 0.5;
166
+ filter: blur(2px);
167
+ }
168
+ .welcome-message {
169
+ text-align: center;
170
+ color: var(--light);
171
+ font-size: 20px;
172
+ margin-bottom: 40px;
173
+ opacity: 0;
174
+ transform: translateY(10px);
175
+ animation: fadeInUp 0.5s ease forwards;
176
+ font-weight: 300;
177
+ letter-spacing: 0.3px;
178
+ }
179
+ .quick-actions {
180
+ display: grid;
181
+ grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
182
+ gap: 15px;
183
+ max-width: 800px;
184
+ margin: 0 auto;
185
+ padding: 20px;
186
+ }
187
+ .quick-button {
188
+ padding: 15px 20px;
189
+ background: rgba(40, 40, 40, 0.7);
190
+ color: var(--light);
191
+ border: none;
192
+ border-radius: 12px;
193
+ cursor: pointer;
194
+ font-size: 16px;
195
+ font-weight: 500;
196
+ transition: all 0.3s ease;
197
+ opacity: 0;
198
+ transform: translateY(10px);
199
+ animation: fadeInUp 0.3s ease forwards;
200
+ backdrop-filter: blur(5px);
201
+ border: 1px solid rgba(255, 255, 255, 0.1);
202
+ text-align: left;
203
+ position: relative;
204
+ overflow: hidden;
205
+ }
206
+ .quick-button::before {
207
+ content: '';
208
+ position: absolute;
209
+ top: 0;
210
+ left: 0;
211
+ width: 100%;
212
+ height: 100%;
213
+ background: linear-gradient(135deg, rgba(110, 72, 170, 0.3), rgba(71, 118, 230, 0.3));
214
+ z-index: -1;
215
+ opacity: 0;
216
+ transition: opacity 0.3s ease;
217
+ }
218
+ .quick-button:nth-child(1) { animation-delay: 0.1s; }
219
+ .quick-button:nth-child(2) { animation-delay: 0.2s; }
220
+ .quick-button:nth-child(3) { animation-delay: 0.3s; }
221
+ .quick-button:nth-child(4) { animation-delay: 0.4s; }
222
+ .quick-button:nth-child(5) { animation-delay: 0.5s; }
223
+ .quick-button:nth-child(6) { animation-delay: 0.6s; }
224
+ .quick-button:hover {
225
+ transform: translateY(-5px);
226
+ box-shadow: 0 10px 20px rgba(110, 72, 170, 0.3);
227
+ }
228
+ .quick-button:hover::before {
229
+ opacity: 1;
230
+ }
231
+ .message {
232
+ margin-bottom: 20px;
233
+ padding: 16px 20px;
234
+ border-radius: 16px;
235
+ opacity: 0;
236
+ transform: translateY(10px);
237
+ animation: fadeInUp 0.3s ease forwards;
238
+ max-width: 85%;
239
+ word-wrap: break-word;
240
+ line-height: 1.7;
241
+ position: relative;
242
+ transition: transform 0.3s ease;
243
+ }
244
+ .message:hover {
245
+ transform: translateY(-3px);
246
+ }
247
+ @keyframes fadeInUp {
248
+ to {
249
+ opacity: 1;
250
+ transform: translateY(0);
251
+ }
252
+ }
253
+ .user {
254
+ background: linear-gradient(135deg, var(--primary), var(--secondary));
255
+ color: white;
256
+ margin-left: auto;
257
+ text-align: right;
258
+ box-shadow: 0 4px 15px rgba(110, 72, 170, 0.3);
259
+ border: none;
260
+ }
261
+ .bot {
262
+ background: rgba(40, 40, 40, 0.7);
263
+ color: var(--light);
264
+ border: 1px solid rgba(255, 255, 255, 0.1);
265
+ box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
266
+ backdrop-filter: blur(5px);
267
+ }
268
+ .processing-indicator {
269
+ display: flex;
270
+ align-items: center;
271
+ gap: 10px;
272
+ padding: 16px 20px;
273
+ background: rgba(40, 40, 40, 0.7);
274
+ border-radius: 16px;
275
+ border: 1px solid rgba(255, 255, 255, 0.1);
276
+ max-width: 85%;
277
+ box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
278
+ color: var(--light);
279
+ backdrop-filter: blur(5px);
280
+ }
281
+ .processing-dots {
282
+ display: flex;
283
+ gap: 4px;
284
+ }
285
+ .processing-dots span {
286
+ width: 8px;
287
+ height: 8px;
288
+ border-radius: 50%;
289
+ background: #ffffff;
290
+ animation: typing 1.4s infinite ease-in-out;
291
+ }
292
+ .processing-dots span:nth-child(1) { animation-delay: -0.32s; }
293
+ .processing-dots span:nth-child(2) { animation-delay: -0.16s; }
294
+ @keyframes typing {
295
+ 0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
296
+ 40% { transform: scale(1); opacity: 1; }
297
+ }
298
+ #input-container {
299
+ display: flex;
300
+ gap: 15px;
301
+ padding: 0 25px;
302
+ margin: 0 auto 25px;
303
+ width: 95%;
304
+ max-width: 1000px;
305
+ }
306
+ #user-input {
307
+ flex: 1;
308
+ padding: 16px 20px;
309
+ border: 2px solid rgba(255, 255, 255, 0.1);
310
+ border-radius: 16px;
311
+ background: rgba(40, 40, 40, 0.7);
312
+ color: var(--light);
313
+ font-size: 16px;
314
+ outline: none;
315
+ transition: all 0.3s ease;
316
+ backdrop-filter: blur(5px);
317
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
318
+ }
319
+ #user-input:focus {
320
+ border-color: var(--accent);
321
+ box-shadow: 0 0 0 3px rgba(71, 118, 230, 0.2);
322
+ }
323
+ #user-input::placeholder {
324
+ color: rgba(255, 255, 255, 0.5);
325
+ }
326
+ #send-button {
327
+ padding: 16px 25px;
328
+ background: linear-gradient(135deg, var(--primary), var(--accent));
329
+ color: white;
330
+ border: none;
331
+ border-radius: 16px;
332
+ cursor: pointer;
333
+ font-size: 16px;
334
+ font-weight: 600;
335
+ transition: all 0.3s ease;
336
+ box-shadow: 0 4px 15px rgba(110, 72, 170, 0.4);
337
+ display: flex;
338
+ align-items: center;
339
+ gap: 8px;
340
+ }
341
+ #send-button:hover {
342
+ transform: translateY(-3px);
343
+ box-shadow: 0 10px 20px rgba(110, 72, 170, 0.4);
344
+ }
345
+ #send-button:active {
346
+ transform: translateY(0);
347
+ }
348
+ @media (max-width: 768px) {
349
+ body { padding: 15px; }
350
+ .header { margin: 10px 0 20px; }
351
+ h1 { font-size: 22px; }
352
+ #mode-selector { flex-wrap: wrap; }
353
+ .mode-button { padding: 10px 15px; font-size: 14px; }
354
+ #chat-container { padding: 15px; margin-bottom: 15px; width: 100%; }
355
+ #input-container { padding: 0 15px; margin-bottom: 15px; width: 100%; }
356
+ .quick-actions { grid-template-columns: 1fr; padding: 15px; }
357
+ .message, .processing-indicator { max-width: 90%; }
358
+ #user-input, #send-button { padding: 14px 18px; }
359
+ }
360
+
361
+ /* Scrollbar styling */
362
+ ::-webkit-scrollbar {
363
+ width: 8px;
364
+ }
365
+ ::-webkit-scrollbar-track {
366
+ background: transparent;
367
+ }
368
+ ::-webkit-scrollbar-thumb {
369
+ background: var(--primary);
370
+ border-radius: 4px;
371
+ }
372
+ ::-webkit-scrollbar-thumb:hover {
373
+ background: var(--secondary);
374
+ }
375
+ </style>
376
+ </head>
377
+ <body>
378
+ <div class="header">
379
+ <div class="logo"></div>
380
+ <h1>CosmicAI Nexus</h1>
381
+ </div>
382
+ <div id="mode-selector">
383
+ <button class="mode-button active" data-mode="normal">Normal Chat</button>
384
+ <button class="mode-button" data-mode="thinking">Thinking Mode</button>
385
+ <button class="mode-button" data-mode="websearch">Web Search</button>
386
+ </div>
387
+ <div id="mode-instructions" class="visible"></div>
388
+ <div id="chat-container">
389
+ <div class="welcome-message">Welcome to Zenh AI! Select a mode and start chatting.</div>
390
+ <div class="quick-actions">
391
+ <button class="quick-button" onclick="quickAction('Tell me a cosmic joke.')">🌠 Cosmic Joke</button>
392
+ <button class="quick-button" onclick="quickAction('What is the weather like today?')">β›… Weather Check</button>
393
+ <button class="quick-button" onclick="quickAction('Explain quantum physics simply.')">πŸ”¬ Science Explainer</button>
394
+ <button class="quick-button" onclick="quickAction('Generate a poem about the universe.')">✨ Cosmic Poetry</button>
395
+ <button class="quick-button" onclick="quickAction('Help me with code: print Hello World in Python.')">πŸ’» Code Assistant</button>
396
+ <button class="quick-button" onclick="quickAction('Summarize the latest space discoveries.')">πŸš€ Space News</button>
397
+ </div>
398
+ </div>
399
+ <div id="input-container">
400
+ <input type="text" id="user-input" placeholder="Type your message..." onkeypress="handleKeyPress(event)">
401
+ <button id="send-button" onclick="sendMessage()">Send</button>
402
+ </div>
403
+
404
+ <script>
405
+ const API_KEY = 'YOUR_API_KEY_HERE'; // Replace with your actual API key
406
+ const MODEL = 'gpt-4'; // Updated to a more powerful model
407
+ const API_URL = 'https://openrouter.ai/api/v1/chat/completions';
408
+ const DDG_API = 'https://api.duckduckgo.com/';
409
+
410
+ let messages = [];
411
+ let currentMode = 'normal';
412
+ const modeInstructions = {
413
+ normal: '✨ Normal Chat Mode: Instant responses for everyday questions and conversations. Perfect for quick answers and casual chat.',
414
+ thinking: '🧠 Deep Thought Mode: The AI carefully analyzes and breaks down complex problems step-by-step. Ideal for detailed explanations and logical reasoning.',
415
+ websearch: '🌐 Web Search Mode: Real-time information from across the internet. The AI will search, summarize, and provide sources for up-to-date answers.'
416
+ };
417
+
418
+ function updateModeInstructions() {
419
+ const instructionsDiv = document.getElementById('mode-instructions');
420
+ instructionsDiv.textContent = modeInstructions[currentMode];
421
+ instructionsDiv.classList.add('visible');
422
+ }
423
+
424
+ function animateModeSwitch() {
425
+ const chatContainer = document.getElementById('chat-container');
426
+ chatContainer.classList.add('fade');
427
+ setTimeout(() => {
428
+ chatContainer.classList.remove('fade');
429
+ }, 500);
430
+ }
431
+
432
+ document.querySelectorAll('.mode-button').forEach(button => {
433
+ button.addEventListener('click', () => {
434
+ document.querySelectorAll('.mode-button').forEach(btn => btn.classList.remove('active'));
435
+ button.classList.add('active');
436
+ currentMode = button.dataset.mode;
437
+ updateModeInstructions();
438
+ animateModeSwitch();
439
+ });
440
+ });
441
+
442
+ updateModeInstructions(); // Initial
443
+
444
+ function addMessage(content, isUser) {
445
+ const chatContainer = document.getElementById('chat-container');
446
+ const welcome = chatContainer.querySelector('.welcome-message');
447
+ const quickActions = chatContainer.querySelector('.quick-actions');
448
+ if (welcome) welcome.style.display = 'none';
449
+ if (quickActions) quickActions.style.display = 'none';
450
+
451
+ const messageDiv = document.createElement('div');
452
+ messageDiv.classList.add('message', isUser ? 'user' : 'bot');
453
+ messageDiv.textContent = content;
454
+ chatContainer.appendChild(messageDiv);
455
+ chatContainer.scrollTop = chatContainer.scrollHeight;
456
+ }
457
+
458
+ function addProcessingIndicator(text) {
459
+ const chatContainer = document.getElementById('chat-container');
460
+ const processingDiv = document.createElement('div');
461
+ processingDiv.id = 'processing-indicator';
462
+ processingDiv.classList.add('processing-indicator');
463
+ processingDiv.innerHTML = `${text} <div class="processing-dots"><span></span><span></span><span></span></div>`;
464
+ chatContainer.appendChild(processingDiv);
465
+ chatContainer.scrollTop = chatContainer.scrollHeight;
466
+ }
467
+
468
+ function removeProcessingIndicator() {
469
+ const processingDiv = document.getElementById('processing-indicator');
470
+ if (processingDiv) {
471
+ processingDiv.remove();
472
+ }
473
+ }
474
+
475
+ function quickAction(prompt) {
476
+ document.getElementById('user-input').value = prompt;
477
+ sendMessage();
478
+ }
479
+
480
+ async function handleWebSearch(query) {
481
+ addProcessingIndicator('Searching...');
482
+ try {
483
+ const response = await fetch(`${DDG_API}?q=${encodeURIComponent(query)}&format=json`);
484
+ const data = await response.json();
485
+ let result = data.Abstract || 'No direct answer found. Here are related topics:\n';
486
+ if (data.RelatedTopics && data.RelatedTopics.length > 0) {
487
+ data.RelatedTopics.slice(0, 5).forEach(topic => {
488
+ result += `- ${topic.Text}: ${topic.FirstURL}\n`;
489
+ });
490
+ }
491
+ removeProcessingIndicator();
492
+ addMessage(result, false);
493
+ } catch (error) {
494
+ removeProcessingIndicator();
495
+ addMessage('Error during search: ' + error.message, false);
496
+ }
497
+ }
498
+
499
+ async function sendMessage() {
500
+ const input = document.getElementById('user-input');
501
+ const userMessage = input.value.trim();
502
+ if (!userMessage) return;
503
+
504
+ addMessage(userMessage, true);
505
+ input.value = '';
506
+
507
+ if (currentMode === 'websearch') {
508
+ await handleWebSearch(userMessage);
509
+ return;
510
+ }
511
+
512
+ let systemPrompt = '';
513
+ let indicatorText = 'Responding...';
514
+ if (currentMode === 'thinking') {
515
+ systemPrompt = 'Think step by step before responding. ';
516
+ indicatorText = 'Thinking...';
517
+ }
518
+
519
+ messages.push({ role: 'user', content: systemPrompt + userMessage });
520
+
521
+ addProcessingIndicator(indicatorText);
522
+
523
+ try {
524
+ const response = await fetch(API_URL, {
525
+ method: 'POST',
526
+ headers: {
527
+ 'Authorization': `Bearer ${API_KEY}`,
528
+ 'Content-Type': 'application/json',
529
+ 'HTTP-Referer': window.location.origin,
530
+ 'X-Title': 'Zenh AI'
531
+ },
532
+ body: JSON.stringify({
533
+ model: MODEL,
534
+ messages: messages,
535
+ max_tokens: 500,
536
+ temperature: 0.7
537
+ })
538
+ });
539
+
540
+ removeProcessingIndicator();
541
+
542
+ if (!response.ok) throw new Error(`API error: ${response.status}`);
543
+
544
+ const data = await response.json();
545
+ const botMessage = data.choices[0].message.content;
546
+ addMessage(botMessage, false);
547
+ messages.push({ role: 'assistant', content: botMessage });
548
+ } catch (error) {
549
+ removeProcessingIndicator();
550
+ addMessage('Error: ' + error.message, false);
551
+ }
552
+ }
553
+
554
+ function handleKeyPress(event) {
555
+ if (event.key === 'Enter') {
556
+ sendMessage();
557
+ }
558
+ }
559
+ </script>
560
+ </body>
561
+ </html>