(response: any)
| 2274 | } |
| 2275 | |
| 2276 | export 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 | |
| 2299 | export const isReasoningModelOpenAI = (name: string): boolean => { |
| 2300 | if (/^o[134]/.test(name)) return true |
no test coverage detected