summaryrefslogtreecommitdiffstats
path: root/g4f/gui/server/api.py
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2024-03-26 06:42:47 +0100
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2024-03-26 06:42:47 +0100
commit95bab66dad89b6712bddbb4a20eb89d6cf5236b5 (patch)
treee9653f9026e947d14246b76282f5c198c123e24f /g4f/gui/server/api.py
parentUpdate min requirements, Add pycryptodome (diff)
downloadgpt4free-95bab66dad89b6712bddbb4a20eb89d6cf5236b5.tar
gpt4free-95bab66dad89b6712bddbb4a20eb89d6cf5236b5.tar.gz
gpt4free-95bab66dad89b6712bddbb4a20eb89d6cf5236b5.tar.bz2
gpt4free-95bab66dad89b6712bddbb4a20eb89d6cf5236b5.tar.lz
gpt4free-95bab66dad89b6712bddbb4a20eb89d6cf5236b5.tar.xz
gpt4free-95bab66dad89b6712bddbb4a20eb89d6cf5236b5.tar.zst
gpt4free-95bab66dad89b6712bddbb4a20eb89d6cf5236b5.zip
Diffstat (limited to '')
-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))