π OpenHands: AI-Driven Development
docs: add documentation for adding user settings and tooltips (#8634)
Xingyao Wangbe78cc07bd0a
diff --git a/.openhands/microagents/repo.md b/.openhands/microagents/repo.mdindex 22435340fe..655514d6a6 100644--- a/.openhands/microagents/repo.md+++ b/.openhands/microagents/repo.md@@ -66,3 +66,18 @@ These details may or may not be useful for your current task.- Actions with `thought` property are displayed in the UI based on their action type:- Regular actions (like "run", "edit") display the thought as a separate message- Special actions (like "think") are displayed as collapsible elements only++#### Adding User Settings:+- To add a new user setting to OpenHands, follow these steps:+ 1. Add the setting to the frontend:+ - Add the setting to the `Settings` type in `frontend/src/types/settings.ts`+ - Add the setting to the `ApiSettings` type in the same file+ - Add the setting with an appropriate default value to `DEFAULT_SETTINGS` in `frontend/src/services/settings.ts`+ - Update the `useSettings` hook in `frontend/src/hooks/query/use-settings.ts` to map the API response+ - Update the `useSaveSettings` hook in `frontend/src/hooks/mutation/use-save-settings.ts` to include the setting in API requests+ - Add UI components (like toggle switches) in the appropriate settings screen (e.g., `frontend/src/routes/app-settings.tsx`)+ - Add i18n translations for the setting name and any tooltips in `frontend/src/i18n/translation.json`+ - Add the translation key to `frontend/src/i18n/declaration.ts`+ 2. Add the setting to the backend:+ - Add the setting to the `Settings` model in `openhands/storage/data_models/settings.py`+ - Update any relevant backend code to apply the setting (e.g., in session creation)