π OpenHands: AI-Driven Development
fix: open LLM settings from model dropdown (#1664)
Engel Nystab893f288a82
diff --git a/__tests__/components/features/chat/components/chat-input-model.test.tsx b/__tests__/components/features/chat/components/chat-input-model.test.tsxindex 8e8ac2589f..f29937b3d0 100644--- a/__tests__/components/features/chat/components/chat-input-model.test.tsx+++ b/__tests__/components/features/chat/components/chat-input-model.test.tsx@@ -68,7 +68,7 @@ describe("ChatInputModel", () => {const llmSettingsLink = screen.getByRole("link", {name: /LLM Profiles|SETTINGS\$LLM_PROFILES|LLM Settings|SETTINGS\$LLM_SETTINGS/,});- expect(llmSettingsLink).toHaveAttribute("href", "/settings");+ expect(llmSettingsLink).toHaveAttribute("href", "/settings/llm");});it("renders nothing when llm_model is missing", () => {diff --git a/__tests__/hooks/use-chat-input-model-state.test.tsx b/__tests__/hooks/use-chat-input-model-state.test.tsxindex 7ac2a852d8..9ea4143f33 100644--- a/__tests__/hooks/use-chat-input-model-state.test.tsx+++ b/__tests__/hooks/use-chat-input-model-state.test.tsx@@ -48,7 +48,7 @@ const acpContext = (isActiveAcpConversation: false,isHomeAcp: false,isAcpContext: false,- destinationPath: "/settings",+ destinationPath: "/settings/llm",destinationLabel: "LLM Profiles",...overrides,});@@ -83,7 +83,7 @@ describe("useChatInputModelState", () => {expect(result.current.showAcpPicker).toBe(false);// switchConversationId is ACP-only β null for native conversations.expect(result.current.switchConversationId).toBeNull();- expect(result.current.destinationPath).toBe("/settings");+ expect(result.current.destinationPath).toBe("/settings/llm");});it("non-ACP: falls back to settings.llm_model when the conversation has none", () => {diff --git a/src/hooks/use-acp-model-context.ts b/src/hooks/use-acp-model-context.tsindex 63e0e91aa2..f50285c403 100644--- a/src/hooks/use-acp-model-context.ts+++ b/src/hooks/use-acp-model-context.ts@@ -5,6 +5,9 @@ import { useSettings } from "#/hooks/query/use-settings";import { useActiveAgentKind } from "#/hooks/use-active-agent-profile";import { I18nKey } from "#/i18n/declaration";+const AGENT_SETTINGS_PATH = "/settings/agents";+const LLM_SETTINGS_PATH = "/settings/llm";+export interface AcpModelContext {/** The active conversation runs an ACP agent. */isActiveAcpConversation: boolean;@@ -17,7 +20,7 @@ export interface AcpModelContext {/** Either of the above: the model affordance should defer to the ACP picker. */isAcpContext: boolean;/** Where the model/settings link should navigate. */- destinationPath: "/settings/agents" | "/settings";+ destinationPath: typeof AGENT_SETTINGS_PATH | typeof LLM_SETTINGS_PATH;/** Translated label for that link. */destinationLabel: string;}@@ -44,7 +47,9 @@ export function useAcpModelContext(): AcpModelContext {(activeAgentKind ?? settings?.agent_settings?.agent_kind) === "acp";const isAcpContext = isActiveAcpConversation || isHomeAcp;- const destinationPath = isAcpContext ? "/settings/agents" : "/settings";+ const destinationPath = isAcpContext+ ? AGENT_SETTINGS_PATH+ : LLM_SETTINGS_PATH;const destinationLabel = t(isAcpContext? I18nKey.SETTINGS$NAV_AGENTdiff --git a/src/hooks/use-chat-input-model-state.ts b/src/hooks/use-chat-input-model-state.tsindex c63f42a709..f5cb99f36c 100644--- a/src/hooks/use-chat-input-model-state.ts+++ b/src/hooks/use-chat-input-model-state.ts@@ -1,6 +1,9 @@import { useActiveConversation } from "#/hooks/query/use-active-conversation";import { useSettings } from "#/hooks/query/use-settings";-import { useAcpModelContext } from "#/hooks/use-acp-model-context";+import {+ type AcpModelContext,+ useAcpModelContext,+} from "#/hooks/use-acp-model-context";import { useOptionalConversationId } from "#/hooks/use-conversation-id";import {getAcpPreferredDefaultModel,@@ -17,7 +20,7 @@ export interface ChatInputModelState {availableAcpModels: ACPModelOption[];showAcpPicker: boolean;switchConversationId: string | null;- destinationPath: "/settings/agents" | "/settings";+ destinationPath: AcpModelContext["destinationPath"];destinationLabel: string;}