only app.py for redesigns
Browse filesFiles changed (2)
558 unmodified lines559560561562563564820 unmodified lines13851386138713881389139013911392139313941395139613971398558 unmodified linesprint(f"[Deploy] Generated {len(files)} file(s): {list(files.keys())}")# Upload all generated files (the LLM is instructed to only output .py files,# but if it creates new assets/data files, we should upload those too)# This approach updates .py files and adds any new files without touching820 unmodified linesfiles["app.py"] = cleaned_code# For Gradio PRs, only include .py files (preserve existing requirements.txt, etc.)if language == "gradio":print(f"[PR] Gradio app - filtering to only .py files")py_files = {fname: content for fname, content in files.items() if fname.endswith('.py')}if not py_files:print(f"[PR] Warning: No .py files found in parsed output")return False, "No Python files found in generated code for Gradio PR", Nonefiles = py_filesprint(f"[PR] Will update {len(files)} Python file(s): {list(files.keys())}")# Write files (create subdirectories if needed)for filename, content in files.items():558 unmodified lines559560561562563564565566567568569570571572573574575576577578579580581582583584820 unmodified lines140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431558 unmodified linesprint(f"[Deploy] Generated {len(files)} file(s): {list(files.keys())}")# For redesign operations, ONLY update app.py to preserve other helper files# Detect redesign from commit message OR from history (user prompt contains "redesign")is_redesign = Falseif commit_message and "redesign" in commit_message.lower():is_redesign = Trueelif history:# Check last user message for "redesign" keywordfor role, content in reversed(history):if role == "user" and content and "redesign" in content.lower():is_redesign = Truebreakif is_redesign:print(f"[Deploy] Redesign operation detected - filtering to ONLY app.py")app_py_content = files.get('app.py')if not app_py_content:return False, "Error: No app.py found in redesign output", Nonefiles = {'app.py': app_py_content}print(f"[Deploy] Will only update app.py ({len(app_py_content)} chars)")# Upload all generated files (the LLM is instructed to only output .py files,# but if it creates new assets/data files, we should upload those too)# This approach updates .py files and adds any new files without touching820 unmodified linesfiles["app.py"] = cleaned_code# For Gradio PRs, only include .py files (preserve existing requirements.txt, etc.)# For redesigns, ONLY include app.py to avoid modifying helper filesif language == "gradio":print(f"[PR] Gradio app - filtering to only .py files")py_files = {fname: content for fname, content in files.items() if fname.endswith('.py')}if not py_files:print(f"[PR] Warning: No .py files found in parsed output")return False, "No Python files found in generated code for Gradio PR", None# Check if this is a redesign (pr_title contains "Redesign")is_redesign = "redesign" in pr_title.lower() if pr_title else Falseif is_redesign:print(f"[PR] Redesign PR detected - filtering to ONLY app.py")if 'app.py' not in py_files:print(f"[PR] Warning: No app.py found in redesign output")return False, "No app.py found in redesign output for Gradio PR", Nonefiles = {'app.py': py_files['app.py']}print(f"[PR] Will only update app.py ({len(py_files['app.py'])} chars)")else:files = py_filesprint(f"[PR] Will update {len(files)} Python file(s): {list(files.keys())}")# Write files (create subdirectories if needed)for filename, content in files.items():
384 unmodified lines38538638738838939039137 unmodified lines429430431432433434435384 unmodified lines- Modern UI/UX best practices- Better visual hierarchy and spacing${isGradio ? '\n\nIMPORTANT: Only output Python (.py) files. Do NOT include requirements.txt or any other non-Python files. The existing dependencies and configuration files will be preserved.' : ''}`;if (onStart) {// Pass duplicated space ID so auto-deploy updates it37 unmodified lines- Modern UI/UX best practices- Better visual hierarchy and spacing${isGradio ? '\n\nIMPORTANT: Only output Python (.py) files. Do NOT include requirements.txt or any other non-Python files. The existing dependencies and configuration files will be preserved.' : ''}Note: After generating the redesign, I will create a Pull Request on the original space.`;384 unmodified lines38538638738838939039137 unmodified lines429430431432433434435384 unmodified lines- Modern UI/UX best practices- Better visual hierarchy and spacing${isGradio ? '\n\nIMPORTANT: Only output app.py with the redesigned UI (themes, layout, styling). Do NOT modify or output any other .py files (utils.py, models.py, etc.). Do NOT include requirements.txt or README.md.' : ''}`;if (onStart) {// Pass duplicated space ID so auto-deploy updates it37 unmodified lines- Modern UI/UX best practices- Better visual hierarchy and spacing${isGradio ? '\n\nIMPORTANT: Only output app.py with the redesigned UI (themes, layout, styling). Do NOT modify or output any other .py files (utils.py, models.py, etc.). Do NOT include requirements.txt or README.md.' : ''}Note: After generating the redesign, I will create a Pull Request on the original space.`;
backend_deploy.py+35-2
frontend/src/components/LandingPage.tsx+2-2