mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
Merge 80b3d8c272 into b867ec9145
This commit is contained in:
commit
bfccfd9e56
2 changed files with 41 additions and 3 deletions
|
|
@ -100,11 +100,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,
|
||||
}
|
||||
}, [listApiConfigMeta, currentApiConfigName])
|
||||
|
||||
|
|
@ -1309,7 +1314,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 || []}
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue