Skip to content

🙌 OpenHands: AI-Driven Development

fix: clarify local llm profiles ui (#534)

Engel Nyst40032f97c8b9
diff --git a/AGENTS.md b/AGENTS.md
index f899673b88..65c7f2e4ec 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -430,4 +430,6 @@ return new ConversationClient(getAgentServerClientOptions()).someMethod(...);
- Collapsible thinking: `ThinkAction` events and LLM extended reasoning (`reasoning_content` / `thinking_blocks` on `ActionEvent`) are rendered as collapsible sections via `CollapsibleThinking` (`src/components/conversation-events/chat/event-message-components/collapsible-thinking.tsx`). Collapsed by default to keep the chat compact — the thinking is often in English regardless of the user's conversation language. The `getReasoningContent()` helper in `event-thought-helpers.ts` extracts the content, preferring `reasoning_content` (plain string) and falling back to Anthropic `thinking_blocks`. i18n keys: `THINKING$TITLE`, `THINKING$EXPAND`, `THINKING$COLLAPSE`. Tests: `__tests__/components/conversation-events/chat/event-message-think-action.test.tsx`.
+- Settings naming is backend-aware today: local `/settings` is profile-oriented (`use-settings-nav-items.ts` renames the first settings item/title/subtitle to `LLM Profiles` and `chat-input-model.tsx` / `chat-input-actions.tsx` link there as `LLM Profiles`), while cloud keeps the generic `LLM Settings` copy because cloud still edits raw settings rather than saved profiles. The local profile editor (`llm-settings-local-view.tsx`) should keep explicit create/edit profile headings plus helper text so users know they are saving a profile, not mutating the current conversation directly.
+
- ESLint config (flat, ESLint 9): the project uses `eslint.config.js` (not `.eslintrc`) and runs on `[email protected]`, not 10. The constraint pinning us below 10 is `[email protected]`, which still calls `context.getFilename()` at rule-load time — that API was removed in ESLint 10 and `@eslint/compat`'s `fixupPluginRules` does NOT shim it. Don't try to bump eslint past 9 until eslint-plugin-react ships a v10-compatible release. Import rules come from `eslint-plugin-import-x` (the maintained fork of `eslint-plugin-import`) but are registered under both `import-x/` and `import/` prefixes via `plugins: { import: importXPlugin, ... }` so existing `// eslint-disable-next-line import/...` directives keep working. `linterOptions.reportUnusedDisableDirectives` is set to `"warn"` (not "off") so stale airbnb-era disable comments still surface in lint output without failing CI. The TS-overrides block has an `ignores: ["src/hooks/query/query-keys.ts"]` so the `no-restricted-syntax` rule banning raw `["settings", ...]` query keys doesn't fire on the file that defines the helpers themselves. No `.npmrc` / `legacy-peer-deps` flag is needed — all our plugins declare ESLint 9 peer compatibility.
diff --git a/__tests__/components/features/chat/components/chat-input-model.test.tsx b/__tests__/components/features/chat/components/chat-input-model.test.tsx
index d34406b479..e7db0682ba 100644
--- a/__tests__/components/features/chat/components/chat-input-model.test.tsx
+++ b/__tests__/components/features/chat/components/chat-input-model.test.tsx
@@ -46,7 +46,7 @@ describe("ChatInputModel", () => {
const popover = screen.getByTestId("chat-input-llm-model-popover");
expect(popover).toHaveTextContent("openai/gpt-4o");
const llmSettingsLink = screen.getByRole("link", {
- name: /LLM Settings|SETTINGS\$LLM_SETTINGS/,
+ name: /LLM Profiles|SETTINGS\$LLM_PROFILES|LLM Settings|SETTINGS\$LLM_SETTINGS/,
});
expect(llmSettingsLink).toHaveAttribute("href", "/settings");
});
diff --git a/__tests__/components/settings/llm-profiles/llm-settings-local-view.test.tsx b/__tests__/components/settings/llm-profiles/llm-settings-local-view.test.tsx
index fcb7356c91..c48a4449ae 100644
--- a/__tests__/components/settings/llm-profiles/llm-settings-local-view.test.tsx
+++ b/__tests__/components/settings/llm-profiles/llm-settings-local-view.test.tsx
@@ -125,6 +125,10 @@ describe("LlmSettingsLocalView", () => {
// Should show create view elements (profile name input and back button)
expect(screen.getByTestId("profile-name-input")).toBeInTheDocument();
expect(screen.getByTestId("back-to-profiles")).toBeInTheDocument();
+ expect(
+ screen.getByText(/Add LLM Profile|SETTINGS\$ADD_LLM_PROFILE/),
+ ).toBeInTheDocument();
+ expect(screen.getByTestId("profile-editor-description")).toBeInTheDocument();
});
it("returns to list view when back button clicked", async () => {
@@ -333,6 +337,13 @@ describe("LlmSettingsLocalView", () => {
expect(nameInput).toHaveValue("gpt-4-profile");
});
+ expect(
+ screen.getByText(/Edit LLM Profile|SETTINGS\$EDIT_LLM_PROFILE/),
+ ).toBeInTheDocument();
+ expect(screen.getByTestId("profile-editor-description")).toHaveTextContent(
+ /gpt-4-profile|SETTINGS\$PROFILE_LOADED/,
+ );
+
// Verify getProfile was called with the correct profile name
expect(ProfilesService.getProfile).toHaveBeenCalledWith(
"gpt-4-profile",
diff --git a/__tests__/hooks/use-settings-nav-items.test.tsx b/__tests__/hooks/use-settings-nav-items.test.tsx
index 891d26c8a4..f923b8aca1 100644
--- a/__tests__/hooks/use-settings-nav-items.test.tsx
+++ b/__tests__/hooks/use-settings-nav-items.test.tsx
@@ -5,11 +5,21 @@ import { useSettingsNavItems } from "#/hooks/use-settings-nav-items";
import { WebClientConfig } from "#/api/option-service/option.types";
const useConfigMock = vi.fn();
+const useActiveBackendMock = vi.fn<
+ () => { backend: { kind: "local" | "cloud" }; orgId: string | null }
+>(() => ({
+ backend: { kind: "local" },
+ orgId: null,
+}));
vi.mock("#/hooks/query/use-config", () => ({
useConfig: () => useConfigMock(),
}));
+vi.mock("#/contexts/active-backend-context", () => ({
+ useActiveBackend: () => useActiveBackendMock(),
+}));
+
const createConfig = (
feature_flags: Partial<WebClientConfig["feature_flags"]> = {},
): WebClientConfig => ({
@@ -30,11 +40,37 @@ const createConfig = (
describe("useSettingsNavItems", () => {
beforeEach(() => {
vi.clearAllMocks();
+ useActiveBackendMock.mockReturnValue({
+ backend: { kind: "local" },
+ orgId: null,
+ });
});
- it("returns the OSS settings items in order", () => {
+ it("renames the LLM settings item to LLM profiles on local backends", () => {
useConfigMock.mockReturnValue({ data: createConfig() });
+ const { result } = renderHook(() => useSettingsNavItems());
+ const llmItem = result.current.find(
+ (item) => item.type === "item" && item.item.to === "/settings",
+ );
+
+ expect(llmItem).toEqual({
+ type: "item",
+ item: {
+ ...OSS_NAV_ITEMS[0],
+ text: "SETTINGS$LLM_PROFILES",
+ subtitle: "SETTINGS$PAGE_LLM_PROFILES_SUBLINE",
+ },
+ });
+ });
+
+ it("keeps the generic LLM settings item on cloud backends", () => {
+ useConfigMock.mockReturnValue({ data: createConfig() });
+ useActiveBackendMock.mockReturnValue({
+ backend: { kind: "cloud" },
+ orgId: "org-123",
+ });
+
const { result } = renderHook(() => useSettingsNavItems());
expect(result.current).toEqual(
diff --git a/src/components/features/chat/components/chat-input-actions.tsx b/src/components/features/chat/components/chat-input-actions.tsx
index 350d87bf1b..230b8b711c 100644
--- a/src/components/features/chat/components/chat-input-actions.tsx
+++ b/src/components/features/chat/components/chat-input-actions.tsx
@@ -64,7 +64,11 @@ export function ChatInputActions({
// conversation route yet). Conversation-scoped actions below guard on this.
const { conversationId } = useOptionalConversationId();
const { data: conversation } = useActiveConversation();
- const isCloud = useActiveBackend().backend.kind === "cloud";
+ const { backend } = useActiveBackend();
+ const isCloud = backend.kind === "cloud";
+ const llmDestinationLabel = t(
+ isCloud ? I18nKey.SETTINGS$LLM_SETTINGS : I18nKey.SETTINGS$LLM_PROFILES,
+ );
const webSocketStatus = useUnifiedWebSocketStatus();
const { curAgentState } = useAgentState();
const { conversationMode, setConversationMode } = useConversationStore();
@@ -470,7 +474,7 @@ export function ChatInputActions({
className="shrink-0"
aria-hidden
/>
- <span>{t(I18nKey.SETTINGS$LLM_SETTINGS)}</span>
+ <span>{llmDestinationLabel}</span>
</NavigationLink>
</li>
</ContextMenu>
diff --git a/src/components/features/chat/components/chat-input-model.tsx b/src/components/features/chat/components/chat-input-model.tsx
index f21f77acb8..3033863291 100644
--- a/src/components/features/chat/components/chat-input-model.tsx
+++ b/src/components/features/chat/components/chat-input-model.tsx
@@ -7,6 +7,7 @@ import { NavigationLink } from "#/components/shared/navigation-link";
import { ContextMenu } from "#/ui/context-menu";
import { Divider } from "#/ui/divider";
import { I18nKey } from "#/i18n/declaration";
+import { useActiveBackend } from "#/contexts/active-backend-context";
import { cn } from "#/utils/utils";
import React from "react";
import { useTranslation } from "react-i18next";
@@ -22,11 +23,17 @@ function truncateModelLabel(model: string): string {
export function ChatInputModel() {
const { t } = useTranslation("openhands");
+ const { backend } = useActiveBackend();
const { data: conversation } = useActiveConversation();
// Home page has no active conversation; fall back to the user's default
// model so the switcher renders consistently across both surfaces.
const { data: settings } = useSettings();
const llmModel = conversation?.llm_model ?? settings?.llm_model;
+ const llmDestinationLabel = t(
+ backend.kind === "cloud"
+ ? I18nKey.SETTINGS$LLM_SETTINGS
+ : I18nKey.SETTINGS$LLM_PROFILES,
+ );
const [isPopoverOpen, setIsPopoverOpen] = React.useState(false);
const popoverRef = useClickOutsideElement<HTMLUListElement>(() => {
@@ -91,7 +98,7 @@ export function ChatInputModel() {
className="shrink-0"
aria-hidden
/>
- <span>{t(I18nKey.SETTINGS$LLM_SETTINGS)}</span>
+ <span>{llmDestinationLabel}</span>
</NavigationLink>
</li>
</ContextMenu>
diff --git a/src/components/features/settings/llm-profiles/llm-settings-local-view.tsx b/src/components/features/settings/llm-profiles/llm-settings-local-view.tsx
index 944c46c738..b60ac0de96 100644
--- a/src/components/features/settings/llm-profiles/llm-settings-local-view.tsx
+++ b/src/components/features/settings/llm-profiles/llm-settings-local-view.tsx
@@ -252,23 +252,42 @@ export function LlmSettingsLocalView() {
);
}
+ const profileEditorTitle =
+ viewMode === "edit"
+ ? t(I18nKey.SETTINGS$EDIT_LLM_PROFILE)
+ : t(I18nKey.SETTINGS$ADD_LLM_PROFILE);
+ const profileEditorDescription =
+ viewMode === "edit" && editingProfile
+ ? t(I18nKey.SETTINGS$PROFILE_LOADED, {
+ name: editingProfile.profile.name,
+ })
+ : t(I18nKey.SETTINGS$PROFILE_SAVE_HINT);
+
// Create/Edit view: show form with profile name input
return (
<div className="flex flex-col gap-6">
{/* Header with back button */}
- <div className="flex items-center gap-3">
- <button
- type="button"
- onClick={handleBackToList}
- className="p-2 rounded-lg hover:bg-tertiary text-neutral-400 hover:text-white transition-colors"
- aria-label={t(I18nKey.BUTTON$BACK)}
- data-testid="back-to-profiles"
+ <div className="flex flex-col gap-2">
+ <div className="flex items-center gap-3">
+ <button
+ type="button"
+ onClick={handleBackToList}
+ className="p-2 rounded-lg hover:bg-tertiary text-neutral-400 hover:text-white transition-colors"
+ aria-label={t(I18nKey.BUTTON$BACK)}
+ data-testid="back-to-profiles"
+ >
+ <ArrowLeft size={20} />
+ </button>
+ <h2 className="text-base font-semibold text-white">
+ {profileEditorTitle}
+ </h2>
+ </div>
+ <p
+ data-testid="profile-editor-description"
+ className="text-sm leading-5 text-tertiary-light"
>
- <ArrowLeft size={20} />
- </button>
- <h2 className="text-base font-semibold text-white">
- {t(I18nKey.SETTINGS$BACK_TO_LLM_PROFILES_LIST)}
- </h2>
+ {profileEditorDescription}
+ </p>
</div>
{/* Profile name input */}
@@ -279,7 +298,7 @@ export function LlmSettingsLocalView() {
isRequired
/>
- {/* LLM Settings Form - key ensures form remounts when switching profiles */}
+ {/* Profile form - key ensures form remounts when switching profiles */}
<LlmSettingsScreen
key={
viewMode === "edit"
diff --git a/src/hooks/use-settings-nav-items.ts b/src/hooks/use-settings-nav-items.ts
index 69bf42c3de..589718d4fa 100644
--- a/src/hooks/use-settings-nav-items.ts
+++ b/src/hooks/use-settings-nav-items.ts
@@ -2,6 +2,7 @@ import { useConfig } from "#/hooks/query/use-config";
import { OSS_NAV_ITEMS, SettingsNavItem } from "#/constants/settings-nav";
import { isSettingsPageHidden } from "#/utils/settings-utils";
import { I18nKey } from "#/i18n/declaration";
+import { useActiveBackend } from "#/contexts/active-backend-context";
export type SettingsNavRenderedItem =
| { type: "item"; item: SettingsNavItem }
@@ -10,9 +11,27 @@ export type SettingsNavRenderedItem =
export function useSettingsNavItems(): SettingsNavRenderedItem[] {
const { data: config } = useConfig();
+ const { backend } = useActiveBackend();
const featureFlags = config?.feature_flags;
return OSS_NAV_ITEMS.filter(
(item) => !isSettingsPageHidden(item.to, featureFlags),
- ).map((item) => ({ type: "item", item }));
+ ).map((item) => {
+ if (item.to !== "/settings") {
+ return { type: "item", item };
+ }
+
+ return {
+ type: "item",
+ item: {
+ ...item,
+ text:
+ backend.kind === "local" ? I18nKey.SETTINGS$LLM_PROFILES : item.text,
+ subtitle:
+ backend.kind === "local"
+ ? I18nKey.SETTINGS$PAGE_LLM_PROFILES_SUBLINE
+ : item.subtitle,
+ },
+ };
+ });
}
diff --git a/src/i18n/translation.json b/src/i18n/translation.json
index f41b84d94c..78d41776a4 100644
--- a/src/i18n/translation.json
+++ b/src/i18n/translation.json
@@ -4997,6 +4997,23 @@
"uk": "Модель, API ключ та параметри агента.",
"ca": "Model, clau d'API i opcions per a l'agent."
},
+ "SETTINGS$PAGE_LLM_PROFILES_SUBLINE": {
+ "en": "Create, edit, and activate saved LLM profiles for the agent.",
+ "ja": "エージェント用の保存済みLLMプロファイルを作成、編集、有効化します。",
+ "zh-CN": "为代理创建、编辑和激活已保存的 LLM 配置文件。",
+ "zh-TW": "為代理建立、編輯和啟用已儲存的 LLM 設定檔。",
+ "ko-KR": "에이전트용 저장된 LLM 프로필을 생성, 편집 및 활성화합니다.",
+ "no": "Opprett, rediger og aktiver lagrede LLM-profiler for agenten.",
+ "it": "Crea, modifica e attiva profili LLM salvati per l'agente.",
+ "pt": "Crie, edite e ative perfis LLM salvos para o agente.",
+ "es": "Crea, edita y activa perfiles LLM guardados para el agente.",
+ "ar": "أنشئ وعدّل وفعّل ملفات تعريف LLM المحفوظة للوكيل.",
+ "fr": "Créez, modifiez et activez des profils LLM enregistrés pour l'agent.",
+ "tr": "Aracı için kayıtlı LLM profilleri oluşturun, düzenleyin ve etkinleştirin.",
+ "de": "Erstellen, bearbeiten und aktivieren Sie gespeicherte LLM-Profile für den Agenten.",
+ "uk": "Створюйте, редагуйте й активуйте збережені профілі LLM для агента.",
+ "ca": "Creeu, editeu i activeu perfils LLM desats per a l'agent."
+ },
"SETTINGS$PAGE_CONDENSER_SUBLINE": {
"en": "Summarize long chats to stay within context limits.",
"ja": "コンテキスト制限内に収まるよう、長いチャットを要約します。",
@@ -5660,6 +5677,23 @@
"uk": "LLM налаштування",
"ca": "Configuració del LLM"
},
+ "SETTINGS$LLM_PROFILES": {
+ "en": "LLM Profiles",
+ "ja": "LLMプロファイル",
+ "zh-CN": "LLM配置文件",
+ "zh-TW": "LLM設定檔",
+ "ko-KR": "LLM 프로필",
+ "de": "LLM-Profile",
+ "no": "LLM-profiler",
+ "it": "Profili LLM",
+ "pt": "Perfis LLM",
+ "es": "Perfiles LLM",
+ "ar": "ملفات تعريف LLM",
+ "fr": "Profils LLM",
+ "tr": "LLM profilleri",
+ "uk": "Профілі LLM",
+ "ca": "Perfils LLM"
+ },
"SETTINGS$GIT_SETTINGS": {
"en": "Git Settings",
"ja": "Git設定",