Kaynağa Gözat

fix: crash caused by filter config

Yifei Zhang 1 yıl önce
ebeveyn
işleme
dea3d26335
1 değiştirilmiş dosya ile 4 ekleme ve 2 silme
  1. 4 2
      app/store/app.ts

+ 4 - 2
app/store/app.ts

@@ -89,7 +89,9 @@ export function isValidNumber(x: number, min: number, max: number) {
   return typeof x === "number" && x <= max && x >= min;
   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: {
   const validator: {
     [k in keyof ModelConfig]: (x: ModelConfig[keyof ModelConfig]) => boolean;
     [k in keyof ModelConfig]: (x: ModelConfig[keyof ModelConfig]) => boolean;
   } = {
   } = {
@@ -103,7 +105,7 @@ export function filterConfig(config: ModelConfig): Partial<ModelConfig> {
       return isValidNumber(x as number, -2, 2);
       return isValidNumber(x as number, -2, 2);
     },
     },
     temperature(x) {
     temperature(x) {
-      return isValidNumber(x as number, 0, 1);
+      return isValidNumber(x as number, 0, 2);
     },
     },
   };
   };