update PR
Browse filesFiles changed (2)
1399 unmodified lines1400140114021403140314041405140614071408140914081409141014111412141314141414141514161399 unmodified lines file_path.write_text(content, encoding='utf-8') # Create PR using the correct API flow: # 1. Create discussion with pull_request=True # 1. Create PR with create_pull_request() # 2. Add commits to the PR branch try: print(f"[PR] Creating pull request on {repo_id}") # Step 1: Create the PR (draft mode) discussion = api.create_discussion( # Step 1: Create the PR (draft mode) using the wrapper function discussion = api.create_pull_request( repo_id=repo_id, title=pr_title, description=pr_description, repo_type="space", pull_request=True, # This makes it a PR instead of discussion token=token ) 237 unmodified lines23823924024124124224324456 unmodified lines301302303304304305306307481 unmodified lines789790791792792793794795237 unmodified lines } };
const handleSendMessage = async (message: string, overrideLanguage?: Language, overrideModel?: string, overrideRepoId?: string) => { const handleSendMessage = async (message: string, overrideLanguage?: Language, overrideModel?: string, overrideRepoId?: string, shouldCreatePR?: boolean) => { if (!isAuthenticated) { alert('Please sign in with HuggingFace first! Click the "Sign in with Hugging Face" button in the header.'); return;56 unmodified lines history: messages.map((m) => [m.role, m.content]), agent_mode: false, existing_repo_id: effectiveRepoId, // Pass duplicated/imported space ID for auto-deploy skip_auto_deploy: !!pendingPR, // Skip auto-deploy if PR is pending skip_auto_deploy: !!shouldCreatePR, // Skip auto-deploy if creating PR };
const assistantMessage: Message = {481 unmodified lines // Send the message with the selected language and model // Don't pass repoId to handleSendMessage when creating PR (we want to generate code first, then create PR) await handleSendMessage(prompt, language, modelId, shouldCreatePR ? undefined : repoId); await handleSendMessage(prompt, language, modelId, shouldCreatePR ? undefined : repoId, shouldCreatePR); };
// Resize handlers for chat sidebar (desktop only)backend_deploy.py+3-4
frontend/src/app/page.tsx+3-3