diff --git a/src/components/workflows/timeline/MetricAverageChart.vue b/src/components/workflows/timeline/MetricAverageChart.vue index 54e6a93..f78ab61 100644 --- a/src/components/workflows/timeline/MetricAverageChart.vue +++ b/src/components/workflows/timeline/MetricAverageChart.vue @@ -38,10 +38,10 @@ function init() { function getTimelineData(runs: EvaluationRun[], metric: string): TimelineChartDataPoint[] { const datesValues = runs.reduce((acc, cur) => { const date = new Date(new Date(cur.metadata.timestamp).setHours(0, 0, 0, 0)).toDateString() - const value = cur.evaluation_results.document_wide[metric] - if (!value || Array.isArray(value)) return acc + const value = (cur.evaluation_results.document_wide[metric as keyof EvaluationResultsDocumentWide]) ?? 0 + if (Array.isArray(value)) return acc - if (!acc[date]) acc[date] = [value] + if (!acc.hasOwnProperty(date)) acc[date] = [value] else acc[date] = [...acc[date], value] return acc }, diff --git a/src/components/workflows/timeline/MetricChart.vue b/src/components/workflows/timeline/MetricChart.vue index 39d039e..f4b4590 100644 --- a/src/components/workflows/timeline/MetricChart.vue +++ b/src/components/workflows/timeline/MetricChart.vue @@ -40,7 +40,7 @@ function getTimelineData(runs: EvaluationRun[], metric: keyof EvaluationResultsD const value = evaluation_results.document_wide[metric] return { date: new Date(metadata.timestamp), - value + value: value ?? 0 } }) }