feat: 将视频转写重构为纯文字异步语音识别

This commit is contained in:
2026-10-03 21:58:06 +08:00
parent 040273586b
commit 6f0e38054b
34 changed files with 2283 additions and 1771 deletions
+5 -17
View File
@@ -1,26 +1,23 @@
import { NextResponse } from "next/server";
import { prisma } from "@/lib/prisma";
import { getFileUrl } from "@/lib/minio";
import { prisma } from "@/lib/prisma";
import { transcriptionState } from "@/lib/stt/types";
export async function GET() {
try {
const videos = await prisma.video.findMany({
orderBy: { created_at: "desc" },
take: 1000,
include: {
author: {
select: {
nickname: true,
},
},
transcriptionTask: true,
transcript: {
select: {
id: true,
speech_detected: true,
language: true,
audio_type: true,
transcript: true,
non_speech_summary: true,
},
},
},
@@ -29,21 +26,12 @@ export async function GET() {
const formattedVideos = videos.map((v) => ({
aweme_id: v.aweme_id,
desc: v.desc,
cover_url: getFileUrl(v.cover_url ?? ""),
cover_url: v.cover_url ? getFileUrl(v.cover_url) : "",
duration_ms: v.duration_ms,
author: {
nickname: v.author.nickname,
},
transcript: v.transcript
? {
id: v.transcript.id,
speech_detected: v.transcript.speech_detected,
language: v.transcript.language,
audio_type: v.transcript.audio_type,
transcript: v.transcript.transcript,
non_speech_summary: v.transcript.non_speech_summary,
}
: null,
transcription: transcriptionState(v.transcript, v.transcriptionTask),
}));
return NextResponse.json({