(content)
| 301 | } |
| 302 | |
| 303 | function contentToText(content) { |
| 304 | if (typeof content === 'string') { |
| 305 | return content; |
| 306 | } |
| 307 | if (Array.isArray(content)) { |
| 308 | return content.map((part) => { |
| 309 | if (typeof part === 'string') { |
| 310 | return part; |
| 311 | } |
| 312 | if (part && typeof part === 'object') { |
| 313 | if (typeof part.text === 'string') { |
| 314 | return part.text; |
| 315 | } |
| 316 | if (typeof part.content === 'string') { |
| 317 | return part.content; |
| 318 | } |
| 319 | } |
| 320 | return part ? JSON.stringify(part) : ''; |
| 321 | }).filter(Boolean).join('\n\n'); |
| 322 | } |
| 323 | return content ? JSON.stringify(content) : ''; |
| 324 | } |
| 325 | |
| 326 | function normalizeObservation(message) { |
| 327 | const extra = message && message.extra ? message.extra : {}; |
no outgoing calls
no test coverage detected