feat: Add MessageInput to the external chat page #1880 (#1963)

### 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:
balibabu
2024-08-15 16:10:21 +08:00
committed by GitHub
parent 6acc46bc7b
commit d3ff1a30bf
10 changed files with 146 additions and 122 deletions

View File

@ -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];
};