mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-17 14:51:35 +00:00
Merged via squash.
Prepared head SHA: e37e577cd4
Co-authored-by: vincentkoc <25068+vincentkoc@users.noreply.github.com>
Co-authored-by: vincentkoc <25068+vincentkoc@users.noreply.github.com>
Reviewed-by: @vincentkoc
16 lines
598 B
TypeScript
16 lines
598 B
TypeScript
// Media Understanding Common module implements video behavior.
|
|
import { DEFAULT_VIDEO_MAX_BASE64_BYTES } from "./defaults.js";
|
|
|
|
// Video payload size helpers for base64-expanded request bodies.
|
|
|
|
/** Estimate base64 size for a byte count. */
|
|
export function estimateBase64Size(bytes: number): number {
|
|
return Math.ceil(bytes / 3) * 4;
|
|
}
|
|
|
|
/** Resolve video base64 byte limit from raw byte limit and global cap. */
|
|
export function resolveVideoMaxBase64Bytes(maxBytes: number): number {
|
|
const expanded = estimateBase64Size(maxBytes);
|
|
return Math.min(expanded, DEFAULT_VIDEO_MAX_BASE64_BYTES);
|
|
}
|