mirror of
https://github.com/xtekky/gpt4free.git
synced 2024-09-12 08:29:30 -04:00
Update __init__.py
This commit is contained in:
parent
b9478049b3
commit
41e00dde26
@ -144,10 +144,15 @@ class Completion:
|
||||
response = Completion.__response_to_json(content)
|
||||
return response
|
||||
|
||||
|
||||
@classmethod
|
||||
def __response_to_json(cls, text) -> str:
|
||||
text = str(text.decode("utf-8"))
|
||||
|
||||
split_text = text.rsplit("\n", 1)[1]
|
||||
to_json = json.loads(split_text)
|
||||
return to_json
|
||||
split_text = text.rsplit("\n", 1)
|
||||
if len(split_text) > 1:
|
||||
to_json = json.loads(split_text[1])
|
||||
return to_json
|
||||
else:
|
||||
return None
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user