simplificando app
This commit is contained in:
+1
-17
@@ -36,10 +36,6 @@ export interface TmdbMovieDetails {
|
||||
keywords?: {
|
||||
keywords: Array<{ id: number; name: string }>;
|
||||
};
|
||||
credits?: {
|
||||
cast: Array<{ name: string; character: string }>;
|
||||
crew: Array<{ name: string; job: string; department: string }>;
|
||||
};
|
||||
}
|
||||
|
||||
function getApiKey(): string {
|
||||
@@ -85,7 +81,7 @@ export async function searchMovies(query: string): Promise<TmdbSearchResult[]> {
|
||||
|
||||
export async function getMovieDetails(movieId: number): Promise<TmdbMovieDetails> {
|
||||
return tmdbFetch<TmdbMovieDetails>(`/movie/${movieId}`, {
|
||||
append_to_response: "release_dates,credits,keywords",
|
||||
append_to_response: "release_dates,keywords",
|
||||
});
|
||||
}
|
||||
|
||||
@@ -115,14 +111,6 @@ export function formatMovieContext(movie: TmdbMovieDetails): string {
|
||||
const genres = movie.genres.map((g) => g.name).join(", ");
|
||||
const keywords = movie.keywords?.keywords.map((k) => k.name).join(", ") ?? "";
|
||||
const certification = getUsCertification(movie);
|
||||
const directors = movie.credits?.crew
|
||||
.filter((c) => c.job === "Director")
|
||||
.map((c) => c.name)
|
||||
.join(", ");
|
||||
const leadCast = movie.credits?.cast
|
||||
.slice(0, 5)
|
||||
.map((c) => `${c.name} as ${c.character}`)
|
||||
.join("; ");
|
||||
|
||||
const releaseDates = movie.release_dates?.results
|
||||
.map((country) => {
|
||||
@@ -146,10 +134,6 @@ export function formatMovieContext(movie: TmdbMovieDetails): string {
|
||||
`Overview: ${movie.overview}`,
|
||||
certification ? `US Certification: ${certification}` : null,
|
||||
keywords ? `Keywords: ${keywords}` : null,
|
||||
directors ? `Director(s): ${directors}` : null,
|
||||
leadCast ? `Lead cast: ${leadCast}` : null,
|
||||
movie.budget ? `Budget: $${movie.budget.toLocaleString("en-US")}` : null,
|
||||
movie.revenue ? `Revenue: $${movie.revenue.toLocaleString("en-US")}` : null,
|
||||
releaseDates ? `International certifications:\n${releaseDates}` : null,
|
||||
]
|
||||
.filter(Boolean)
|
||||
|
||||
Reference in New Issue
Block a user