tv shows to tv series

This commit is contained in:
2026-04-20 19:37:33 -03:00
parent c319dea2bf
commit 5e02ca267f
20 changed files with 396 additions and 117 deletions

View File

@@ -4,7 +4,7 @@ import { z } from 'zod';
import { zodTextFormat } from 'openai/helpers/zod';
const CuratorSchema = z.object({
shows: z.array(z.object({
series: z.array(z.object({
title: z.string(),
explanation: z.string(),
category: z.enum(["Full Match", "Definitely Like", "Might Like", "Questionable", "Will Not Like"]),
@@ -24,7 +24,7 @@ export async function runCurator(
): Promise<CuratorOutput[]> {
const mediaLabel = mediaType === 'movie' ? 'movie' : 'TV show';
const allShows = [
const allSeries = [
...(ranking.full_match ?? []).map((t) => ({ title: t, category: 'Full Match' as const })),
...ranking.definitely_like.map((t) => ({ title: t, category: 'Definitely Like' as const })),
...ranking.might_like.map((t) => ({ title: t, category: 'Might Like' as const })),
@@ -32,7 +32,7 @@ export async function runCurator(
...ranking.will_not_like.map((t) => ({ title: t, category: 'Will Not Like' as const })),
];
if (allShows.length === 0) return [];
if (allSeries.length === 0) return [];
const canSearch = useWebSearch && supportsWebSearch;
const preferenceSummary = `User preferences summary:
@@ -53,9 +53,9 @@ Rules:
- cons: up to 3 short bullet points about what the user might not like based on their preferences
- Be honest — explain why "Questionable" or "Will Not Like" ${mediaLabel}s got that rating`;
const chunks: typeof allShows[] = [];
for (let i = 0; i < allShows.length; i += CHUNK_SIZE) {
chunks.push(allShows.slice(i, i + CHUNK_SIZE));
const chunks: typeof allSeries[] = [];
for (let i = 0; i < allSeries.length; i += CHUNK_SIZE) {
chunks.push(allSeries.slice(i, i + CHUNK_SIZE));
}
const results: CuratorOutput[] = [];
@@ -66,14 +66,14 @@ Rules:
temperature: 0.5,
...serviceOptions,
...(canSearch ? { tools: [{ type: 'web_search' as const }] } : {}),
text: { format: zodTextFormat(CuratorSchema, "shows") },
text: { format: zodTextFormat(CuratorSchema, "series") },
instructions,
input: `${preferenceSummary}
${mediaLabel}s to describe:
${showList}`,
}));
results.push(...(response.output_parsed?.shows ?? []));
results.push(...(response.output_parsed?.series ?? []));
}
return results;