Update sss.html
Browse files
sss.html
CHANGED
|
@@ -67,6 +67,42 @@
|
|
| 67 |
background-color: #404040;
|
| 68 |
}
|
| 69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
/* Code Block Styles */
|
| 71 |
pre[class*="language-"] {
|
| 72 |
direction: ltr;
|
|
@@ -246,7 +282,7 @@
|
|
| 246 |
</footer>
|
| 247 |
|
| 248 |
<script>
|
| 249 |
-
const API_URL = 'https://nvgsxt9jqx730v-7777.proxy.runpod.net/proxy/8000/chat
|
| 250 |
const messagesContainer = document.getElementById('messagesContainer');
|
| 251 |
const messageInput = document.getElementById('messageInput');
|
| 252 |
const sendButton = document.getElementById('sendMessage');
|
|
@@ -257,15 +293,15 @@
|
|
| 257 |
let currentStyle = 'normal';
|
| 258 |
let currentController = null;
|
| 259 |
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
}
|
| 269 |
|
| 270 |
function createUserMessage(text) {
|
| 271 |
return `
|
|
@@ -331,33 +367,32 @@
|
|
| 331 |
|
| 332 |
async function typeText(elementId, text) {
|
| 333 |
const element = document.getElementById(elementId);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 334 |
element.innerHTML = '';
|
| 335 |
|
| 336 |
-
// Check if text contains code blocks
|
| 337 |
const codeBlockRegex = /```(\w+)\n([\s\S]+?)```/g;
|
| 338 |
let lastIndex = 0;
|
| 339 |
let match;
|
| 340 |
|
| 341 |
while ((match = codeBlockRegex.exec(text)) !== null) {
|
| 342 |
-
// Add text before code block
|
| 343 |
const beforeText = text.slice(lastIndex, match.index);
|
| 344 |
if (beforeText) {
|
| 345 |
await addTextWithEditor(element, beforeText);
|
| 346 |
}
|
| 347 |
|
| 348 |
-
// Add code block
|
| 349 |
const [, language, code] = match;
|
| 350 |
element.innerHTML += formatCodeBlock(code.trim(), language);
|
| 351 |
lastIndex = match.index + match[0].length;
|
| 352 |
}
|
| 353 |
|
| 354 |
-
// Add remaining text
|
| 355 |
const remainingText = text.slice(lastIndex);
|
| 356 |
if (remainingText) {
|
| 357 |
await addTextWithEditor(element, remainingText);
|
| 358 |
}
|
| 359 |
|
| 360 |
-
// Initialize Prism.js
|
| 361 |
Prism.highlightAllUnder(element);
|
| 362 |
}
|
| 363 |
|
|
@@ -379,7 +414,6 @@
|
|
| 379 |
element.appendChild(textWrapper);
|
| 380 |
element.appendChild(editorWrapper);
|
| 381 |
|
| 382 |
-
// Initialize TinyMCE for this textarea
|
| 383 |
tinymce.init({
|
| 384 |
selector: '.tinymce-editor:last',
|
| 385 |
directionality: 'rtl',
|
|
@@ -421,6 +455,11 @@
|
|
| 421 |
|
| 422 |
messagesContainer.insertAdjacentHTML('beforeend', createUserMessage(message));
|
| 423 |
messagesContainer.insertAdjacentHTML('beforeend', createBotMessage('', messageId));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 424 |
scrollToBottom();
|
| 425 |
|
| 426 |
try {
|
|
|
|
| 67 |
background-color: #404040;
|
| 68 |
}
|
| 69 |
|
| 70 |
+
/* Typing Indicator Styles */
|
| 71 |
+
.typing-indicator {
|
| 72 |
+
display: flex;
|
| 73 |
+
align-items: center;
|
| 74 |
+
padding: 0.5rem 1rem;
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
.typing-indicator span {
|
| 78 |
+
height: 8px;
|
| 79 |
+
width: 8px;
|
| 80 |
+
margin: 0 1px;
|
| 81 |
+
background-color: #6366f1;
|
| 82 |
+
display: inline-block;
|
| 83 |
+
border-radius: 50%;
|
| 84 |
+
opacity: 0.4;
|
| 85 |
+
animation: typing 1s infinite ease-in-out;
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
.typing-indicator span:nth-child(1) {
|
| 89 |
+
animation-delay: 200ms;
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
.typing-indicator span:nth-child(2) {
|
| 93 |
+
animation-delay: 300ms;
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
.typing-indicator span:nth-child(3) {
|
| 97 |
+
animation-delay: 400ms;
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
@keyframes typing {
|
| 101 |
+
0% { transform: translateY(0px); opacity: 0.4; }
|
| 102 |
+
50% { transform: translateY(-5px); opacity: 0.8; }
|
| 103 |
+
100% { transform: translateY(0px); opacity: 0.4; }
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
/* Code Block Styles */
|
| 107 |
pre[class*="language-"] {
|
| 108 |
direction: ltr;
|
|
|
|
| 282 |
</footer>
|
| 283 |
|
| 284 |
<script>
|
| 285 |
+
const API_URL = 'https://nvgsxt9jqx730v-7777.proxy.runpod.net/proxy/8000/chat';
|
| 286 |
const messagesContainer = document.getElementById('messagesContainer');
|
| 287 |
const messageInput = document.getElementById('messageInput');
|
| 288 |
const sendButton = document.getElementById('sendMessage');
|
|
|
|
| 293 |
let currentStyle = 'normal';
|
| 294 |
let currentController = null;
|
| 295 |
|
| 296 |
+
function createTypingIndicator() {
|
| 297 |
+
return `
|
| 298 |
+
<div class="typing-indicator">
|
| 299 |
+
<span></span>
|
| 300 |
+
<span></span>
|
| 301 |
+
<span></span>
|
| 302 |
+
</div>
|
| 303 |
+
`;
|
| 304 |
+
}
|
| 305 |
|
| 306 |
function createUserMessage(text) {
|
| 307 |
return `
|
|
|
|
| 367 |
|
| 368 |
async function typeText(elementId, text) {
|
| 369 |
const element = document.getElementById(elementId);
|
| 370 |
+
const typingIndicator = element.querySelector('.typing-indicator');
|
| 371 |
+
if (typingIndicator) {
|
| 372 |
+
typingIndicator.remove();
|
| 373 |
+
}
|
| 374 |
element.innerHTML = '';
|
| 375 |
|
|
|
|
| 376 |
const codeBlockRegex = /```(\w+)\n([\s\S]+?)```/g;
|
| 377 |
let lastIndex = 0;
|
| 378 |
let match;
|
| 379 |
|
| 380 |
while ((match = codeBlockRegex.exec(text)) !== null) {
|
|
|
|
| 381 |
const beforeText = text.slice(lastIndex, match.index);
|
| 382 |
if (beforeText) {
|
| 383 |
await addTextWithEditor(element, beforeText);
|
| 384 |
}
|
| 385 |
|
|
|
|
| 386 |
const [, language, code] = match;
|
| 387 |
element.innerHTML += formatCodeBlock(code.trim(), language);
|
| 388 |
lastIndex = match.index + match[0].length;
|
| 389 |
}
|
| 390 |
|
|
|
|
| 391 |
const remainingText = text.slice(lastIndex);
|
| 392 |
if (remainingText) {
|
| 393 |
await addTextWithEditor(element, remainingText);
|
| 394 |
}
|
| 395 |
|
|
|
|
| 396 |
Prism.highlightAllUnder(element);
|
| 397 |
}
|
| 398 |
|
|
|
|
| 414 |
element.appendChild(textWrapper);
|
| 415 |
element.appendChild(editorWrapper);
|
| 416 |
|
|
|
|
| 417 |
tinymce.init({
|
| 418 |
selector: '.tinymce-editor:last',
|
| 419 |
directionality: 'rtl',
|
|
|
|
| 455 |
|
| 456 |
messagesContainer.insertAdjacentHTML('beforeend', createUserMessage(message));
|
| 457 |
messagesContainer.insertAdjacentHTML('beforeend', createBotMessage('', messageId));
|
| 458 |
+
|
| 459 |
+
// Add typing indicator
|
| 460 |
+
const messageElement = document.getElementById(messageId);
|
| 461 |
+
messageElement.innerHTML = createTypingIndicator();
|
| 462 |
+
|
| 463 |
scrollToBottom();
|
| 464 |
|
| 465 |
try {
|