🔀 refactor(textsplitters.py): extract options list into a variable for reusability and sorting
The options list for the separator_type field in the TextSplittersFrontendNode class has been extracted into a variable called options. This improves code readability and allows for easier modification and sorting of the options list.
This commit is contained in:
parent
8c12e17ad0
commit
3485893be0
1 changed files with 3 additions and 1 deletions
|
|
@ -21,6 +21,8 @@ class TextSplittersFrontendNode(FrontendNode):
|
|||
# Add a field for type of separator
|
||||
# which will have Text or any value from the
|
||||
# Language enum
|
||||
options = [x.value for x in Language] + ["Text"]
|
||||
options.sort()
|
||||
self.template.add_field(
|
||||
TemplateField(
|
||||
field_type="str",
|
||||
|
|
@ -29,7 +31,7 @@ class TextSplittersFrontendNode(FrontendNode):
|
|||
name="separator_type",
|
||||
advanced=False,
|
||||
is_list=True,
|
||||
options=[x.value for x in Language],
|
||||
options=options,
|
||||
value="Text",
|
||||
display_name="Separator Type",
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue