MCPcopy Index your code
hub / github.com/simstudioai/sim / extractFalMediaUrl

Function extractFalMediaUrl

apps/sim/lib/media/falai.ts:173–191  ·  view source on GitHub ↗
(
  data: Record<string, unknown>,
  keys: string[]
)

Source from the content-addressed store, hash-verified

171 * shapes different models return (string url, { url }, nested arrays).
172 */
173export function extractFalMediaUrl(
174 data: Record<string, unknown>,
175 keys: string[]
176): string | undefined {
177 for (const key of keys) {
178 const value = data[key]
179 if (typeof value === 'string') return value
180 if (isRecordLike(value)) {
181 const url = getStringProp(value, 'url')
182 if (url) return url
183 }
184 if (Array.isArray(value)) {
185 const first = value.find(isRecordLike) as Record<string, unknown> | undefined
186 const url = getStringProp(first, 'url')
187 if (url) return url
188 }
189 }
190 return undefined
191}
192
193/** Securely download a generated media URL (or inline data URI) to a buffer. */
194export async function downloadFalMedia(

Callers 2

generateFalAudioFunction · 0.90
generateFalVideoFunction · 0.90

Calls 2

isRecordLikeFunction · 0.90
getStringPropFunction · 0.85

Tested by

no test coverage detected