simplificando app

This commit is contained in:
2026-06-18 17:13:24 +02:00
parent cdf2893b94
commit f977925880
16 changed files with 82 additions and 614 deletions
+1 -57
View File
@@ -2,12 +2,8 @@ import type { CardType } from "./cards";
import { getCachedCard, setCachedCard } from "./cache";
import { generateStructuredResponse } from "./llm";
import {
historicalAccuracySchema,
internationalRatingsSchema,
productionFactsSchema,
ratingExplainedSchema,
sensitivityGuideSchema,
skipGuideSchema,
} from "./schemas";
import { formatMovieContext, getMovieDetails } from "./tmdb";
@@ -29,66 +25,14 @@ You MUST return ONLY valid JSON matching this exact structure (no extra keys, no
}
Focus on specific scenes or content patterns that drove the rating. Be precise with the allowed category and intensity values.`,
skip_guide: `Create a skip guide for families who want to watch this film with a younger audience.
You MUST return ONLY valid JSON matching this exact structure:
{
"originalRating": string,
"suggestedAudienceAge": number (integer 0-21),
"totalSkippedMinutes": number (integer),
"segments": array of {
"start": string (e.g. "0:05" or "12m"),
"end": string,
"reason": string,
"intensity": one of exactly ["mild", "moderate", "strong"],
"plotImpact": one of exactly ["none", "minor", "significant"],
"skipRecommendation": one of exactly ["recommended", "optional", "do_not_skip"],
"resumeHint": string
},
"disclaimer": string
}
Only include genuinely skippable segments. Mark plot-critical scenes as skipRecommendation "do_not_skip".
Timestamps should be approximate for the standard theatrical cut. Use only the exact enum strings listed.`,
sensitivity_guide: `Create a sensitivity guide grouping potentially upsetting content by theme.
You MUST return ONLY valid JSON:
{
"summary": string,
"themes": array of {
"theme": string,
"severity": one of exactly ["mild", "moderate", "strong"],
"description": string,
"approximateTiming": string (optional)
}
}
Cover violence, sexuality, substances, self-harm, abuse, animal harm, discrimination, and other difficult themes where relevant. Use only the exact "severity" values.`,
international_ratings: `Summarize how this film is rated across countries using the certification data provided.
Return JSON with: ratings (array of {country, countryCode, rating, descriptors?}), discrepancyNote, strictestCountry (optional), mostLenientCountry (optional).
Include at least US, GB, ES, DE, FR when data exists. Explain notable differences.`,
production_facts: `Curate interesting behind-the-scenes production facts for cinephiles.
Return JSON with: facts (array of at least 5 {category, fact}), budget (optional string), boxOffice (optional string), filmingLocations (optional array of strings).
Prefer specific, verifiable-sounding details; note uncertainty in the fact text when needed.`,
historical_accuracy: `Evaluate historical accuracy for this biographical or historical film.
You MUST return ONLY valid JSON:
{
"accuracyScore": number (0-100),
"summary": string,
"accurateElements": string[],
"inventions": array of { "claim": string, "reality": string },
"confidence": one of exactly ["high", "medium", "low"]
}
If the film is not historical/biographical, still assess any real-world basis it claims. Use only the exact confidence value.`,
};
const SCHEMAS = {
rating_explained: ratingExplainedSchema,
skip_guide: skipGuideSchema,
sensitivity_guide: sensitivityGuideSchema,
international_ratings: internationalRatingsSchema,
production_facts: productionFactsSchema,
historical_accuracy: historicalAccuracySchema,
} as const;
export async function generateCard(movieId: number, cardType: CardType) {
@@ -113,4 +57,4 @@ ${context}`;
await setCachedCard(movieId, cardType, data);
return { data, cached: false };
}
}