mirror of
https://github.com/coder/coder.git
synced 2026-11-06 00:03:36 +08:00
## Summary Refactors the admin-only "Configure Agents" dialog into a unified **Settings** dialog accessible to all users via a gear icon in the sidebar. ### What changed - **Settings gear in sidebar**: A gear icon now appears in the bottom-left of the sidebar (next to the user avatar dropdown). Clicking it opens the Settings dialog. This replaces the admin-only "Admin" button that was in the top toolbar. - **Custom Prompt tab** (all users): A new "Custom Prompt" tab is always visible in the dialog. Users can write personal instructions that are applied to all their new chats (stored per-user via the `/api/experimental/chats/config/user-prompt` endpoint). - **Admin tabs remain gated**: The Providers, Models, and Behavior (system prompt) tabs only appear for admin users, preserving the existing RBAC model. - **API + query hooks**: Added `getUserChatCustomPrompt` / `updateUserChatCustomPrompt` methods to the TypeScript API client and corresponding React Query hooks. ### Files changed | File | Change | |------|--------| | `site/src/api/api.ts` | Added GET/PUT methods for user custom prompt | | `site/src/api/queries/chats.ts` | Added query/mutation hooks for user custom prompt | | `site/src/pages/AgentsPage/ConfigureAgentsDialog.tsx` | Added "Custom Prompt" tab, renamed to "Settings" | | `site/src/pages/AgentsPage/AgentsSidebar.tsx` | Added settings gear button next to user dropdown | | `site/src/pages/AgentsPage/AgentsPageView.tsx` | Removed "Admin" button, pass `onOpenSettings` to sidebar | | `site/src/pages/AgentsPage/AgentsPage.tsx` | Wired up user prompt state, removed admin-only guard on dialog | | `*.stories.tsx` | Updated to match new prop interfaces |