Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(desktop-app): name the decoded 16 MiB total in the Grok composer copy

Alfredo Lopez25228232443f
diff --git a/desktop-app/ui/src/components/agents/ComposerPanel.tsx b/desktop-app/ui/src/components/agents/ComposerPanel.tsx
index c6e3ad1eb..b8776990d 100644
--- a/desktop-app/ui/src/components/agents/ComposerPanel.tsx
+++ b/desktop-app/ui/src/components/agents/ComposerPanel.tsx
@@ -21,6 +21,7 @@ import {
import {
COMPOSER_ACCEPT_IMAGE_MIME_TYPES,
COMPOSER_MAX_IMAGE_ATTACHMENTS,
+ type ComposerImageBudget,
composerImageBudget,
} from '@constants/attachments'
import { useContextsDataController } from '@hooks/domain/useContextsDataController'
@@ -60,6 +61,14 @@ function formatComposerMebibytes(bytes: number): number {
return Math.round(bytes / (1024 * 1024))
}
+/** Only reached for a budget with a composer total, which always carries its label. */
+function composerTotalLimitLabel(budget: ComposerImageBudget): string {
+ if (budget.totalLimitLabelBytes === null) {
+ throw new Error('composer image budget has a total without a label')
+ }
+ return `${formatComposerMebibytes(budget.totalLimitLabelBytes)} ${budget.sizeUnit}`
+}
+
function bytesFromBase64(data: string): Uint8Array | null {
try {
const binary = atob(data)
@@ -570,9 +579,9 @@ export function ComposerPanel({ inline = false, agentSelector }: ComposerPanelPr
totalBase64Bytes + dataBase64.length > imageBudget.maxTotalBase64Bytes
) {
validationErrors.push(
- `${file.name || 'Image'} does not fit in this message: the images in one message are limited to ${formatComposerMebibytes(
- imageBudget.maxTotalBase64Bytes
- )} ${imageBudget.sizeUnit} in total. Send the attached images first or remove one.`
+ `${file.name || 'Image'} does not fit in this message: the images in one message are limited to ${composerTotalLimitLabel(
+ imageBudget
+ )} in total. Send the attached images first or remove one.`
)
revokePreviewUrl(previewUrl)
continue
@@ -661,9 +670,9 @@ export function ComposerPanel({ inline = false, agentSelector }: ComposerPanelPr
)
}
throw new Error(
- `${updated.name || 'Image'} was kept unchanged. The images in one message are limited to ${formatComposerMebibytes(
- imageBudget.maxTotalBase64Bytes ?? 0
- )} ${imageBudget.sizeUnit} in total.`
+ `${updated.name || 'Image'} was kept unchanged. The images in one message are limited to ${composerTotalLimitLabel(
+ imageBudget
+ )} in total.`
)
},
[composerImageAttachments, imageBudget, onUpdateComposerImageAttachment]
diff --git a/desktop-app/ui/src/constants/attachments.ts b/desktop-app/ui/src/constants/attachments.ts
index eca78062d..3251561ad 100644
--- a/desktop-app/ui/src/constants/attachments.ts
+++ b/desktop-app/ui/src/constants/attachments.ts
@@ -41,6 +41,12 @@ export type ComposerImageBudget = {
maxImageBytes: number
/** `null` → no composer aggregate; the Codex hop owns that ceiling. */
maxTotalBase64Bytes: number | null
+ /**
+ * Bytes the total-limit copy names. It is the base64 total for the general
+ * branch (#669 counts and names base64 MB) and the decoded ingress total for
+ * Grok, whose base64 total is exactly the encoding of 16 MiB.
+ */
+ totalLimitLabelBytes: number | null
/** `null` → no composer pixel bound (Grok and general models). */
maxDimension: number | null
sizeUnit: 'MB' | 'MiB'
@@ -55,6 +61,7 @@ export function composerImageBudget(provider: string | null | undefined): Compos
return {
maxImageBytes: CODEX_COMPOSER_MAX_IMAGE_BYTES,
maxTotalBase64Bytes: null,
+ totalLimitLabelBytes: null,
maxDimension: CODEX_COMPOSER_MAX_IMAGE_DIMENSION,
sizeUnit: 'MiB',
}
@@ -63,6 +70,7 @@ export function composerImageBudget(provider: string | null | undefined): Compos
return {
maxImageBytes: GROK_COMPOSER_MAX_IMAGE_BYTES,
maxTotalBase64Bytes: GROK_COMPOSER_MAX_TOTAL_IMAGE_BASE64_BYTES,
+ totalLimitLabelBytes: GROK_COMPOSER_MAX_IMAGE_BYTES,
maxDimension: null,
sizeUnit: 'MiB',
}
@@ -70,6 +78,7 @@ export function composerImageBudget(provider: string | null | undefined): Compos
return {
maxImageBytes: COMPOSER_MAX_IMAGE_BYTES,
maxTotalBase64Bytes: COMPOSER_MAX_TOTAL_IMAGE_BASE64_BYTES,
+ totalLimitLabelBytes: COMPOSER_MAX_TOTAL_IMAGE_BASE64_BYTES,
maxDimension: null,
sizeUnit: 'MB',
}