feat: add utterance field to dataset entries and update related components for filtering and display
This commit is contained in:
@@ -11,6 +11,7 @@ interface FilterParams {
|
||||
modelName?: string;
|
||||
dialect?: string;
|
||||
iteration?: number;
|
||||
utteranceId?: string;
|
||||
}
|
||||
|
||||
export async function getDatasetEntries(
|
||||
@@ -39,6 +40,10 @@ export async function getDatasetEntries(
|
||||
conditions.push(eq(dataset_entry.iteration, filters.iteration));
|
||||
}
|
||||
|
||||
if (filters?.utteranceId) {
|
||||
conditions.push(like(dataset_entry.utteranceId, `%${filters.utteranceId}%`));
|
||||
}
|
||||
|
||||
const whereClause = and(...conditions);
|
||||
|
||||
const entries = await db
|
||||
|
||||
@@ -15,11 +15,13 @@ export async function getFilterOptions(datasetId: number) {
|
||||
const modelNames = [...new Set(entries.map(e => e.modelName))].sort();
|
||||
const dialects = [...new Set(entries.map(e => e.dialect))].sort();
|
||||
const iterations = [...new Set(entries.map(e => e.iteration))].sort((a, b) => a - b);
|
||||
const utteranceIds = [...new Set(entries.map(e => e.utteranceId).filter((id): id is string => Boolean(id)))].sort();
|
||||
|
||||
return {
|
||||
speakerIds,
|
||||
modelNames,
|
||||
dialects,
|
||||
iterations,
|
||||
utteranceIds,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -131,6 +131,8 @@ export async function processDatasetEntries(
|
||||
externalId: row.id,
|
||||
speakerId: row.speaker,
|
||||
modelName: row.model,
|
||||
utteranceId: row.utt_id,
|
||||
utteranceText: row.text,
|
||||
fileName: relativePath,
|
||||
dialect: row.dialect,
|
||||
iteration: parseInt(row.iteration, 10),
|
||||
|
||||
@@ -87,6 +87,11 @@ export default async function DatasetEntryPage({ params }: DatasetEntryPageProps
|
||||
<p className="text-lg font-semibold">{entry.modelName}</p>
|
||||
</div>
|
||||
|
||||
<div className="bg-white border border-gray-200 p-4 rounded-lg">
|
||||
<p className="text-sm text-gray-600 mb-1">Utterance ID</p>
|
||||
<p className="text-lg font-semibold">{entry.utteranceId || '-'}</p>
|
||||
</div>
|
||||
|
||||
<div className="bg-white border border-gray-200 p-4 rounded-lg">
|
||||
<p className="text-sm text-gray-600 mb-1">Dialect</p>
|
||||
<p className="text-lg font-semibold">{entry.dialect}</p>
|
||||
@@ -102,6 +107,11 @@ export default async function DatasetEntryPage({ params }: DatasetEntryPageProps
|
||||
<p className="text-lg font-semibold break-all">{entry.fileName}</p>
|
||||
</div>
|
||||
|
||||
<div className="col-span-2 bg-white border border-gray-200 p-4 rounded-lg">
|
||||
<p className="text-sm text-gray-600 mb-1">Utterance Text</p>
|
||||
<p className="text-lg font-semibold break-words">{entry.utteranceText || '-'}</p>
|
||||
</div>
|
||||
|
||||
<div className="col-span-2 bg-white border border-gray-200 p-4 rounded-lg">
|
||||
<p className="text-sm text-gray-600 mb-3">Audio Player</p>
|
||||
<AudioPlayer datasetId={datasetIdNum} fileName={entry.fileName} externalId={entry.externalId} />
|
||||
|
||||
Reference in New Issue
Block a user