mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-29 10:02:04 +00:00
26 lines
747 B
TypeScript
26 lines
747 B
TypeScript
export type OutboundMediaLoadParams = {
|
|
maxBytes?: number;
|
|
mediaLocalRoots?: readonly string[];
|
|
};
|
|
|
|
export type OutboundMediaLoadOptions = {
|
|
maxBytes?: number;
|
|
localRoots?: readonly string[];
|
|
};
|
|
|
|
export function resolveOutboundMediaLocalRoots(
|
|
mediaLocalRoots?: readonly string[],
|
|
): readonly string[] | undefined {
|
|
return mediaLocalRoots && mediaLocalRoots.length > 0 ? mediaLocalRoots : undefined;
|
|
}
|
|
|
|
export function buildOutboundMediaLoadOptions(
|
|
params: OutboundMediaLoadParams = {},
|
|
): OutboundMediaLoadOptions {
|
|
const localRoots = resolveOutboundMediaLocalRoots(params.mediaLocalRoots);
|
|
return {
|
|
...(params.maxBytes !== undefined ? { maxBytes: params.maxBytes } : {}),
|
|
...(localRoots ? { localRoots } : {}),
|
|
};
|
|
}
|