Skip to content

Commit 52479fb

Browse files
fix: Improve Read File and Write File storage location UX (#11589)
* advanced mode for storage * add tests * hide storage location * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 8300733 commit 52479fb

11 files changed

Lines changed: 59 additions & 22 deletions

File tree

src/backend/base/langflow/initial_setup/starter_projects/Document Q&A.json

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

src/backend/base/langflow/initial_setup/starter_projects/News Aggregator.json

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

src/backend/base/langflow/initial_setup/starter_projects/Portfolio Website Code Generator.json

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

src/backend/base/langflow/initial_setup/starter_projects/Text Sentiment Analysis.json

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

src/backend/base/langflow/initial_setup/starter_projects/Vector Store RAG.json

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

src/backend/tests/unit/components/files_and_knowledge/test_file_component.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,3 +718,17 @@ def test_pipeline_change_disabled_in_cloud(self, monkeypatch):
718718
# Even if pipeline is set to "standard", OCR engine should be disabled in cloud
719719
assert result["ocr_engine"]["show"] is False
720720
assert result["ocr_engine"]["value"] == "None"
721+
722+
723+
class TestFileComponentStorageLocation:
724+
"""Tests for default Local storage and Storage Location in advanced controls."""
725+
726+
def test_storage_location_defaults_to_local(self):
727+
"""Test that storage_location input defaults to Local when component is dropped."""
728+
storage_input = next(i for i in FileComponent.inputs if i.name == "storage_location")
729+
assert storage_input.value == [{"name": "Local", "icon": "hard-drive"}]
730+
731+
def test_storage_location_is_advanced(self):
732+
"""Test that storage_location is in advanced controls."""
733+
storage_input = next(i for i in FileComponent.inputs if i.name == "storage_location")
734+
assert storage_input.advanced is True

src/backend/tests/unit/components/processing/test_save_file_component.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,3 +462,13 @@ def test_append_mode_hidden_for_cloud_storage(self, component_class):
462462
assert result["append_mode"]["show"] is False, "append_mode should be hidden for Google Drive storage"
463463
assert result["file_name"]["show"] is True
464464
assert result["gdrive_format"]["show"] is True
465+
466+
def test_storage_location_defaults_to_local(self, component_class):
467+
"""Test that storage_location input defaults to Local when component is dropped."""
468+
storage_input = next(i for i in component_class.inputs if i.name == "storage_location")
469+
assert storage_input.value == [{"name": "Local", "icon": "hard-drive"}]
470+
471+
def test_storage_location_is_advanced(self, component_class):
472+
"""Test that storage_location is in advanced controls."""
473+
storage_input = next(i for i in component_class.inputs if i.name == "storage_location")
474+
assert storage_input.advanced is True

src/lfx/src/lfx/_assets/component_index.json

Lines changed: 19 additions & 9 deletions
Large diffs are not rendered by default.

src/lfx/src/lfx/_assets/stable_hash_history.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@
766766
},
767767
"File": {
768768
"versions": {
769-
"0.3.0": "fccb3ab047f1"
769+
"0.3.0": "12a5841f1a03"
770770
}
771771
},
772772
"KnowledgeIngestion": {
@@ -781,7 +781,7 @@
781781
},
782782
"SaveToFile": {
783783
"versions": {
784-
"0.3.0": "6657b458359b"
784+
"0.3.0": "6d0e4842271e"
785785
}
786786
},
787787
"FirecrawlCrawlApi": {

src/lfx/src/lfx/components/files_and_knowledge/file.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ class FileComponent(BaseFileComponent):
109109
options=_get_storage_location_options(),
110110
real_time_refresh=True,
111111
limit=1,
112+
value=[{"name": "Local", "icon": "hard-drive"}],
113+
advanced=True,
112114
),
113115
*_base_inputs,
114116
StrInput(

0 commit comments

Comments
 (0)