feat: add hide_base_name option and update data folder prompts (#1004)

* feat: add hide_base_name option and update data folder prompts

* rename folder
This commit is contained in:
you-n-g
2025-06-29 21:22:16 +08:00
committed by GitHub
parent 66e0e8ffd8
commit cd237292ea
3 changed files with 6 additions and 5 deletions
@@ -80,7 +80,7 @@ pipeline_coder:
--------- Competition Information ---------
{{ competition_info }}
--------- Data Folder Description (All path are relative to the data folder) ---------
--------- Data Folder Description (All path are relative to the data folder, i.e. "{% include "scenarios.data_science.share:scen.input_path" %}") ---------
{{ folder_spec }}
{% if latest_code %}
@@ -312,7 +312,7 @@ data_loader_coder:
--------- Code Specification ---------
{{ code_spec }}
--------- Data Folder Description (All path are relative to the data folder) ---------
--------- Data Folder Description (All path are relative to the data folder, i.e. "{% include "scenarios.data_science.share:scen.input_path" %}") ---------
{{ folder_spec }}
{% if latest_code %}
+4 -3
View File
@@ -3,7 +3,7 @@ An example of the generated data folder description:
## File tree:
```
plant-pathology-2020-fgvc7/
./
├── images/
│ ├── Test_0.jpg (182.7 kB)
│ ├── Test_1.jpg (362.4 kB)
@@ -294,7 +294,7 @@ class FileTreeGenerator:
Smart file tree generator with symlink handling and intelligent truncation.
"""
def __init__(self, max_lines: int = 200, priority_files: Set[str] = None):
def __init__(self, max_lines: int = 200, priority_files: Set[str] = None, hide_base_name: bool = True):
"""
Initialize the file tree generator.
@@ -306,6 +306,7 @@ class FileTreeGenerator:
self.priority_files = priority_files or {".csv", ".json", ".parquet", ".md", ".txt"}
self.lines = []
self.line_count = 0
self.hide_base_name = hide_base_name
def generate_tree(self, path: Union[str, Path]) -> str:
"""
@@ -325,7 +326,7 @@ class FileTreeGenerator:
base_path = path.resolve()
self.lines = []
self.line_count = 0
self._add_line(f"{path.name}/")
self._add_line(f"{'.' if self.hide_base_name else path.name}/")
self._process_directory(path, 0, "", base_path)
except MaxLinesExceededError:
pass # Expected when hitting line limit