diff options
author | H Lohaus <hlohaus@users.noreply.github.com> | 2024-11-21 05:00:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-21 05:00:08 +0100 |
commit | eae317a1665f94ada0c34875a0aec09df89b138b (patch) | |
tree | 179028357182327909cb7bd4f53977e8ae4d9122 /g4f/gui/server/api.py | |
parent | Improve download of generated images, serve images in the api (#2391) (diff) | |
download | gpt4free-eae317a1665f94ada0c34875a0aec09df89b138b.tar gpt4free-eae317a1665f94ada0c34875a0aec09df89b138b.tar.gz gpt4free-eae317a1665f94ada0c34875a0aec09df89b138b.tar.bz2 gpt4free-eae317a1665f94ada0c34875a0aec09df89b138b.tar.lz gpt4free-eae317a1665f94ada0c34875a0aec09df89b138b.tar.xz gpt4free-eae317a1665f94ada0c34875a0aec09df89b138b.tar.zst gpt4free-eae317a1665f94ada0c34875a0aec09df89b138b.zip |
Diffstat (limited to 'g4f/gui/server/api.py')
-rw-r--r-- | g4f/gui/server/api.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/g4f/gui/server/api.py b/g4f/gui/server/api.py index 00eb7182..0c32bea5 100644 --- a/g4f/gui/server/api.py +++ b/g4f/gui/server/api.py @@ -13,7 +13,7 @@ from g4f.errors import VersionNotFoundError from g4f.image import ImagePreview, ImageResponse, copy_images, ensure_images_dir, images_dir from g4f.Provider import ProviderType, __providers__, __map__ from g4f.providers.base_provider import ProviderModelMixin -from g4f.providers.response import BaseConversation, FinishReason +from g4f.providers.response import BaseConversation, FinishReason, SynthesizeData from g4f.client.service import convert_to_provider from g4f import debug @@ -177,6 +177,8 @@ class Api: images = asyncio.run(copy_images(chunk.get_list(), chunk.options.get("cookies"))) images = ImageResponse(images, chunk.alt) yield self._format_json("content", str(images)) + elif isinstance(chunk, SynthesizeData): + yield self._format_json("synthesize", chunk.to_json()) elif not isinstance(chunk, FinishReason): yield self._format_json("content", str(chunk)) if debug.logs: |