From fd6c11a500a42201691485ff4c678c43893615d3 Mon Sep 17 00:00:00 2001 From: "Alex \"mcmonkey\" Goodwin" Date: Mon, 26 Aug 2024 08:00:18 -0700 Subject: [PATCH] autoparse correct vram total when available --- components/UsageGraph.tsx | 15 ++++++++++----- pages/workflow/[id].tsx | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/components/UsageGraph.tsx b/components/UsageGraph.tsx index 3a7c752..cf01594 100644 --- a/components/UsageGraph.tsx +++ b/components/UsageGraph.tsx @@ -1,11 +1,16 @@ import React from 'react'; import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer } from 'recharts'; -const UsageGraph = ({ data, maxMemory }) => { - const parsedData = Object.entries(data).map(([time, mem]) => ({ - time: parseFloat(time.split(' ')[0]), - mem: parseInt((mem as string).split(' ')[0]) - })).sort((a, b) => a.time - b.time); +const UsageGraph = ({ data }) => { + const maxMemory = data["total"] ? parseInt(data["total"].split(' ')[0]) : undefined; + + const parsedData = Object.entries(data) + .filter(([key]) => key !== "total") + .map(([time, mem]) => ({ + time: parseFloat(time.split(' ')[0]), + mem: parseInt((mem as string).split(' ')[0]) + })) + .sort((a, b) => a.time - b.time); const maxYValue = maxMemory || Math.max(...parsedData.map(item => item.mem)); diff --git a/pages/workflow/[id].tsx b/pages/workflow/[id].tsx index 8e8d9e9..42b3ae4 100644 --- a/pages/workflow/[id].tsx +++ b/pages/workflow/[id].tsx @@ -158,7 +158,7 @@ function WorkflowResultDetail() { VRAM Usage Over Time
- +