Skip to content

Commit 294159c

Browse files
handled rate limit error frontend
1 parent a297572 commit 294159c

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ const Chat: React.FC<ChatProps> = ({
7373
payload: true,
7474
});
7575

76-
if ((reqType !== 'graph' && reqType !== 'error') && isCharthDisplayDefault){
76+
if (((reqType !== 'graph' && reqType !== 'error') || messages[messages.length - 1].role !== ERROR) && isCharthDisplayDefault ){
77+
7778
setIsChartLoading(true);
7879
setTimeout(()=>{
7980
makeApiRequestForChart('show in a graph by default', convId, messages[messages.length - 1].content as string)
@@ -267,7 +268,7 @@ const Chat: React.FC<ChatProps> = ({
267268
const errorMsg = JSON.parse(runningText).error;
268269
const errorMessage: ChatMessage = {
269270
id: generateUUIDv4(),
270-
role: ASSISTANT,
271+
role: ERROR,
271272
content: errorMsg,
272273
date: new Date().toISOString(),
273274
};
@@ -332,7 +333,7 @@ const Chat: React.FC<ChatProps> = ({
332333
parsedChartResponse?.object?.message;
333334
const errorMessage: ChatMessage = {
334335
id: generateUUIDv4(),
335-
role: ASSISTANT,
336+
role: ERROR,
336337
content: errorMsg,
337338
date: new Date().toISOString(),
338339
};
@@ -546,7 +547,7 @@ const Chat: React.FC<ChatProps> = ({
546547

547548
const errorMessage: ChatMessage = {
548549
id: generateUUIDv4(),
549-
role: ASSISTANT,
550+
role: ERROR,
550551
content: errorMsg,
551552
date: new Date().toISOString(),
552553
};
@@ -612,7 +613,7 @@ const Chat: React.FC<ChatProps> = ({
612613
parsedChartResponse?.object?.message;
613614
const errorMessage: ChatMessage = {
614615
id: generateUUIDv4(),
615-
role: ASSISTANT,
616+
role: ERROR,
616617
content: errorMsg,
617618
date: new Date().toISOString(),
618619
};

0 commit comments

Comments
 (0)