h4sch commited on
Commit
db8c575
·
verified ·
1 Parent(s): 5ca45d6

Add 1 files

Browse files
Files changed (1) hide show
  1. index.html +215 -309
index.html CHANGED
@@ -1,338 +1,244 @@
1
-
2
-
3
  <!DOCTYPE html>
4
  <html lang="de">
5
  <head>
6
  <meta charset="UTF-8">
7
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
8
- <title>Maverick-Chat XL 🇩🇪</title>
9
  <script src="https://cdn.tailwindcss.com"></script>
10
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
11
  <style>
12
- .chat-message-user {
13
- background-color: #f0f7ff;
14
- border-left: 4px solid #3b82f6;
15
- }
16
- .chat-message-ai {
17
- background-color: #f8fafc;
18
- border-left: 4px solid #10b981;
19
- }
20
- .typing-indicator::after {
21
- content: '...';
22
- animation: typing 1.5s infinite;
23
- }
24
- @keyframes typing {
25
- 0% { content: '.'; }
26
- 33% { content: '..'; }
27
- 66% { content: '...'; }
28
- }
29
- .gradient-bg {
30
- background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
31
- }
32
-
33
- /* Enhanced Textarea Styling */
34
- .xl-textarea {
35
- resize: vertical;
36
- min-height: 120px; /* Start with larger initial height */
37
- max-height: 400px;
38
- overflow-y: auto;
39
- transition: height 0.2s;
40
- line-height: 1.6;
41
- padding: 12px;
42
- font-size: 16px;
43
- }
44
-
45
- /* Custom scrollbar - more visible */
46
- .xl-textarea::-webkit-scrollbar {
47
- width: 14px;
48
- }
49
- .xl-textarea::-webkit-scrollbar-track {
50
- background: #f1f1f1;
51
- border-radius: 10px;
52
- border: 3px solid white;
53
- }
54
- .xl-textarea::-webkit-scrollbar-thumb {
55
- background: #888;
56
- border-radius: 10px;
57
- border: 3px solid white;
58
- }
59
- .xl-textarea::-webkit-scrollbar-thumb:hover {
60
- background: #555;
61
- }
62
-
63
- /* Paragraph visibility */
64
- .xl-textarea {
65
- white-space: pre-wrap;
66
- }
67
-
68
- /* Character counter */
69
- .char-counter {
70
- background: rgba(255,255,255,0.9);
71
- padding: 2px 8px;
72
- border-radius: 12px;
73
- font-weight: bold;
74
- }
75
- .char-counter.warning {
76
- color: #f59e0b;
77
- }
78
- .char-counter.error {
79
- color: #ef4444;
80
  }
81
  </style>
82
  </head>
83
- <body class="gradient-bg min-h-screen">
84
- <div class="container mx-auto px-4 py-8 max-w-5xl">
85
- <!-- Header -->
86
- <header class="mb-8 text-center">
87
- <h1 class="text-4xl font-bold text-gray-800 mb-2">
88
- <i class="fas fa-bolt text-yellow-500 mr-2"></i> Maverick-Chat XL
89
- </h1>
90
- <p class="text-lg text-gray-600">Erweiterter KI-Chat mit 15.000+ Zeichen Kapazität</p>
91
- </header>
92
 
93
- <!-- Main Chat Interface -->
94
- <div class="bg-white rounded-xl shadow-xl overflow-hidden border-2 border-gray-300">
95
- <!-- Chat History -->
96
- <div id="chat-history" class="p-6 h-[500px] overflow-y-auto space-y-4">
97
- <div class="chat-message-ai p-4 rounded-lg">
98
- <div class="font-bold text-green-600 mb-2 text-lg">
99
- <i class="fas fa-brain mr-2"></i>Maverick XL
100
- </div>
101
- <p class="text-gray-800">Willkommen beim Maverick-Chat XL! Ich bin die erweiterte Version mit Unterstützung für lange Texte (bis zu 15.000 Zeichen). Sie können jetzt ausführliche Dokumente, Code oder lange Fragen eingeben.</p>
102
- <div class="mt-3 p-3 bg-green-50 rounded border border-green-200">
103
- <p class="text-sm text-green-800"><i class="fas fa-info-circle mr-2"></i> Tipp: Nutzen Sie die großen Eingabefelder und den sichtbaren Scrollbalken für bessere Navigation in langen Texten.</p>
104
- </div>
105
- </div>
106
- </div>
107
 
108
- <!-- Input Area -->
109
- <div class="border-t-2 border-gray-300 p-4 bg-gray-50">
110
- <form id="chat-form" class="flex space-x-3 items-end">
111
- <div class="flex-1 relative">
112
- <textarea
113
- id="user-input"
114
- placeholder="Geben Sie hier Ihren ausführlichen Text ein (bis zu 15.000 Zeichen)..."
115
- class="xl-textarea w-full px-4 py-3 border-2 border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent shadow-sm"
116
- rows="5"
117
- oninput="autoGrow(this)"
118
- ></textarea>
119
- <div class="absolute bottom-3 right-3">
120
- <span id="char-count" class="char-counter">0/15.000</span>
121
- </div>
122
- </div>
123
- <div class="flex flex-col space-y-2">
124
- <button
125
- type="submit"
126
- class="h-14 px-5 bg-blue-600 text-white rounded-lg hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors shadow-md"
127
- title="Nachricht senden"
128
- >
129
- <i class="fas fa-paper-plane text-lg"></i>
130
- </button>
131
- <button
132
- type="button"
133
- id="clear-chat"
134
- class="h-14 px-5 bg-gray-200 text-gray-700 rounded-lg hover:bg-gray-300 focus:outline-none focus:ring-2 focus:ring-gray-500 focus:ring-offset-2 transition-colors shadow-md"
135
- title="Chat zurücksetzen"
136
- >
137
- <i class="fas fa-eraser text-lg"></i>
138
- </button>
139
- </div>
140
- </form>
141
  </div>
142
  </div>
143
 
144
- <!-- Features Section -->
145
- <div class="mt-8 grid grid-cols-1 md:grid-cols-3 gap-6">
146
- <div class="bg-white p-5 rounded-xl shadow-lg border-2 border-blue-200">
147
- <div class="text-blue-600 mb-3 text-2xl">
148
- <i class="fas fa-expand"></i>
149
- </div>
150
- <h3 class="font-bold text-lg mb-2">Große Texteingabe</h3>
151
- <p class="text-gray-600">Bis zu 15.000 Zeichen Kapazität mit automatischer Höhenanpassung und sichtbarem Scrollbalken.</p>
152
- </div>
153
- <div class="bg-white p-5 rounded-xl shadow-lg border-2 border-green-200">
154
- <div class="text-green-600 mb-3 text-2xl">
155
- <i class="fas fa-paragraph"></i>
156
- </div>
157
- <h3 class="font-bold text-lg mb-2">Klare Absätze</h3>
158
- <p class="text-gray-600">Optimierte Darstellung von Absätzen und Zeilenumbrüchen für bessere Lesbarkeit.</p>
159
- </div>
160
- <div class="bg-white p-5 rounded-xl shadow-lg border-2 border-yellow-200">
161
- <div class="text-yellow-600 mb-3 text-2xl">
162
- <i class="fas fa-sliders-h"></i>
163
- </div>
164
- <h3 class="font-bold text-lg mb-2">Anpassbare Größe</h3>
165
- <p class="text-gray-600">Manuelles Resizing des Eingabefeldes durch Ziehen der unteren Ecke.</p>
166
  </div>
167
  </div>
168
 
169
- <!-- Model Info -->
170
- <div class="mt-8 bg-white rounded-xl shadow-xl overflow-hidden border-2 border-gray-300">
171
- <div class="px-5 py-4 bg-gray-100 border-b-2 border-gray-300">
172
- <div class="flex items-center">
173
- <i class="fas fa-server text-purple-600 mr-3 text-xl"></i>
174
- <span class="font-bold text-lg">Erweiterte Modellinformationen</span>
175
- </div>
176
- </div>
177
- <div class="p-5">
178
- <div class="grid grid-cols-1 md:grid-cols-3 gap-5">
179
- <div class="p-4 bg-gray-50 rounded-lg border border-gray-200">
180
- <p class="text-sm text-gray-500 mb-1">Modellname</p>
181
- <p class="font-bold text-lg">Llama 4 Maverick XL</p>
182
- </div>
183
- <div class="p-4 bg-gray-50 rounded-lg border border-gray-200">
184
- <p class="text-sm text-gray-500 mb-1">Max. Zeichen</p>
185
- <p class="font-bold text-lg">15.000+</p>
186
- </div>
187
- <div class="p-4 bg-gray-50 rounded-lg border border-gray-200">
188
- <p class="text-sm text-gray-500 mb-1">Kontextlänge</p>
189
- <p class="font-bold text-lg">8k Tokens</p>
190
- </div>
191
- </div>
192
- <div class="mt-4 p-4 bg-blue-50 rounded-lg border border-blue-200">
193
- <p class="text-blue-800"><i class="fas fa-lightbulb mr-2"></i> Dieses erweiterte Modell ist speziell für lange Dokumente, Code und ausführliche Analysen optimiert.</p>
194
- </div>
195
  </div>
196
- </div>
 
 
 
 
 
 
 
 
 
 
 
197
  </div>
 
 
 
 
 
 
 
 
198
 
199
- <script>
200
- // Enhanced auto-grow function with character limit
201
- function autoGrow(element) {
202
- // Reset height to get correct scrollHeight
203
- element.style.height = 'auto';
204
- // Set new height (with buffer to prevent scrollbar flickering)
205
- element.style.height = (element.scrollHeight + 4) + 'px';
206
-
207
- const currentLength = element.value.length;
208
- const maxLength = 15000;
209
- const charCounter = document.getElementById('char-count');
210
-
211
- // Update character count
212
- charCounter.textContent = `${currentLength}/${maxLength}`;
213
-
214
- // Visual feedback based on length
215
- if (currentLength > maxLength * 0.9) {
216
- charCounter.className = 'char-counter error';
217
- } else if (currentLength > maxLength * 0.7) {
218
- charCounter.className = 'char-counter warning';
219
- } else {
220
- charCounter.className = 'char-counter';
221
- }
222
-
223
- // Limit to maxLength characters
224
- if (currentLength > maxLength) {
225
- element.value = element.value.substring(0, maxLength);
226
- charCounter.textContent = `${maxLength}/${maxLength}`;
227
- }
228
  }
229
 
230
- // Handle Shift+Enter for new line, Enter to submit
231
- document.getElementById('user-input').addEventListener('keydown', function(e) {
232
- if (e.key === 'Enter' && !e.shiftKey) {
233
- e.preventDefault();
234
- document.getElementById('chat-form').dispatchEvent(new Event('submit'));
235
- }
236
- });
 
 
 
 
 
 
 
237
 
238
- // Chat functionality
239
- document.getElementById('chat-form').addEventListener('submit', function(e) {
240
- e.preventDefault();
241
- const input = document.getElementById('user-input');
242
- const message = input.value.trim();
243
-
244
- if (message) {
245
- // Add user message
246
- addMessage(message, 'user');
247
- input.value = '';
248
- // Reset textarea height
249
- input.style.height = 'auto';
250
- document.getElementById('char-count').textContent = '0/15000';
251
- document.getElementById('char-count').className = 'char-counter';
252
-
253
- // Show typing indicator
254
- const typingIndicator = document.createElement('div');
255
- typingIndicator.className = 'chat-message-ai p-4 rounded-lg';
256
- typingIndicator.innerHTML = `
257
- <div class="font-bold text-green-600 mb-2 text-lg">
258
- <i class="fas fa-brain mr-2"></i>Maverick XL
259
- </div>
260
- <p class="typing-indicator text-gray-800">Analysiere Ihre ausführliche Anfrage...</p>
261
- `;
262
- document.getElementById('chat-history').appendChild(typingIndicator);
263
- typingIndicator.scrollIntoView({ behavior: 'smooth' });
264
-
265
- // Simulate AI response after delay
266
- setTimeout(() => {
267
- // Remove typing indicator
268
- typingIndicator.remove();
269
-
270
- // Add AI response
271
- const responses = [
272
- `Ich habe Ihre ausführliche Eingabe mit ${message.length} Zeichen analysiert. Das XL-Modell ist perfekt für solche detaillierten Anfragen geeignet. Hier ist meine ausführliche Antwort:\n\nLlama 4 Maverick XL ist speziell für die Verarbeitung langer Texte optimiert. Mit 17 Milliarden Parametern und einer erweiterten Kontextlänge von 8k Tokens kann ich komplexe Zusammenhänge in langen Dokumenten verstehen und verarbeiten.\n\nDie Architektur verwendet erweiterte Attention-Mechanismen, die besonders effizient mit langen Sequenzen umgehen können. Dies ermöglicht tiefgehende Analysen von:\n- Technischen Dokumenten\n- Langen Code-Ausschnitten\n- Ausführlichen Forschungsfragen\n- Mehrseitigen Texten`,
273
- `Vielen Dank für Ihre detaillierte Anfrage. Bei ${message.length} Zeichen nutzen Sie bereits die erweiterten Fähigkeiten dieses Modells. Hier sind einige Beobachtungen zu Ihrem Text:\n\n1. Absatzstruktur: ${(message.match(/\n\s*\n/g) || []).length + 1} klare Absätze erkannt\n2. Code-Blöcke: ${(message.match(/```/g) || []).length / 2 || 0} Code-Abschnitte identifiziert\n3. Schlüsselwörter: ${message.split(/\s+/).length} Wörter analysiert\n\nMeine erweiterte Kontextverarbeitung ermöglicht es, alle diese Elemente in Beziehung zueinander zu setzen.`,
274
- `Ihre lange Eingabe zeigt, dass Sie das volle Potenzial dieses XL-Modells nutzen möchten. Als Maverick XL kann ich:\n\n• Bis zu 15.000 Zeichen Eingabe verarbeiten\n• Komplexe Dokumente mit vielen Absätzen analysieren\n• Lange Code-Blöcke verstehen und kommentieren\n• Ausführliche, zusammenhängende Antworten generieren\n\nDiese erweiterten Fähigkeiten machen mich ideal für:\n- Technische Dokumentation\n- Forschungsarbeiten\n- Code-Reviews\n- Lange Korrespondenz`
275
- ];
276
-
277
- addMessage(responses[Math.floor(Math.random() * responses.length)], 'ai');
278
- }, 2000 + Math.random() * 2000); // Longer delay for "processing" long texts
279
- }
280
- });
 
 
 
 
 
 
 
 
 
 
 
 
281
 
282
- // Clear chat
283
- document.getElementById('clear-chat').addEventListener('click', function() {
284
- if (confirm('Möchten Sie den gesamten Chatverlauf wirklich zurücksetzen?')) {
285
- document.getElementById('chat-history').innerHTML = `
286
- <div class="chat-message-ai p-4 rounded-lg">
287
- <div class="font-bold text-green-600 mb-2 text-lg">
288
- <i class="fas fa-brain mr-2"></i>Maverick XL
289
- </div>
290
- <p class="text-gray-800">Willkommen beim Maverick-Chat XL! Ich bin die erweiterte Version mit Unterstützung für lange Texte (bis zu 15.000 Zeichen). Sie können jetzt ausführliche Dokumente, Code oder lange Fragen eingeben.</p>
291
- <div class="mt-3 p-3 bg-green-50 rounded border border-green-200">
292
- <p class="text-sm text-green-800"><i class="fas fa-info-circle mr-2"></i> Tipp: Nutzen Sie die großen Eingabefelder und den sichtbaren Scrollbalken für bessere Navigation in langen Texten.</p>
293
- </div>
294
- </div>
295
- `;
296
- }
297
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
298
 
299
- // Helper function to add messages with better paragraph handling
300
- function addMessage(text, sender) {
301
- const chatHistory = document.getElementById('chat-history');
302
- const messageDiv = document.createElement('div');
303
- messageDiv.className = `chat-message-${sender} p-4 rounded-lg`;
304
-
305
- // Format paragraphs and preserve whitespace
306
- const formattedText = text
307
- .replace(/\n{3,}/g, '\n\n') // Normalize multiple newlines
308
- .replace(/\n\n/g, '</p><p class="mt-4">') // Double newline -> paragraph
309
- .replace(/\n/g, '<br>') // Single newline -> line break
310
- // Format code blocks
311
- .replace(/```(\w*)([\s\S]*?)```/g,
312
- '<pre class="bg-gray-100 p-3 rounded my-3 overflow-x-auto border border-gray-300"><code>$2</code></pre>');
313
-
314
- if (sender === 'user') {
315
- messageDiv.innerHTML = `
316
- <div class="font-bold text-blue-600 mb-2 text-lg">
317
- <i class="fas fa-user mr-2"></i>Sie
318
- </div>
319
- <p class="text-gray-800">${formattedText}</p>
320
- <div class="mt-2 text-xs text-gray-500">
321
- ${text.length} Zeichen, ${text.split(/\s+/).length} Wörter
322
- </div>
323
- `;
324
- } else {
325
- messageDiv.innerHTML = `
326
- <div class="font-bold text-green-600 mb-2 text-lg">
327
- <i class="fas fa-brain mr-2"></i>Maverick XL
328
- </div>
329
- <div class="text-gray-800">${formattedText}</div>
330
- `;
331
- }
332
-
333
- chatHistory.appendChild(messageDiv);
334
- messageDiv.scrollIntoView({ behavior: 'smooth' });
335
- }
336
- </script>
337
  <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=h4sch/m-chat" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
338
  </html>
 
 
 
1
  <!DOCTYPE html>
2
  <html lang="de">
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Maverick-Chat 🇩🇪</title>
7
  <script src="https://cdn.tailwindcss.com"></script>
8
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
  <style>
10
+ .chat-user { background-color: #e0f2fe; border-left: 4px solid #38bdf8; }
11
+ .chat-ai { background-color: #f0fdf4; border-left: 4px solid #34d399; }
12
+ .chat-error { background-color: #fee2e2; border-left: 4px solid #ef4444; }
13
+ .textarea-flex { resize: vertical; min-height: 60px; max-height: 400px; transition: height 0.2s; }
14
+ .typing-indicator span {
15
+ animation: bounce 1.5s infinite ease-in-out;
16
+ display: inline-block;
17
+ }
18
+ .typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
19
+ .typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
20
+ @keyframes bounce {
21
+ 0%, 100% { transform: translateY(0); }
22
+ 50% { transform: translateY(-5px); }
23
+ }
24
+ .pulse {
25
+ animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
26
+ }
27
+ @keyframes pulse {
28
+ 0%, 100% { opacity: 1; }
29
+ 50% { opacity: 0.5; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  }
31
  </style>
32
  </head>
33
+ <body class="bg-gray-100 min-h-screen font-sans">
 
 
 
 
 
 
 
 
34
 
35
+ <div class="max-w-4xl mx-auto py-10 px-4">
36
+ <header class="text-center mb-6">
37
+ <div class="flex items-center justify-center gap-2">
38
+ <h1 class="text-4xl font-bold text-blue-600">⚡ Maverick-Chat</h1>
39
+ <span class="bg-green-100 text-green-800 text-xs font-medium px-2.5 py-0.5 rounded-full flex items-center gap-1">
40
+ <span class="relative flex h-2 w-2">
41
+ <span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"></span>
42
+ <span class="relative inline-flex rounded-full h-2 w-2 bg-green-500"></span>
43
+ </span>
44
+ Llama-4 17B
45
+ </span>
46
+ </div>
47
+ <p class="text-gray-600 mt-2">KI-Chat mit Llama-4 Maverick 17B (Deutsch)</p>
48
+ </header>
49
 
50
+ <div class="bg-white shadow-xl rounded-xl overflow-hidden">
51
+ <div id="chat-history" class="h-[500px] overflow-auto p-4 space-y-3">
52
+ <div class="chat-ai p-3 rounded">
53
+ <strong class="flex items-center gap-1">
54
+ <span class="bg-green-500 text-white rounded-full w-6 h-6 flex items-center justify-center">🤖</span>
55
+ Maverick:
56
+ </strong>
57
+ Willkommen beim Maverick-Chat! Ich bin ein fortschrittliches KI-Modell basierend auf Llama-4 Maverick 17B. Wie kann ich Ihnen helfen?
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  </div>
59
  </div>
60
 
61
+ <div id="typing-indicator" class="hidden px-4 pb-2">
62
+ <div class="chat-ai p-3 rounded">
63
+ <strong class="flex items-center gap-1">
64
+ <span class="bg-green-500 text-white rounded-full w-6 h-6 flex items-center justify-center">🤖</span>
65
+ Maverick:
66
+ </strong>
67
+ <span class="typing-indicator"><span>.</span><span>.</span><span>.</span></span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  </div>
69
  </div>
70
 
71
+ <form id="chat-form" class="p-3 bg-gray-50 border-t flex items-end gap-2">
72
+ <div class="relative flex-1">
73
+ <textarea id="input" placeholder="Nachricht eingeben..."
74
+ class="textarea-flex w-full border rounded-lg p-3 pr-10 focus:ring-2 focus:ring-blue-300 focus:border-blue-500"
75
+ oninput="adjustHeight(this)"></textarea>
76
+ <button type="button" id="clear-input" class="absolute right-2 bottom-3 text-gray-400 hover:text-gray-600">
77
+ <i class="fas fa-times"></i>
78
+ </button>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  </div>
80
+ <button type="submit" class="bg-blue-600 hover:bg-blue-700 text-white p-3 rounded-lg transition-colors flex items-center justify-center w-12 h-12">
81
+ <i class="fas fa-paper-plane"></i>
82
+ </button>
83
+ <button type="button" id="clear-btn" class="bg-gray-200 hover:bg-gray-300 text-gray-800 p-3 rounded-lg transition-colors flex items-center justify-center w-12 h-12">
84
+ <i class="fas fa-trash-alt"></i>
85
+ </button>
86
+ </form>
87
+ </div>
88
+
89
+ <div class="mt-4 text-center text-sm text-gray-500 flex items-center justify-center gap-2">
90
+ <i class="fas fa-info-circle"></i>
91
+ <p>Hinweis: Antworten können einige Sekunden dauern. Bitte haben Sie Geduld.</p>
92
  </div>
93
+ </div>
94
+
95
+ <script>
96
+ // Textarea height adjustment
97
+ function adjustHeight(el) {
98
+ el.style.height = "auto";
99
+ el.style.height = (el.scrollHeight) + "px";
100
+ }
101
 
102
+ // API call to Hugging Face Space
103
+ async function queryLlamaMaverick(prompt) {
104
+ const API_URL = "https://openfree-llama-4-maverick-17b-research.hf.space/api/predict";
105
+
106
+ try {
107
+ const response = await fetch(API_URL, {
108
+ method: "POST",
109
+ headers: {
110
+ "Content-Type": "application/json"
111
+ },
112
+ body: JSON.stringify({
113
+ data: [prompt]
114
+ }),
115
+ });
116
+
117
+ if (!response.ok) {
118
+ throw new Error(`API request failed with status ${response.status}`);
 
 
 
 
 
 
 
 
 
 
 
 
119
  }
120
 
121
+ const result = await response.json();
122
+
123
+ // The response structure might need adjustment based on the actual API response
124
+ if (result.data && result.data.length > 0) {
125
+ return result.data[0];
126
+ } else {
127
+ throw new Error("Unexpected API response format");
128
+ }
129
+
130
+ } catch (error) {
131
+ console.error("API Error:", error);
132
+ throw error;
133
+ }
134
+ }
135
 
136
+ // Send message function
137
+ async function sendMessage(message) {
138
+ const chatHistory = document.getElementById('chat-history');
139
+ const typingIndicator = document.getElementById('typing-indicator');
140
+ const submitBtn = document.querySelector('#chat-form button[type="submit"]');
141
+
142
+ // Disable submit button during request
143
+ submitBtn.disabled = true;
144
+ submitBtn.classList.add('opacity-50');
145
+
146
+ // Add user message
147
+ chatHistory.innerHTML += `<div class="chat-user p-3 rounded">
148
+ <strong class="flex items-center gap-1">
149
+ <span class="bg-blue-500 text-white rounded-full w-6 h-6 flex items-center justify-center">👤</span>
150
+ Du:
151
+ </strong>
152
+ ${message}
153
+ </div>`;
154
+
155
+ // Show typing indicator
156
+ typingIndicator.classList.remove('hidden');
157
+ chatHistory.scrollTop = chatHistory.scrollHeight;
158
+
159
+ try {
160
+ // Call the API
161
+ const response = await queryLlamaMaverick(message);
162
+
163
+ // Hide typing indicator and show response
164
+ typingIndicator.classList.add('hidden');
165
+ chatHistory.innerHTML += `<div class="chat-ai p-3 rounded">
166
+ <strong class="flex items-center gap-1">
167
+ <span class="bg-green-500 text-white rounded-full w-6 h-6 flex items-center justify-center">🤖</span>
168
+ Maverick:
169
+ </strong>
170
+ ${response || "Ich konnte keine Antwort generieren."}
171
+ </div>`;
172
+
173
+ } catch (error) {
174
+ console.error("Error:", error);
175
+ typingIndicator.classList.add('hidden');
176
+ chatHistory.innerHTML += `<div class="chat-error p-3 rounded">
177
+ <strong class="flex items-center gap-1">
178
+ <span class="bg-red-500 text-white rounded-full w-6 h-6 flex items-center justify-center">⚠️</span>
179
+ Fehler:
180
+ </strong>
181
+ Entschuldigung, es gab ein Problem bei der Verbindung zum KI-Modell. Bitte versuchen Sie es in einigen Minuten erneut.
182
+ <div class="text-xs mt-1 text-red-600">${error.message || 'Unbekannter Fehler'}</div>
183
+ </div>`;
184
+ } finally {
185
+ // Re-enable submit button
186
+ submitBtn.disabled = false;
187
+ submitBtn.classList.remove('opacity-50');
188
+ chatHistory.scrollTop = chatHistory.scrollHeight;
189
+ }
190
+ }
191
 
192
+ // Event listeners
193
+ window.addEventListener('DOMContentLoaded', () => {
194
+ const chatForm = document.getElementById('chat-form');
195
+ const inputEl = document.getElementById('input');
196
+ const clearInputBtn = document.getElementById('clear-input');
197
+ const clearBtn = document.getElementById('clear-btn');
198
+
199
+ // Form submission
200
+ chatForm.addEventListener('submit', (e) => {
201
+ e.preventDefault();
202
+ const message = inputEl.value.trim();
203
+ if (message) {
204
+ sendMessage(message);
205
+ inputEl.value = '';
206
+ adjustHeight(inputEl);
207
+ }
208
+ });
209
+
210
+ // Clear input button
211
+ clearInputBtn.addEventListener('click', () => {
212
+ inputEl.value = '';
213
+ adjustHeight(inputEl);
214
+ inputEl.focus();
215
+ });
216
+
217
+ // Clear chat button
218
+ clearBtn.addEventListener('click', () => {
219
+ if (confirm('Möchten Sie den gesamten Chatverlauf wirklich löschen?')) {
220
+ document.getElementById('chat-history').innerHTML = `<div class="chat-ai p-3 rounded">
221
+ <strong class="flex items-center gap-1">
222
+ <span class="bg-green-500 text-white rounded-full w-6 h-6 flex items-center justify-center">🤖</span>
223
+ Maverick:
224
+ </strong>
225
+ Willkommen beim Maverick-Chat! Ich bin ein fortschrittliches KI-Modell basierend auf Llama-4 Maverick 17B. Wie kann ich Ihnen helfen?
226
+ </div>`;
227
+ }
228
+ });
229
+
230
+ // Allow Shift+Enter for new lines, Enter to submit
231
+ inputEl.addEventListener('keydown', (e) => {
232
+ if (e.key === 'Enter' && !e.shiftKey) {
233
+ e.preventDefault();
234
+ chatForm.dispatchEvent(new Event('submit'));
235
+ }
236
+ });
237
+
238
+ // Focus input on page load
239
+ inputEl.focus();
240
+ });
241
+ </script>
242
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
243
  <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=h4sch/m-chat" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
244
  </html>