diff options
author | H Lohaus <hlohaus@users.noreply.github.com> | 2024-04-10 08:14:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-10 08:14:50 +0200 |
commit | 00951eb79114adf74ad1a3f1ce596e9e0fa932bf (patch) | |
tree | fea75e7745d69b09d91b0003e5dbf12b77380223 /g4f/gui/server/api.py | |
parent | Update Dockerfile (diff) | |
download | gpt4free-00951eb79114adf74ad1a3f1ce596e9e0fa932bf.tar gpt4free-00951eb79114adf74ad1a3f1ce596e9e0fa932bf.tar.gz gpt4free-00951eb79114adf74ad1a3f1ce596e9e0fa932bf.tar.bz2 gpt4free-00951eb79114adf74ad1a3f1ce596e9e0fa932bf.tar.lz gpt4free-00951eb79114adf74ad1a3f1ce596e9e0fa932bf.tar.xz gpt4free-00951eb79114adf74ad1a3f1ce596e9e0fa932bf.tar.zst gpt4free-00951eb79114adf74ad1a3f1ce596e9e0fa932bf.zip |
Diffstat (limited to '')
-rw-r--r-- | g4f/gui/server/api.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/g4f/gui/server/api.py b/g4f/gui/server/api.py index 2b3f2fb6..bbae6066 100644 --- a/g4f/gui/server/api.py +++ b/g4f/gui/server/api.py @@ -8,7 +8,7 @@ from g4f import version, models from g4f import get_last_provider, ChatCompletion from g4f.errors import VersionNotFoundError from g4f.Provider import ProviderType, __providers__, __map__ -from g4f.providers.base_provider import ProviderModelMixin +from g4f.providers.base_provider import ProviderModelMixin, FinishReason from g4f.providers.conversation import BaseConversation conversations: dict[dict[str, BaseConversation]] = {} @@ -134,7 +134,7 @@ class Api(): elif isinstance(chunk, Exception): logging.exception(chunk) yield self._format_json("message", get_error_message(chunk)) - else: + elif not isinstance(chunk, FinishReason): yield self._format_json("content", str(chunk)) except Exception as e: logging.exception(e) |