(output: any)
| 1316 | * @returns {string} |
| 1317 | */ |
| 1318 | export const extractOutputFromArray = (output: any): string => { |
| 1319 | if (Array.isArray(output)) { |
| 1320 | return output.map((o) => o.text).join('\n') |
| 1321 | } else if (typeof output === 'object') { |
| 1322 | if (output.text) return output.text |
| 1323 | else return JSON.stringify(output) |
| 1324 | } |
| 1325 | return output |
| 1326 | } |
| 1327 | |
| 1328 | /** |
| 1329 | * Loop through the object and replace the key with the value |