AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
feat(frontend): capture marketing-site triggerprompt into sessionStorage (#13248)
### Why / What / How **Why.** The marketing site hero CTA hands a user-entered prompt to the platform so the chat starts with it pre-submitted. The previous handoff used `https://platform.agpt.co/copilot?autosubmit=true#prompt=...`. URL hashes are never sent to the server, so when the Supabase middleware redirects an unauthenticated visitor from `/copilot` to `/login?next=/copilot?autosubmit=true`, the `#prompt=` fragment is dropped. New users always lost their prompt before reaching the chat. **What.** Switch the handoff to a `?triggerprompt=` query param read on `/signup` and `/login` mount. A small `useCaptureMarketingPrompt` hook stashes the value into sessionStorage and strips it from the URL. The existing `useWorkflowImportAutoSubmit` on `/copilot` already consumes that sessionStorage key, so the prompt survives the auth → onboarding → `/copilot` redirect chain and auto-submits once the user lands in the chat. **How.** - `useCaptureMarketingPrompt` (new): mount-once effect that reads `?triggerprompt=` from the URL, writes `importWorkflowPrompt` + `importWorkflowAutosubmit` to sessionStorage, and uses `history.replaceState` to remove the param so subsequent navigations are clean. - Wired into `useSignupPage` and `useLoginPage` as the first hook call, so capture happens before any logged-in short-circuit, password-form submit, or OAuth redirect (sessionStorage survives the OAuth round-trip since the user returns to the same origin). - `useWorkflowImportAutoSubmit` now also reads the autosubmit flag from sessionStorage. URL `?autosubmit=true` continues to win when explicitly set (workflow import path), but the marketing handoff needs the storage-side flag because onboarding wipes URL params before we reach `/copilot`. Marketing-site change (`/signup?triggerprompt=...` instead of `/copilot?autosubmit=true#prompt=...`) shipped separately in the marketing repo. ### Changes 🏗️ - New `src/hooks/useCaptureMarketingPrompt.ts` - `useSignupPage` and `useLoginPage` call the new hook on mount - `useWorkflowImportAutoSubmit` consumes the `importWorkflowAutosubmit` sessionStorage flag in addition to the URL param ### Checklist 📋 #### For code changes: - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [ ] I have tested my changes according to the test plan: - [ ] New unauthenticated user: open `https://platform.agpt.co/signup?triggerprompt=Hello%20world`, complete email + password signup, finish onboarding, confirm `/copilot` auto-submits "Hello world" as the first message. - [ ] Same flow via Google OAuth. - [ ] Existing logged-in user: open `https://platform.agpt.co/signup?triggerprompt=Hello`, confirm OnboardingProvider routes through to `/copilot` and the prompt auto-submits. - [ ] Existing logged-in user with onboarding incomplete: same URL, confirm onboarding completes then `/copilot` auto-submits. - [ ] Refreshing `/signup?triggerprompt=...` after the URL is stripped does not lose the prompt (sessionStorage persists until consumed on `/copilot`). - [ ] Existing workflow-import flow (`/copilot?source=import&autosubmit=true` + sessionStorage) still auto-submits the imported workflow prompt. - [ ] Existing `/copilot#prompt=...&autosubmit=true` deep link (e.g. SitrepItem, LibraryAgentCard) still works. #### For configuration changes: - [x] `.env.default` is updated or already compatible with my changes - [x] `docker-compose.yml` is updated or already compatible with my changes - [x] I have included a list of my configuration changes in the PR description (under **Changes**) _No configuration changes._
U
Ubbe committed
a59ff3c35a3dd8e5fa30d2c241a9137c2408fa05
Parent: c194ab1
Committed by Lluis Agusti <hi@llu.lu>
on 5/29/2026, 3:06:34 PM