summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/ChatGpt.py
diff options
context:
space:
mode:
authorkqlio67 <kqlio67@users.noreply.github.com>2024-10-03 00:15:38 +0200
committerkqlio67 <kqlio67@users.noreply.github.com>2024-10-03 00:15:38 +0200
commitcba121daac8a0365fc192a901d8d3023f13fa535 (patch)
tree7e011c13e4ac5ac392e0496229f0a35e227d816a /g4f/Provider/ChatGpt.py
parentrefactor(g4f/Provider/Bixin123.py): remove Bixin123 provider (diff)
downloadgpt4free-cba121daac8a0365fc192a901d8d3023f13fa535.tar
gpt4free-cba121daac8a0365fc192a901d8d3023f13fa535.tar.gz
gpt4free-cba121daac8a0365fc192a901d8d3023f13fa535.tar.bz2
gpt4free-cba121daac8a0365fc192a901d8d3023f13fa535.tar.lz
gpt4free-cba121daac8a0365fc192a901d8d3023f13fa535.tar.xz
gpt4free-cba121daac8a0365fc192a901d8d3023f13fa535.tar.zst
gpt4free-cba121daac8a0365fc192a901d8d3023f13fa535.zip
Diffstat (limited to 'g4f/Provider/ChatGpt.py')
-rw-r--r--g4f/Provider/ChatGpt.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/g4f/Provider/ChatGpt.py b/g4f/Provider/ChatGpt.py
index 37ad17d8..b5a78b9a 100644
--- a/g4f/Provider/ChatGpt.py
+++ b/g4f/Provider/ChatGpt.py
@@ -136,7 +136,6 @@ class ChatGpt(AbstractProvider, ProviderModelMixin):
response = session.post('https://chatgpt.com/backend-anon/sentinel/chat-requirements',
headers=headers, json={'p': pow_req})
- # Додана перевірка на статус відповідей, якщо "незвична активність"
if response.status_code != 200:
print(f"Request failed with status: {response.status_code}")
print(f"Response content: {response.content}")
@@ -199,7 +198,6 @@ class ChatGpt(AbstractProvider, ProviderModelMixin):
},
}
- # Додав паузу між запитами для уникнення блокувань через частоту
time.sleep(2)
response = session.post('https://chatgpt.com/backend-anon/conversation',
@@ -209,10 +207,10 @@ class ChatGpt(AbstractProvider, ProviderModelMixin):
for line in response.iter_lines():
if line:
decoded_line = line.decode()
- print(f"Received line: {decoded_line}") # Debugging output
+ print(f"Received line: {decoded_line}")
if decoded_line.startswith('data:'):
- json_string = decoded_line[6:] # Extract JSON part after 'data:'
- if json_string.strip(): # Check if there's actual content
+ json_string = decoded_line[6:]
+ if json_string.strip():
try:
data = json.loads(json_string)
except json.JSONDecodeError as e: