summaryrefslogtreecommitdiffstats
path: root/g4f/gui/server/api.py
diff options
context:
space:
mode:
authorH Lohaus <hlohaus@users.noreply.github.com>2024-03-26 21:50:35 +0100
committerGitHub <noreply@github.com>2024-03-26 21:50:35 +0100
commitdd08125bb4740ab5dc1116868ff237ce51ae3d5e (patch)
treeed6339c66505409e7dced6d3499814b00446ff12 /g4f/gui/server/api.py
parentMerge pull request #1754 from hlohaus/goo (diff)
parentFix load .har files, add hardir to docker, add docs (diff)
downloadgpt4free-dd08125bb4740ab5dc1116868ff237ce51ae3d5e.tar
gpt4free-dd08125bb4740ab5dc1116868ff237ce51ae3d5e.tar.gz
gpt4free-dd08125bb4740ab5dc1116868ff237ce51ae3d5e.tar.bz2
gpt4free-dd08125bb4740ab5dc1116868ff237ce51ae3d5e.tar.lz
gpt4free-dd08125bb4740ab5dc1116868ff237ce51ae3d5e.tar.xz
gpt4free-dd08125bb4740ab5dc1116868ff237ce51ae3d5e.tar.zst
gpt4free-dd08125bb4740ab5dc1116868ff237ce51ae3d5e.zip
Diffstat (limited to 'g4f/gui/server/api.py')
-rw-r--r--g4f/gui/server/api.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/g4f/gui/server/api.py b/g4f/gui/server/api.py
index 11b28dda..da934d57 100644
--- a/g4f/gui/server/api.py
+++ b/g4f/gui/server/api.py
@@ -39,9 +39,9 @@ from g4f.errors import VersionNotFoundError
from g4f.Provider import ProviderType, __providers__, __map__
from g4f.providers.base_provider import ProviderModelMixin
from g4f.Provider.bing.create_images import patch_provider
-from g4f.Provider.Bing import Conversation
+from g4f.providers.conversation import BaseConversation
-conversations: dict[str, Conversation] = {}
+conversations: dict[str, BaseConversation] = {}
class Api():
@@ -230,14 +230,14 @@ class Api():
if first:
first = False
yield self._format_json("provider", get_last_provider(True))
- if isinstance(chunk, Conversation):
+ if isinstance(chunk, BaseConversation):
conversations[conversation_id] = chunk
yield self._format_json("conversation", conversation_id)
elif isinstance(chunk, Exception):
logging.exception(chunk)
yield self._format_json("message", get_error_message(chunk))
else:
- yield self._format_json("content", chunk)
+ yield self._format_json("content", str(chunk))
except Exception as e:
logging.exception(e)
yield self._format_json('error', get_error_message(e))