update comfyui system prompt
Browse files46 unmodified lines474849505152956 unmodified lines10091010101110121013101410154 unmodified lines102010211022102310241025102625 unmodified lines1052105310541055105610574596 unmodified lines56545655565656575658565946 unmodified linesreturn "python"if language == "gradio":return "python"return language if language in GRADIO_SUPPORTED_LANGUAGES else None# Search/Replace Constants956 unmodified linesdocs_content = get_comfyui_docs_content()# Base system promptbase_prompt = """You are an expert JSON developer. Generate clean, valid JSON data based on the user's request. Follow JSON syntax rules strictly:- Use double quotes for strings- No trailing commas4 unmodified lines"""# Search-enabled system promptsearch_prompt = """You are an expert JSON developer. You have access to real-time web search. When needed, use web search to find the latest information or data structures for your JSON generation.Generate clean, valid JSON data based on the user's request. Follow JSON syntax rules strictly:25 unmodified linesJSON_SYSTEM_PROMPT = base_promptJSON_SYSTEM_PROMPT_WITH_SEARCH = search_prompt# Initialize Gradio documentation on startupdef initialize_gradio_docs():"""Initialize Gradio documentation on application startup"""4596 unmodified linessystem_prompt = GRADIO_SYSTEM_PROMPTelif language == "json":system_prompt = JSON_SYSTEM_PROMPTelse:system_prompt = GENERIC_SYSTEM_PROMPT.format(language=language)46 unmodified lines4748495051525354956 unmodified lines10111012101310141015101610174 unmodified lines102210231024102510261027102825 unmodified lines1054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011014596 unmodified lines5698569957005701570257035704570546 unmodified linesreturn "python"if language == "gradio":return "python"if language == "comfyui":return "json"return language if language in GRADIO_SUPPORTED_LANGUAGES else None# Search/Replace Constants956 unmodified linesdocs_content = get_comfyui_docs_content()# Base system prompt for regular JSONbase_prompt = """You are an expert JSON developer. Generate clean, valid JSON data based on the user's request. Follow JSON syntax rules strictly:- Use double quotes for strings- No trailing commas4 unmodified lines"""# Search-enabled system prompt for regular JSONsearch_prompt = """You are an expert JSON developer. You have access to real-time web search. When needed, use web search to find the latest information or data structures for your JSON generation.Generate clean, valid JSON data based on the user's request. Follow JSON syntax rules strictly:25 unmodified linesJSON_SYSTEM_PROMPT = base_promptJSON_SYSTEM_PROMPT_WITH_SEARCH = search_promptdef get_comfyui_system_prompt():"""Get ComfyUI-specific system prompt with enhanced guidance"""docs_content = get_comfyui_docs_content()base_prompt = """You are an expert ComfyUI developer. Generate clean, valid JSON workflows for ComfyUI based on the user's request.ComfyUI workflows are JSON structures that define:- Nodes: Individual processing units with specific functions- Connections: Links between nodes that define data flow- Parameters: Configuration values for each node- Inputs/Outputs: Data flow between nodesFollow JSON syntax rules strictly:- Use double quotes for strings- No trailing commas- Proper nesting and structure- Valid data types (string, number, boolean, null, object, array)Generate ONLY the ComfyUI workflow JSON - no HTML, no applications, no explanations outside the JSON. The output should be a complete, valid ComfyUI workflow that can be loaded directly into ComfyUI."""# Add ComfyUI documentation if availableif docs_content.strip():comfyui_section = f"""## ComfyUI Reference DocumentationUse this reference for accurate node types, parameters, and workflow structures:{docs_content}This reference is automatically synced from https://docs.comfy.org/llms.txt to ensure accuracy."""base_prompt += comfyui_sectionbase_prompt += """IMPORTANT: Always include "Built with anycoder" as a comment or metadata field in your ComfyUI workflow JSON that references https://huggingface.co/spaces/akhaliq/anycoder"""return base_prompt# Initialize Gradio documentation on startupdef initialize_gradio_docs():"""Initialize Gradio documentation on application startup"""4596 unmodified linessystem_prompt = GRADIO_SYSTEM_PROMPTelif language == "json":system_prompt = JSON_SYSTEM_PROMPTelif language == "comfyui":system_prompt = get_comfyui_system_prompt()else:system_prompt = GENERIC_SYSTEM_PROMPT.format(language=language)
app.py+48-2