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

Method editImage

ai/ai.ts:3700–3728  ·  view source on GitHub ↗
(
    prompt: string,
    image: AIImage,
    token?: AbortToken,
  )

Source from the content-addressed store, hash-verified

3698
3699 async editImage(
3700 prompt: string,
3701 image: AIImage,
3702 token?: AbortToken,
3703 ): Promise<AIImage[]> {
3704 const { providerConfig, model, config } =
3705 await this.getCurrentProviderConfig("image");
3706 const { modeConfig } = this.resolveMode(providerConfig, "image", model);
3707
3708 if (!modeConfig.supportsEdit) {
3709 throw new UserError("当前提供商未启用图片编辑支持");
3710 }
3711
3712 if (!image.data) {
3713 throw new Error("无法解析图片数据");
3714 }
3715
3716 const handler = this.strategyHandlers[modeConfig.strategy]?.image;
3717 if (!handler) throw new UserError("当前提供商不支持图片编辑");
3718 return await handler({
3719 providerConfig,
3720 model,
3721 config,
3722 modeConfig,
3723 prompt,
3724 image,
3725 token,
3726 });
3727 }
3728
3729 async generateVideo(
3730 prompt: string,
3731 images: AIContentPart[],

Callers 1

executeMethod · 0.80

Calls 2

resolveModeMethod · 0.95

Tested by

no test coverage detected