(item: SearchIndexItem)
| 265 | } |
| 266 | |
| 267 | function 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 | |
| 299 | function resultSubtitle(item: SearchIndexItem) { |
| 300 | if (item.type === "model") return item.id; |
no test coverage detected