语音转文本接口,bgm路径修复

This commit is contained in:
2025-10-25 13:06:17 +08:00
parent e4339a5b91
commit d1b4fb6be0
12 changed files with 423 additions and 172 deletions
+11 -11
View File
@@ -1,6 +1,7 @@
import { NextRequest, NextResponse } from 'next/server';
import { prisma } from '@/lib/prisma';
import type { FeedItem, FeedResponse } from '@/app/types/feed';
import { getFileUrl } from '@/lib/minio';
// Contract
// Inputs: search params { before?: ISOString, limit?: number }
@@ -32,30 +33,29 @@ export async function GET(req: NextRequest) {
const merged: FeedItem[] = [
...videos.map((v) => ({
type: 'video' as const,
type: "video" as const,
aweme_id: v.aweme_id,
created_at: v.created_at,
desc: v.desc,
video_url: v.video_url,
cover_url: v.cover_url ?? null,
video_url: getFileUrl(v.video_url),
cover_url: getFileUrl(v.cover_url ?? 'default_cover.png'),
width: v.width ?? null,
height: v.height ?? null,
author: { nickname: v.author.nickname, avatar_url: v.author.avatar_url ?? null },
likes: Number(v.digg_count),
author: { nickname: v.author.nickname, avatar_url: getFileUrl(v.author.avatar_url ?? '') },
likes: Number(v.digg_count)
})),
...posts.map((p) => ({
type: 'image' as const,
type: "image" as const,
aweme_id: p.aweme_id,
created_at: p.created_at,
desc: p.desc,
cover_url: p.images?.[0]?.url ?? null,
cover_url: getFileUrl(p.images?.[0]?.url ?? null),
width: p.images?.[0]?.width ?? null,
height: p.images?.[0]?.height ?? null,
author: { nickname: p.author.nickname, avatar_url: p.author.avatar_url ?? null },
likes: Number(p.digg_count),
author: { nickname: p.author.nickname, avatar_url: getFileUrl(p.author.avatar_url ?? '') },
likes: Number(p.digg_count)
})),
]
.sort((a, b) => +new Date(b.created_at as any) - +new Date(a.created_at as any))
].sort((a, b) => +new Date(b.created_at) - +new Date(a.created_at))
.slice(0, limit);
const nextCursor = merged.length > 0 ? new Date(merged[merged.length - 1].created_at as any).toISOString() : null;