Skip to content

Commit

Permalink
feat: model selection shows toggle even if only one variant
Browse files Browse the repository at this point in the history
  • Loading branch information
Neet-Nestor committed Nov 9, 2024
1 parent 48be91a commit 3e9a1fd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
18 changes: 3 additions & 15 deletions app/components/model-row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ interface ModelRowProps {
baseModel: string;
variants: string[];
isExpanded: boolean;
hasSingleVariant: boolean;
determineModelIcon: (model: string) => JSX.Element;
extractModelDetails: (model: string) => {
displayName: string;
Expand All @@ -22,40 +21,29 @@ const ModelRow: React.FC<ModelRowProps> = ({
baseModel,
variants,
isExpanded,
hasSingleVariant,
determineModelIcon,
extractModelDetails,
onSelectModel,
onClose,
handleToggleExpand,
}) => {
const { quantBadge } = hasSingleVariant
? extractModelDetails(variants[0])
: { quantBadge: null };

return (
<div className={style["row"]} key={baseModel}>
<div
className={style["summary-continer"]}
onClick={() => {
if (hasSingleVariant) {
onSelectModel(variants[0]);
onClose();
} else {
handleToggleExpand(baseModel);
}
handleToggleExpand(baseModel);
}}
>
<div className={style["summary"]}>
<div className={style["summary-model-info"]}>
{determineModelIcon(variants[0])}
<span>{baseModel}</span>
{hasSingleVariant && quantBadge && <span>{quantBadge}</span>}
</div>
{!hasSingleVariant && (isExpanded ? <ChevronUp /> : <ChevronDown />)}
{isExpanded ? <ChevronUp /> : <ChevronDown />}
</div>
</div>
{isExpanded && !hasSingleVariant && (
{isExpanded && (
<div className={style["expanded"]}>
{variants.map((variant) => {
const { quantBadge } = extractModelDetails(variant);
Expand Down
1 change: 0 additions & 1 deletion app/components/model-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ const ModelSelect: React.FC<ModelSearchProps> = ({
baseModel={model[0]}
variants={model[1]}
isExpanded={expandedModels.has(model[0])}
hasSingleVariant={model[1].length === 1}
determineModelIcon={determineModelIcon}
extractModelDetails={extractModelDetails}
onSelectModel={onSelectModel}
Expand Down

0 comments on commit 3e9a1fd

Please sign in to comment.