Commit History
-
add import feature
3eb00a5 -
update gemini to poe
d4d57c4 -
update gemini
0498411 -
fix gemini 3
fab9ff4 -
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 -
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 -
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 -
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 -
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 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 -
new UI
b42dfef