use daggr latest version
Browse filesFiles changed (4)
22 unmodified lines23242526272829793 unmodified lines82382482582682782817 unmodified lines8468478488498508518529 unmodified lines86286386486586686759 unmodified lines927928929930931932599 unmodified lines15321533153415351536153749 unmodified lines1587158815891590159115921593159415951596159722 unmodified linesstrip_tool_call_markers,remove_code_block,extract_import_statements,generate_requirements_txt_with_llm)793 unmodified linesfile_path = temp_path / filenameprint(f"[Deploy] Writing {filename} ({len(content)} chars) to {file_path}")# Use text mode - Python handles encoding automaticallyfile_path.write_text(content, encoding='utf-8')# Verify the write was successfulwritten_size = file_path.stat().st_size17 unmodified lineshtml_code = prettify_comfyui_json_for_html(code)(temp_path / "index.html").write_text(html_code, encoding='utf-8')elif language in ["gradio", "streamlit"]:files = parse_multi_file_python_output(code)# Fallback: if no files parsed (missing === markers), treat entire code as app.py9 unmodified linesfor filename, content in files.items():file_path = temp_path / filenamefile_path.parent.mkdir(parents=True, exist_ok=True)file_path.write_text(content, encoding='utf-8')# Ensure requirements.txt exists - generate from imports if missing59 unmodified linesfor filename, content in files.items():file_path = temp_path / filenamefile_path.parent.mkdir(parents=True, exist_ok=True)file_path.write_text(content, encoding='utf-8')# Generate requirements.txt from imports if missing599 unmodified lines# Write transformers.js filesfor filename, content in files.items():file_path = temp_path / filenamefile_path.write_text(content, encoding='utf-8')except Exception as e:49 unmodified linesfor filename, content in files.items():file_path = temp_path / filenamefile_path.parent.mkdir(parents=True, exist_ok=True)file_path.write_text(content, encoding='utf-8')# Skip requirements.txt generation for Gradio PRs (preserve existing)# For Streamlit, generate requirements.txt if missingif language == "streamlit" and "requirements.txt" not in files:main_app = files.get('streamlit_app.py') or files.get('app.py', '')if main_app:print(f"[PR] Generating requirements.txt from imports")22 unmodified lines2324252627282930793 unmodified lines82482582682782882983083117 unmodified lines8498508518528538548559 unmodified lines86586686786886987087187259 unmodified lines932933934935936937938939599 unmodified lines1539154015411542154315441545154649 unmodified lines159615971598159916001601160216031604160516061607160822 unmodified linesstrip_tool_call_markers,remove_code_block,extract_import_statements,generate_requirements_txt_with_llm,enforce_critical_versions)793 unmodified linesfile_path = temp_path / filenameprint(f"[Deploy] Writing {filename} ({len(content)} chars) to {file_path}")# Use text mode - Python handles encoding automaticallyif filename == "requirements.txt":content = enforce_critical_versions(content)file_path.write_text(content, encoding='utf-8')# Verify the write was successfulwritten_size = file_path.stat().st_size17 unmodified lineshtml_code = prettify_comfyui_json_for_html(code)(temp_path / "index.html").write_text(html_code, encoding='utf-8')elif language in ["gradio", "streamlit", "daggr"]:files = parse_multi_file_python_output(code)# Fallback: if no files parsed (missing === markers), treat entire code as app.py9 unmodified linesfor filename, content in files.items():file_path = temp_path / filenamefile_path.parent.mkdir(parents=True, exist_ok=True)if filename == "requirements.txt":content = enforce_critical_versions(content)file_path.write_text(content, encoding='utf-8')# Ensure requirements.txt exists - generate from imports if missing59 unmodified linesfor filename, content in files.items():file_path = temp_path / filenamefile_path.parent.mkdir(parents=True, exist_ok=True)if filename == "requirements.txt":content = enforce_critical_versions(content)file_path.write_text(content, encoding='utf-8')# Generate requirements.txt from imports if missing599 unmodified lines# Write transformers.js filesfor filename, content in files.items():file_path = temp_path / filenameif filename == "requirements.txt":content = enforce_critical_versions(content)file_path.write_text(content, encoding='utf-8')except Exception as e:49 unmodified linesfor filename, content in files.items():file_path = temp_path / filenamefile_path.parent.mkdir(parents=True, exist_ok=True)if filename == "requirements.txt":content = enforce_critical_versions(content)file_path.write_text(content, encoding='utf-8')# Skip requirements.txt generation for Gradio PRs (preserve existing)# For Streamlit, generate requirements.txt if missingif language in ["streamlit", "daggr"] and "requirements.txt" not in files:main_app = files.get('streamlit_app.py') or files.get('app.py', '')if main_app:print(f"[PR] Generating requirements.txt from imports")
443 unmodified lines444445446447448449450443 unmodified lines**File Organization:**- `app.py` - Main application entry point (REQUIRED)- `requirements.txt` - Python dependencies (REQUIRED, auto-generated from imports)- `utils.py` - Utility functions and helpers (optional)- `models.py` - Model loading and inference functions (optional)- `config.py` - Configuration and constants (optional)443 unmodified lines444445446447448449450443 unmodified lines**File Organization:**- `app.py` - Main application entry point (REQUIRED)- `requirements.txt` - Python dependencies (REQUIRED, auto-generated from imports). ALWAYS use `daggr>=0.5.4` and `gradio>=6.0.2` if applicable.- `utils.py` - Utility functions and helpers (optional)- `models.py` - Model loading and inference functions (optional)- `config.py` - Configuration and constants (optional)
191 unmodified lines1921931941951961971981994 unmodified lines204205206207208209154 unmodified lines36436536636736836997 unmodified lines4674684694704714728 unmodified lines481482483484485486487191 unmodified lines"""Parse multi-file Python output (e.g., Gradio, Streamlit)"""files = {}# Pattern to match file sectionspattern = r'===\s*(\S+\.(?:py|txt))\s*===\s*(.*?)(?====|$)'matches = re.finditer(pattern, code, re.DOTALL | re.IGNORECASE)for match in matches:4 unmodified linescontent = re.sub(r'^```\w*\s*', '', content, flags=re.MULTILINE)content = re.sub(r'```\s*$', '', content, flags=re.MULTILINE)files[filename] = contentreturn files154 unmodified linesreturn files if isinstance(files, dict) and files else {}def generate_requirements_txt_with_llm(import_statements):"""Generate requirements.txt content using LLM based on import statements."""if not import_statements:97 unmodified linesrequirements_content = '\n'.join(clean_lines).strip()# Ensure it ends with a newlineif requirements_content and not requirements_content.endswith('\n'):requirements_content += '\n'8 unmodified lines'PIL': 'Pillow','sklearn': 'scikit-learn','skimage': 'scikit-image','bs4': 'beautifulsoup4'}for stmt in import_statements:191 unmodified lines1921931941951961971981994 unmodified lines204205206207208209210211154 unmodified lines36636736836937037137237337437537637737837938038138238338438538638797 unmodified lines4854864874884894904914928 unmodified lines501502503504505506507508509191 unmodified lines"""Parse multi-file Python output (e.g., Gradio, Streamlit)"""files = {}# Pattern to match file sections like === filename.ext ===pattern = r'===\s*(\S+\.\w+)\s*===\s*(.*?)(?=\n\s*===\s*\S+\.\w+\s*===|$)'matches = re.finditer(pattern, code, re.DOTALL | re.IGNORECASE)for match in matches:4 unmodified linescontent = re.sub(r'^```\w*\s*', '', content, flags=re.MULTILINE)content = re.sub(r'```\s*$', '', content, flags=re.MULTILINE)if filename == "requirements.txt":content = enforce_critical_versions(content)files[filename] = contentreturn files154 unmodified linesreturn files if isinstance(files, dict) and files else {}def enforce_critical_versions(requirements_content: str) -> str:"""Ensure critical packages like daggr and gradio have minimum required versions"""if 'daggr' in requirements_content:# Check if version is already specifiedif 'daggr>=' not in requirements_content and 'daggr==' not in requirements_content:# Replace plain 'daggr' with pinned version, preserving commentsrequirements_content = re.sub(r'^daggr\s*(?=[#\n]|$)', 'daggr>=0.5.4', requirements_content, flags=re.MULTILINE)if 'gradio' in requirements_content:if 'gradio>=' not in requirements_content and 'gradio==' not in requirements_content:# Replace plain 'gradio' with pinned version, preserving commentsrequirements_content = re.sub(r'^gradio\s*(?=[#\n]|$)', 'gradio>=6.0.2', requirements_content, flags=re.MULTILINE)return requirements_contentdef generate_requirements_txt_with_llm(import_statements):"""Generate requirements.txt content using LLM based on import statements."""if not import_statements:97 unmodified linesrequirements_content = '\n'.join(clean_lines).strip()requirements_content = enforce_critical_versions(requirements_content)# Ensure it ends with a newlineif requirements_content and not requirements_content.endswith('\n'):requirements_content += '\n'8 unmodified lines'PIL': 'Pillow','sklearn': 'scikit-learn','skimage': 'scikit-image','bs4': 'beautifulsoup4','daggr': 'daggr>=0.5.4','gradio': 'gradio>=6.0.2'}for stmt in import_statements:
161 unmodified lines162163164165166167168453 unmodified lines622623624625626627161 unmodified lines[main application code]=== requirements.txt ===[dependencies]=== utils.py ===[utility functions - optional]453 unmodified linesgraph = Graph(name="My Workflow", nodes=[node1, node2])graph.launch()**🚨 CRITICAL: DO NOT Generate README.md Files**- NEVER generate README.md files under any circumstances- A template README.md is automatically provided and will be overridden by the deployment system161 unmodified lines162163164165166167168453 unmodified lines622623624625626627628629630631161 unmodified lines[main application code]=== requirements.txt ===[dependencies]. ALWAYS use `daggr>=0.5.4` and `gradio>=6.0.2` if applicable.=== utils.py ===[utility functions - optional]453 unmodified linesgraph = Graph(name="My Workflow", nodes=[node1, node2])graph.launch()=== requirements.txt ===daggr>=0.5.4gradio>=6.0.2**🚨 CRITICAL: DO NOT Generate README.md Files**- NEVER generate README.md files under any circumstances- A template README.md is automatically provided and will be overridden by the deployment system
backend_deploy.py+14-3
backend_docs_manager.py+1-1
backend_parsers.py+25-3
backend_prompts.py+5-1