summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authort.me/xtekky <98614666+xtekky@users.noreply.github.com>2023-05-04 20:14:09 +0200
committerGitHub <noreply@github.com>2023-05-04 20:14:09 +0200
commit7cd8a58c37eb44ee20032ea16f9430877a011a3a (patch)
tree9868ac81403c2f15f3731ce0d91d9a83ffa549bd
parentMerge pull request #441 from hamza1312/main (diff)
parentMerge branch 'main' into main (diff)
downloadgpt4free-7cd8a58c37eb44ee20032ea16f9430877a011a3a.tar
gpt4free-7cd8a58c37eb44ee20032ea16f9430877a011a3a.tar.gz
gpt4free-7cd8a58c37eb44ee20032ea16f9430877a011a3a.tar.bz2
gpt4free-7cd8a58c37eb44ee20032ea16f9430877a011a3a.tar.lz
gpt4free-7cd8a58c37eb44ee20032ea16f9430877a011a3a.tar.xz
gpt4free-7cd8a58c37eb44ee20032ea16f9430877a011a3a.tar.zst
gpt4free-7cd8a58c37eb44ee20032ea16f9430877a011a3a.zip
Diffstat (limited to '')
-rw-r--r--gpt4free/theb/__init__.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/gpt4free/theb/__init__.py b/gpt4free/theb/__init__.py
index 852fe17b..0177194e 100644
--- a/gpt4free/theb/__init__.py
+++ b/gpt4free/theb/__init__.py
@@ -46,7 +46,6 @@ class Completion:
Completion.stream_completed = True
@staticmethod
-
def create(prompt: str, proxy: Optional[str] = None) -> Generator[str, None, None]:
Completion.stream_completed = False
@@ -65,4 +64,13 @@ class Completion:
@staticmethod
def handle_stream_response(response):
+ Completion.message_queue.put(response.decode())
+
+ @staticmethod
+ def get_response(prompt: str, proxy: Optional[str] = None) -> str:
+ response_list = []
+ for message in Completion.create(prompt, proxy):
+ response_list.append(message)
+ return ''.join(response_list)
+
Completion.message_queue.put(response.decode(errors='replace'))