From 00d3bd8316a4faa447743babfa287c760dcc81fd Mon Sep 17 00:00:00 2001 From: Saoud Rizwan <7799382+saoudrizwan@users.noreply.github.com> Date: Fri, 5 Dec 2025 12:50:31 -0800 Subject: [PATCH] refactor(ui): move model capabilities to Advanced section and fix layout - Move Images, Browser, Prompt Caching badges into collapsible Advanced section - Use consistent row styling (label: value) for capabilities - Fix InfoRow vertical spacing when items wrap (column-gap: 16px, row-gap: 4px) - Add bottom padding to model picker popup for breathing room - Remove unused Tooltip imports and badge styled components --- .../src/components/chat/ChatTextArea.tsx | 2 +- .../settings/common/ModelInfoView.tsx | 228 +++++++----------- 2 files changed, 91 insertions(+), 139 deletions(-) diff --git a/webview-ui/src/components/chat/ChatTextArea.tsx b/webview-ui/src/components/chat/ChatTextArea.tsx index 378eea01..4f5a4274 100644 --- a/webview-ui/src/components/chat/ChatTextArea.tsx +++ b/webview-ui/src/components/chat/ChatTextArea.tsx @@ -154,7 +154,7 @@ const ModelSelectorTooltip = styled.div` right: 15px; background: ${CODE_BLOCK_BG_COLOR}; border: 1px solid var(--vscode-editorGroup-border); - padding: 12px; + padding: 12px 12px 18px 12px; border-radius: 3px; z-index: 1000; max-height: calc(100vh - 100px); diff --git a/webview-ui/src/components/settings/common/ModelInfoView.tsx b/webview-ui/src/components/settings/common/ModelInfoView.tsx index 4c0e3053..32893f2c 100644 --- a/webview-ui/src/components/settings/common/ModelInfoView.tsx +++ b/webview-ui/src/components/settings/common/ModelInfoView.tsx @@ -2,7 +2,6 @@ import { geminiModels, ModelInfo } from "@shared/api" import { VSCodeDropdown, VSCodeOption } from "@vscode/webview-ui-toolkit/react" import { useState } from "react" import styled from "styled-components" -import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip" import { ModelDescriptionMarkdown } from "../ModelDescriptionMarkdown" import { formatPrice, hasThinkingBudget, supportsBrowserUse, supportsImages, supportsPromptCache } from "../utils/pricingUtils" @@ -10,7 +9,8 @@ import { formatPrice, hasThinkingBudget, supportsBrowserUse, supportsImages, sup const InfoRow = styled.div` display: flex; - gap: 16px; + column-gap: 16px; + row-gap: 4px; font-size: 12px; color: var(--vscode-foreground); margin-top: 8px; @@ -29,30 +29,6 @@ const InfoValue = styled.span` font-weight: 500; ` -const BadgesContainer = styled.div` - display: flex; - gap: 8px; - margin-top: 10px; - flex-wrap: wrap; -` - -const CapabilityBadge = styled.span<{ $isEnabled: boolean }>` - display: inline-flex; - align-items: center; - gap: 4px; - padding: 4px 10px; - font-size: 11px; - border-radius: 4px; - border: 1px solid var(--vscode-descriptionForeground); - color: ${({ $isEnabled }) => ($isEnabled ? "var(--vscode-foreground)" : "var(--vscode-descriptionForeground)")}; - background: transparent; - opacity: ${({ $isEnabled }) => ($isEnabled ? 1 : 0.5)}; -` - -const BadgeIcon = styled.span` - font-size: 12px; -` - const CollapsibleHeader = styled.div` display: flex; align-items: center; @@ -224,9 +200,6 @@ export const ModelInfoView = ({ // Check if we have cache pricing to show in Advanced section const hasCachePricing = modelInfo.supportsPromptCache && (modelInfo.cacheWritesPrice || modelInfo.cacheReadsPrice) - // Show Advanced section if we have cache pricing, tiers, or provider routing - const showAdvanced = hasCachePricing || hasTiers || showProviderRouting - return (
{/* Description */} @@ -260,120 +233,99 @@ export const ModelInfoView = ({ )} - {/* Capability Badges */} - - - - - - Images - - - Model can analyze images and screenshots - - - - - - Browser - - - Model can interact with web browsers - - {!isGemini && ( - - - - $ - {hasCaching ? "Caching enabled" : "Caching"} - - - Prompt caching reduces costs by reusing previous context - - )} - - {/* Collapsible Advanced Section */} - {showAdvanced && ( - <> - setAdvancedExpanded(!advancedExpanded)}> - ▶ - Advanced - - - - {/* Cache Pricing */} - {hasCachePricing && ( + setAdvancedExpanded(!advancedExpanded)}> + ▶ + Advanced + + + + {/* Capabilities */} + + Images + {hasImages ? "Yes" : "No"} + + + Browser + {hasBrowser ? "Yes" : "No"} + + {!isGemini && ( + + Prompt Caching + {hasCaching ? "Yes" : "No"} + + )} + + {/* Cache Pricing */} + {hasCachePricing && ( + <> + {modelInfo.cacheReadsPrice !== undefined && ( + + Cache Reads + {formatCompactPrice(modelInfo.cacheReadsPrice)} + + )} + {modelInfo.cacheWritesPrice !== undefined && ( + + Cache Writes + {formatCompactPrice(modelInfo.cacheWritesPrice)} + + )} + + )} + + {/* Tiered Pricing */} + {hasTiers && ( +
+
Tiered Pricing:
+ {modelInfo.tiers && ( <> - {modelInfo.cacheReadsPrice !== undefined && ( - - Cache Reads - {formatCompactPrice(modelInfo.cacheReadsPrice)} - - )} - {modelInfo.cacheWritesPrice !== undefined && ( - - Cache Writes - {formatCompactPrice(modelInfo.cacheWritesPrice)} - - )} +
+ Input: +
+ {formatTiers(modelInfo.tiers, "inputPrice")} +
+
+ Output: +
+ {formatTiers(modelInfo.tiers, "outputPrice")} +
)} +
+ )} - {/* Tiered Pricing */} - {hasTiers && ( -
-
Tiered Pricing:
- {modelInfo.tiers && ( - <> -
- Input: -
- {formatTiers(modelInfo.tiers, "inputPrice")} -
-
- Output: -
- {formatTiers(modelInfo.tiers, "outputPrice")} -
- - )} -
- )} - - {/* Provider Routing */} - {showProviderRouting && onProviderSortingChange && ( - - Provider Routing - onProviderSortingChange(e.target.value)} - style={{ width: "100%" }} - value={providerSorting || ""}> - Default - Price - Throughput - Latency - -

- {!providerSorting && - "Load balance across providers (AWS, Google Vertex, etc.), prioritizing price while considering uptime"} - {providerSorting === "price" && "Sort by price, prioritizing the lowest cost provider"} - {providerSorting === "throughput" && - "Sort by throughput, prioritizing highest throughput (may increase cost)"} - {providerSorting === "latency" && "Sort by response time, prioritizing lowest latency"} -

-
- )} -
-
- - )} + {/* Provider Routing */} + {showProviderRouting && onProviderSortingChange && ( + + Provider Routing + onProviderSortingChange(e.target.value)} + style={{ width: "100%" }} + value={providerSorting || ""}> + Default + Price + Throughput + Latency + +

+ {!providerSorting && + "Load balance across providers (AWS, Google Vertex, etc.), prioritizing price while considering uptime"} + {providerSorting === "price" && "Sort by price, prioritizing the lowest cost provider"} + {providerSorting === "throughput" && + "Sort by throughput, prioritizing highest throughput (may increase cost)"} + {providerSorting === "latency" && "Sort by response time, prioritizing lowest latency"} +

+
+ )} +
+
) }