mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-02-16 17:55:55 -05:00
### Changes 🏗️ <img width="1920" height="998" alt="Screenshot 2026-01-19 at 22 14 51" src="https://github.com/user-attachments/assets/ecd1c241-6f77-4702-9774-5e58806b0b64" /> This PR lays the groundwork for the new UX of AutoGPT Copilot. - moves the Copilot to its own route `/copilot` - Makes the Copilot the homepage when enabled - Updates the labelling of the homepage icons - Makes the Library the homepage when Copilot is disabled - Improves Copilot's: - session handling - styles and UX - message parsing ### Other improvements - Improve the log out UX by adding a new `/logout` page and using a re-direct ### Checklist 📋 #### For code changes: - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [x] I have tested my changes according to the test plan: - [x] Run locally and test the above <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Launches the new Copilot experience and aligns API behavior with the UI. > > - **Routing/Home**: Add `/copilot` with `CopilotShell` (desktop sidebar + mobile drawer), make homepage route flag-driven; update login/signup/error redirects and root page to use `getHomepageRoute`. > - **Chat UX**: Replace legacy chat with `components/contextual/Chat/*` (new message list, bubbles, tool call/response formatting, stop button, initial-prompt handling, refined streaming/error handling); remove old platform chat components. > - **Sessions**: Add paginated session list (infinite load), auto-select/create logic, mobile/desktop navigation, and improved session fetching/claiming guards. > - **Auth/Logout**: New `/logout` flow with delayed redirect; gate various queries on auth state and logout-in-progress. > - **Backend**: `GET /api/chat/sessions/{id}` returns `null` instead of 404; service saves assistant message on `StreamFinish` to avoid loss and prevents duplicate saves; OpenAPI updated accordingly. > - **Misc**: Minor UI polish in library modals, loader styling, docs (CONTRIBUTING) additions, and small formatting fixes in block docs generator. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 1b4776dcf52ccd6987830ada3a58a87a160ce36c. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
80 lines
3.4 KiB
Markdown
80 lines
3.4 KiB
Markdown
# AutoGPT Platform Contribution Guide
|
||
|
||
This guide provides context for Codex when updating the **autogpt_platform** folder.
|
||
|
||
## Directory overview
|
||
|
||
- `autogpt_platform/backend` – FastAPI based backend service.
|
||
- `autogpt_platform/autogpt_libs` – Shared Python libraries.
|
||
- `autogpt_platform/frontend` – Next.js + Typescript frontend.
|
||
- `autogpt_platform/docker-compose.yml` – development stack.
|
||
|
||
See `docs/content/platform/getting-started.md` for setup instructions.
|
||
|
||
## Code style
|
||
|
||
- Format Python code with `poetry run format`.
|
||
- Format frontend code using `pnpm format`.
|
||
|
||
|
||
## Frontend guidelines:
|
||
|
||
See `/frontend/CONTRIBUTING.md` for complete patterns. Quick reference:
|
||
|
||
1. **Pages**: Create in `src/app/(platform)/feature-name/page.tsx`
|
||
- Add `usePageName.ts` hook for logic
|
||
- Put sub-components in local `components/` folder
|
||
2. **Components**: Structure as `ComponentName/ComponentName.tsx` + `useComponentName.ts` + `helpers.ts`
|
||
- Use design system components from `src/components/` (atoms, molecules, organisms)
|
||
- Never use `src/components/__legacy__/*`
|
||
3. **Data fetching**: Use generated API hooks from `@/app/api/__generated__/endpoints/`
|
||
- Regenerate with `pnpm generate:api`
|
||
- Pattern: `use{Method}{Version}{OperationName}`
|
||
4. **Styling**: Tailwind CSS only, use design tokens, Phosphor Icons only
|
||
5. **Testing**: Add Storybook stories for new components, Playwright for E2E
|
||
6. **Code conventions**: Function declarations (not arrow functions) for components/handlers
|
||
- Component props should be `interface Props { ... }` (not exported) unless the interface needs to be used outside the component
|
||
- Separate render logic from business logic (component.tsx + useComponent.ts + helpers.ts)
|
||
- Colocate state when possible and avoid creating large components, use sub-components ( local `/components` folder next to the parent component ) when sensible
|
||
- Avoid large hooks, abstract logic into `helpers.ts` files when sensible
|
||
- Use function declarations for components, arrow functions only for callbacks
|
||
- No barrel files or `index.ts` re-exports
|
||
- Do not use `useCallback` or `useMemo` unless strictly needed
|
||
- Avoid comments at all times unless the code is very complex
|
||
|
||
## Testing
|
||
|
||
- Backend: `poetry run test` (runs pytest with a docker based postgres + prisma).
|
||
- Frontend: `pnpm test` or `pnpm test-ui` for Playwright tests. See `docs/content/platform/contributing/tests.md` for tips.
|
||
|
||
Always run the relevant linters and tests before committing.
|
||
Use conventional commit messages for all commits (e.g. `feat(backend): add API`).
|
||
Types:
|
||
- feat
|
||
- fix
|
||
- refactor
|
||
- ci
|
||
- dx (developer experience)
|
||
Scopes:
|
||
- platform
|
||
- platform/library
|
||
- platform/marketplace
|
||
- backend
|
||
- backend/executor
|
||
- frontend
|
||
- frontend/library
|
||
- frontend/marketplace
|
||
- blocks
|
||
|
||
## Pull requests
|
||
|
||
- Use the template in `.github/PULL_REQUEST_TEMPLATE.md`.
|
||
- Rely on the pre-commit checks for linting and formatting
|
||
- Fill out the **Changes** section and the checklist.
|
||
- Use conventional commit titles with a scope (e.g. `feat(frontend): add feature`).
|
||
- Keep out-of-scope changes under 20% of the PR.
|
||
- Ensure PR descriptions are complete.
|
||
- For changes touching `data/*.py`, validate user ID checks or explain why not needed.
|
||
- If adding protected frontend routes, update `frontend/lib/supabase/middleware.ts`.
|
||
- Use the linear ticket branch structure if given codex/open-1668-resume-dropped-runs
|