diff --git a/apps/web/src/components/chat/ModelListRow.tsx b/apps/web/src/components/chat/ModelListRow.tsx index 74dae2dc23582..22865a0691dea 100644 --- a/apps/web/src/components/chat/ModelListRow.tsx +++ b/apps/web/src/components/chat/ModelListRow.tsx @@ -7,6 +7,7 @@ import { ComboboxItem } from "../ui/combobox"; import { Button } from "../ui/button"; import { Badge } from "../ui/badge"; import { Kbd } from "../ui/kbd"; +import { MiddleTruncate } from "../ui/middle-truncate"; import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip"; import { cn } from "~/lib/utils"; import { modelPickerModelKey } from "./modelPickerKeys"; @@ -36,11 +37,14 @@ export const ModelListRow = memo(function ModelListRow(props: { onToggleFavorite: (instanceId: ProviderInstanceId, slug: string) => void; }) { const gt = useGT(); - const model = { + const displayName = getDisplayModelName({ slug: props.slug, name: props.name, subProvider: props.subProvider, - }; + }); + const lastSlash = displayName.lastIndexOf("/"); + // The slash stays in the head: MiddleTruncate needs 5+ head characters to split, so "meta/" must count. + const pathTail = lastSlash > 0 ? Array.from(displayName.slice(lastSlash + 1)).length : undefined; const row = (
-
{ - const name = event.currentTarget; - name.title = name.scrollWidth > name.clientWidth ? getDisplayModelName(model) : ""; - }} - > - {getDisplayModelName(model)} +
+ {/* Custom models often share a long path, so the cut takes the path and keeps the model + name whole. Its "…" would be read aloud, so screen readers get the sr-only name below. */} +
{props.isSelected ?