mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fix: displaying API error for AI response (#1677)
This commit is contained in:
parent
0e352b7bcb
commit
0b86080166
@ -117,18 +117,21 @@ export const GptAssistantModal: React.FC<Props> = ({
|
|||||||
else setInvalidResponse(false);
|
else setInvalidResponse(false);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
const error = err?.data?.error;
|
||||||
|
|
||||||
if (err.status === 429)
|
if (err.status === 429)
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
type: "error",
|
type: "error",
|
||||||
title: "Error!",
|
title: "Error!",
|
||||||
message:
|
message:
|
||||||
|
error ||
|
||||||
"You have reached the maximum number of requests of 50 requests per month per user.",
|
"You have reached the maximum number of requests of 50 requests per month per user.",
|
||||||
});
|
});
|
||||||
else
|
else
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
type: "error",
|
type: "error",
|
||||||
title: "Error!",
|
title: "Error!",
|
||||||
message: "Some error occurred. Please try again.",
|
message: error || "Some error occurred. Please try again.",
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -202,18 +202,21 @@ export const IssueForm: FC<IssueFormProps> = ({
|
|||||||
else handleAiAssistance(res.response_html);
|
else handleAiAssistance(res.response_html);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
const error = err?.data?.error;
|
||||||
|
|
||||||
if (err.status === 429)
|
if (err.status === 429)
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
type: "error",
|
type: "error",
|
||||||
title: "Error!",
|
title: "Error!",
|
||||||
message:
|
message:
|
||||||
|
error ||
|
||||||
"You have reached the maximum number of requests of 50 requests per month per user.",
|
"You have reached the maximum number of requests of 50 requests per month per user.",
|
||||||
});
|
});
|
||||||
else
|
else
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
type: "error",
|
type: "error",
|
||||||
title: "Error!",
|
title: "Error!",
|
||||||
message: "Some error occurred. Please try again.",
|
message: error || "Some error occurred. Please try again.",
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.finally(() => setIAmFeelingLucky(false));
|
.finally(() => setIAmFeelingLucky(false));
|
||||||
|
Loading…
Reference in New Issue
Block a user