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

Method buildDoubaoVideoContent

ai/ai.ts:3223–3260  ·  view source on GitHub ↗
(
    prompt: string,
    images: AIContentPart[],
    imageMode: VideoImageMode,
  )

Source from the content-addressed store, hash-verified

3221
3222 private buildDoubaoVideoContent(
3223 prompt: string,
3224 images: AIContentPart[],
3225 imageMode: VideoImageMode,
3226 ): Array<Record<string, any>> {
3227 const content: Array<Record<string, any>> = [];
3228 const trimmedPrompt = prompt.trim();
3229 if (trimmedPrompt) {
3230 content.push({ type: "text", text: trimmedPrompt });
3231 }
3232
3233 const imageParts = images.filter(
3234 (part) => part.type === "image_url" && !!parseDataUrl(part.image_url.url),
3235 );
3236 const imageCount = imageParts.length;
3237
3238 for (const [index, part] of imageParts.entries()) {
3239 if (part.type !== "image_url") continue;
3240 const item: Record<string, any> = {
3241 type: "image_url",
3242 image_url: { url: part.image_url.url },
3243 };
3244 if (imageMode === "first") {
3245 item.role = "first_frame";
3246 } else if (imageMode === "firstlast") {
3247 item.role = index === 0 ? "first_frame" : "last_frame";
3248 } else if (imageMode === "reference") {
3249 item.role = "reference_image";
3250 } else if (imageCount === 2) {
3251 item.role = index === 0 ? "first_frame" : "last_frame";
3252 } else if (imageCount > 2) {
3253 item.role = "reference_image";
3254 }
3255 content.push(item);
3256 }
3257
3258 return content;
3259 }
3260
3261 private async generateGeminiImageRest(
3262 providerConfig: ProviderConfig,
3263 model: string,

Callers 1

Calls 1

parseDataUrlFunction · 0.85

Tested by

no test coverage detected