Skip to content

Commit 264a141

Browse files
fix: Chat History Fails to Save After Receiving Error (e.g., Rate Limit Error), Even When Valid Response is Received Afterwards
2 parents 6987297 + fbf05f4 commit 264a141

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/App/src/components/Chat/Chat.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ const Chat: React.FC<ChatProps> = ({
642642
];
643643
}
644644
}
645-
if (!updatedMessages.find((msg: any) => msg.role=== "error")) {
645+
if (updatedMessages[updatedMessages.length-1]?.role !== "error") {
646646
saveToDB(updatedMessages, conversationId, isChatReq);
647647
}
648648
} catch (e) {

0 commit comments

Comments
 (0)