update
Browse filesFiles changed (2)
41 unmodified lines424344454647726 unmodified lines77477577677777877941 unmodified linesTRANSFORMERS_JS_SYSTEM_PROMPT,STREAMLIT_SYSTEM_PROMPT,REACT_SYSTEM_PROMPT,get_gradio_system_prompt, # Import the function to get dynamic promptget_comfyui_system_prompt, # Import the function to get dynamic ComfyUI promptJSON_SYSTEM_PROMPT,726 unmodified lines# Format generic prompt only if neededsystem_prompt = GENERIC_SYSTEM_PROMPT.format(language=language)# Get cached client (reuses connections)client = get_cached_client(selected_model_id, provider)41 unmodified lines42434445464748726 unmodified lines77577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580641 unmodified linesTRANSFORMERS_JS_SYSTEM_PROMPT,STREAMLIT_SYSTEM_PROMPT,REACT_SYSTEM_PROMPT,REACT_FOLLOW_UP_SYSTEM_PROMPT, # Import React followup promptget_gradio_system_prompt, # Import the function to get dynamic promptget_comfyui_system_prompt, # Import the function to get dynamic ComfyUI promptJSON_SYSTEM_PROMPT,726 unmodified lines# Format generic prompt only if neededsystem_prompt = GENERIC_SYSTEM_PROMPT.format(language=language)# Detect if this is a followup request for React apps# Check if there's existing code in the conversation historyis_followup = Falseif language == "react" and request.history:# Check if there's any previous assistant message with code (indicating a followup)for msg in request.history:if isinstance(msg, dict):role = msg.get('role', '')content = msg.get('content', '')elif isinstance(msg, list) and len(msg) >= 2:role = msg[0]content = msg[1]else:continue# If we find previous code from assistant, this is a followupif role == 'assistant' and ('===' in content or 'Dockerfile' in content or 'package.json' in content):is_followup = Trueprint(f"[Generate] Detected React followup request")break# Use followup prompt for React if detectedif is_followup and language == "react":system_prompt = REACT_FOLLOW_UP_SYSTEM_PROMPTprint(f"[Generate] Using React followup system prompt for targeted fixes")# Get cached client (reuses connections)client = get_cached_client(selected_model_id, provider)
242 unmodified lines243244245246247248242 unmodified lines"""# Gradio system prompt - dynamically loaded with full Gradio 6 documentationdef get_gradio_system_prompt() -> str:"""Get the complete Gradio system prompt with full Gradio 6 documentation"""242 unmodified lines243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319242 unmodified lines"""# React followup system prompt for modifying existing React/Next.js applicationsREACT_FOLLOW_UP_SYSTEM_PROMPT = """You are an expert React and Next.js developer modifying an existing Next.js application.The user wants to apply changes based on their request.You MUST output ONLY the changes required using the following SEARCH/REPLACE block format. Do NOT output the entire file.Explain the changes briefly *before* the blocks if necessary, but the code changes THEMSELVES MUST be within the blocks.π¨ CRITICAL JSX SYNTAX RULES - FOLLOW EXACTLY:**RULE 1: Style objects MUST have proper closing braces }}**Every style={{ must have a matching }} before any other props or />**RULE 2: ALWAYS use Tailwind CSS classes instead of inline styles**- Use className="..." for styling- Only use inline styles if absolutely necessary- When replacing inline styles, use Tailwind classes**RULE 3: Before outputting, verify:**- [ ] All style={{ have matching }}- [ ] No event handlers inside style objects- [ ] Prefer Tailwind classes over inline styles- [ ] All JSX elements are properly closedFormat Rules:1. Start with <<<<<<< SEARCH2. Include the exact lines that need to be changed (with full context, at least 3 lines before and after)3. Follow with =======4. Include the replacement lines5. End with >>>>>>> REPLACE6. Generate multiple blocks if multiple sections need changes**File Structure Guidelines:**When making changes to a Next.js application, identify which file needs modification:- Component logic/rendering β components/*.jsx or pages/*.js- API routes β pages/api/*.js- Global styles β styles/globals.css- Configuration β next.config.js, tailwind.config.js, postcss.config.js- Dependencies β package.json- Docker configuration β Dockerfile**Common Fix Scenarios:**- Syntax errors in JSX β Fix the specific component file- Styling issues β Fix styles/globals.css or add Tailwind classes- API/backend logic β Fix pages/api files- Build errors β Fix next.config.js or package.json- Deployment issues β Fix Dockerfile**Example Format:**```Fixing the button styling in the header component...=== components/Header.jsx ===<<<<<<< SEARCH<buttonstyle={{backgroundColor: 'blue',padding: '10px'}}onClick={handleClick}>=======<buttonclassName="bg-blue-500 p-2.5 hover:bg-blue-600 transition-colors"onClick={handleClick}>>>>>>>> REPLACE```IMPORTANT: Always include "Built with anycoder" as clickable text in the header/top section of your application that links to https://huggingface.co/spaces/akhaliq/anycoder"""# Gradio system prompt - dynamically loaded with full Gradio 6 documentationdef get_gradio_system_prompt() -> str:"""Get the complete Gradio system prompt with full Gradio 6 documentation"""
backend_api.py+27
backend_prompts.py+71