Add 1 files
Browse files- 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
|
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-
|
13 |
-
|
14 |
-
|
15 |
-
}
|
16 |
-
.
|
17 |
-
|
18 |
-
|
19 |
-
}
|
20 |
-
.typing-indicator
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
}
|
29 |
-
|
30 |
-
|
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="
|
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 |
-
|
94 |
-
|
95 |
-
|
96 |
-
<
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
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 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
</
|
150 |
-
<
|
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 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
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 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
237 |
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
281 |
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
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>
|