Feat(tool): fal ai flux image generation (#10606)

This commit is contained in:
Kalo Chin 2024-11-13 18:41:58 +09:00 committed by GitHub
parent bddecba9ed
commit 2a4783307a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 843 additions and 0 deletions

View File

@ -78,3 +78,4 @@
- regex
- trello
- vanna
- fal

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32">
<path d="M0 0 C3.96 0 7.92 0 12 0 C12.4125 0.928125 12.825 1.85625 13.25 2.8125 C15.56104487 7.02190315 17.49701732 8.49900577 22 10 C22 13.96 22 17.92 22 22 C21.071875 22.4125 20.14375 22.825 19.1875 23.25 C14.97809685 25.56104487 13.50099423 27.49701732 12 32 C8.04 32 4.08 32 0 32 C-0.4125 31.071875 -0.825 30.14375 -1.25 29.1875 C-3.56104487 24.97809685 -5.49701732 23.50099423 -10 22 C-10 18.04 -10 14.08 -10 10 C-9.071875 9.5875 -8.14375 9.175 -7.1875 8.75 C-2.97809685 6.43895513 -1.50099423 4.50298268 0 0 Z M-2 11 C-3.42662219 13.85324437 -3.31033868 15.83454549 -3 19 C-1.20006226 21.69990662 0.083773 23.5418865 3 25 C7.1364408 25.56406011 8.76045933 25.14638597 12.375 22.9375 C15.26054626 20.20817124 15.26054626 20.20817124 15.6875 16.5625 C14.76325283 11.77321919 13.68514918 10.2147046 10 7 C4.54838272 6.02649691 1.87056683 7.12943317 -2 11 Z " fill="#EC0648" transform="translate(10,0)"/>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -0,0 +1,20 @@
import requests
from core.tools.errors import ToolProviderCredentialValidationError
from core.tools.provider.builtin_tool_provider import BuiltinToolProviderController
class FalProvider(BuiltinToolProviderController):
def _validate_credentials(self, credentials: dict) -> None:
url = "https://fal.run/fal-ai/flux/dev"
headers = {
"Authorization": f"Key {credentials.get('fal_api_key')}",
"Content-Type": "application/json",
}
data = {"prompt": "Cat"}
response = requests.post(url, json=data, headers=headers)
if response.status_code == 401:
raise ToolProviderCredentialValidationError("FAL API key is invalid")
elif response.status_code != 200:
raise ToolProviderCredentialValidationError(f"FAL API key validation failed: {response.text}")

View File

@ -0,0 +1,21 @@
identity:
author: Kalo Chin
name: fal
label:
en_US: FAL
zh_CN: FAL
description:
en_US: The image generation API provided by FAL.
zh_CN: FAL 提供的图像生成 API。
icon: icon.svg
tags:
- image
credentials_for_provider:
fal_api_key:
type: secret-input
required: true
label:
en_US: FAL API Key
placeholder:
en_US: Please input your FAL API key
url: https://fal.ai/dashboard/keys

View File

@ -0,0 +1,46 @@
from typing import Any, Union
import requests
from core.tools.entities.tool_entities import ToolInvokeMessage
from core.tools.tool.builtin_tool import BuiltinTool
class Flux11ProTool(BuiltinTool):
def _invoke(
self, user_id: str, tool_parameters: dict[str, Any]
) -> Union[ToolInvokeMessage, list[ToolInvokeMessage]]:
headers = {
"Authorization": f"Key {self.runtime.credentials['fal_api_key']}",
"Content-Type": "application/json",
}
prompt = tool_parameters.get("prompt", "")
sanitized_prompt = prompt.replace("\\", "") # Remove backslashes from the prompt which may cause errors
payload = {
"prompt": sanitized_prompt,
"image_size": tool_parameters.get("image_size", "landscape_4_3"),
"seed": tool_parameters.get("seed"),
"sync_mode": tool_parameters.get("sync_mode", False),
"num_images": tool_parameters.get("num_images", 1),
"enable_safety_checker": tool_parameters.get("enable_safety_checker", True),
"safety_tolerance": tool_parameters.get("safety_tolerance", "2"),
}
url = "https://fal.run/fal-ai/flux-pro/v1.1"
response = requests.post(url, json=payload, headers=headers)
if response.status_code != 200:
return self.create_text_message(f"Got Error Response: {response.text}")
res = response.json()
result = [self.create_json_message(res)]
for image_info in res.get("images", []):
image_url = image_info.get("url")
if image_url:
result.append(self.create_image_message(image=image_url, save_as=self.VariableKey.IMAGE.value))
return result

View File

@ -0,0 +1,147 @@
identity:
name: flux_1_1_pro
author: Kalo Chin
label:
en_US: FLUX 1.1 [pro]
zh_Hans: FLUX 1.1 [pro]
icon: icon.svg
description:
human:
en_US: FLUX 1.1 [pro] is an enhanced version of FLUX.1 [pro], improved image generation capabilities, delivering superior composition, detail, and artistic fidelity compared to its predecessor.
zh_Hans: FLUX 1.1 [pro] 是 FLUX.1 [pro] 的增强版,改进了图像生成能力,与其前身相比,提供了更出色的构图、细节和艺术保真度。
llm: This tool generates images from prompts using FAL's FLUX 1.1 [pro] model.
parameters:
- name: prompt
type: string
required: true
label:
en_US: Prompt
zh_Hans: 提示词
human_description:
en_US: The text prompt used to generate the image.
zh_Hans: 用于生成图片的文字提示词。
llm_description: This prompt text will be used to generate the image.
form: llm
- name: image_size
type: select
required: false
options:
- value: square_hd
label:
en_US: Square HD
zh_Hans: 方形高清
- value: square
label:
en_US: Square
zh_Hans: 方形
- value: portrait_4_3
label:
en_US: Portrait 4:3
zh_Hans: 竖屏 4:3
- value: portrait_16_9
label:
en_US: Portrait 16:9
zh_Hans: 竖屏 16:9
- value: landscape_4_3
label:
en_US: Landscape 4:3
zh_Hans: 横屏 4:3
- value: landscape_16_9
label:
en_US: Landscape 16:9
zh_Hans: 横屏 16:9
default: landscape_4_3
label:
en_US: Image Size
zh_Hans: 图片大小
human_description:
en_US: The size of the generated image.
zh_Hans: 生成图像的尺寸。
form: form
- name: num_images
type: number
required: false
default: 1
min: 1
max: 1
label:
en_US: Number of Images
zh_Hans: 图片数量
human_description:
en_US: The number of images to generate.
zh_Hans: 要生成的图片数量。
form: form
- name: safety_tolerance
type: select
required: false
options:
- value: "1"
label:
en_US: "1 (Most strict)"
zh_Hans: "1最严格"
- value: "2"
label:
en_US: "2"
zh_Hans: "2"
- value: "3"
label:
en_US: "3"
zh_Hans: "3"
- value: "4"
label:
en_US: "4"
zh_Hans: "4"
- value: "5"
label:
en_US: "5"
zh_Hans: "5"
- value: "6"
label:
en_US: "6 (Most permissive)"
zh_Hans: "6最宽松"
default: "2"
label:
en_US: Safety Tolerance
zh_Hans: 安全容忍度
human_description:
en_US: The safety tolerance level for the generated image. 1 being the most strict and 6 being the most permissive.
zh_Hans: 生成图像的安全容忍级别1 为最严格6 为最宽松。
form: form
- name: seed
type: number
required: false
min: 0
max: 9999999999
label:
en_US: Seed
zh_Hans: 种子
human_description:
en_US: The same seed and prompt can produce similar images.
zh_Hans: 相同的种子和提示词可以产生相似的图像。
form: form
- name: enable_safety_checker
type: boolean
required: false
default: true
label:
en_US: Enable Safety Checker
zh_Hans: 启用安全检查器
human_description:
en_US: Enable or disable the safety checker.
zh_Hans: 启用或禁用安全检查器。
form: form
- name: sync_mode
type: boolean
required: false
default: false
label:
en_US: Sync Mode
zh_Hans: 同步模式
human_description:
en_US: >
If set to true, the function will wait for the image to be generated and uploaded before returning the response.
This will increase the latency but allows you to get the image directly in the response without going through the CDN.
zh_Hans: >
如果设置为 true函数将在生成并上传图像后再返回响应。
这将增加函数的延迟,但可以让您直接在响应中获取图像,而无需通过 CDN。
form: form

View File

@ -0,0 +1,47 @@
from typing import Any, Union
import requests
from core.tools.entities.tool_entities import ToolInvokeMessage
from core.tools.tool.builtin_tool import BuiltinTool
class Flux11ProUltraTool(BuiltinTool):
def _invoke(
self, user_id: str, tool_parameters: dict[str, Any]
) -> Union[ToolInvokeMessage, list[ToolInvokeMessage]]:
headers = {
"Authorization": f"Key {self.runtime.credentials['fal_api_key']}",
"Content-Type": "application/json",
}
prompt = tool_parameters.get("prompt", "")
sanitized_prompt = prompt.replace("\\", "") # Remove backslashes from the prompt which may cause errors
payload = {
"prompt": sanitized_prompt,
"seed": tool_parameters.get("seed"),
"sync_mode": tool_parameters.get("sync_mode", False),
"num_images": tool_parameters.get("num_images", 1),
"enable_safety_checker": tool_parameters.get("enable_safety_checker", True),
"safety_tolerance": str(tool_parameters.get("safety_tolerance", "2")),
"aspect_ratio": tool_parameters.get("aspect_ratio", "16:9"),
"raw": tool_parameters.get("raw", False),
}
url = "https://fal.run/fal-ai/flux-pro/v1.1-ultra"
response = requests.post(url, json=payload, headers=headers)
if response.status_code != 200:
return self.create_text_message(f"Got Error Response: {response.text}")
res = response.json()
result = [self.create_json_message(res)]
for image_info in res.get("images", []):
image_url = image_info.get("url")
if image_url:
result.append(self.create_image_message(image=image_url, save_as=self.VariableKey.IMAGE.value))
return result

View File

@ -0,0 +1,162 @@
identity:
name: flux_1_1_pro_ultra
author: Kalo Chin
label:
en_US: FLUX 1.1 [pro] ultra
zh_Hans: FLUX 1.1 [pro] ultra
icon: icon.svg
description:
human:
en_US: FLUX 1.1 [pro] ultra is the newest version of FLUX 1.1 [pro], maintaining professional-grade image quality while delivering up to 2K resolution with improved photo realism.
zh_Hans: FLUX 1.1 [pro] ultra 是 FLUX 1.1 [pro] 的最新版本,保持了专业级的图像质量,同时以改进的照片真实感提供高达 2K 的分辨率。
llm: This tool generates images from prompts using FAL's FLUX 1.1 [pro] ultra model.
parameters:
- name: prompt
type: string
required: true
label:
en_US: Prompt
zh_Hans: 提示词
human_description:
en_US: The text prompt used to generate the image.
zh_Hans: 用于生成图像的文本提示。
llm_description: This prompt text will be used to generate the image.
form: llm
- name: aspect_ratio
type: select
required: false
options:
- value: '21:9'
label:
en_US: '21:9'
zh_Hans: '21:9'
- value: '16:9'
label:
en_US: '16:9'
zh_Hans: '16:9'
- value: '4:3'
label:
en_US: '4:3'
zh_Hans: '4:3'
- value: '1:1'
label:
en_US: '1:1'
zh_Hans: '1:1'
- value: '3:4'
label:
en_US: '3:4'
zh_Hans: '3:4'
- value: '9:16'
label:
en_US: '9:16'
zh_Hans: '9:16'
- value: '9:21'
label:
en_US: '9:21'
zh_Hans: '9:21'
default: '16:9'
label:
en_US: Aspect Ratio
zh_Hans: 纵横比
human_description:
en_US: The aspect ratio of the generated image.
zh_Hans: 生成图像的宽高比。
form: form
- name: num_images
type: number
required: false
default: 1
min: 1
max: 1
label:
en_US: Number of Images
zh_Hans: 图片数量
human_description:
en_US: The number of images to generate.
zh_Hans: 要生成的图像数量。
form: form
- name: safety_tolerance
type: select
required: false
options:
- value: "1"
label:
en_US: "1 (Most strict)"
zh_Hans: "1最严格"
- value: "2"
label:
en_US: "2"
zh_Hans: "2"
- value: "3"
label:
en_US: "3"
zh_Hans: "3"
- value: "4"
label:
en_US: "4"
zh_Hans: "4"
- value: "5"
label:
en_US: "5"
zh_Hans: "5"
- value: "6"
label:
en_US: "6 (Most permissive)"
zh_Hans: "6最宽松"
default: '2'
label:
en_US: Safety Tolerance
zh_Hans: 安全容忍度
human_description:
en_US: The safety tolerance level for the generated image. 1 being the most strict and 6 being the most permissive.
zh_Hans: 生成图像的安全容忍级别1 为最严格6 为最宽松。
form: form
- name: seed
type: number
required: false
min: 0
max: 9999999999
label:
en_US: Seed
zh_Hans: 种子
human_description:
en_US: The same seed and prompt can produce similar images.
zh_Hans: 相同的种子和提示词可以生成相似的图像。
form: form
- name: raw
type: boolean
required: false
default: false
label:
en_US: Raw Mode
zh_Hans: 原始模式
human_description:
en_US: Generate less processed, more natural-looking images.
zh_Hans: 生成较少处理、更自然的图像。
form: form
- name: enable_safety_checker
type: boolean
required: false
default: true
label:
en_US: Enable Safety Checker
zh_Hans: 启用安全检查器
human_description:
en_US: Enable or disable the safety checker.
zh_Hans: 启用或禁用安全检查器。
form: form
- name: sync_mode
type: boolean
required: false
default: false
label:
en_US: Sync Mode
zh_Hans: 同步模式
human_description:
en_US: >
If set to true, the function will wait for the image to be generated and uploaded before returning the response.
This will increase the latency but allows you to get the image directly in the response without going through the CDN.
zh_Hans: >
如果设置为 true函数将在生成并上传图像后才返回响应。
这将增加延迟,但允许您直接在响应中获取图像,而无需通过 CDN。
form: form

View File

@ -0,0 +1,47 @@
from typing import Any, Union
import requests
from core.tools.entities.tool_entities import ToolInvokeMessage
from core.tools.tool.builtin_tool import BuiltinTool
class Flux1DevTool(BuiltinTool):
def _invoke(
self, user_id: str, tool_parameters: dict[str, Any]
) -> Union[ToolInvokeMessage, list[ToolInvokeMessage]]:
headers = {
"Authorization": f"Key {self.runtime.credentials['fal_api_key']}",
"Content-Type": "application/json",
}
prompt = tool_parameters.get("prompt", "")
sanitized_prompt = prompt.replace("\\", "") # Remove backslashes from the prompt which may cause errors
payload = {
"prompt": sanitized_prompt,
"image_size": tool_parameters.get("image_size", "landscape_4_3"),
"num_inference_steps": tool_parameters.get("num_inference_steps", 28),
"guidance_scale": tool_parameters.get("guidance_scale", 3.5),
"seed": tool_parameters.get("seed"),
"num_images": tool_parameters.get("num_images", 1),
"enable_safety_checker": tool_parameters.get("enable_safety_checker", True),
"sync_mode": tool_parameters.get("sync_mode", False),
}
url = "https://fal.run/fal-ai/flux/dev"
response = requests.post(url, json=payload, headers=headers)
if response.status_code != 200:
return self.create_text_message(f"Got Error Response: {response.text}")
res = response.json()
result = [self.create_json_message(res)]
for image_info in res.get("images", []):
image_url = image_info.get("url")
if image_url:
result.append(self.create_image_message(image=image_url, save_as=self.VariableKey.IMAGE.value))
return result

View File

@ -0,0 +1,137 @@
identity:
name: flux_1_dev
author: Kalo Chin
label:
en_US: FLUX.1 [dev]
zh_Hans: FLUX.1 [dev]
icon: icon.svg
description:
human:
en_US: FLUX.1 [dev] is a 12 billion parameter flow transformer that generates high-quality images from text. It is suitable for personal and commercial use.
zh_Hans: FLUX.1 [dev] 是一个拥有120亿参数的流动变换模型可以从文本生成高质量的图像。适用于个人和商业用途。
llm: This tool generates images from prompts using FAL's FLUX.1 [dev] model.
parameters:
- name: prompt
type: string
required: true
label:
en_US: Prompt
zh_Hans: 提示词
human_description:
en_US: The text prompt used to generate the image.
zh_Hans: 用于生成图片的文字提示词。
llm_description: This prompt text will be used to generate the image.
form: llm
- name: image_size
type: select
required: false
options:
- value: square_hd
label:
en_US: Square HD
zh_Hans: 方形高清
- value: square
label:
en_US: Square
zh_Hans: 方形
- value: portrait_4_3
label:
en_US: Portrait 4:3
zh_Hans: 竖屏 4:3
- value: portrait_16_9
label:
en_US: Portrait 16:9
zh_Hans: 竖屏 16:9
- value: landscape_4_3
label:
en_US: Landscape 4:3
zh_Hans: 横屏 4:3
- value: landscape_16_9
label:
en_US: Landscape 16:9
zh_Hans: 横屏 16:9
default: landscape_4_3
label:
en_US: Image Size
zh_Hans: 图片大小
human_description:
en_US: The size of the generated image.
zh_Hans: 生成图像的尺寸。
form: form
- name: num_images
type: number
required: false
default: 1
min: 1
max: 4
label:
en_US: Number of Images
zh_Hans: 图片数量
human_description:
en_US: The number of images to generate.
zh_Hans: 要生成的图片数量。
form: form
- name: num_inference_steps
type: number
required: false
default: 28
min: 1
max: 50
label:
en_US: Num Inference Steps
zh_Hans: 推理步数
human_description:
en_US: The number of inference steps to perform. More steps produce higher quality but take longer.
zh_Hans: 执行的推理步骤数量。更多的步骤可以产生更高质量的结果,但需要更长的时间。
form: form
- name: guidance_scale
type: number
required: false
default: 3.5
min: 0
max: 20
label:
en_US: Guidance Scale
zh_Hans: 指导强度
human_description:
en_US: How closely the model should follow the prompt.
zh_Hans: 模型对提示词的遵循程度。
form: form
- name: seed
type: number
required: false
min: 0
max: 9999999999
label:
en_US: Seed
zh_Hans: 种子
human_description:
en_US: The same seed and prompt can produce similar images.
zh_Hans: 相同的种子和提示可以产生相似的图像。
form: form
- name: enable_safety_checker
type: boolean
required: false
default: true
label:
en_US: Enable Safety Checker
zh_Hans: 启用安全检查器
human_description:
en_US: Enable or disable the safety checker.
zh_Hans: 启用或禁用安全检查器。
form: form
- name: sync_mode
type: boolean
required: false
default: false
label:
en_US: Sync Mode
zh_Hans: 同步模式
human_description:
en_US: >
If set to true, the function will wait for the image to be generated and uploaded before returning the response.
This will increase the latency but allows you to get the image directly in the response without going through the CDN.
zh_Hans: >
如果设置为 true函数将在生成并上传图像后再返回响应。
这将增加函数的延迟,但可以让您直接在响应中获取图像,而无需通过 CDN。
form: form

View File

@ -0,0 +1,47 @@
from typing import Any, Union
import requests
from core.tools.entities.tool_entities import ToolInvokeMessage
from core.tools.tool.builtin_tool import BuiltinTool
class Flux1ProNewTool(BuiltinTool):
def _invoke(
self, user_id: str, tool_parameters: dict[str, Any]
) -> Union[ToolInvokeMessage, list[ToolInvokeMessage]]:
headers = {
"Authorization": f"Key {self.runtime.credentials['fal_api_key']}",
"Content-Type": "application/json",
}
prompt = tool_parameters.get("prompt", "")
sanitized_prompt = prompt.replace("\\", "") # Remove backslashes that may cause errors
payload = {
"prompt": sanitized_prompt,
"image_size": tool_parameters.get("image_size", "landscape_4_3"),
"num_inference_steps": tool_parameters.get("num_inference_steps", 28),
"guidance_scale": tool_parameters.get("guidance_scale", 3.5),
"seed": tool_parameters.get("seed"),
"num_images": tool_parameters.get("num_images", 1),
"safety_tolerance": tool_parameters.get("safety_tolerance", "2"),
"sync_mode": tool_parameters.get("sync_mode", False),
}
url = "https://fal.run/fal-ai/flux-pro/new"
response = requests.post(url, json=payload, headers=headers)
if response.status_code != 200:
return self.create_text_message(f"Got Error Response: {response.text}")
res = response.json()
result = [self.create_json_message(res)]
for image_info in res.get("images", []):
image_url = image_info.get("url")
if image_url:
result.append(self.create_image_message(image=image_url, save_as=self.VariableKey.IMAGE.value))
return result

View File

@ -0,0 +1,164 @@
identity:
name: flux_1_pro_new
author: Kalo Chin
label:
en_US: FLUX.1 [pro] new
zh_Hans: FLUX.1 [pro] new
icon: icon.svg
description:
human:
en_US: FLUX.1 [pro] new is an accelerated version of FLUX.1 [pro], maintaining professional-grade image quality while delivering significantly faster generation speeds.
zh_Hans: FLUX.1 [pro] new 是 FLUX.1 [pro] 的加速版本,在保持专业级图像质量的同时,大大提高了生成速度。
llm: This tool generates images from prompts using FAL's FLUX.1 [pro] new model.
parameters:
- name: prompt
type: string
required: true
label:
en_US: Prompt
zh_Hans: 提示词
human_description:
en_US: The text prompt used to generate the image.
zh_Hans: 用于生成图像的文本提示。
llm_description: This prompt text will be used to generate the image.
form: llm
- name: image_size
type: select
required: false
options:
- value: square_hd
label:
en_US: Square HD
zh_Hans: 正方形高清
- value: square
label:
en_US: Square
zh_Hans: 正方形
- value: portrait_4_3
label:
en_US: Portrait 4:3
zh_Hans: 竖屏 4:3
- value: portrait_16_9
label:
en_US: Portrait 16:9
zh_Hans: 竖屏 16:9
- value: landscape_4_3
label:
en_US: Landscape 4:3
zh_Hans: 横屏 4:3
- value: landscape_16_9
label:
en_US: Landscape 16:9
zh_Hans: 横屏 16:9
default: landscape_4_3
label:
en_US: Image Size
zh_Hans: 图像尺寸
human_description:
en_US: The size of the generated image.
zh_Hans: 生成图像的尺寸。
form: form
- name: num_images
type: number
required: false
default: 1
min: 1
max: 1
label:
en_US: Number of Images
zh_Hans: 图像数量
human_description:
en_US: The number of images to generate.
zh_Hans: 要生成的图像数量。
form: form
- name: num_inference_steps
type: number
required: false
default: 28
min: 1
max: 50
label:
en_US: Num Inference Steps
zh_Hans: 推理步数
human_description:
en_US: The number of inference steps to perform. More steps produce higher quality but take longer.
zh_Hans: 执行的推理步数。步数越多,质量越高,但所需时间也更长。
form: form
- name: guidance_scale
type: number
required: false
default: 3.5
min: 0
max: 20
label:
en_US: Guidance Scale
zh_Hans: 指导强度
human_description:
en_US: How closely the model should follow the prompt.
zh_Hans: 模型对提示词的遵循程度。
form: form
- name: safety_tolerance
type: select
required: false
options:
- value: "1"
label:
en_US: "1 (Most strict)"
zh_Hans: "1最严格"
- value: "2"
label:
en_US: "2"
zh_Hans: "2"
- value: "3"
label:
en_US: "3"
zh_Hans: "3"
- value: "4"
label:
en_US: "4"
zh_Hans: "4"
- value: "5"
label:
en_US: "5"
zh_Hans: "5"
- value: "6"
label:
en_US: "6 (Most permissive)"
zh_Hans: "6最宽松"
default: "2"
label:
en_US: Safety Tolerance
zh_Hans: 安全容忍度
human_description:
en_US: >
The safety tolerance level for the generated image. 1 being the most strict and 5 being the most permissive.
zh_Hans: >
生成图像的安全容忍级别。1 是最严格6 是最宽松。
form: form
- name: seed
type: number
required: false
min: 0
max: 9999999999
label:
en_US: Seed
zh_Hans: 种子
human_description:
en_US: The same seed and prompt can produce similar images.
zh_Hans: 相同的种子和提示词可以生成相似的图像。
form: form
- name: sync_mode
type: boolean
required: false
default: false
label:
en_US: Sync Mode
zh_Hans: 同步模式
human_description:
en_US: >
If set to true, the function will wait for the image to be generated and uploaded before returning the response.
This will increase the latency but allows you to get the image directly in the response without going through the CDN.
zh_Hans: >
如果设置为 true函数将在生成并上传图像后才返回响应。
这将增加延迟,但允许您直接在响应中获取图像,而无需通过 CDN。
form: form