mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-15 07:31:19 +00:00
fix log chart display (#5449)
This commit is contained in:
@@ -255,7 +255,7 @@ const LogChart = ({
|
|||||||
pointsPerChat,
|
pointsPerChat,
|
||||||
errorCount: item.summary.errorCount,
|
errorCount: item.summary.errorCount,
|
||||||
errorRate: item.summary.chatItemCount
|
errorRate: item.summary.chatItemCount
|
||||||
? Number((item.summary.errorCount / item.summary.chatItemCount).toFixed(2))
|
? Number(((item.summary.errorCount / item.summary.chatItemCount) * 100).toFixed(2))
|
||||||
: 0
|
: 0
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@@ -304,8 +304,7 @@ const LogChart = ({
|
|||||||
chatItemCount: 'sum',
|
chatItemCount: 'sum',
|
||||||
chatCount: 'sum',
|
chatCount: 'sum',
|
||||||
pointsPerChat: 'avg',
|
pointsPerChat: 'avg',
|
||||||
errorCount: 'sum',
|
errorCount: 'sum'
|
||||||
errorRate: 'avg'
|
|
||||||
}),
|
}),
|
||||||
...calculateStats(app, {
|
...calculateStats(app, {
|
||||||
goodFeedBackCount: 'sum',
|
goodFeedBackCount: 'sum',
|
||||||
@@ -314,6 +313,11 @@ const LogChart = ({
|
|||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const totalChatItems = cumulative.chatItemCount || 0;
|
||||||
|
const totalErrors = cumulative.errorCount || 0;
|
||||||
|
cumulative.errorRate =
|
||||||
|
totalChatItems > 0 ? Number(((totalErrors / totalChatItems) * 100).toFixed(2)) : 0;
|
||||||
|
|
||||||
return { user, chat, app, cumulative };
|
return { user, chat, app, cumulative };
|
||||||
}, [
|
}, [
|
||||||
feConfigs?.isPlus,
|
feConfigs?.isPlus,
|
||||||
@@ -468,7 +472,7 @@ const LogChart = ({
|
|||||||
averageKey="points"
|
averageKey="points"
|
||||||
HeaderRightChildren={
|
HeaderRightChildren={
|
||||||
<Flex alignItems={'center'} fontSize={'sm'} color={'myGray.600'}>
|
<Flex alignItems={'center'} fontSize={'sm'} color={'myGray.600'}>
|
||||||
{t('app:logs_total')}: {formatChartData.cumulative.points}
|
{t('app:logs_total')}: {formatChartData.cumulative.points.toFixed(2)}
|
||||||
</Flex>
|
</Flex>
|
||||||
}
|
}
|
||||||
blur={!feConfigs?.isPlus}
|
blur={!feConfigs?.isPlus}
|
||||||
@@ -599,7 +603,8 @@ const LogChart = ({
|
|||||||
{
|
{
|
||||||
label: t('app:logs_error_rate'),
|
label: t('app:logs_error_rate'),
|
||||||
dataKey: 'errorRate',
|
dataKey: 'errorRate',
|
||||||
color: theme.colors.primary['400']
|
color: theme.colors.primary['400'],
|
||||||
|
formatter: (value) => `${value}%`
|
||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
HeaderRightChildren={
|
HeaderRightChildren={
|
||||||
|
@@ -44,7 +44,7 @@ const SaveButton = ({
|
|||||||
placement={'bottom-end'}
|
placement={'bottom-end'}
|
||||||
hasArrow={false}
|
hasArrow={false}
|
||||||
offset={[2, 4]}
|
offset={[2, 4]}
|
||||||
w={'116px'}
|
w={'124px'}
|
||||||
onOpenFunc={() => setIsSave(true)}
|
onOpenFunc={() => setIsSave(true)}
|
||||||
onCloseFunc={() => setIsSave(false)}
|
onCloseFunc={() => setIsSave(false)}
|
||||||
trigger={'hover'}
|
trigger={'hover'}
|
||||||
|
Reference in New Issue
Block a user