Skip to content

Commit 121df07

Browse files
committed
feat: remove model header constant in chat model picker
1 parent 769a175 commit 121df07

3 files changed

Lines changed: 8 additions & 19 deletions

File tree

frontend/components/ui/input.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function Input({ className, type, ...props }: React.ComponentProps<"input">) {
88
type={type}
99
data-slot="input"
1010
className={cn(
11-
"h-8 w-full min-w-0 rounded-md border border-input/40 bg-transparent px-3 py-1 text-xs shadow-none transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-8 file:border-0 file:bg-transparent file:text-xs file:font-medium file:text-foreground placeholder:text-xs placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-xs dark:bg-input/30",
11+
"h-8 w-full min-w-0 rounded-md border border-input/40 bg-transparent px-3 py-1 text-xs shadow-none transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-8 file:border-0 file:bg-transparent file:text-xs file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-xs dark:bg-input/30",
1212
"focus-visible:border-ring/60 focus-visible:ring-[1px] focus-visible:ring-ring/40",
1313
"aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",
1414
className

frontend/components/ui/textarea.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function Textarea({ className, ...props }: React.ComponentProps<"textarea">) {
77
<textarea
88
data-slot="textarea"
99
className={cn(
10-
"flex field-sizing-content min-h-16 w-full rounded-md border border-input/40 bg-transparent px-3 py-2 text-xs shadow-none transition-[color,box-shadow] outline-none placeholder:text-muted-foreground placeholder:text-xs focus-visible:border-ring/60 focus-visible:ring-[1px] focus-visible:ring-ring/40 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:aria-invalid:ring-destructive/40",
10+
"flex field-sizing-content min-h-16 w-full rounded-md border border-input/40 bg-transparent px-3 py-2 text-xs shadow-none transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring/60 focus-visible:ring-[1px] focus-visible:ring-ring/40 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:aria-invalid:ring-destructive/40",
1111
className
1212
)}
1313
{...props}

frontend/features/chat/components/sections/chat-model-picker.tsx

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { cn } from "@/lib/utils";
2020
const MODEL_MENU_MAX_HEIGHT = 320;
2121
const MODEL_MENU_VENDOR_ROW_HEIGHT = 28;
2222
const MODEL_MENU_MODEL_ROW_HEIGHT = 28;
23-
const MODEL_MENU_MODEL_HEADER_HEIGHT = 28;
23+
const MODEL_MENU_MODEL_PANEL_CHROME_HEIGHT = 12;
2424
const MODEL_MENU_TEXT_WIDTH_UNIT = 7;
2525
const MODEL_MENU_CONTENT_GAP_WIDTH = 56;
2626
const MODEL_MENU_VIEWPORT_GUTTER = 24;
@@ -549,7 +549,7 @@ export function ChatModelPicker({
549549
return resolveModelMenuMaxHeight(
550550
activeDesktopVendorGroup?.items.length ?? 0,
551551
MODEL_MENU_MODEL_ROW_HEIGHT,
552-
MODEL_MENU_MODEL_HEADER_HEIGHT + 12,
552+
MODEL_MENU_MODEL_PANEL_CHROME_HEIGHT,
553553
);
554554
},
555555
[activeDesktopVendorGroup, desktopModelPanelLayout],
@@ -662,23 +662,23 @@ export function ChatModelPicker({
662662
desktopModelMenuWidthValue,
663663
Math.max(0, window.innerWidth - MODEL_MENU_COLLISION_GUTTER * 2),
664664
);
665-
const headerAndPaddingHeight = MODEL_MENU_MODEL_HEADER_HEIGHT + 12;
665+
const panelChromeHeight = MODEL_MENU_MODEL_PANEL_CHROME_HEIGHT;
666666
const contentHeight = Math.min(activeDesktopVendorGroup.items.length * MODEL_MENU_MODEL_ROW_HEIGHT, MODEL_MENU_MAX_HEIGHT);
667667
const initialListHeight = Math.min(
668668
contentHeight,
669669
Math.max(
670670
MODEL_MENU_MODEL_ROW_HEIGHT,
671-
window.innerHeight - menuRect.top - MODEL_MENU_COLLISION_GUTTER - headerAndPaddingHeight,
671+
window.innerHeight - menuRect.top - MODEL_MENU_COLLISION_GUTTER - panelChromeHeight,
672672
),
673673
);
674-
const initialPanelHeight = headerAndPaddingHeight + initialListHeight;
674+
const initialPanelHeight = panelChromeHeight + initialListHeight;
675675
const y = Math.min(
676676
Math.max(menuRect.top, MODEL_MENU_COLLISION_GUTTER),
677677
Math.max(MODEL_MENU_COLLISION_GUTTER, window.innerHeight - initialPanelHeight - MODEL_MENU_COLLISION_GUTTER),
678678
);
679679
const listMaxHeight = Math.min(
680680
contentHeight,
681-
Math.max(MODEL_MENU_MODEL_ROW_HEIGHT, window.innerHeight - y - MODEL_MENU_COLLISION_GUTTER - headerAndPaddingHeight),
681+
Math.max(MODEL_MENU_MODEL_ROW_HEIGHT, window.innerHeight - y - MODEL_MENU_COLLISION_GUTTER - panelChromeHeight),
682682
);
683683
const rightX = menuRect.right + MODEL_MENU_PANEL_GAP;
684684
const leftX = menuRect.left - MODEL_MENU_PANEL_GAP - panelWidth;
@@ -898,17 +898,6 @@ export function ChatModelPicker({
898898
width: desktopModelPanelLayout.width,
899899
}}
900900
>
901-
<div className="flex h-7 items-center justify-between gap-3 px-2">
902-
<span className="flex min-w-0 items-center gap-2">
903-
<LobeHubIcon iconUrl={resolveLobeHubIconURL(activeDesktopVendorGroup.icon)} label={activeDesktopVendorGroup.label} />
904-
<span className="truncate text-[11px] font-medium text-foreground">
905-
{activeDesktopVendorGroup.label}
906-
</span>
907-
</span>
908-
<span className="text-[10px] font-medium text-muted-foreground">
909-
{activeDesktopVendorGroup.items.length}
910-
</span>
911-
</div>
912901
<ModelMenuScrollContainer maxHeight={desktopModelMenuMaxHeight}>
913902
<div className="flex flex-col gap-0.5">
914903
{activeDesktopVendorGroup.items.map((item) => (

0 commit comments

Comments
 (0)