UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

3 lines • 1.55 kB
import{o as normalizeLowercaseStringOrEmpty}from"./string-coerce-CpTFcSwY.mjs";import{P as resolveIntegerOption}from"./number-coercion-B3CfI447.mjs"; //!packages/memory-host-sdk/src/host/multimodal.ts const MEMORY_MULTIMODAL_SPECS={image:{labelPrefix:`Image file`,extensions:[`.jpg`,`.jpeg`,`.png`,`.webp`,`.gif`,`.heic`,`.heif`]},audio:{labelPrefix:`Audio file`,extensions:[`.mp3`,`.wav`,`.ogg`,`.opus`,`.m4a`,`.m2a`,`.aac`,`.flac`]}};const MEMORY_MULTIMODAL_MODALITIES=Object.keys(MEMORY_MULTIMODAL_SPECS);const DEFAULT_MEMORY_MULTIMODAL_MAX_FILE_BYTES=10485760;function normalizeMemoryMultimodalModalities(e){if(e===void 0||e.includes(`all`))return[...MEMORY_MULTIMODAL_MODALITIES];return[...new Set(e.filter(e=>e===`image`||e===`audio`))]}function normalizeMemoryMultimodalSettings(e){const t=e.enabled===true;const n=resolveIntegerOption(e.maxFileBytes,DEFAULT_MEMORY_MULTIMODAL_MAX_FILE_BYTES,{min:1});return{enabled:t,modalities:t?normalizeMemoryMultimodalModalities(e.modalities):[],maxFileBytes:n}}function isMemoryMultimodalEnabled(e){return e.enabled&&e.modalities.length>0}function buildMemoryMultimodalLabel(e,t){return`${MEMORY_MULTIMODAL_SPECS[e].labelPrefix}: ${t}`}function classifyMemoryMultimodalPath(e,t){if(!isMemoryMultimodalEnabled(t))return null;const n=normalizeLowercaseStringOrEmpty(e);return t.modalities.find(e=>MEMORY_MULTIMODAL_SPECS[e].extensions.some(e=>n.endsWith(e)))??null}export{normalizeMemoryMultimodalSettings as i,classifyMemoryMultimodalPath as n,isMemoryMultimodalEnabled as r,buildMemoryMultimodalLabel as t};