MCPcopy Create free account
hub / github.com/simstudioai/sim / formatValue

Function formatValue

apps/sim/app/(interfaces)/chat/hooks/use-chat-streaming.ts:242–268  ·  view source on GitHub ↗
(value: any)

Source from the content-addressed store, hash-verified

240 let extractedFiles: ChatFile[] = []
241
242 const formatValue = (value: any): string | null => {
243 if (value === null || value === undefined) {
244 return null
245 }
246
247 if (isUserFileWithMetadata(value)) {
248 return null
249 }
250
251 if (Array.isArray(value) && value.length === 0) {
252 return null
253 }
254
255 if (typeof value === 'string') {
256 return value
257 }
258
259 if (typeof value === 'object') {
260 try {
261 return `\`\`\`json\n${JSON.stringify(value, null, 2)}\n\`\`\``
262 } catch {
263 return String(value)
264 }
265 }
266
267 return String(value)
268 }
269
270 const getOutputValue = (blockOutputs: Record<string, any>, path?: string) => {
271 if (!path || path === 'content') {

Callers 1

handleStreamedResponseFunction · 0.70

Calls 1

isUserFileWithMetadataFunction · 0.90

Tested by

no test coverage detected