MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / buildResponsesInputContent

Function buildResponsesInputContent

ai/ai.ts:510–541  ·  view source on GitHub ↗
(
  text: string,
  images: AIContentPart[],
)

Source from the content-addressed store, hash-verified

508
509const 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
542const extractErrorMessage = (error: any): string => {
543 const msgText = typeof error?.message === "string" ? error.message : "";
544 const reasonText =

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected