File tree Expand file tree Collapse file tree 3 files changed +1140
-95
lines changed
Expand file tree Collapse file tree 3 files changed +1140
-95
lines changed Original file line number Diff line number Diff line change 1+ import os
2+
3+ def compile_llms_txt ():
4+ # Get the docs directory path (where this script is located)
5+ docs_dir = os .path .dirname (os .path .abspath (__file__ ))
6+ content = ''
7+ # Define names of directories and files to exclude
8+ excluded_names = {'tool' }
9+
10+ # Change to docs directory
11+ os .chdir (docs_dir )
12+
13+ for root , _ , files in os .walk ('.' ):
14+ # Get the last part of the current directory
15+ current_dir = os .path .basename (root )
16+ if current_dir in excluded_names :
17+ continue
18+
19+ for file in files :
20+ if file .endswith ('.mdx' ):
21+ if file in excluded_names :
22+ continue
23+
24+ file_path = os .path .join (root , file )
25+ relative_path = os .path .relpath (file_path , '.' )
26+
27+ with open (file_path , 'r' , encoding = 'utf-8' ) as f :
28+ file_content = f .read ()
29+ content += f"## { relative_path } \n \n { file_content } \n \n "
30+
31+ # Write the complete content, replacing the existing file
32+ output_path = os .path .join (docs_dir , 'llms.txt' )
33+ with open (output_path , 'w' , encoding = 'utf-8' ) as f :
34+ f .write (content )
35+
36+ if __name__ == "__main__" :
37+ compile_llms_txt ()
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments