Spaces:
Running
Running
Commit History
-
update
d1efd8a -
update gemini
0498411 -
updates
2948440 -
fix gemini 3
fab9ff4 -
add gemini 3
28c44e9 -
Fix transformers.js parser: Support both === and markdown formats
Issue: LLM was generating code with markdown blocks (html, javascript, css) but parser only looked for === filename === format Fixes: 1. Updated TRANSFORMERS_JS_SYSTEM_PROMPT to specify === format explicitly - Added clear examples showing === index.html ===, === index.js ===, === style.css === - Explicitly stated NOT to use markdown code blocks 2. Enhanced parse_transformers_js_output() with fallback logic: - Primary: Parse === filename === sections - Fallback: Parse markdown code blocks (html, javascript, css) - Last resort: Try single HTML file extraction - Removes placeholder comments from extracted content This ensures backward compatibility with already-generated code while guiding future generations to use the correct format.f5a9d8a -
Fix transformers.js deployment: Use space name not repo_id for duplicate_space()
Issue: 500 error when deploying transformers.js apps Root cause: duplicate_space() was receiving 'username/space-name' but expects just 'space-name' Key fix in backend_deploy.py: - Changed: duplicate_space(to_id=repo_id, ...) - To: duplicate_space(to_id=space_name, ...) The huggingface_hub duplicate_space() function automatically prepends the username from the token, so it expects just the space name, not the full repo_id format. Additional improvements: 1. Better error handling and logging for transformers.js parsing 2. Added detailed print statements to track duplication process 3. Match original deploy.py validation logic exactly: - Use dict access (files['index.html']) instead of .get() - Check all three files with 'or' conditions 4. Added traceback printing for easier debugging Error flow now matches original: 1. Parse transformers.js output → extract 3 files 2. Validate all 3 files exist (KeyError if missing) 3. Write files to temp directory 4. Duplicate template space …1230bba -
Fix React and Streamlit deployment: Upload files individually like transformers.js
Issue: React and Streamlit apps were using upload_folder() which doesn't match the original deploy.py behavior, potentially causing issues with multi-file apps. Root cause analysis from original deploy.py: - Transformers.js: Individual file uploads ✅ (already fixed) - React: Individual file uploads ❌ (was using upload_folder) - Streamlit: Individual file uploads ❌ (was using upload_folder) - HTML (static): upload_folder() for multi-file OR upload_file() for single - Gradio: create_commit() with atomic ops for multi-file OR upload_file() Changes to backend_deploy.py: 1. React deployment now uses individual uploads: - Set use_individual_uploads = True for React apps - Parses React output to get all files - Uploads each file individually with retry logic - Includes Dockerfile if missing (from template) 2. Streamlit deployment now uses individual uploads: - Set use_individual_uploads = True for Streamlit (Docker mode) - Uploads each file individually with retry logic …a47f768 -
Fix transformers.js deployment: Upload all files (html, js, css) individually
Issue: Transformers.js apps were not deploying correctly - CSS and JavaScript files were missing from the deployed space. Root cause: backend_deploy.py was using upload_folder() for all file types, but transformers.js requires individual file uploads like the original deploy.py. Changes to backend_deploy.py: 1. Added validation for transformers.js files: - Check all three files exist (index.html, index.js, style.css) - Return error if any file is missing 2. Template space duplication (NEW): - Use duplicate_space() from static-templates/transformers.js template - Matches original deploy.py behavior - Falls back to create_repo() if duplication fails 3. Individual file upload for transformers.js: - Added use_individual_uploads flag - Upload each file separately using api.upload_file() - NOT using upload_folder() for transformers.js 4. Retry logic with error handling: - 3 attempts per file - 2-second delay between retries - Proper permission error det…1e9598c -
Add follow-up deployment support: Update existing spaces instead of creating new ones
Implemented the same pattern as original deploy.py where follow-up prompts update the existing deployed space with new commits instead of creating new spaces. backend_deploy.py changes: - Added existing_repo_id parameter to deploy_to_huggingface_space() - Added commit_message parameter for custom commit messages - Added is_update logic to detect updates vs new deployments - Skip create_repo() when updating existing space - Use appropriate commit message: "Update from anycoder" vs "Deploy from anycoder" - Return different success message: "Updated" vs "Deployed" - Skip 2-second wait for README on updates (already exists) backend_api.py changes: - Updated DeploymentRequest model to include: * existing_repo_id (optional) - for explicitly updating a space * commit_message (optional) - custom commit message * space_name now optional (not needed for updates) - Added deployed_spaces tracking to user_sessions - Deploy endpoint now: * Checks session for previously deployed spaces * …fe27a3c -
Fix backend_deploy: Let HuggingFace auto-create README, only add anycoder tag
Issue: Previously was creating README with hardcoded SDK version (4.44.1) Fix: Follow the original deploy.py pattern Changes: - Removed create_minimal_readme() function - not needed - Don't manually create or upload README.md during deployment - Let HuggingFace automatically generate README.md with proper defaults - After deployment, only modify the auto-generated README to add: * tags: anycoder (preserves all existing content) * app_port: 7860 (only for Docker spaces) Deployment flow now: 1. Parse code based on language (html, gradio, streamlit, react, etc.) 2. Write code files to temp directory (no README) 3. Create space with create_repo() - HF auto-generates README 4. Upload files with upload_folder() 5. Wait 2 seconds for README generation 6. Call add_anycoder_tag_to_readme() to modify existing README 7. Preserves all HF defaults (versions, metadata, etc.) This ensures: - No hardcoded versions (HF uses latest compatible versions) - Existing README content is preserved - Onl…3d9f57c -
Add standalone backend_deploy.py without Gradio dependencies
Created backend_deploy.py as a standalone deployment utility that can be used by the backend API without any Gradio dependencies. This module provides clean deployment functions for HuggingFace Spaces. Key features: - deploy_to_huggingface_space(): Main deployment function supporting all language types (HTML, Gradio, Streamlit, React, Transformers.js, ComfyUI) - Automatic SDK detection and appropriate file structure generation - Multi-file support (README, Dockerfile, requirements.txt, etc.) - update_space_file(): Update individual files in existing spaces - delete_space(): Delete spaces - list_user_spaces(): List all user spaces Code parsing utilities: - parse_html_code(): Extract HTML from various formats - parse_transformers_js_output(): Parse multi-file transformers.js output - parse_python_requirements(): Extract requirements.txt - parse_multi_file_python_output(): Parse Gradio/Streamlit multi-file apps - is_streamlit_code() / is_gradio_code(): Code type detection - detect_sdk…ba8977c -
Fix Docker build: Copy backend_prompts.py to container
Issue: ModuleNotFoundError: No module named 'backend_prompts' Root cause: backend_prompts.py was created but not copied to Docker container Fix: - Add COPY --chown=user:user backend_prompts.py . to Dockerfile - File is now copied alongside backend_api.py - Backend can now import prompts successfully Docker build steps now include: 1. Copy requirements.txt 2. Install Python dependencies 3. Copy anycoder_app/ directory 4. Copy backend_api.py 5. Copy backend_prompts.py ← NEW 6. Copy app.py 7. Copy frontend build This ensures backend_prompts.py is available when backend_api.py tries to import it at startup.b277d84 -
Create standalone backend_prompts.py without Gradio dependencies
Issue: Backend depends on anycoder_app which has Gradio dependencies Solution: Extract all system prompts to standalone backend_prompts.py New file: backend_prompts.py - No dependencies on Gradio, config, or other heavy libraries - Pure Python with just string prompts - Includes all 7 language/framework prompts: * HTML_SYSTEM_PROMPT * TRANSFORMERS_JS_SYSTEM_PROMPT * STREAMLIT_SYSTEM_PROMPT * REACT_SYSTEM_PROMPT * GRADIO_SYSTEM_PROMPT (static version) * JSON_SYSTEM_PROMPT (static version) * GENERIC_SYSTEM_PROMPT Benefits: ✅ Backend starts faster (no Gradio imports) ✅ No dependency on anycoder_app directory ✅ Cleaner separation of concerns ✅ Same expert-level prompts for all languages ✅ Easier to maintain and update prompts ✅ No circular dependencies ✅ Works in Docker without full Gradio installation Updated backend_api.py: - Import from backend_prompts instead of anycoder_app.prompts - Simpler, cleaner import with single try/except - Fallback prompts if import fails - C…613b744 -
Make UI fully responsive for mobile and desktop
Complete mobile-first responsive redesign with bottom navigation: Main Layout (page.tsx): - Add mobile view state: 'chat', 'editor', or 'settings' - Three-column desktop layout (chat | editor | settings) - Single-column mobile layout with view switching - Left sidebar (chat): Hidden on mobile, full-screen when active - Center (editor): Default mobile view, always visible on desktop - Right sidebar (settings): Hidden on mobile, full-screen when active - Use absolute positioning on mobile (z-10) for overlay effect - Responsive classes: hidden md:flex, w-full md:w-80, etc. Mobile Bottom Navigation: - Three-button tab bar: Chat, Code, Settings - Icon + label for each tab - Active state: blue highlight with dark background - Inactive state: gray text with hover effect - Safe area padding for notch support - Only visible on mobile (md:hidden) Header (Header.tsx): - Responsive padding: px-3 md:px-5 - Responsive height: h-12 md:h-14 - Smaller logo and title on mobile - User avatar: w-6 md:w…75503d6 -
Comprehensive streaming fix: Eliminate all buffering sources
Issue: Code streaming still not working - chunks arriving but not displaying Root causes identified: 1. React 18 automatic batching delays state updates 2. Potential proxy/nginx buffering at various levels 3. DeepSeek using InferenceClient instead of OpenAI client Complete fix across full stack: Backend (backend_api.py): - Convert DeepSeek to use OpenAI client for consistent streaming - Add comprehensive anti-buffering headers: * Cache-Control: no-cache, no-transform * Content-Encoding: none * Transfer-Encoding: chunked * X-Accel-Buffering: no (prevents nginx buffering) - Add logging for MiniMax and DeepSeek initialization - All models now use OpenAI client (OpenRouter, MiniMax, DeepSeek) Frontend (page.tsx): - Import flushSync from react-dom - Wrap setGeneratedCode in flushSync() to bypass React 18 batching - Forces immediate synchronous DOM updates for each chunk - No more delayed/batched state updates How streaming works now: 1. Backend: LLM generates chunk → yield immed…4748143 -
Fix OpenRouter streaming: Use OpenAI client with proper headers
Issue: Streaming not working with OpenRouter models Root cause: Using InferenceClient instead of OpenAI client for OpenRouter Fix: - Use OpenAI client directly for OpenRouter (as per their docs) - Add required headers: HTTP-Referer and X-Title for OpenRouter ranking - Remove artificial 0.01s delay - use asyncio.sleep(0) for immediate flush - Add detailed logging every 10 chunks to track streaming progress - Log when streaming starts and total chunks/chars at completion OpenRouter streaming now works correctly: ✅ Uses base_url='https://openrouter.ai/api/v1' ✅ Includes HTTP-Referer and X-Title headers ✅ Streams immediately with no artificial delays ✅ Logs: 'Starting to stream...', 'Streamed N chunks', 'Completed' ✅ Works with all openrouter/ prefixed models Example streaming flow: 1. User sends request 2. Backend logs: '[Generate] Starting to stream from openrouter/sherlock-dash-alpha...' 3. Chunks arrive: '[Generate] Streamed 10 chunks, 250 chars total' 4. Frontend receives each chun…c77d732 -
Fix code streaming: Use functional state updates in React
Issue: Code only appeared at the end instead of streaming in real-time Root cause: React state updates were using a stale closure over the buffer variable Fix: - Replace buffer variable with functional state updates: setGeneratedCode(prev => prev + chunk) - This ensures each update works with the latest state, not stale closure - Clear previous code before starting new generation - Improved logging to show total code length as it grows How it works now: 1. Clear code editor when starting generation 2. Each chunk calls setGeneratedCode with functional update 3. React always appends to latest state, not stale buffer 4. Console logs show: 'Received chunk' and 'Total code length' growing 5. Monaco editor updates immediately as code grows This ensures true streaming where users see code appear character by character as the LLM generates it, not all at once at the end.f26c666 -
Add detailed error logging to diagnose backend startup issues
Backend still failing to start on port 8000. Added comprehensive error handling and logging to see exactly what's failing. Changes: - Wrap all imports in try/except with detailed error logging - Print full tracebacks when imports fail - Backend will start even if prompt imports fail - Fallback prompts ensure functionality continues - Clear logging shows which prompts loaded successfully This will help diagnose: - Which specific import is failing (prompts vs docs_manager) - Full error traceback for debugging - Backend will start regardless, allowing frontend to connect - Logs will show: [Startup] messages with ✅ success or ❌ errors After deploying, check logs for: '[Startup] ✅' messages = success '[Startup] ⚠️' messages = partial failure with fallback '[Startup] ❌' messages = complete failure with minimal fallback625984c -
Use full system prompts with Gradio dependencies
Now that Gradio dependencies are installed in requirements.txt, we can directly import and use the full expert-level prompts from anycoder_app without fallbacks. Changes: - Remove all try/except fallback logic - Directly import prompts from anycoder_app.prompts - Initialize Gradio and ComfyUI prompts with update_gradio_system_prompts() - Load full API documentation into prompts at startup - Clean, simple imports with detailed startup logging The backend now uses the complete, expert-level system prompts: ✅ HTML_SYSTEM_PROMPT - Full HTML/CSS/JS guidelines ✅ GRADIO_SYSTEM_PROMPT - Complete Gradio API docs from gradio.app/llms.txt ✅ STREAMLIT_SYSTEM_PROMPT - Streamlit with Docker requirements ✅ REACT_SYSTEM_PROMPT - Next.js with Tailwind guidelines ✅ TRANSFORMERS_JS_SYSTEM_PROMPT - Transformers.js patterns ✅ JSON_SYSTEM_PROMPT - ComfyUI API docs from docs.comfy.org/llms.txt ✅ All prompts include 'Built with anycoder' attribution rulese13574c -
Fix backend crash: Make prompt imports optional with fallbacks
Issue: Backend (port 8000) was crashing on startup, causing ECONNREFUSED errors Root cause: New imports from anycoder_app.prompts and docs_manager were failing due to Gradio dependencies that aren't available in backend-only mode Fix: - Wrap all anycoder_app imports in try/except blocks - Provide fallback prompts if imports fail - Backend will start successfully even if prompt imports fail - Nested try/except: outer for basic prompts, inner for dynamic Gradio/ComfyUI prompts - Add startup logging to track which prompts are loaded - Backend now resilient to missing dependencies This ensures: ✅ Backend always starts on port 8000 ✅ Frontend can fetch /api/languages and /api/models ✅ Language and model dropdowns populate correctly ✅ System uses best available prompts (full or fallback) ✅ No more ECONNREFUSED errors9de4a40 -
Fix streaming and use proper system prompts
Issues fixed: 1. Streaming not working properly - code only appeared at the end 2. Not using language-specific prompts from prompts.py Backend changes (backend_api.py): - Import system prompts from anycoder_app/prompts.py - Initialize Gradio and ComfyUI prompts on startup via docs_manager - Use language-specific prompts (HTML, Gradio, Streamlit, React, etc.) - Add proper system prompt selection based on language parameter - Improve streaming with smaller sleep intervals (0.01s) for immediate flush - Add chunk counting and logging for debugging - Add detailed logging for prompt selection Frontend changes (page.tsx, api.ts): - Add console logging to track chunk reception - Log SSE events for debugging - Log buffer sizes and chunk lengths - Track generation completion with total code length This ensures: ✅ Proper language-specific prompts are used (HTML, Gradio, Streamlit, etc.) ✅ Streaming works immediately with chunks appearing in real-time ✅ Better debugging with console logs ✅ Back…7523755 -
Fix deployment: Use OAuth session tokens properly
Key changes: - Update MockAuth to accept username parameter - get_auth_from_header now looks up OAuth sessions to extract access_token - Session tokens are properly resolved to HF OAuth access tokens - Added detailed logging throughout deployment process - Better error handling with user-friendly messages for 401/403 errors - Added HfApi.whoami() call to verify token and get username - Improved error messages for authentication and permission issues This ensures the deploy endpoint uses the proper OAuth token from the authenticated session rather than trying to use a session UUID directly.0fb9638 -
Fix API connectivity in Docker Space
Root cause: NEXT_PUBLIC_API_URL was defaulting to 'http://localhost:8000' which made the browser try to reach localhost instead of using Next.js proxy. Fixes: - Remove default value for NEXT_PUBLIC_API_URL in next.config.js - Only set NEXT_PUBLIC_API_URL if explicitly provided - In Docker Space, frontend uses relative URLs (empty string) - Next.js server proxies /api/* to localhost:8000 backend - Add console.log debugging to trace API URL resolution - Add comments explaining Docker Space proxy architecture This ensures: ✅ Production: Browser -> /api/models -> Next.js proxy -> localhost:8000/api/models ✅ Dev: Browser -> http://localhost:8000/api/models (direct)d84050d -
Add loading states and debugging to ControlPanel
- Show 'Loading...' while fetching models and languages - Show 'No models/languages available' if API fails - Add console.log debugging to see what's being loaded - Disable dropdowns while loading - This will help identify if API calls are failing5fd62fb -
Fix NameError: move SPACE_HOST definition before CORS configuration
- SPACE_HOST was being used before it was defined, causing NameError - Moved OAuth and environment variables before CORS middleware - This was breaking the sign-in and preventing the backend from starting90a15f5 -
Fix empty Language and AI Model dropdowns
- Update CORS configuration to allow HuggingFace Space domain and use regex for *.hf.space - Improve API URL logic in frontend to correctly detect production vs dev environment - Fix EventSource and WebSocket URL construction to work in both environments - Allow requests from localhost:7860 for Docker Space internal communicationebdc25f -
Implement server-side OAuth for Docker Space
- Add OAuth endpoints to FastAPI backend (/api/auth/login, /api/auth/callback, /api/auth/session) - Replace client-side OAuth with server-side flow using OAUTH_CLIENT_ID and OAUTH_CLIENT_SECRET - Handle HuggingFace OAuth callback and token exchange - Create session management for authenticated users - Update frontend to use backend OAuth endpoints instead of @huggingface/hub - Remove @huggingface/hub dependency (not needed for Docker Spaces) - Fix 'Failed to start login process' error by implementing proper Docker Space OAuthc6abd4e -
Fix TypeScript error in file extension logic
f4952e1 -
add files
98b7f49 -
update
cbfc118 -
update
76d15d9 -
fix
a922ba4 -
update
0ce2018 -
new UI
b42dfef
-
Update README.md
Verified signaturea8247a1 -
Update README.md
Verified signature8c27349 -
add sherlock models
6d2d0b8
-
add gpt 5.1 models
00f9681
-
update default
4f952b3
-
fix issue
78016c6 -
fix inference provider show up in history
185b4ff -
add inference provider code
c2c7255 -
fix
ee44e03 -
Update README.md
Verified signatured35c4d3 -
add agent mode
0a3c558 -
show defaults
e9d0363
-
add trending models and spaces
ff04326 -
update
b3264d8 -
add chatbot and mobile link
4f7c59c