Spaces:
Sleeping
Sleeping
thinking animation
Browse files- src/App.css +39 -0
- src/App.js +13 -1
src/App.css
CHANGED
|
@@ -486,3 +486,42 @@ body, html, #root {
|
|
| 486 |
to { transform: rotate(360deg); }
|
| 487 |
}
|
| 488 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 486 |
to { transform: rotate(360deg); }
|
| 487 |
}
|
| 488 |
|
| 489 |
+
.thinking-dots {
|
| 490 |
+
display: flex;
|
| 491 |
+
align-items: center;
|
| 492 |
+
justify-content: flex-start;
|
| 493 |
+
gap: 6px;
|
| 494 |
+
padding: 12px 0;
|
| 495 |
+
}
|
| 496 |
+
|
| 497 |
+
.thinking-dots span {
|
| 498 |
+
display: inline-block;
|
| 499 |
+
width: 8px;
|
| 500 |
+
height: 8px;
|
| 501 |
+
background-color: #818cf8;
|
| 502 |
+
border-radius: 50%;
|
| 503 |
+
animation: thinking-pulse 1.4s ease-in-out infinite;
|
| 504 |
+
}
|
| 505 |
+
|
| 506 |
+
.thinking-dots span:nth-child(1) {
|
| 507 |
+
animation-delay: 0s;
|
| 508 |
+
}
|
| 509 |
+
|
| 510 |
+
.thinking-dots span:nth-child(2) {
|
| 511 |
+
animation-delay: 0.2s;
|
| 512 |
+
}
|
| 513 |
+
|
| 514 |
+
.thinking-dots span:nth-child(3) {
|
| 515 |
+
animation-delay: 0.4s;
|
| 516 |
+
}
|
| 517 |
+
|
| 518 |
+
@keyframes thinking-pulse {
|
| 519 |
+
0%, 80%, 100% {
|
| 520 |
+
opacity: 0.3;
|
| 521 |
+
transform: scale(0.8);
|
| 522 |
+
}
|
| 523 |
+
40% {
|
| 524 |
+
opacity: 1;
|
| 525 |
+
transform: scale(1.2);
|
| 526 |
+
}
|
| 527 |
+
}
|
src/App.js
CHANGED
|
@@ -1001,6 +1001,9 @@ function Message({ message }) {
|
|
| 1001 |
.replace(/```/g, "")
|
| 1002 |
.trim();
|
| 1003 |
}, []);
|
|
|
|
|
|
|
|
|
|
| 1004 |
const displayText = React.useMemo(() => {
|
| 1005 |
const raw = typeof message.text === "string" ? message.text : "";
|
| 1006 |
return raw;
|
|
@@ -1014,7 +1017,15 @@ function Message({ message }) {
|
|
| 1014 |
return (
|
| 1015 |
<div className={`message ${isUser ? "user" : "assistant"}`}>
|
| 1016 |
<div className="bubble">
|
| 1017 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1018 |
className="markdown-body"
|
| 1019 |
remarkPlugins={[remarkMath, remarkGfm]}
|
| 1020 |
rehypePlugins={[[rehypeKatex, { strict: "ignore", throwOnError: false, trust: true }]]}
|
|
@@ -1023,6 +1034,7 @@ function Message({ message }) {
|
|
| 1023 |
>
|
| 1024 |
{normalizedText}
|
| 1025 |
</ReactMarkdown>
|
|
|
|
| 1026 |
</div>
|
| 1027 |
{!isUser && message.debug && (
|
| 1028 |
<>
|
|
|
|
| 1001 |
.replace(/```/g, "")
|
| 1002 |
.trim();
|
| 1003 |
}, []);
|
| 1004 |
+
|
| 1005 |
+
const isThinking = !isUser && message.thinking && (!message.text || !message.text.trim());
|
| 1006 |
+
|
| 1007 |
const displayText = React.useMemo(() => {
|
| 1008 |
const raw = typeof message.text === "string" ? message.text : "";
|
| 1009 |
return raw;
|
|
|
|
| 1017 |
return (
|
| 1018 |
<div className={`message ${isUser ? "user" : "assistant"}`}>
|
| 1019 |
<div className="bubble">
|
| 1020 |
+
{isThinking && (
|
| 1021 |
+
<div className="thinking-dots">
|
| 1022 |
+
<span></span>
|
| 1023 |
+
<span></span>
|
| 1024 |
+
<span></span>
|
| 1025 |
+
</div>
|
| 1026 |
+
)}
|
| 1027 |
+
{!isThinking && (
|
| 1028 |
+
<ReactMarkdown
|
| 1029 |
className="markdown-body"
|
| 1030 |
remarkPlugins={[remarkMath, remarkGfm]}
|
| 1031 |
rehypePlugins={[[rehypeKatex, { strict: "ignore", throwOnError: false, trust: true }]]}
|
|
|
|
| 1034 |
>
|
| 1035 |
{normalizedText}
|
| 1036 |
</ReactMarkdown>
|
| 1037 |
+
)}
|
| 1038 |
</div>
|
| 1039 |
{!isUser && message.debug && (
|
| 1040 |
<>
|