Skip to content

Commit ea50c1f

Browse files
feat: add currently selected model row to popover and fix responsive truncate
1 parent c3a9112 commit ea50c1f

2 files changed

Lines changed: 23 additions & 11 deletions

File tree

frontend/src/components/message/PromptInput.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,10 +1230,10 @@ return (
12301230
directory={directory}
12311231
onOpenFullDialog={() => onShowModelsDialog?.()}
12321232
>
1233-
<button
1234-
className="px-2.5 py-0.5 md:px-3 min-h-[36px] rounded-lg text-xs md:text-sm font-medium border bg-muted border-border text-muted-foreground hover:bg-muted-foreground/10 hover:border-foreground/30 transition-colors cursor-pointer max-w-[90px] md:max-w-[220px] dark:border-white/30 flex flex-col items-start justify-center overflow-hidden"
1235-
>
1236-
<span className="truncate w-full text-left">{displayModelName || 'Select model'}</span>
1233+
<button
1234+
className="px-2.5 py-0.5 md:px-3 min-h-[36px] min-w-0 rounded-lg text-xs md:text-sm font-medium border bg-muted border-border text-muted-foreground hover:bg-muted-foreground/10 hover:border-foreground/30 transition-colors cursor-pointer w-full md:w-auto md:max-w-[220px] dark:border-white/30 flex flex-col items-start justify-center overflow-hidden"
1235+
>
1236+
<span className="truncate w-full text-left">{displayModelName || 'Select model'}</span>
12371237
{hasVariants && currentVariant && (
12381238
<span className="text-[10px] text-orange-500 truncate w-full text-center capitalize">{currentVariant}</span>
12391239
)}

frontend/src/components/model/ModelQuickSelect.tsx

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ export function ModelQuickSelect({
103103
toggleFavorite(model)
104104
}
105105

106+
const currentModelDisplayName = model ? getDisplayName(model.providerID, model.modelID) : ''
107+
const currentProviderName = model ? getProviderName(model.providerID) : ''
106108
const isCurrentFavorite = model
107109
? favoriteModels.some((favorite) => favorite.providerID === model.providerID && favorite.modelID === model.modelID)
108110
: false
@@ -116,13 +118,23 @@ export function ModelQuickSelect({
116118
</DropdownMenuTrigger>
117119
<DropdownMenuContent align="start" className="w-56">
118120
{model && (
119-
<DropdownMenuItem
120-
onClick={handleCurrentFavoriteToggle}
121-
className="flex items-center justify-between"
122-
>
123-
<span>{isCurrentFavorite ? 'Remove from favorites' : 'Add to favorites'}</span>
124-
<Star className={`h-4 w-4 ${isCurrentFavorite ? 'fill-yellow-400 text-yellow-400' : ''}`} />
125-
</DropdownMenuItem>
121+
<>
122+
<DropdownMenuItem className="flex items-center justify-between font-medium">
123+
<span className="truncate">
124+
{duplicateDisplayNames.has(currentModelDisplayName)
125+
? `${currentProviderName}/${currentModelDisplayName}`
126+
: currentModelDisplayName}
127+
</span>
128+
<Check className="h-4 w-4" />
129+
</DropdownMenuItem>
130+
<DropdownMenuItem
131+
onClick={handleCurrentFavoriteToggle}
132+
className="flex items-center justify-between"
133+
>
134+
<span>{isCurrentFavorite ? 'Remove from favorites' : 'Add to favorites'}</span>
135+
<Star className={`h-4 w-4 ${isCurrentFavorite ? 'fill-yellow-400 text-yellow-400' : ''}`} />
136+
</DropdownMenuItem>
137+
</>
126138
)}
127139

128140
{hasVariants && (

0 commit comments

Comments
 (0)