From 0a74b0d0c8a30457c0bbcd4e6244d6efacf3811b Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Mon, 4 May 2026 11:58:59 +0530 Subject: [PATCH] refactor(model-selector): enhance premium and citation status display logic; streamline badge rendering for improved clarity and UI consistency --- .../components/new-chat/model-selector.tsx | 63 ++++++++++--------- 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/surfsense_web/components/new-chat/model-selector.tsx b/surfsense_web/components/new-chat/model-selector.tsx index 82c0fb9e9..7d7afb3d8 100644 --- a/surfsense_web/components/new-chat/model-selector.tsx +++ b/surfsense_web/components/new-chat/model-selector.tsx @@ -997,6 +997,8 @@ export function ModelSelector({ const isSelected = getSelectedId() === config.id; const isFocused = focusedIndex === index; const hasCitations = "citations_enabled" in config && !!config.citations_enabled; + const hasPremiumStatus = "is_premium" in config && !isAutoMode; + const isPremium = hasPremiumStatus && !!(config as Record).is_premium; // Chat-tab only: surface an amber "No image" hint when the // composer carries images and the catalog reports the model as // non-vision. This is purely advisory — selection is *not* @@ -1068,23 +1070,6 @@ export function ModelSelector({ Recommended )} - {"is_premium" in config && (config as Record).is_premium ? ( - - Premium - - ) : "is_premium" in config && - !(config as Record).is_premium && - !isAutoMode ? ( - - Free - - ) : null} {isImageIncompatibleChatModel && ( )} -
- - {isAutoMode ? "Auto Mode" : (config.model_name as string)} - - {!isAutoMode && hasCitations && ( - - Citations - - )} -
+ {isAutoMode ? ( +
+ Auto Mode +
+ ) : ( + (hasPremiumStatus || hasCitations) && ( +
+ {hasPremiumStatus && ( + + {isPremium ? "Premium" : "Free"} + + )} + {hasCitations && ( + + Citations + + )} +
+ ) + )} {/* Actions */}