- Next.js 14 + Tailwind CSS + Prisma - 模型数据库页面 (列表+详情) - GPU数据库页面 (列表+详情) - CPU数据库页面 - 显存计算器工具 - 参数对比工具 - 知识库页面 - 初始数据: 15个模型, 10个GPU, 3个CPU
215 lines
5.8 KiB
Plaintext
215 lines
5.8 KiB
Plaintext
// Prisma schema for ParamHub - 参数百科数据库
|
||
|
||
generator client {
|
||
provider = "prisma-client-js"
|
||
}
|
||
|
||
datasource db {
|
||
provider = "postgresql"
|
||
url = env("DATABASE_URL")
|
||
}
|
||
|
||
// 大模型数据
|
||
model Model {
|
||
id Int @id @default(autoincrement())
|
||
name String
|
||
slug String @unique
|
||
organization String?
|
||
parametersCount BigInt? // 参数量(以B为单位存储实际数值)
|
||
architecture String?
|
||
layers Int?
|
||
hiddenSize Int?
|
||
attentionHeads Int?
|
||
contextLength Int?
|
||
trainingTokens BigInt? // 训练token数
|
||
trainingCostUsd Float?
|
||
releaseDate DateTime?
|
||
isOpenSource Boolean @default(false)
|
||
license String?
|
||
description String? @db.Text
|
||
imageUrl String?
|
||
|
||
// Benchmark 分数
|
||
benchmarkMmlu Float?
|
||
benchmarkHumaneval Float?
|
||
benchmarkGsm8k Float?
|
||
benchmarkMath Float?
|
||
|
||
// 部署要求
|
||
minVramFp16 Int? // GB
|
||
minVramInt8 Int?
|
||
minVramInt4 Int?
|
||
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
// 关联
|
||
apis ModelApi[]
|
||
categories ModelCategory[]
|
||
comparisonsA ModelComparison[] @relation("ModelA")
|
||
comparisonsB ModelComparison[] @relation("ModelB")
|
||
|
||
@@index([organization])
|
||
@@index([parametersCount])
|
||
@@index([releaseDate])
|
||
}
|
||
|
||
// 模型API信息
|
||
model ModelApi {
|
||
id Int @id @default(autoincrement())
|
||
modelId Int
|
||
provider String // OpenAI, Azure, Together, etc.
|
||
apiName String?
|
||
inputPricePer1k Float? // 输入价格 $/1K tokens
|
||
outputPricePer1k Float? // 输出价格 $/1K tokens
|
||
contextLimit Int?
|
||
rateLimitRpm Int?
|
||
available Boolean @default(true)
|
||
|
||
model Model @relation(fields: [modelId], references: [id])
|
||
|
||
@@index([provider])
|
||
}
|
||
|
||
// 模型分类
|
||
model ModelCategory {
|
||
id Int @id @default(autoincrement())
|
||
modelId Int
|
||
category String // chat, code, embedding, image, etc.
|
||
|
||
model Model @relation(fields: [modelId], references: [id])
|
||
|
||
@@unique([modelId, category])
|
||
}
|
||
|
||
// 模型对比记录
|
||
model ModelComparison {
|
||
id Int @id @default(autoincrement())
|
||
modelAId Int
|
||
modelBId Int
|
||
comparisonType String? // performance, cost, etc.
|
||
notes String? @db.Text
|
||
createdAt DateTime @default(now())
|
||
|
||
modelA Model @relation("ModelA", fields: [modelAId], references: [id])
|
||
modelB Model @relation("ModelB", fields: [modelBId], references: [id])
|
||
}
|
||
|
||
// GPU数据
|
||
model Gpu {
|
||
id Int @id @default(autoincrement())
|
||
name String
|
||
slug String @unique
|
||
manufacturer String // NVIDIA, AMD, Intel
|
||
architecture String?
|
||
cudaCores Int?
|
||
tensorCores Int?
|
||
memoryGb Float?
|
||
memoryType String? // GDDR6X, HBM2e, etc.
|
||
memoryBandwidthGbps Float?
|
||
fp32Tflops Float?
|
||
fp16Tflops Float?
|
||
int8Tops Float?
|
||
tdpWatts Int?
|
||
priceUsd Float?
|
||
releaseDate DateTime?
|
||
recommendedFor String[] // training, inference, gaming
|
||
imageUrl String?
|
||
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([manufacturer])
|
||
@@index([memoryGb])
|
||
@@index([priceUsd])
|
||
}
|
||
|
||
// CPU数据
|
||
model Cpu {
|
||
id Int @id @default(autoincrement())
|
||
name String
|
||
slug String @unique
|
||
manufacturer String // AMD, Intel
|
||
architecture String?
|
||
cores Int?
|
||
threads Int?
|
||
baseClockGhz Float?
|
||
boostClockGhz Float?
|
||
l3CacheMb Int?
|
||
tdpWatts Int?
|
||
memoryType String?
|
||
memoryChannels Int?
|
||
pcieLanes Int?
|
||
priceUsd Float?
|
||
releaseDate DateTime?
|
||
imageUrl String?
|
||
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([manufacturer])
|
||
@@index([cores])
|
||
}
|
||
|
||
// 服务器配置
|
||
model ServerConfig {
|
||
id Int @id @default(autoincrement())
|
||
name String
|
||
slug String @unique
|
||
cpuConfig String? @db.Text // JSON
|
||
gpuConfig String? @db.Text // JSON
|
||
memoryGb Int?
|
||
storageConfig String? @db.Text // JSON
|
||
networkConfig String? @db.Text // JSON
|
||
totalTdpWatts Int?
|
||
priceUsd Float?
|
||
useCase String?
|
||
description String? @db.Text
|
||
imageUrl String?
|
||
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
}
|
||
|
||
// 知识库文章
|
||
model Article {
|
||
id Int @id @default(autoincrement())
|
||
title String
|
||
slug String @unique
|
||
category String // explanation, guide, best-practice
|
||
content String @db.Text // Markdown
|
||
tags String[]
|
||
author String?
|
||
publishedAt DateTime?
|
||
views Int @default(0)
|
||
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([category])
|
||
@@index([tags])
|
||
}
|
||
|
||
// 用户
|
||
model User {
|
||
id Int @id @default(autoincrement())
|
||
email String @unique
|
||
name String?
|
||
avatar String?
|
||
role String @default("user") // user, admin, contributor
|
||
favorites String[] // 模型/GPU slug列表
|
||
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
}
|
||
|
||
// 计算器使用记录(可选,用于统计)
|
||
model CalculatorLog {
|
||
id Int @id @default(autoincrement())
|
||
calculatorType String // vram, training-cost, inference-cost
|
||
inputParams String @db.Text // JSON
|
||
outputResult String @db.Text // JSON
|
||
createdAt DateTime @default(now())
|
||
|
||
@@index([calculatorType])
|
||
} |