Implementiere i18n für Frontend, Admin und Datenbank
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
import { requireAdminAuth } from '@/lib/auth';
|
||||
import { getLocalizedValue } from '@/lib/i18n';
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
@@ -83,7 +84,8 @@ export async function POST(request: Request) {
|
||||
// Process each song in this batch
|
||||
for (const song of uncategorizedSongs) {
|
||||
try {
|
||||
const genreNames = allGenres.map(g => g.name);
|
||||
// Use German names for AI categorization (primary language)
|
||||
const genreNames = allGenres.map(g => getLocalizedValue(g.name, 'de'));
|
||||
|
||||
const prompt = `You are a music genre categorization assistant. Given a song title and artist, categorize it into 0-3 of the available genres.
|
||||
|
||||
@@ -140,7 +142,7 @@ Your response:`;
|
||||
|
||||
// Filter to only valid genres and get their IDs
|
||||
const genreIds = allGenres
|
||||
.filter(g => suggestedGenreNames.includes(g.name))
|
||||
.filter(g => suggestedGenreNames.includes(getLocalizedValue(g.name, 'de')))
|
||||
.map(g => g.id)
|
||||
.slice(0, 3); // Max 3 genres
|
||||
|
||||
@@ -160,7 +162,7 @@ Your response:`;
|
||||
title: song.title,
|
||||
artist: song.artist,
|
||||
assignedGenres: suggestedGenreNames.filter(name =>
|
||||
allGenres.some(g => g.name === name)
|
||||
allGenres.some(g => getLocalizedValue(g.name, 'de') === name)
|
||||
)
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user