Skip to content

Commit 7f38d7f

Browse files
Update MessageBox.tsx
1 parent f72d3d4 commit 7f38d7f

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

app/classrooms/[classroomId]/chat/MessageBox.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
import { ChatMessageList } from "@shared/components/ui/chat/chat-message-list";
99
import { ChatInput } from "@shared/components/ui/chat/chat-input";
1010
import { Button } from "@/shared/components/ui/button";
11-
1211
import {
1312
ChatClientWithSession,
1413
RagFlowMessage,
@@ -35,7 +34,6 @@ export default function MessageBox({
3534
messageHistory || []
3635
);
3736
const [isLoading, setIsLoading] = useState(false);
38-
const [isMessageSent, setIsMessageSent] = useState(false); // New state for tracking message sent
3937

4038
function cleanMessage(content: string): string {
4139
return content.replace(/##\d+\$\$/g, "").trim();
@@ -48,7 +46,6 @@ export default function MessageBox({
4846
setMessages((prev) => [...prev, userMessage]);
4947
setValue("");
5048
setIsLoading(true);
51-
setIsMessageSent(true);
5249
const response = await sendMessage(chatClient, value);
5350
setIsLoading(false);
5451

@@ -65,8 +62,6 @@ export default function MessageBox({
6562
content: response.response,
6663
};
6764
setMessages((prev) => [...prev, assistantMessage]);
68-
69-
setIsMessageSent(false);
7065
}
7166

7267
return (
@@ -75,7 +70,7 @@ export default function MessageBox({
7570
className={"size-24 place-self-center stroke-black stroke-[10px]"}
7671
/>
7772

78-
<AutoScroll isMessageSent={isMessageSent}>
73+
<AutoScroll messages={messages}>
7974
<ChatMessageList smooth>
8075
{messages.map((msg, index) => (
8176
<ChatBubble

0 commit comments

Comments
 (0)