Parcourir la source

fix(variables): NoneVariable should inherit from NoneSegment. (#6584)

-LAN- il y a 9 mois
Parent
commit
85a883e281
2 fichiers modifiés avec 7 ajouts et 14 suppressions
  1. 4 11
      api/core/app/segments/types.py
  2. 3 3
      api/core/app/segments/variables.py

+ 4 - 11
api/core/app/segments/types.py

@@ -2,17 +2,10 @@ from enum import Enum
 
 
 class SegmentType(str, Enum):
-    STRING = 'string'
+    NONE = 'none'
     NUMBER = 'number'
-    FILE = 'file'
-
+    STRING = 'string'
     SECRET = 'secret'
-
-    OBJECT = 'object'
-
     ARRAY = 'array'
-    ARRAY_STRING = 'array[string]'
-    ARRAY_NUMBER = 'array[number]'
-    ARRAY_OBJECT = 'array[object]'
-    ARRAY_FILE = 'array[file]'
-    NONE = 'none'
+    OBJECT = 'object'
+    FILE = 'file'

+ 3 - 3
api/core/app/segments/variables.py

@@ -6,7 +6,7 @@ from pydantic import Field
 from core.file.file_obj import FileVar
 from core.helper import encrypter
 
-from .segments import Segment, StringSegment
+from .segments import NoneSegment, Segment, StringSegment
 from .types import SegmentType
 
 
@@ -83,6 +83,6 @@ class SecretVariable(StringVariable):
         return encrypter.obfuscated_token(self.value)
 
 
-class NoneVariable(Variable):
+class NoneVariable(NoneSegment, Variable):
     value_type: SegmentType = SegmentType.NONE
-    value: None = None
+    value: None = None