Spaces:
Running
Running
Commit ·
80e61b9
1
Parent(s): 6c0e5ab
commit 011
Browse files- src/App.js +3 -1
- src/components/ChatBox.css +5 -8
- src/components/ChatBox.jsx +8 -8
src/App.js
CHANGED
|
@@ -27,7 +27,9 @@ export default function App() {
|
|
| 27 |
botMsg.content += chunk;
|
| 28 |
setMessages((prev) => [...prev.slice(0, -1), { ...botMsg }]);
|
| 29 |
},
|
| 30 |
-
onDone: () => {
|
|
|
|
|
|
|
| 31 |
});
|
| 32 |
};
|
| 33 |
|
|
|
|
| 27 |
botMsg.content += chunk;
|
| 28 |
setMessages((prev) => [...prev.slice(0, -1), { ...botMsg }]);
|
| 29 |
},
|
| 30 |
+
onDone: () => {
|
| 31 |
+
setLoading(false);
|
| 32 |
+
},
|
| 33 |
});
|
| 34 |
};
|
| 35 |
|
src/components/ChatBox.css
CHANGED
|
@@ -1,14 +1,15 @@
|
|
| 1 |
.typing-indicator {
|
| 2 |
display: flex;
|
| 3 |
gap: 6px;
|
| 4 |
-
padding: 0.5rem
|
|
|
|
| 5 |
align-items: center;
|
| 6 |
}
|
| 7 |
|
| 8 |
.typing-indicator .dot {
|
| 9 |
width: 8px;
|
| 10 |
height: 8px;
|
| 11 |
-
background-color: #
|
| 12 |
border-radius: 50%;
|
| 13 |
animation: blink 1.4s infinite both;
|
| 14 |
}
|
|
@@ -21,10 +22,6 @@
|
|
| 21 |
}
|
| 22 |
|
| 23 |
@keyframes blink {
|
| 24 |
-
0%, 80%, 100% {
|
| 25 |
-
|
| 26 |
-
}
|
| 27 |
-
40% {
|
| 28 |
-
opacity: 1;
|
| 29 |
-
}
|
| 30 |
}
|
|
|
|
| 1 |
.typing-indicator {
|
| 2 |
display: flex;
|
| 3 |
gap: 6px;
|
| 4 |
+
padding: 0.5rem;
|
| 5 |
+
margin-left: 1rem;
|
| 6 |
align-items: center;
|
| 7 |
}
|
| 8 |
|
| 9 |
.typing-indicator .dot {
|
| 10 |
width: 8px;
|
| 11 |
height: 8px;
|
| 12 |
+
background-color: #ccc;
|
| 13 |
border-radius: 50%;
|
| 14 |
animation: blink 1.4s infinite both;
|
| 15 |
}
|
|
|
|
| 22 |
}
|
| 23 |
|
| 24 |
@keyframes blink {
|
| 25 |
+
0%, 80%, 100% { opacity: 0; }
|
| 26 |
+
40% { opacity: 1; }
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
}
|
src/components/ChatBox.jsx
CHANGED
|
@@ -15,14 +15,14 @@ export default function ChatBox({ messages, loading }) {
|
|
| 15 |
|
| 16 |
{/* ✅ Typing indicator when loading */}
|
| 17 |
{loading && (
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
</div>
|
| 27 |
);
|
| 28 |
}
|
|
|
|
| 15 |
|
| 16 |
{/* ✅ Typing indicator when loading */}
|
| 17 |
{loading && (
|
| 18 |
+
<div className="message assistant">
|
| 19 |
+
<div className="typing-indicator">
|
| 20 |
+
<span className="dot"></span>
|
| 21 |
+
<span className="dot"></span>
|
| 22 |
+
<span className="dot"></span>
|
| 23 |
+
</div>
|
| 24 |
+
</div>
|
| 25 |
+
)}
|
| 26 |
</div>
|
| 27 |
);
|
| 28 |
}
|