mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? feat: Add MessageInput to the external chat page #1880 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -85,3 +85,16 @@ export const downloadFile = ({
|
||||
downloadElement.click();
|
||||
document.body.removeChild(downloadElement);
|
||||
};
|
||||
|
||||
const Units = ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
||||
|
||||
export const formatBytes = (x: string | number) => {
|
||||
let l = 0,
|
||||
n = (typeof x === 'string' ? parseInt(x, 10) : x) || 0;
|
||||
|
||||
while (n >= 1024 && ++l) {
|
||||
n = n / 1024;
|
||||
}
|
||||
|
||||
return n.toFixed(n < 10 && l > 0 ? 1 : 0) + ' ' + Units[l];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user