mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? feat: API access key management #2846 feat: Render markdown file with remark-loader #2846 ### Type of change - [ ] Bug Fix (non-breaking change which fixes an issue) - [x] New Feature (non-breaking change which adds functionality) - [ ] Documentation Update - [ ] Refactoring - [ ] Performance Improvement - [ ] Other (please describe):
41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
import LineChart from '@/components/line-chart';
|
|
import { useTranslate } from '@/hooks/common-hooks';
|
|
import { IStats } from '@/interfaces/database/chat';
|
|
import { formatDate } from '@/utils/date';
|
|
import camelCase from 'lodash/camelCase';
|
|
import { useSelectChartStatsList } from '../hooks';
|
|
|
|
import styles from './index.less';
|
|
|
|
const StatsLineChart = ({ statsType }: { statsType: keyof IStats }) => {
|
|
const { t } = useTranslate('chat');
|
|
const chartList = useSelectChartStatsList();
|
|
const list =
|
|
chartList[statsType]?.map((x) => ({
|
|
...x,
|
|
xAxis: formatDate(x.xAxis),
|
|
})) ?? [];
|
|
|
|
return (
|
|
<div className={styles.chartItem}>
|
|
<b className={styles.chartLabel}>{t(camelCase(statsType))}</b>
|
|
<LineChart data={list}></LineChart>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
const StatsChart = () => {
|
|
return (
|
|
<div className={styles.chartWrapper}>
|
|
<StatsLineChart statsType={'pv'}></StatsLineChart>
|
|
<StatsLineChart statsType={'round'}></StatsLineChart>
|
|
<StatsLineChart statsType={'speed'}></StatsLineChart>
|
|
<StatsLineChart statsType={'thumb_up'}></StatsLineChart>
|
|
<StatsLineChart statsType={'tokens'}></StatsLineChart>
|
|
<StatsLineChart statsType={'uv'}></StatsLineChart>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default StatsChart;
|