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

Method generateVideoWithDoubao

ai/ai.ts:3516–3609  ·  view source on GitHub ↗
(
    providerConfig: ProviderConfig,
    model: string,
    prompt: string,
    images: AIContentPart[],
    imageMode: VideoImageMode,
    videoAudio: boolean,
    videoDuration: number,
    modeConfig: ProviderModeConfig,
    token?: AbortToken,
  )

Source from the content-addressed store, hash-verified

3514
3515 private async generateVideoWithDoubao(
3516 providerConfig: ProviderConfig,
3517 model: string,
3518 prompt: string,
3519 images: AIContentPart[],
3520 imageMode: VideoImageMode,
3521 videoAudio: boolean,
3522 videoDuration: number,
3523 modeConfig: ProviderModeConfig,
3524 token?: AbortToken,
3525 ): Promise<AIVideo[]> {
3526 const baseUrl = resolveBaseUrl(providerConfig, modeConfig);
3527
3528 const content = this.buildDoubaoVideoContent(prompt, images, imageMode);
3529 const data: Record<string, any> = {
3530 model,
3531 content,
3532 generateAudio: videoAudio,
3533 duration: videoDuration,
3534 };
3535 this.applyVideoDefaults(data, modeConfig);
3536
3537 const endpoint = modeConfig.endpoint || "api/v3/contents/generations/tasks";
3538 const authMode = resolveAuthMode(
3539 getProviderProfile(providerConfig),
3540 modeConfig,
3541 providerConfig,
3542 );
3543 const authConfig = applyAuthConfig(
3544 authMode,
3545 providerConfig,
3546 resolveEndpointUrl(baseUrl, endpoint),
3547 {
3548 "Content-Type": "application/json",
3549 },
3550 );
3551 const response = await this.httpClient.request(
3552 {
3553 url: authConfig.url,
3554 method: "POST",
3555 headers: authConfig.headers,
3556 data,
3557 },
3558 token,
3559 );
3560
3561 const taskId =
3562 response.data?.task_id ||
3563 response.data?.data?.task_id ||
3564 response.data?.data?.id ||
3565 response.data?.id;
3566 if (!taskId) throw new Error("视频生成任务创建失败");
3567
3568 const videoUrl = await pollTask<string>(
3569 async (abortToken) => {
3570 const pollUrl = resolveEndpointUrl(baseUrl, `${endpoint}/${taskId}`);
3571 const authConfig = applyAuthConfig(
3572 authMode,
3573 providerConfig,

Callers 1

Calls 9

applyVideoDefaultsMethod · 0.95
resolveBaseUrlFunction · 0.85
resolveAuthModeFunction · 0.85
getProviderProfileFunction · 0.85
applyAuthConfigFunction · 0.85
resolveEndpointUrlFunction · 0.85
buildDoubaoVideoUrlFunction · 0.85
requestMethod · 0.45

Tested by

no test coverage detected