Spaces:
Running
Running
Update index.html
Browse files- index.html +24 -23
index.html
CHANGED
|
@@ -238,16 +238,14 @@
|
|
| 238 |
#send-button-container::after {
|
| 239 |
content: '';
|
| 240 |
position: absolute;
|
|
|
|
|
|
|
| 241 |
left: 50%;
|
| 242 |
transform: translateX(-50%);
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
background: var(--eye-color);
|
| 246 |
-
border-radius: 4px;
|
| 247 |
-
box-shadow: 0 0 8px var(--eye-color), 0 0 16px var(--eye-color);
|
| 248 |
-
top: -20px;
|
| 249 |
opacity: 0;
|
| 250 |
-
animation: swipe
|
| 251 |
animation-delay: 1s;
|
| 252 |
}
|
| 253 |
|
|
@@ -256,11 +254,11 @@
|
|
| 256 |
display: none;
|
| 257 |
}
|
| 258 |
|
| 259 |
-
@keyframes swipe
|
| 260 |
-
0% { top:
|
| 261 |
40% { opacity: 0.7; }
|
| 262 |
-
80% { top:
|
| 263 |
-
100% {
|
| 264 |
}
|
| 265 |
|
| 266 |
|
|
@@ -437,7 +435,7 @@ class ChatInterface {
|
|
| 437 |
this.inputArea = document.getElementById('input-area');
|
| 438 |
this.sendButtonContainer = document.getElementById('send-button-container');
|
| 439 |
this.sendButton = document.getElementById('send-button');
|
| 440 |
-
this.isDragging = false; this.startY = 0; this.currentY = 0; this.dragThreshold =
|
| 441 |
this.API_URL = 'https://text.pollinations.ai/openai';
|
| 442 |
|
| 443 |
const SYSTEM_PROMPT = `
|
|
@@ -574,18 +572,21 @@ class ChatInterface {
|
|
| 574 |
return '';
|
| 575 |
});
|
| 576 |
|
|
|
|
| 577 |
let contentHtml = escapeHTML(processedText)
|
| 578 |
-
.replace(markdownLinkRegex, '<a href="$2" target="_blank">$1</a>')
|
| 579 |
-
|
| 580 |
-
|
| 581 |
-
|
| 582 |
-
|
| 583 |
-
|
| 584 |
-
|
| 585 |
-
|
| 586 |
-
<
|
| 587 |
-
</div
|
| 588 |
-
|
|
|
|
|
|
|
| 589 |
|
| 590 |
bubble.innerHTML = `
|
| 591 |
<div class="message-content">${contentHtml.trim()}</div>
|
|
|
|
| 238 |
#send-button-container::after {
|
| 239 |
content: '';
|
| 240 |
position: absolute;
|
| 241 |
+
width: 80px;
|
| 242 |
+
height: 80px;
|
| 243 |
left: 50%;
|
| 244 |
transform: translateX(-50%);
|
| 245 |
+
border-radius: 50%;
|
| 246 |
+
box-shadow: 0 0 15px var(--eye-color);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 247 |
opacity: 0;
|
| 248 |
+
animation: arc-swipe 2.5s ease-in-out infinite;
|
| 249 |
animation-delay: 1s;
|
| 250 |
}
|
| 251 |
|
|
|
|
| 254 |
display: none;
|
| 255 |
}
|
| 256 |
|
| 257 |
+
@keyframes arc-swipe {
|
| 258 |
+
0% { top: -40px; opacity: 0; }
|
| 259 |
40% { opacity: 0.7; }
|
| 260 |
+
80% { top: 40px; opacity: 0; }
|
| 261 |
+
100% { opacity: 0; }
|
| 262 |
}
|
| 263 |
|
| 264 |
|
|
|
|
| 435 |
this.inputArea = document.getElementById('input-area');
|
| 436 |
this.sendButtonContainer = document.getElementById('send-button-container');
|
| 437 |
this.sendButton = document.getElementById('send-button');
|
| 438 |
+
this.isDragging = false; this.startY = 0; this.currentY = 0; this.dragThreshold = 30; // اصلاح آستانه
|
| 439 |
this.API_URL = 'https://text.pollinations.ai/openai';
|
| 440 |
|
| 441 |
const SYSTEM_PROMPT = `
|
|
|
|
| 572 |
return '';
|
| 573 |
});
|
| 574 |
|
| 575 |
+
// First, escape all HTML, then process markdown.
|
| 576 |
let contentHtml = escapeHTML(processedText)
|
| 577 |
+
.replace(markdownLinkRegex, '<a href="$2" target="_blank">$1</a>');
|
| 578 |
+
|
| 579 |
+
// Since code blocks are special, we handle them separately to avoid double-escaping.
|
| 580 |
+
contentHtml = contentHtml.replace(codeBlockRegex, (match, lang, code) => {
|
| 581 |
+
const uniqueId = `code-${Date.now()}-${Math.random()}`;
|
| 582 |
+
// The code inside is already escaped from the main escapeHTML call.
|
| 583 |
+
return `<div class="code-block-wrapper">
|
| 584 |
+
<div class="code-block-header">
|
| 585 |
+
<button class="copy-code-btn" data-target="${uniqueId}">کپی</button>
|
| 586 |
+
</div>
|
| 587 |
+
<pre><code id="${uniqueId}">${code.trim()}</code></pre>
|
| 588 |
+
</div>`;
|
| 589 |
+
});
|
| 590 |
|
| 591 |
bubble.innerHTML = `
|
| 592 |
<div class="message-content">${contentHtml.trim()}</div>
|