fix/refac: temp chat image handling

This commit is contained in:
Timothy Jaeryang Baek
2025-12-22 09:48:53 +04:00
parent 4ab917c74b
commit 423983f5a7
+13 -3
View File
@@ -731,10 +731,20 @@
imageUrl = await compressImageHandler(imageUrl, $settings, $config); imageUrl = await compressImageHandler(imageUrl, $settings, $config);
} }
const blob = await (await fetch(imageUrl)).blob(); if ($temporaryChatEnabled) {
const compressedFile = new File([blob], file.name, { type: file.type }); files = [
...files,
{
type: 'image',
url: imageUrl
}
];
} else {
const blob = await (await fetch(imageUrl)).blob();
const compressedFile = new File([blob], file.name, { type: file.type });
uploadFileHandler(compressedFile, false); uploadFileHandler(compressedFile, false);
}
}; };
reader.readAsDataURL(file['type'] === 'image/heic' ? await convertHeicToJpeg(file) : file); reader.readAsDataURL(file['type'] === 'image/heic' ? await convertHeicToJpeg(file) : file);