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

Add 2 files

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +338 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: M Chat
3
- emoji:
4
- colorFrom: indigo
5
- colorTo: blue
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: m-chat
3
+ emoji: 🐳
4
+ colorFrom: green
5
+ colorTo: pink
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,338 @@
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
+
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>