Skip to content

Commit

Permalink
fix: crash caused by filter config
Browse files Browse the repository at this point in the history
  • Loading branch information
Yidadaa committed Mar 30, 2023
1 parent 9fafd14 commit fc49b34
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/store/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ export function isValidNumber(x: number, min: number, max: number) {
return typeof x === "number" && x <= max && x >= min;
}

export function filterConfig(config: ModelConfig): Partial<ModelConfig> {
export function filterConfig(oldConfig: ModelConfig): Partial<ModelConfig> {
const config = Object.assign({}, oldConfig);

const validator: {
[k in keyof ModelConfig]: (x: ModelConfig[keyof ModelConfig]) => boolean;
} = {
Expand All @@ -103,7 +105,7 @@ export function filterConfig(config: ModelConfig): Partial<ModelConfig> {
return isValidNumber(x as number, -2, 2);
},
temperature(x) {
return isValidNumber(x as number, 0, 1);
return isValidNumber(x as number, 0, 2);
},
};

Expand Down

0 comments on commit fc49b34

Please sign in to comment.