Skip to content

Commit

Permalink
fix validator lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
mjh1 committed Oct 2, 2024
1 parent 110d060 commit 67382a8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/api/src/controllers/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { BadRequestError } from "../store/errors";
import { fetchWithTimeout, kebabToCamel } from "../util";
import { experimentSubjectsOnly } from "./experiment";
import { pathJoin2 } from "./helpers";
import validators from "../schema/validators";

const AI_GATEWAY_TIMEOUT = 10 * 60 * 1000; // 10 minutes
const RATE_LIMIT_WINDOW = 60 * 1000; // 1 minute
Expand Down Expand Up @@ -181,6 +182,9 @@ function registerGenerateHandler(
if (isJSONReq) {
payloadParsers = [validatePost(`${camelType}Params`)];
} else {
if (!validators[`Body_gen${camelType}`]) {
camelType = type.toUpperCase();
}
payloadParsers = [
multipart.any(),
validateFormData(`Body_gen${camelType}`),
Expand Down

0 comments on commit 67382a8

Please sign in to comment.