完成转录功能,中文脚本搜索,播放界面显示脚本

This commit is contained in:
2025-10-25 19:22:41 +08:00
parent d1b4fb6be0
commit 0d18595b68
34 changed files with 1827 additions and 404 deletions
+93 -113
View File
@@ -4,172 +4,152 @@ generator client {
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
url = env("DATABASE_URL")
}
model Author {
// 抖音作者;以 sec_uid 稳定标识
sec_uid String @id
uid String? @unique
sec_uid String @id
uid String? @unique
nickname String
signature String?
avatar_url String?
follower_count BigInt @default(0)
total_favorited BigInt @default(0)
unique_id String? // 抖音号
follower_count BigInt @default(0)
total_favorited BigInt @default(0)
unique_id String?
short_id String?
videos Video[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
imagePosts ImagePost[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
videos Video[]
}
model Video {
aweme_id String @id
desc String
preview_title String?
duration_ms Int
created_at DateTime
share_url String
digg_count BigInt @default(0)
comment_count BigInt @default(0)
share_count BigInt @default(0)
collect_count BigInt @default(0)
// 视频分辨率(用于前端预布局)
width Int?
height Int?
// 视频帧率
fps Int?
// 视频封面(首帧提取后上传到 MinIO 的外链)
cover_url String?
authorId String
author Author @relation(fields: [authorId], references: [sec_uid], onDelete: Cascade)
comments Comment[]
tags String[] // 视频标签列表
video_url String // 视频文件 URL
// 保存完整的接口原始 JSON 数据(用于备份和后续分析)
raw_json Json?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
aweme_id String @id
desc String
preview_title String?
duration_ms Int
created_at DateTime
share_url String
digg_count BigInt @default(0)
comment_count BigInt @default(0)
share_count BigInt @default(0)
collect_count BigInt @default(0)
authorId String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
tags String[]
video_url String
height Int?
width Int?
cover_url String?
fps Int?
raw_json Json?
comments Comment[]
author Author @relation(fields: [authorId], references: [sec_uid], onDelete: Cascade)
transcript VideoTranscript?
@@index([authorId])
@@index([created_at])
}
model CommentUser {
id String @id @default(cuid())
id String @id @default(cuid())
nickname String
avatar_url String?
// 以 (nickname, avatar_url) 近似去重;如果你从响应里拿到用户 uid,可以改为以 uid 作为主键
@@unique([nickname, avatar_url])
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
comments Comment[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@unique([nickname, avatar_url])
}
model Comment {
cid String @id
text String
digg_count BigInt @default(0)
created_at DateTime
// 可关联视频或图文中的一种
videoId String?
video Video? @relation(fields: [videoId], references: [aweme_id], onDelete: Cascade)
imagePostId String?
imagePost ImagePost? @relation(fields: [imagePostId], references: [aweme_id], onDelete: Cascade)
userId String
user CommentUser @relation(fields: [userId], references: [id], onDelete: Cascade)
// 评论下的贴纸/配图(统一按图片存储)
images CommentImage[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
cid String @id
text String
digg_count BigInt @default(0)
created_at DateTime
videoId String?
userId String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
imagePostId String?
imagePost ImagePost? @relation(fields: [imagePostId], references: [aweme_id], onDelete: Cascade)
user CommentUser @relation(fields: [userId], references: [id], onDelete: Cascade)
video Video? @relation(fields: [videoId], references: [aweme_id], onDelete: Cascade)
images CommentImage[]
@@index([videoId, created_at])
@@index([imagePostId, created_at])
}
// 评论图片(贴纸和配图统一保存在这里)
model CommentImage {
id String @id @default(cuid())
commentId String
comment Comment @relation(fields: [commentId], references: [cid], onDelete: Cascade)
id String @id @default(cuid())
commentId String
url String
order Int
width Int?
height Int?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
comment Comment @relation(fields: [commentId], references: [cid], onDelete: Cascade)
url String
order Int // 在该评论中的顺序(0 开始)
width Int?
height Int?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([commentId, order])
@@unique([commentId, order])
@@index([commentId, order])
}
// 图片作品(图文)
model ImagePost {
aweme_id String @id
aweme_id String @id
desc String
created_at DateTime
share_url String
digg_count BigInt @default(0)
comment_count BigInt @default(0)
share_count BigInt @default(0)
collect_count BigInt @default(0)
digg_count BigInt @default(0)
comment_count BigInt @default(0)
share_count BigInt @default(0)
collect_count BigInt @default(0)
authorId String
author Author @relation(fields: [authorId], references: [sec_uid], onDelete: Cascade)
tags String[]
music_url String? // 背景音乐(已上传到 MinIO 的外链)
images ImageFile[]
comments Comment[]
// 保存完整的接口原始 JSON 数据(用于备份和后续分析)
music_url String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
raw_json Json?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
comments Comment[]
images ImageFile[]
author Author @relation(fields: [authorId], references: [sec_uid], onDelete: Cascade)
@@index([authorId])
@@index([created_at])
}
// 图片作品中的单张图片(已上传到 MinIO 的外链)
model ImageFile {
id String @id @default(cuid())
postId String
post ImagePost @relation(fields: [postId], references: [aweme_id], onDelete: Cascade)
url String
order Int // 在作品中的顺序(从 0 开始)
order Int
width Int?
height Int?
animated String? // 如果是动图,存储 video 格式的 URL
duration Int? // 动图时长(毫秒),仅当 animated 不为 null 时有值
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
animated String?
duration Int?
post ImagePost @relation(fields: [postId], references: [aweme_id], onDelete: Cascade)
@@index([postId, order])
@@unique([postId, order])
@@index([postId, order])
}
model VideoTranscript {
id String @id @default(cuid())
videoId String @unique
speech_detected Boolean
language String?
audio_type String?
transcript String[]
non_speech_summary String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
transcript_zh_tsv Unsupported("tsvector")?
video Video @relation(fields: [videoId], references: [aweme_id], onDelete: Cascade)
@@index([videoId])
@@index([transcript_zh_tsv], map: "video_transcript_zh_idx", type: Gin)
}