Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions frontend/src/components/ModelSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export const MODEL_CONFIG: Record<string, ModelCfg> = {
"leon-se/gemma-3-27b-it-fp8-dynamic": {
displayName: "Gemma 3 27B",
shortName: "Gemma 3",
badges: ["Starter"],
requiresStarter: true,
supportsVision: true,
tokenLimit: 20000
Expand Down Expand Up @@ -222,15 +221,36 @@ export function ModelSelector({
return true;
};

// Get dynamic badges for a model based on billing status
const getModelBadges = (modelId: string): string[] => {
const config = MODEL_CONFIG[modelId];
const planName = billingStatus?.product_name?.toLowerCase() || "";
const isStarter = planName.includes("starter");

// Gemma: "starter" for starter users, "pro" for others
if (modelId === "leon-se/gemma-3-27b-it-fp8-dynamic") {
return isStarter ? ["Starter"] : ["Pro"];
}

// Llama models: no badges
if (modelId.includes("llama") || modelId.includes("Llama")) {
return [];
Comment on lines +235 to +237

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Case sensitivity check for Llama models could miss edge cases. Consider using a single case-insensitive approach: modelId.toLowerCase().includes('llama')

Suggested change
// Llama models: no badges
if (modelId.includes("llama") || modelId.includes("Llama")) {
return [];
// Llama models: no badges
if (modelId.toLowerCase().includes("llama")) {
return [];

}

// Other models: use their existing badges or default to ["Pro"]
return config?.badges || ["Pro"];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Models without explicit badges now default to ['Pro'] which may not be accurate for all models. Consider checking model access requirements before defaulting.

};

const getDisplayName = (modelId: string, showLock = false) => {
const config = MODEL_CONFIG[modelId];
const elements: React.ReactNode[] = [];

if (config) {
elements.push(config.displayName);

if (config.badges && config.badges.length > 0) {
config.badges.forEach((badge, index) => {
const badges = getModelBadges(modelId);
if (badges && badges.length > 0) {
badges.forEach((badge, index) => {
let badgeClass = "text-[10px] px-1.5 py-0.5 rounded-sm font-medium";

if (badge === "Coming Soon") {
Expand Down
Loading