Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions webview-ui/src/components/chat/ChatTextArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,16 @@ export const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
} = useExtensionState()

// Find the ID and display text for the currently selected API configuration.
const { currentConfigId, displayName } = useMemo(() => {
const { currentConfigId, displayName, tooltipContent } = useMemo(() => {
const currentConfig = listApiConfigMeta?.find((config) => config.name === currentApiConfigName)
const configName = currentApiConfigName || ""
const modelId = currentConfig?.modelId
return {
currentConfigId: currentConfig?.id || "",
displayName: currentApiConfigName || "", // Use the name directly for display.
displayName: modelId ? `${configName} · ${modelId}` : configName,
tooltipContent: modelId
? `${configName}${currentConfig?.apiProvider ? ` (${currentConfig.apiProvider})` : ""} · ${modelId}`
: configName,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When modelId is absent, tooltipContent is set to configName -- the same value as displayName. This makes the tooltip redundant (identical to the button label). It also prevents the || t("chat:selectApiConfig") fallback on line 1318 from ever triggering, so the original instructional tooltip text is lost for any config with a non-empty name. Setting this branch to "" would let the i18n fallback work correctly when there is no extra model info to display.

Suggested change
: configName,
: "",

Fix it with Roo Code or mention @roomote and request a fix.

}
}, [listApiConfigMeta, currentApiConfigName])

Expand Down Expand Up @@ -1310,7 +1315,7 @@ export const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
value={currentConfigId}
displayName={displayName}
disabled={selectApiConfigDisabled}
title={t("chat:selectApiConfig")}
title={tooltipContent || t("chat:selectApiConfig")}
onChange={handleApiConfigChange}
triggerClassName="min-w-[28px] text-ellipsis overflow-hidden flex-shrink"
listApiConfigMeta={listApiConfigMeta || []}
Expand Down
33 changes: 33 additions & 0 deletions webview-ui/src/components/chat/__tests__/ChatTextArea.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,39 @@ describe("ChatTextArea", () => {
expect(apiConfigDropdown).toHaveAttribute("disabled")
})

it("should display model ID alongside config name when modelId is available", () => {
;(useExtensionState as ReturnType<typeof vi.fn>).mockReturnValue({
filePaths: [],
openedTabs: [],
taskHistory: [],
cwd: "/test/workspace",
currentApiConfigName: "my-config",
listApiConfigMeta: [
{ id: "cfg1", name: "my-config", apiProvider: "anthropic", modelId: "claude-sonnet-4-20250514" },
],
})

render(<ChatTextArea {...defaultProps} />)
const apiConfigDropdown = getApiConfigDropdown()
expect(apiConfigDropdown).toHaveTextContent("my-config · claude-sonnet-4-20250514")
})

it("should display only config name when modelId is not available", () => {
;(useExtensionState as ReturnType<typeof vi.fn>).mockReturnValue({
filePaths: [],
openedTabs: [],
taskHistory: [],
cwd: "/test/workspace",
currentApiConfigName: "my-config",
listApiConfigMeta: [{ id: "cfg1", name: "my-config" }],
})

render(<ChatTextArea {...defaultProps} />)
const apiConfigDropdown = getApiConfigDropdown()
expect(apiConfigDropdown).toHaveTextContent("my-config")
expect(apiConfigDropdown).not.toHaveTextContent("·")
})

describe("enter key behavior", () => {
it("should send on Enter and allow newline on Shift+Enter in default mode", () => {
const onSend = vi.fn()
Expand Down
Loading