9ee8daa295
- Added WebSocket endpoint for real-time chat interactions. - Refactored ChatPage component to utilize WebSocket for sending and receiving messages. - Updated chat service to handle streaming responses from the LLM agent. - Introduced error handling for WebSocket connections and message processing. - Modified Editor_Test to include AppShellWithMenu for better layout. - Adjusted file path in generar_tree.py for correct directory structure. - Created llm_chat_endpoint_v1.py and llm_chat_srvc.py for handling chat requests and responses. - Established logging for WebSocket interactions and errors.
32 lines
1.1 KiB
Python
32 lines
1.1 KiB
Python
import os
|
|
|
|
def generate_tree(start_path='.', max_depth=2):
|
|
lines = []
|
|
|
|
def _tree(dir_path, depth, prefix):
|
|
if depth > max_depth:
|
|
return
|
|
entries = sorted(os.listdir(dir_path))
|
|
for i, entry in enumerate(entries):
|
|
path = os.path.join(dir_path, entry)
|
|
connector = "└── " if i == len(entries) - 1 else "├── "
|
|
lines.append(prefix + connector + entry)
|
|
if os.path.isdir(path):
|
|
extension = " " if i == len(entries) - 1 else "│ "
|
|
_tree(path, depth + 1, prefix + extension)
|
|
|
|
lines.append(start_path)
|
|
_tree(start_path, 1, '')
|
|
return '\n'.join(lines)
|
|
|
|
def save_tree_to_file(start_path='.', max_depth=2, output_file='tree.txt'):
|
|
tree_output = generate_tree(start_path, max_depth)
|
|
with open(output_file, 'w', encoding='utf-8') as f:
|
|
f.write(tree_output)
|
|
print(f"Árbol guardado en: {output_file}")
|
|
|
|
# Ejemplo de uso:
|
|
# Puedes cambiar estos valores según lo necesites
|
|
save_tree_to_file(start_path=r'E:\Fitz_Studio\backend', max_depth=3, output_file=r'E:\Fitz_Studio\data\files\txt\tree.txt')
|
|
|