|
| 1 | +import { formatTokenCount } from '@/lib/format' |
| 2 | +import type { ManifestModel } from '@/types/manifests' |
| 3 | + |
| 4 | +export interface ModelSpecificationsProps { |
| 5 | + model: Pick<ManifestModel, 'size' | 'contextWindow' | 'maxOutput' | 'tokenPricing'> |
| 6 | + translations: { |
| 7 | + title: string |
| 8 | + modelSize: string |
| 9 | + contextWindow: string |
| 10 | + maxOutput: string |
| 11 | + pricing: string |
| 12 | + input: string |
| 13 | + output: string |
| 14 | + cache: string |
| 15 | + } |
| 16 | +} |
| 17 | + |
| 18 | +/** |
| 19 | + * ModelSpecifications Section |
| 20 | + * |
| 21 | + * Displays technical specifications for AI models including size, |
| 22 | + * context window, max output, and token pricing. |
| 23 | + */ |
| 24 | +export function ModelSpecifications({ model, translations }: ModelSpecificationsProps) { |
| 25 | + const hasContent = |
| 26 | + model.size || |
| 27 | + model.contextWindow || |
| 28 | + model.maxOutput || |
| 29 | + model.tokenPricing?.input !== null || |
| 30 | + model.tokenPricing?.output !== null || |
| 31 | + model.tokenPricing?.cache !== null |
| 32 | + |
| 33 | + if (!hasContent) { |
| 34 | + return null |
| 35 | + } |
| 36 | + |
| 37 | + return ( |
| 38 | + <section className="py-[var(--spacing-lg)] border-b border-[var(--color-border)]"> |
| 39 | + <div className="max-w-8xl mx-auto px-[var(--spacing-md)]"> |
| 40 | + <h2 className="text-2xl font-semibold tracking-[-0.02em] mb-[var(--spacing-sm)]"> |
| 41 | + {translations.title} |
| 42 | + </h2> |
| 43 | + |
| 44 | + <div className="grid grid-cols-1 md:grid-cols-2 gap-[var(--spacing-md)] mt-[var(--spacing-lg)]"> |
| 45 | + {model.size && ( |
| 46 | + <div className="border border-[var(--color-border)] p-[var(--spacing-md)]"> |
| 47 | + <h3 className="text-xs text-[var(--color-text-muted)] uppercase tracking-wider font-medium mb-[var(--spacing-xs)]"> |
| 48 | + {translations.modelSize} |
| 49 | + </h3> |
| 50 | + <p className="text-lg font-semibold tracking-tight">{model.size}</p> |
| 51 | + </div> |
| 52 | + )} |
| 53 | + |
| 54 | + <div className="border border-[var(--color-border)] p-[var(--spacing-md)]"> |
| 55 | + <h3 className="text-xs text-[var(--color-text-muted)] uppercase tracking-wider font-medium mb-[var(--spacing-xs)]"> |
| 56 | + {translations.contextWindow} |
| 57 | + </h3> |
| 58 | + <p className="text-lg font-semibold tracking-tight"> |
| 59 | + {formatTokenCount(model.contextWindow)} |
| 60 | + </p> |
| 61 | + </div> |
| 62 | + |
| 63 | + <div className="border border-[var(--color-border)] p-[var(--spacing-md)]"> |
| 64 | + <h3 className="text-xs text-[var(--color-text-muted)] uppercase tracking-wider font-medium mb-[var(--spacing-xs)]"> |
| 65 | + {translations.maxOutput} |
| 66 | + </h3> |
| 67 | + <p className="text-lg font-semibold tracking-tight"> |
| 68 | + {formatTokenCount(model.maxOutput)} |
| 69 | + </p> |
| 70 | + </div> |
| 71 | + |
| 72 | + {model.tokenPricing && ( |
| 73 | + <div className="border border-[var(--color-border)] p-[var(--spacing-md)]"> |
| 74 | + <h3 className="text-xs text-[var(--color-text-muted)] uppercase tracking-wider font-medium mb-[var(--spacing-xs)]"> |
| 75 | + {translations.pricing} |
| 76 | + </h3> |
| 77 | + <div className="space-y-1"> |
| 78 | + {model.tokenPricing.input !== null && model.tokenPricing.input !== undefined && ( |
| 79 | + <p className="text-sm"> |
| 80 | + <span className="text-[var(--color-text-muted)] text-xs"> |
| 81 | + {translations.input}{' '} |
| 82 | + </span> |
| 83 | + <span className="font-semibold tracking-tight"> |
| 84 | + ${model.tokenPricing.input}/M |
| 85 | + </span> |
| 86 | + </p> |
| 87 | + )} |
| 88 | + {model.tokenPricing.output !== null && model.tokenPricing.output !== undefined && ( |
| 89 | + <p className="text-sm"> |
| 90 | + <span className="text-[var(--color-text-muted)] text-xs"> |
| 91 | + {translations.output}{' '} |
| 92 | + </span> |
| 93 | + <span className="font-semibold tracking-tight"> |
| 94 | + ${model.tokenPricing.output}/M |
| 95 | + </span> |
| 96 | + </p> |
| 97 | + )} |
| 98 | + {model.tokenPricing.cache !== null && model.tokenPricing.cache !== undefined && ( |
| 99 | + <p className="text-sm"> |
| 100 | + <span className="text-[var(--color-text-muted)] text-xs"> |
| 101 | + {translations.cache}{' '} |
| 102 | + </span> |
| 103 | + <span className="font-semibold tracking-tight"> |
| 104 | + ${model.tokenPricing.cache}/M |
| 105 | + </span> |
| 106 | + </p> |
| 107 | + )} |
| 108 | + </div> |
| 109 | + </div> |
| 110 | + )} |
| 111 | + </div> |
| 112 | + </div> |
| 113 | + </section> |
| 114 | + ) |
| 115 | +} |
0 commit comments