MCPcopy Create free account
hub / github.com/FlowiseAI/Flowise / extractResponseContent

Function extractResponseContent

packages/components/src/utils.ts:2276–2297  ·  view source on GitHub ↗
(response: any)

Source from the content-addressed store, hash-verified

2274}
2275
2276export const extractResponseContent = (response: any): string => {
2277 if (!response) return ''
2278
2279 const content = response.content
2280
2281 if (Array.isArray(content)) {
2282 return content
2283 .map((item: any) => {
2284 if ((item.text && !item.type) || (item.type === 'text' && item.text)) {
2285 return item.text
2286 }
2287 return ''
2288 })
2289 .filter((text: string) => text)
2290 .join('\n')
2291 }
2292
2293 if (typeof content === 'string') return content
2294 if (content != null) return JSON.stringify(content, null, 2)
2295
2296 return JSON.stringify(response, null, 2)
2297}
2298
2299export const isReasoningModelOpenAI = (name: string): boolean => {
2300 if (/^o[134]/.test(name)) return true

Callers 15

checkForViolationsMethod · 0.90
runMethod · 0.90
handleMemoryMethod · 0.90
handleSummaryBufferMethod · 0.90
runMethod · 0.90
handleMemoryMethod · 0.90
handleSummaryBufferMethod · 0.90
runMethod · 0.90
runMethod · 0.90
handleMemoryMethod · 0.90
handleSummaryBufferMethod · 0.90
handleToolCallsMethod · 0.90

Calls 1

stringifyMethod · 0.80

Tested by

no test coverage detected