Skip to content

Commit 46641ec

Browse files
committed
lint
1 parent 2f5d5e7 commit 46641ec

File tree

4 files changed

+43
-50
lines changed

4 files changed

+43
-50
lines changed

apps/sim/app/(landing)/models/components/model-directory.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useMemo, useState } from 'react'
44
import Link from 'next/link'
55
import { Input } from '@/components/emcn'
66
import { SearchIcon } from '@/components/icons'
7+
import { cn } from '@/lib/core/utils/cn'
78
import {
89
CapabilityTags,
910
DetailItem,
@@ -277,11 +278,12 @@ function FilterButton({
277278
<button
278279
type='button'
279280
onClick={onClick}
280-
className={`rounded-full border px-3 py-1.5 text-[12px] transition-colors ${
281+
className={cn(
282+
'rounded-full border px-3 py-1.5 text-[12px] transition-colors',
281283
isActive
282284
? 'border-[#555] bg-[#333] text-[var(--landing-text)]'
283285
: 'border-[var(--landing-border)] bg-transparent text-[var(--landing-text-muted)] hover:border-[var(--landing-border-strong)] hover:text-[var(--landing-text)]'
284-
}`}
286+
)}
285287
>
286288
{label}
287289
</button>

apps/sim/app/(landing)/models/og-utils.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ export async function createModelsOgImage({
187187
name: 'Geist',
188188
data: regularFontData,
189189
style: 'normal' as const,
190-
weight: 400,
190+
weight: 400 as const,
191191
},
192192
]
193193
: []),
@@ -197,7 +197,7 @@ export async function createModelsOgImage({
197197
name: 'Geist',
198198
data: mediumFontData,
199199
style: 'normal' as const,
200-
weight: 500,
200+
weight: 500 as const,
201201
},
202202
]
203203
: []),

apps/sim/app/(landing)/models/page.tsx

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export default function ModelsPage() {
8484
)
8585
const featuredProviders = MODEL_PROVIDERS_WITH_CATALOGS.slice(0, 6)
8686
const featuredModels = MODEL_PROVIDERS_WITH_CATALOGS.flatMap((provider) =>
87-
provider.featuredModels.slice(0, 1)
87+
provider.featuredModels[0] ? [{ provider, model: provider.featuredModels[0] }] : []
8888
).slice(0, 6)
8989
const heroProviders = ['openai', 'anthropic', 'azure-openai', 'google', 'bedrock']
9090
.map((providerId) => MODEL_CATALOG_PROVIDERS.find((provider) => provider.id === providerId))
@@ -108,24 +108,27 @@ export default function ModelsPage() {
108108
description: `Directory of ${TOTAL_MODELS} AI models tracked in Sim across ${TOTAL_MODEL_PROVIDERS} providers.`,
109109
url: `${baseUrl}/models`,
110110
numberOfItems: TOTAL_MODELS,
111-
itemListElement: flatModels.map(({ provider, model }, index) => ({
112-
'@type': 'ListItem',
113-
position: index + 1,
114-
item: {
115-
'@type': 'Product',
116-
name: model.displayName,
117-
url: `${baseUrl}${model.href}`,
118-
description: model.summary,
119-
brand: provider.name,
120-
category: 'AI language model',
121-
offers: {
122-
'@type': 'AggregateOffer',
123-
priceCurrency: 'USD',
124-
lowPrice: getPricingBounds(model.pricing).lowPrice.toString(),
125-
highPrice: getPricingBounds(model.pricing).highPrice.toString(),
111+
itemListElement: flatModels.map(({ provider, model }, index) => {
112+
const { lowPrice, highPrice } = getPricingBounds(model.pricing)
113+
return {
114+
'@type': 'ListItem',
115+
position: index + 1,
116+
item: {
117+
'@type': 'Product',
118+
name: model.displayName,
119+
url: `${baseUrl}${model.href}`,
120+
description: model.summary,
121+
brand: provider.name,
122+
category: 'AI language model',
123+
offers: {
124+
'@type': 'AggregateOffer',
125+
priceCurrency: 'USD',
126+
lowPrice: lowPrice.toString(),
127+
highPrice: highPrice.toString(),
128+
},
126129
},
127-
},
128-
})),
130+
}
131+
}),
129132
}
130133

131134
const faqJsonLd = {
@@ -248,16 +251,9 @@ export default function ModelsPage() {
248251
</div>
249252

250253
<div className='grid grid-cols-1 gap-4 xl:grid-cols-2'>
251-
{featuredModels.map((model) => {
252-
const provider = MODEL_PROVIDERS_WITH_CATALOGS.find(
253-
(entry) => entry.id === model.providerId
254-
)
255-
if (!provider) {
256-
return null
257-
}
258-
259-
return <ModelCard key={model.id} provider={provider} model={model} showProvider />
260-
})}
254+
{featuredModels.map(({ provider, model }) => (
255+
<ModelCard key={model.id} provider={provider} model={model} showProvider />
256+
))}
261257
</div>
262258
</section>
263259

apps/sim/app/(landing)/models/utils.ts

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -414,21 +414,18 @@ function getProviderDisplayName(providerId: string, providerName: string): strin
414414
return PROVIDER_NAME_OVERRIDES[providerId] ?? providerName
415415
}
416416

417+
function computeModelRelevanceScore(model: CatalogModel): number {
418+
return (
419+
(model.capabilities.reasoningEffort ? 10 : 0) +
420+
(model.capabilities.thinking ? 10 : 0) +
421+
(model.capabilities.deepResearch ? 8 : 0) +
422+
(model.capabilities.nativeStructuredOutputs ? 4 : 0) +
423+
(model.contextWindow ?? 0) / 100000
424+
)
425+
}
426+
417427
function compareModelsByRelevance(a: CatalogModel, b: CatalogModel): number {
418-
const aScore =
419-
(a.capabilities.reasoningEffort ? 10 : 0) +
420-
(a.capabilities.thinking ? 10 : 0) +
421-
(a.capabilities.deepResearch ? 8 : 0) +
422-
(a.capabilities.nativeStructuredOutputs ? 4 : 0) +
423-
(a.contextWindow ?? 0) / 100000
424-
const bScore =
425-
(b.capabilities.reasoningEffort ? 10 : 0) +
426-
(b.capabilities.thinking ? 10 : 0) +
427-
(b.capabilities.deepResearch ? 8 : 0) +
428-
(b.capabilities.nativeStructuredOutputs ? 4 : 0) +
429-
(b.contextWindow ?? 0) / 100000
430-
431-
return bScore - aScore
428+
return computeModelRelevanceScore(b) - computeModelRelevanceScore(a)
432429
}
433430

434431
const rawProviders = Object.values(PROVIDER_DEFINITIONS).map((provider) => {
@@ -622,10 +619,8 @@ export function getRelatedModels(targetModel: CatalogModel, limit = 6): CatalogM
622619
}
623620

624621
export function buildProviderFaqs(provider: CatalogProvider): CatalogFaq[] {
625-
const cheapestModel = [...provider.models].sort((a, b) => a.pricing.input - b.pricing.input)[0]
626-
const largestContextModel = [...provider.models].sort(
627-
(a, b) => (b.contextWindow ?? 0) - (a.contextWindow ?? 0)
628-
)[0]
622+
const cheapestModel = getCheapestProviderModel(provider)
623+
const largestContextModel = getLargestContextProviderModel(provider)
629624

630625
return [
631626
{

0 commit comments

Comments
 (0)