fix(web): cap default images at 5 MiB

This commit is contained in:
creatixchu
2026-08-12 14:47:20 +08:00
parent 8d4c3f8a0a
commit 51dc55ec3d
15 changed files with 21 additions and 20 deletions

View File

@@ -12,7 +12,7 @@ export { detectImage } from './image.ts'
export { readImageFile, saveImageFile, validateImageFile } from './store.ts'
/** Default maximum encoded bytes for one image. */
export const DEFAULT_MAX_IMAGE_BYTES = 10 * 1024 * 1024
export const DEFAULT_MAX_IMAGE_BYTES = 5 * 1024 * 1024
/** Default maximum images in one prompt. */
export const DEFAULT_MAX_IMAGES_PER_MESSAGE = 20
/** Default maximum aggregate image bytes in one prompt. */

View File

@@ -14,6 +14,7 @@ import LocalAttachmentStore, {
describe('local attachment service', () => {
it('resolves every omitted admission limit explicitly', () => {
const service = new LocalAttachmentStore(new Context(), {})
expect(DEFAULT_MAX_IMAGE_BYTES).toBe(5 * 1024 * 1024)
expect(service.imageLimits).toEqual({
maxImageBytes: DEFAULT_MAX_IMAGE_BYTES,
maxImagesPerMessage: DEFAULT_MAX_IMAGES_PER_MESSAGE,