🔀 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
|
# Add a field for type of separator
|
||||||
# which will have Text or any value from the
|
# which will have Text or any value from the
|
||||||
# Language enum
|
# Language enum
|
||||||
|
options = [x.value for x in Language] + ["Text"]
|
||||||
|
options.sort()
|
||||||
self.template.add_field(
|
self.template.add_field(
|
||||||
TemplateField(
|
TemplateField(
|
||||||
field_type="str",
|
field_type="str",
|
||||||
|
|
@ -29,7 +31,7 @@ class TextSplittersFrontendNode(FrontendNode):
|
||||||
name="separator_type",
|
name="separator_type",
|
||||||
advanced=False,
|
advanced=False,
|
||||||
is_list=True,
|
is_list=True,
|
||||||
options=[x.value for x in Language],
|
options=options,
|
||||||
value="Text",
|
value="Text",
|
||||||
display_name="Separator Type",
|
display_name="Separator Type",
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue