Skip to content

Commit

Permalink
undefined check on value as treating value:0 as bad request
Browse files Browse the repository at this point in the history
  • Loading branch information
heatherlogan-scottlogic committed Jan 3, 2024
1 parent c173f7d commit d3a6391
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion backend/src/controller/modelController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function handleConfigureModel(req: OpenAiConfigureModelRequest, res: Response) {
const configId = req.body.configId as MODEL_CONFIG | undefined;
const value = req.body.value;

if (configId && value && value >= 0) {
if (configId && value !== undefined) {
const lastConfig = req.session.chatModel.configuration;
const maxValue = configId === MODEL_CONFIG.TOP_P ? 1 : 2;
const updatedConfig = updateConfigProperty(
Expand All @@ -51,6 +51,8 @@ function handleConfigureModel(req: OpenAiConfigureModelRequest, res: Response) {
} else {
res.status(400).send();
}
} else {
res.status(400).send();
}
}

Expand Down

0 comments on commit d3a6391

Please sign in to comment.