Skip to content

Commit

Permalink
feat: suppress 503s and set timeout to 25 seconds (#228)
Browse files Browse the repository at this point in the history
  • Loading branch information
vtsaplin committed Mar 18, 2024
1 parent ba94f71 commit 2b9bf1f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion actions/FirefallClient.js
Expand Up @@ -19,7 +19,7 @@ const ERROR_CODES = {
defaultCompletion: 'An error occurred while generating results',
defaultFeedback: 'An error occurred while sending feedback',
400: "The response was filtered due to the prompt triggering Generative AI's content management policy. Please modify your prompt and retry.",
408: "Generative AI's request timed out. Please try again.",
408: "Generative AI's request timed out. Please try again by reducing the number of variations.",
429: "Generative AI's Rate limit exceeded. Please wait one minute and try again.",
};

Expand Down
2 changes: 1 addition & 1 deletion actions/Network.js
Expand Up @@ -17,7 +17,7 @@ const { Core } = require('@adobe/aio-sdk');

const logger = Core.Logger('FirefallAction');

const REQUEST_TIMEOUT = 55 * 1000;
const REQUEST_TIMEOUT = 25 * 1000;

function createWretchError(status, message) {
const error = new WretchError();
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "aem-genai-assistant",
"version": "2.0.1",
"version": "2.0.2",
"private": true,
"scripts": {
"prepare": "husky install",
Expand Down
1 change: 1 addition & 0 deletions web-src/src/helpers/NetworkHelper.js
Expand Up @@ -30,6 +30,7 @@ function wretchWithOptions(url) {
.notFound((err) => unwrapError(err))
.timeout((err) => unwrapError(err))
.internalError((err) => unwrapError(err))
.error(503, (err) => unwrapError(err))
.fetchError((err) => unwrapError(err));
});
}
Expand Down

0 comments on commit 2b9bf1f

Please sign in to comment.