From 6589578b3b8d93c03d4f776bf785c0a7143aa306 Mon Sep 17 00:00:00 2001 From: Mihovil Ilakovac Date: Thu, 2 Nov 2023 12:58:44 +0100 Subject: [PATCH 1/2] Fixes timeouts for Mage Signed-off-by: Mihovil Ilakovac --- wasp-ai/Dockerfile | 2 +- wasp-ai/src/server/jobs/failStaleGenerations.ts | 3 +-- waspc/src/Wasp/AI/OpenAI/ChatGPT.hs | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/wasp-ai/Dockerfile b/wasp-ai/Dockerfile index e843cf6dd2..1912eb7e41 100644 --- a/wasp-ai/Dockerfile +++ b/wasp-ai/Dockerfile @@ -33,7 +33,7 @@ RUN cd server && PRISMA_CLIENT_OUTPUT_DIR=../server/node_modules/.prisma/client/ RUN cd server && npm run build FROM base AS server-production -RUN curl -sSL https://get.wasp-lang.dev/installer.sh | sh -s -- -v 0.11.1-wasp-ai-11 +RUN curl -sSL https://get.wasp-lang.dev/installer.sh | sh -s -- -v 0.11.1-wasp-ai-12 ENV PATH "$PATH:/root/.local/bin" ENV NODE_ENV production WORKDIR /app diff --git a/wasp-ai/src/server/jobs/failStaleGenerations.ts b/wasp-ai/src/server/jobs/failStaleGenerations.ts index 0c31a532a5..18cd14edad 100644 --- a/wasp-ai/src/server/jobs/failStaleGenerations.ts +++ b/wasp-ai/src/server/jobs/failStaleGenerations.ts @@ -8,12 +8,11 @@ export const failStaleGenerations: FailStaleAppsJobs< success: boolean; } > = async (_args, context) => { - // If a generation has been in progress for > 5 minutes, it fails it log("Failing stale generations"); const { Project, Log } = context.entities; const now = getNowInUTC(); - const fiveMinutesAgo = new Date(now.getTime() - 5 * 60 * 1000); + const fiveMinutesAgo = new Date(now.getTime() - 10 * 60 * 1000); try { const staleProjects = await Project.findMany({ diff --git a/waspc/src/Wasp/AI/OpenAI/ChatGPT.hs b/waspc/src/Wasp/AI/OpenAI/ChatGPT.hs index 83d8f9c506..fa50898bb3 100644 --- a/waspc/src/Wasp/AI/OpenAI/ChatGPT.hs +++ b/waspc/src/Wasp/AI/OpenAI/ChatGPT.hs @@ -44,7 +44,7 @@ queryChatGPT apiKey params requestMessages = do request = -- 90 seconds should be more than enough for ChatGPT to generate an answer, or reach its own timeout. -- If it proves in the future that it might need more time, we can increase this number. - HTTP.setRequestResponseTimeout (HTTP.C.responseTimeoutMicro $ Util.secondsToMicroSeconds 90) $ + HTTP.setRequestResponseTimeout (HTTP.C.responseTimeoutMicro $ Util.secondsToMicroSeconds 300) $ HTTP.setRequestHeader "Authorization" [BSU.fromString $ "Bearer " <> apiKey] $ HTTP.setRequestBodyJSON reqBodyJson $ HTTP.parseRequest_ "POST https://api.openai.com/v1/chat/completions" From cae115bf04dc2356e7cb7a0b4e87a134da2a3c33 Mon Sep 17 00:00:00 2001 From: Mihovil Ilakovac Date: Thu, 2 Nov 2023 13:01:17 +0100 Subject: [PATCH 2/2] Updates version --- wasp-ai/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wasp-ai/Dockerfile b/wasp-ai/Dockerfile index 1912eb7e41..a86db7263c 100644 --- a/wasp-ai/Dockerfile +++ b/wasp-ai/Dockerfile @@ -33,7 +33,7 @@ RUN cd server && PRISMA_CLIENT_OUTPUT_DIR=../server/node_modules/.prisma/client/ RUN cd server && npm run build FROM base AS server-production -RUN curl -sSL https://get.wasp-lang.dev/installer.sh | sh -s -- -v 0.11.1-wasp-ai-12 +RUN curl -sSL https://get.wasp-lang.dev/installer.sh | sh -s -- -v 0.11.4-wasp-ai-12 ENV PATH "$PATH:/root/.local/bin" ENV NODE_ENV production WORKDIR /app