Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { Question } from "@/behavioral-checker/data/questions";
import { extractJsonFromString } from "@/lib/utils";
import {
OPENAI_MAX_RETRIES,
OPENAI_TIMEOUT_MS,
} from "@/behavioral-checker/constants";
import OpenAI from "openai";
import { ChatCompletionSystemMessageParam } from "openai/resources/index.mjs";
import { AIClient } from "../core/domain/AIClient";
Expand All @@ -18,6 +22,8 @@ export class OpenAISdkAIClient implements AIClient {
constructor() {
this.client = new OpenAI({
apiKey: process.env.OPENAI_API_KEY,
timeout: OPENAI_TIMEOUT_MS,
maxRetries: OPENAI_MAX_RETRIES,
});
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import fs from "fs";
import {
OPENAI_MAX_RETRIES,
OPENAI_TIMEOUT_MS,
} from "@/behavioral-checker/constants";
import OpenAI from "openai";
import path from "path";
import { STTClient } from "../core/domain/STTClient";
Expand All @@ -9,6 +13,8 @@ export class OpenAISdkSTTSClient implements STTClient {
constructor() {
this.client = new OpenAI({
apiKey: process.env.OPENAI_API_KEY,
timeout: OPENAI_TIMEOUT_MS,
maxRetries: OPENAI_MAX_RETRIES,
});
}

Expand Down
2 changes: 2 additions & 0 deletions src/behavioral-checker/constants.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
export const NAME = "Behavioral Checker";
export const GITHUB_URL = "https://github.com/silver-dev-org/open-silver";
export const OPENAI_TIMEOUT_MS = 20_000;
export const OPENAI_MAX_RETRIES = 1;
1 change: 1 addition & 0 deletions src/pages/api/analysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ const multerMiddleware = (req: any, res: any, log: RouteLog, next: any) =>
});

export const config = {
maxDuration: 120,
api: {
bodyParser: false,
},
Expand Down
Loading