Skip to content

Commit

Permalink
Fixes timeouts for Mage
Browse files Browse the repository at this point in the history
Signed-off-by: Mihovil Ilakovac <[email protected]>
  • Loading branch information
infomiho committed Nov 2, 2023
1 parent 3c45043 commit 6589578
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion wasp-ai/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions wasp-ai/src/server/jobs/failStaleGenerations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
2 changes: 1 addition & 1 deletion waspc/src/Wasp/AI/OpenAI/ChatGPT.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 6589578

Please sign in to comment.