Files
openmotion/shared/asset-limits.ts
open-design-crew[bot] 6fad1435eb fix(studio): unwrap feature prompt prefixes on reuse and reserve prefix in 20k budget (#1118)
* Fix feature prompt reuse and generation limits

Recover editable descriptions from composed generation history and reserve the active feature instruction in the composer input budget.

Fixes OPEND-5716, OPEND-5709, and OPEND-5740.

* Address review feedback on prompt reuse, whitespace limits, and over-limit alert

- Scope feature-prefix stripping on prompt reuse to active feature scenes so plain Text to Video / Text to Image prompts are preserved verbatim.
- Validate composer prompt limits against the exact trimmed/composed prompt sent to the API so leading/trailing whitespace does not cause false over-limit blocks.
- Render a localized role=alert recovery hint telling the user how many characters to remove when control selection reduces the available budget.

* Avoid raw maxLength whitespace clipping and use Studio i18n formatNumber

- Remove native textarea maxLength so pasting outer whitespace around a valid prompt never clips characters; validation and recovery alerts enforce the exact composed 20,000-char limit.
- Use Studio useI18n().formatNumber for locale-consistent prompt counter and recovery limit formatting.

* fix(studio): reuse shared om-field-error recipe and drop formatNumber fallback

---------

Co-authored-by: 罗高 <luogao@users.noreply.github.com>
2026-11-26 08:36:50 +08:00

7 lines
239 B
TypeScript

export const MAX_ASSET_BYTES = 500_000_000;
export const MAX_GENERATION_PROMPT_LENGTH = 20_000;
export function isAssetFileWithinLimit(file: { isFile(): boolean; size: number }) {
return file.isFile() && file.size <= MAX_ASSET_BYTES;
}