forked from infiniflow/ragflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### What problem does this PR solve? feat: render stats charts feat: create api token feat: delete api token feat: add ChatApiKeyModal feat: add RagLineChart Issue link: infiniflow#345 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
- Loading branch information
Showing
25 changed files
with
1,177 additions
and
40 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { useTranslate } from '@/hooks/commonHooks'; | ||
import { CheckOutlined, CopyOutlined } from '@ant-design/icons'; | ||
import { Tooltip } from 'antd'; | ||
import { useState } from 'react'; | ||
import { CopyToClipboard as Clipboard, Props } from 'react-copy-to-clipboard'; | ||
|
||
const CopyToClipboard = ({ text }: Props) => { | ||
const [copied, setCopied] = useState(false); | ||
const { t } = useTranslate('common'); | ||
|
||
const handleCopy = () => { | ||
setCopied(true); | ||
setTimeout(() => { | ||
setCopied(false); | ||
}, 2000); | ||
}; | ||
|
||
return ( | ||
<Tooltip title={copied ? t('copied') : t('copy')}> | ||
<Clipboard text={text} onCopy={handleCopy}> | ||
{copied ? <CheckOutlined /> : <CopyOutlined />} | ||
</Clipboard> | ||
</Tooltip> | ||
); | ||
}; | ||
|
||
export default CopyToClipboard; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import { | ||
CartesianGrid, | ||
Legend, | ||
Line, | ||
LineChart, | ||
ResponsiveContainer, | ||
Tooltip, | ||
XAxis, | ||
YAxis, | ||
} from 'recharts'; | ||
import { CategoricalChartProps } from 'recharts/types/chart/generateCategoricalChart'; | ||
|
||
const data = [ | ||
{ | ||
name: 'Page A', | ||
uv: 4000, | ||
pv: 2400, | ||
}, | ||
{ | ||
name: 'Page B', | ||
uv: 3000, | ||
pv: 1398, | ||
}, | ||
{ | ||
name: 'Page C', | ||
uv: 2000, | ||
pv: 9800, | ||
}, | ||
{ | ||
name: 'Page D', | ||
uv: 2780, | ||
pv: 3908, | ||
}, | ||
{ | ||
name: 'Page E', | ||
uv: 1890, | ||
pv: 4800, | ||
}, | ||
{ | ||
name: 'Page F', | ||
uv: 2390, | ||
pv: 3800, | ||
}, | ||
{ | ||
name: 'Page G', | ||
uv: 3490, | ||
pv: 4300, | ||
}, | ||
]; | ||
|
||
interface IProps extends CategoricalChartProps { | ||
data?: Array<{ xAxis: string; yAxis: number }>; | ||
} | ||
|
||
const RagLineChart = ({ data }: IProps) => { | ||
return ( | ||
<ResponsiveContainer width="100%" height="100%"> | ||
<LineChart | ||
// width={500} | ||
// height={300} | ||
data={data} | ||
margin={ | ||
{ | ||
// top: 5, | ||
// right: 30, | ||
// left: 20, | ||
// bottom: 10, | ||
} | ||
} | ||
> | ||
<CartesianGrid strokeDasharray="3 3" /> | ||
<XAxis dataKey="xAxis" /> | ||
<YAxis /> | ||
<Tooltip /> | ||
<Legend /> | ||
<Line | ||
type="monotone" | ||
dataKey="yAxis" | ||
stroke="#8884d8" | ||
activeDot={{ r: 8 }} | ||
/> | ||
{/* <Line type="monotone" dataKey="uv" stroke="#82ca9d" /> */} | ||
</LineChart> | ||
</ResponsiveContainer> | ||
); | ||
}; | ||
|
||
export default RagLineChart; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.