MCPcopy Create free account
hub / github.com/anomalyco/models.dev / resultMeta

Function resultMeta

packages/web/src/index.ts:267–297  ·  view source on GitHub ↗
(item: SearchIndexItem)

Source from the content-addressed store, hash-verified

265}
266
267function resultMeta(item: SearchIndexItem) {
268 if (item.type === "model") {
269 return [
270 item.lab,
271 item.providerCount === undefined
272 ? undefined
273 : `${item.providerCount} providers`,
274 item.context === undefined
275 ? undefined
276 : `${formatCompactNumber(item.context)} context`,
277 formatCost(item.inputCost, item.outputCost),
278 item.updated,
279 ].filter((value): value is string => Boolean(value));
280 }
281
282 if (item.type === "provider") {
283 return [
284 item.modelCount === undefined ? undefined : `${item.modelCount} models`,
285 item.npm,
286 item.api,
287 ].filter((value): value is string => Boolean(value));
288 }
289
290 return [
291 item.modelCount === undefined ? undefined : `${item.modelCount} models`,
292 item.providerCount === undefined
293 ? undefined
294 : `${item.providerCount} providers`,
295 item.updated,
296 ].filter((value): value is string => Boolean(value));
297}
298
299function resultSubtitle(item: SearchIndexItem) {
300 if (item.type === "model") return item.id;

Callers 1

createSearchResultFunction · 0.85

Calls 2

formatCompactNumberFunction · 0.85
formatCostFunction · 0.70

Tested by

no test coverage detected