chore: ai assistant limit error (#619)

This commit is contained in:
Aaryan Khandelwal 2023-03-30 18:45:33 +05:30 committed by GitHub
parent 70a00a6309
commit bc7dc43171
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -91,6 +91,21 @@ export const GptAssistantModal: React.FC<Props> = ({
if (res.response === "") setInvalidResponse(true);
else setInvalidResponse(false);
})
.catch((err) => {
if (err.status === 429)
setToastAlert({
type: "error",
title: "Error!",
message:
"You have reached the maximum number of requests of 50 requests per month per user.",
});
else
setToastAlert({
type: "error",
title: "Error!",
message: "Some error occurred. Please try again.",
});
});
};

View File

@ -18,7 +18,7 @@ class AiServices extends APIService {
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/ai-assistant/`, data)
.then((response) => response?.data)
.catch((error) => {
throw error?.response?.data;
throw error?.response;
});
}
}