Skip to content

Commit cbc3f98

Browse files
committed
use aggressive defaults
1 parent c0a4082 commit cbc3f98

File tree

2 files changed

+6
-10
lines changed
  • apps/web/client/src/app/project/[id]/_components/right-panel/chat-tab/chat-input
  • packages/utility/src

2 files changed

+6
-10
lines changed

apps/web/client/src/app/project/[id]/_components/right-panel/chat-tab/chat-input/index.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,7 @@ export const ChatInput = observer(({
203203

204204
const reader = new FileReader();
205205
reader.onload = async (event) => {
206-
const compressedImage = await compressImageInBrowser(file, {
207-
maxSizeMB: 0.2,
208-
maxWidthOrHeight: 512,
209-
quality: 0.6,
210-
});
206+
const compressedImage = await compressImageInBrowser(file);
211207
const base64URL = compressedImage ?? (event.target?.result as string);
212208
const contextImage: ImageMessageContext = {
213209
type: MessageContextType.IMAGE,

packages/utility/src/image.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import imageCompression from 'browser-image-compression';
21
import { DefaultSettings } from '@onlook/constants';
3-
import { normalizePath } from './folder';
2+
import imageCompression from 'browser-image-compression';
43
import { isImageFile } from './file';
4+
import { normalizePath } from './folder';
55

66
// Browser-side image compression
77
export async function compressImageInBrowser(
@@ -13,9 +13,9 @@ export async function compressImageInBrowser(
1313
}
1414
): Promise<string | undefined> {
1515
const options = {
16-
maxSizeMB: compressionOptions?.maxSizeMB ?? 2,
17-
maxWidthOrHeight: compressionOptions?.maxWidthOrHeight ?? 2048,
18-
quality: compressionOptions?.quality ?? 0.8,
16+
maxSizeMB: compressionOptions?.maxSizeMB ?? 0.2,
17+
maxWidthOrHeight: compressionOptions?.maxWidthOrHeight ?? 512,
18+
quality: compressionOptions?.quality ?? 0.6,
1919
};
2020

2121
try {

0 commit comments

Comments
 (0)