( text: string, images: AIContentPart[], )
| 508 | |
| 509 | const buildResponsesInputContent = ( |
| 510 | text: string, |
| 511 | images: AIContentPart[], |
| 512 | ): Array< |
| 513 | | { type: "input_text"; text: string } |
| 514 | | { |
| 515 | type: "input_image"; |
| 516 | image_url: string; |
| 517 | } |
| 518 | > => { |
| 519 | const parts: Array< |
| 520 | | { type: "input_text"; text: string } |
| 521 | | { |
| 522 | type: "input_image"; |
| 523 | image_url: string; |
| 524 | } |
| 525 | > = []; |
| 526 | |
| 527 | if (text.trim()) { |
| 528 | parts.push({ type: "input_text", text: text.trim() }); |
| 529 | } |
| 530 | |
| 531 | for (const part of images) { |
| 532 | if (part.type !== "image_url") continue; |
| 533 | parts.push({ |
| 534 | type: "input_image", |
| 535 | image_url: part.image_url.url, |
| 536 | }); |
| 537 | } |
| 538 | |
| 539 | return parts; |
| 540 | }; |
| 541 | |
| 542 | const extractErrorMessage = (error: any): string => { |
| 543 | const msgText = typeof error?.message === "string" ? error.message : ""; |
| 544 | const reasonText = |
no outgoing calls
no test coverage detected