fix: Remove duplicate options in Save File Component (#8559)

* fix: Take only unique values for the file format

* Update save_file.py

* Update News Aggregator.json

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes (attempt 2/3)

* [autofix.ci] apply automated fixes (attempt 3/3)

* Update News Aggregator.json

* Update src/backend/base/langflow/components/processing/save_file.py

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update News Aggregator.json

* Small tweaks to the save file

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes (attempt 2/3)

* [autofix.ci] apply automated fixes (attempt 3/3)

* Update News Aggregator.json

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes (attempt 2/3)

* [autofix.ci] apply automated fixes (attempt 3/3)

* Update save_file.py

* Update News Aggregator.json

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes (attempt 2/3)

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes (attempt 2/3)

* [autofix.ci] apply automated fixes (attempt 3/3)

* Reorder list

* Update save_file.py

* [autofix.ci] apply automated fixes

* Change default for message

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
Eric Hare 2025-06-20 12:39:09 -07:00 committed by GitHub
commit f04e336f1d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 11 deletions

View file

@ -45,7 +45,7 @@ class SaveToFileComponent(Component):
DropdownInput(
name="file_format",
display_name="File Format",
options=DATA_FORMAT_CHOICES + MESSAGE_FORMAT_CHOICES,
options=list(dict.fromkeys(DATA_FORMAT_CHOICES + MESSAGE_FORMAT_CHOICES)),
info="Select the file format to save the input. If not provided, the default format will be used.",
value="",
advanced=True,
@ -100,13 +100,15 @@ class SaveToFileComponent(Component):
def _get_input_type(self) -> str:
"""Determine the input type based on the provided input."""
if isinstance(self.input, DataFrame):
# Use exact type checking (type() is) instead of isinstance() to avoid inheritance issues.
# Since Message inherits from Data, isinstance(message, Data) would return True for Message objects,
# causing Message inputs to be incorrectly identified as Data type.
if type(self.input) is DataFrame:
return "DataFrame"
if isinstance(self.input, Data):
return "Data"
if isinstance(self.input, Message):
if type(self.input) is Message:
return "Message"
if type(self.input) is Data:
return "Data"
msg = f"Unsupported input type: {type(self.input)}"
raise ValueError(msg)
@ -117,7 +119,7 @@ class SaveToFileComponent(Component):
if self._get_input_type() == "Data":
return "json"
if self._get_input_type() == "Message":
return "markdown"
return "json"
return "json" # Fallback
def _adjust_file_path_with_format(self, path: Path, fmt: str) -> Path:

File diff suppressed because one or more lines are too long