# frontend_agent/live_frontend.py import os FRONTEND_DIR = "frontend_live" os.makedirs(FRONTEND_DIR, exist_ok=True) def save_react_component(task_name, code_str): """ Save React component to frontend_live directory for live preview. """ filename = f"{task_name.replace(' ', '_')}.html" filepath = os.path.join(FRONTEND_DIR, filename) html_content = f""" {task_name}
""" with open(filepath, "w") as f: f.write(html_content) return filepath