feat: add manual video tagging

This commit is contained in:
2026-04-29 21:20:21 +08:00
parent 02d37f3953
commit eac6ad2343
17 changed files with 1066 additions and 418 deletions
+14 -3
View File
@@ -1,6 +1,6 @@
import { type NextRequest, NextResponse } from "next/server";
import type { FeedItem, FeedResponse } from "@/app/types/feed";
import { isAsrContentTag } from "@/lib/asr-tags";
import { isAsrContentTag, resolveEffectiveContentTags } from "@/lib/asr-tags";
import { getFileUrl } from "@/lib/minio";
import { prisma } from "@/lib/prisma";
@@ -24,7 +24,15 @@ export async function GET(req: NextRequest) {
const videoWhere = {
...(before ? { created_at: { lt: before } } : {}),
...(selectedTag
? { transcript: { is: { content_tags: { has: selectedTag } } } }
? {
OR: [
{ manual_content_tags: { has: selectedTag } },
{
manual_content_tags: { isEmpty: true },
transcript: { is: { content_tags: { has: selectedTag } } },
},
],
}
: {}),
};
@@ -68,7 +76,10 @@ export async function GET(req: NextRequest) {
sec_uid: v.author.sec_uid,
},
likes: Number(v.digg_count),
content_tags: v.transcript?.content_tags ?? [],
content_tags: resolveEffectiveContentTags(
v.manual_content_tags,
v.transcript?.content_tags,
),
})),
...posts.map((p) => {
const coverPath = p.images?.[0]?.url;