Skip to content

Commit 67d00ac

Browse files
committed
v1.9.1-beta1 fix bugs
1 parent 3971900 commit 67d00ac

File tree

8 files changed

+8180
-7258
lines changed

8 files changed

+8180
-7258
lines changed

chatgpt/ChatService.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ async def get_chat_requirements(self):
189189
config = get_config(self.user_agent, self.req_token)
190190
p = get_requirements_token(config)
191191
data = {'p': p}
192-
r = await self.ss.post(url, headers=headers, json=data, timeout=5)
192+
r = await self.ss.post(url, headers=headers, json=data, timeout=10)
193193
if r.status_code == 200:
194194
resp = r.json()
195195

@@ -319,35 +319,33 @@ async def prepare_send_conversation(self):
319319
"time_since_loaded": random.randint(50, 500),
320320
"page_height": random.randint(500, 1000),
321321
"page_width": random.randint(1000, 2000),
322-
"pixel_ratio": 1.5,
323-
"screen_height": random.randint(800, 1200),
324-
"screen_width": random.randint(1200, 2200),
322+
"pixel_ratio": 1,
323+
"screen_height": 1440,
324+
"screen_width": 2560,
325325
},
326326
"conversation_mode": conversation_mode,
327-
"conversation_origin": None,
327+
"enable_message_followups": False,
328328
"force_paragen": False,
329329
"force_paragen_model_slug": "",
330330
"force_rate_limit": False,
331331
"force_use_sse": True,
332-
"history_and_training_disabled": self.history_disabled,
333332
"messages": chat_messages,
334333
"model": self.req_model,
335334
"paragen_cot_summary_display_override": "allow",
336-
"paragen_stream_type_override": None,
337335
"parent_message_id": self.parent_message_id if self.parent_message_id else f"client-created-root",
338-
"reset_rate_limits": False,
339-
"suggestions": [],
340336
"supported_encodings": ["v1"],
341337
"system_hints": [],
342338
"timezone": "America/Los_Angeles",
343339
"timezone_offset_min": -480,
344340
"variant_purpose": "comparison_implicit",
345-
"websocket_request_id": f"{uuid.uuid4()}",
346341
}
347342
if "image" in self.origin_model or "image" in self.req_model:
348343
self.chat_request["system_hints"].append("picture_v2")
349344
if self.conversation_id:
350345
self.chat_request['conversation_id'] = self.conversation_id
346+
if self.history_disabled:
347+
self.chat_request["history_and_training_disabled"] = True
348+
351349
return self.chat_request
352350

353351
async def send_conversation(self):

chatgpt/chatFormat.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,9 @@ async def api_messages_to_chat(service, api_messages, upload_by_url=False):
467467
"metadata": metadata
468468
}
469469
chat_messages.append(chat_message)
470+
if "image" in service.origin_model or "image" in service.req_model:
471+
chat_messages[-1]["metadata"]["system_hints"] = ["picture_v2"]
472+
470473
text_tokens = await num_tokens_from_messages(api_messages, service.resp_model)
471474
prompt_tokens = text_tokens + file_tokens
472475
return chat_messages, prompt_tokens

chatgpt/refreshToken.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,19 @@ async def chat_refresh(refresh_token):
3535
"redirect_uri": "com.openai.chat://auth0.openai.com/ios/com.openai.chat/callback",
3636
"refresh_token": refresh_token
3737
}
38+
headers = {
39+
'accept': '*/*',
40+
'accept-encoding': 'gzip, deflate, br, zstd',
41+
'accept-language': 'en-US,en;q=0.9',
42+
'content-type': 'application/json',
43+
'origin': 'https://auth0.openai.com',
44+
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36 Edg/136.0.0.0'
45+
}
3846
session_id = hashlib.md5(refresh_token.encode()).hexdigest()
3947
proxy_url = random.choice(proxy_url_list).replace("{}", session_id) if proxy_url_list else None
4048
client = Client(proxy=proxy_url)
4149
try:
42-
r = await client.post("https://auth0.openai.com/oauth/token", json=data, timeout=15)
50+
r = await client.post("https://auth0.openai.com/oauth/token", json=data, headers=headers, timeout=15)
4351
if r.status_code == 200:
4452
access_token = r.json()['access_token']
4553
return access_token

templates/chatgpt.html

Lines changed: 172 additions & 297 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)