mirror of
https://github.com/lanqian528/chat2api.git
synced 2026-06-13 21:02:46 +08:00
v1.9.1-beta1 fix bugs
This commit is contained in:
parent
3971900a0d
commit
67d00acb0c
@ -189,7 +189,7 @@ class ChatService:
|
||||
config = get_config(self.user_agent, self.req_token)
|
||||
p = get_requirements_token(config)
|
||||
data = {'p': p}
|
||||
r = await self.ss.post(url, headers=headers, json=data, timeout=5)
|
||||
r = await self.ss.post(url, headers=headers, json=data, timeout=10)
|
||||
if r.status_code == 200:
|
||||
resp = r.json()
|
||||
|
||||
@ -319,35 +319,33 @@ class ChatService:
|
||||
"time_since_loaded": random.randint(50, 500),
|
||||
"page_height": random.randint(500, 1000),
|
||||
"page_width": random.randint(1000, 2000),
|
||||
"pixel_ratio": 1.5,
|
||||
"screen_height": random.randint(800, 1200),
|
||||
"screen_width": random.randint(1200, 2200),
|
||||
"pixel_ratio": 1,
|
||||
"screen_height": 1440,
|
||||
"screen_width": 2560,
|
||||
},
|
||||
"conversation_mode": conversation_mode,
|
||||
"conversation_origin": None,
|
||||
"enable_message_followups": False,
|
||||
"force_paragen": False,
|
||||
"force_paragen_model_slug": "",
|
||||
"force_rate_limit": False,
|
||||
"force_use_sse": True,
|
||||
"history_and_training_disabled": self.history_disabled,
|
||||
"messages": chat_messages,
|
||||
"model": self.req_model,
|
||||
"paragen_cot_summary_display_override": "allow",
|
||||
"paragen_stream_type_override": None,
|
||||
"parent_message_id": self.parent_message_id if self.parent_message_id else f"client-created-root",
|
||||
"reset_rate_limits": False,
|
||||
"suggestions": [],
|
||||
"supported_encodings": ["v1"],
|
||||
"system_hints": [],
|
||||
"timezone": "America/Los_Angeles",
|
||||
"timezone_offset_min": -480,
|
||||
"variant_purpose": "comparison_implicit",
|
||||
"websocket_request_id": f"{uuid.uuid4()}",
|
||||
}
|
||||
if "image" in self.origin_model or "image" in self.req_model:
|
||||
self.chat_request["system_hints"].append("picture_v2")
|
||||
if self.conversation_id:
|
||||
self.chat_request['conversation_id'] = self.conversation_id
|
||||
if self.history_disabled:
|
||||
self.chat_request["history_and_training_disabled"] = True
|
||||
|
||||
return self.chat_request
|
||||
|
||||
async def send_conversation(self):
|
||||
|
||||
@ -467,6 +467,9 @@ async def api_messages_to_chat(service, api_messages, upload_by_url=False):
|
||||
"metadata": metadata
|
||||
}
|
||||
chat_messages.append(chat_message)
|
||||
if "image" in service.origin_model or "image" in service.req_model:
|
||||
chat_messages[-1]["metadata"]["system_hints"] = ["picture_v2"]
|
||||
|
||||
text_tokens = await num_tokens_from_messages(api_messages, service.resp_model)
|
||||
prompt_tokens = text_tokens + file_tokens
|
||||
return chat_messages, prompt_tokens
|
||||
|
||||
@ -35,11 +35,19 @@ async def chat_refresh(refresh_token):
|
||||
"redirect_uri": "com.openai.chat://auth0.openai.com/ios/com.openai.chat/callback",
|
||||
"refresh_token": refresh_token
|
||||
}
|
||||
headers = {
|
||||
'accept': '*/*',
|
||||
'accept-encoding': 'gzip, deflate, br, zstd',
|
||||
'accept-language': 'en-US,en;q=0.9',
|
||||
'content-type': 'application/json',
|
||||
'origin': 'https://auth0.openai.com',
|
||||
'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'
|
||||
}
|
||||
session_id = hashlib.md5(refresh_token.encode()).hexdigest()
|
||||
proxy_url = random.choice(proxy_url_list).replace("{}", session_id) if proxy_url_list else None
|
||||
client = Client(proxy=proxy_url)
|
||||
try:
|
||||
r = await client.post("https://auth0.openai.com/oauth/token", json=data, timeout=15)
|
||||
r = await client.post("https://auth0.openai.com/oauth/token", json=data, headers=headers, timeout=15)
|
||||
if r.status_code == 200:
|
||||
access_token = r.json()['access_token']
|
||||
return access_token
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -1,39 +1,39 @@
|
||||
[
|
||||
{
|
||||
"_2235": 2236,
|
||||
"_2237": 2238,
|
||||
"_2338": 37
|
||||
"_2640": 2641,
|
||||
"_2642": 2643,
|
||||
"_2737": 37
|
||||
},
|
||||
"__type",
|
||||
"AccountState",
|
||||
"accountItems",
|
||||
[
|
||||
2239
|
||||
2644
|
||||
],
|
||||
[
|
||||
"SingleFetchClassInstance",
|
||||
2240
|
||||
2645
|
||||
],
|
||||
{
|
||||
"_2241": 2242
|
||||
"_2646": 2647
|
||||
},
|
||||
"data",
|
||||
{
|
||||
"_21": 37,
|
||||
"_2243": 2244,
|
||||
"_2245": 2246,
|
||||
"_2648": 2649,
|
||||
"_2650": 2651,
|
||||
"_65": -5,
|
||||
"_2247": -5,
|
||||
"_2248": -5,
|
||||
"_2652": -5,
|
||||
"_2653": -5,
|
||||
"_40": 41,
|
||||
"_2249": 2250,
|
||||
"_2654": 2655,
|
||||
"_42": -5,
|
||||
"_2251": 2252,
|
||||
"_2253": 30,
|
||||
"_2254": 2255,
|
||||
"_2291": 2292,
|
||||
"_2336": 67,
|
||||
"_2337": -5
|
||||
"_2656": 2657,
|
||||
"_2658": 30,
|
||||
"_2659": 2660,
|
||||
"_2689": 2690,
|
||||
"_2735": 67,
|
||||
"_2736": -5
|
||||
},
|
||||
"residencyRegion",
|
||||
"no_constraint",
|
||||
@ -48,119 +48,109 @@
|
||||
"deactivated",
|
||||
"subscriptionStatus",
|
||||
{
|
||||
"_2256": 2257,
|
||||
"_2258": 67,
|
||||
"_2259": 30,
|
||||
"_2260": 2261,
|
||||
"_2262": 2263,
|
||||
"_2661": -5,
|
||||
"_2662": 67,
|
||||
"_2663": 30,
|
||||
"_2664": 2665,
|
||||
"_2666": 2667,
|
||||
"_38": 39,
|
||||
"_2264": 2265,
|
||||
"_2266": -7,
|
||||
"_2267": 67,
|
||||
"_2268": 67,
|
||||
"_2269": 2270,
|
||||
"_2271": 2272,
|
||||
"_2278": 30,
|
||||
"_2279": 2280,
|
||||
"_2287": 67,
|
||||
"_2288": 30,
|
||||
"_2289": -7,
|
||||
"_2290": -7
|
||||
"_2668": 2669,
|
||||
"_2670": 2671,
|
||||
"_2672": -7,
|
||||
"_2673": 67,
|
||||
"_2674": 30,
|
||||
"_2675": -5,
|
||||
"_2676": 2677,
|
||||
"_2683": 30,
|
||||
"_2684": -5,
|
||||
"_2685": 67,
|
||||
"_2686": 30,
|
||||
"_2687": -7,
|
||||
"_2688": -7
|
||||
},
|
||||
"billingPeriod",
|
||||
"monthly",
|
||||
"hasPaidSubscription",
|
||||
"isActiveSubscriptionGratis",
|
||||
"billingCurrency",
|
||||
"USD",
|
||||
"subscriptionPlan",
|
||||
"chatgptproplan",
|
||||
"subscriptionRenewsAt",
|
||||
1749734507,
|
||||
"subscriptionExpiresAt",
|
||||
"2524579200",
|
||||
"scheduledPlanChange",
|
||||
"wasPaidCustomer",
|
||||
"hasCustomerObject",
|
||||
"processorEntity",
|
||||
"openai_llc",
|
||||
"lastActiveSubscription",
|
||||
{
|
||||
"_2273": 2274,
|
||||
"_2275": 2276,
|
||||
"_2277": 67
|
||||
"_2678": 2679,
|
||||
"_2680": 2681,
|
||||
"_2682": 67
|
||||
},
|
||||
"subscription_id",
|
||||
"44cf1fa1-2fea-433b-8b7a-9d03e7b69533",
|
||||
"809a7079-5208-4fba-bb11-8f0fdea374fd",
|
||||
"purchase_origin_platform",
|
||||
"chatgpt_web",
|
||||
"chatgpt_mobile_ios",
|
||||
"will_renew",
|
||||
"isResellerHosted",
|
||||
"discount",
|
||||
{
|
||||
"_2281": 2282,
|
||||
"_2283": 904,
|
||||
"_2284": 786,
|
||||
"_2285": 2286
|
||||
},
|
||||
"discount_type",
|
||||
"percentage",
|
||||
"amount",
|
||||
"duration_num_periods",
|
||||
"discount_expires_at",
|
||||
"2025-06-08T23:12:46+00:00",
|
||||
"isEligibleForCancellationPromotion",
|
||||
"isDelinquent",
|
||||
"becameDelinquentAt",
|
||||
"gracePeriodEndAt",
|
||||
"features",
|
||||
[
|
||||
2293,
|
||||
2294,
|
||||
2295,
|
||||
2296,
|
||||
1244,
|
||||
2297,
|
||||
2298,
|
||||
2299,
|
||||
2300,
|
||||
2301,
|
||||
2302,
|
||||
2303,
|
||||
2304,
|
||||
2305,
|
||||
2306,
|
||||
2307,
|
||||
2308,
|
||||
2309,
|
||||
2310,
|
||||
2311,
|
||||
2312,
|
||||
2313,
|
||||
2314,
|
||||
2065,
|
||||
2315,
|
||||
2691,
|
||||
2692,
|
||||
2693,
|
||||
2694,
|
||||
1421,
|
||||
2695,
|
||||
2696,
|
||||
2697,
|
||||
2698,
|
||||
2699,
|
||||
2700,
|
||||
2701,
|
||||
2702,
|
||||
2703,
|
||||
2704,
|
||||
2705,
|
||||
2706,
|
||||
2707,
|
||||
2708,
|
||||
2709,
|
||||
2710,
|
||||
2711,
|
||||
2712,
|
||||
2713,
|
||||
2714,
|
||||
2475,
|
||||
29,
|
||||
2316,
|
||||
2317,
|
||||
2318,
|
||||
2319,
|
||||
2320,
|
||||
2321,
|
||||
2016,
|
||||
2322,
|
||||
2022,
|
||||
2323,
|
||||
2324,
|
||||
2325,
|
||||
2326,
|
||||
2327,
|
||||
2328,
|
||||
2329,
|
||||
2330,
|
||||
2331,
|
||||
2332,
|
||||
2333,
|
||||
2334,
|
||||
2335
|
||||
2715,
|
||||
2716,
|
||||
2717,
|
||||
2718,
|
||||
2719,
|
||||
2720,
|
||||
2428,
|
||||
2721,
|
||||
2434,
|
||||
2722,
|
||||
2723,
|
||||
2724,
|
||||
2725,
|
||||
2726,
|
||||
2727,
|
||||
2728,
|
||||
2729,
|
||||
2730,
|
||||
2731,
|
||||
2732,
|
||||
2733,
|
||||
2734
|
||||
],
|
||||
"beta_features",
|
||||
"bizmo_settings",
|
||||
@ -182,9 +172,10 @@
|
||||
"gizmo_canvas_toggle",
|
||||
"gizmo_reviews",
|
||||
"gizmo_support_emails",
|
||||
"gpt4_1",
|
||||
"gpt4_1_mini",
|
||||
"gpt_4_5",
|
||||
"graphite",
|
||||
"jawbone_model_access",
|
||||
"model_ab_use_v2",
|
||||
"model_switcher",
|
||||
"moonshine",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -5,7 +5,7 @@ from curl_cffi.requests import AsyncSession
|
||||
|
||||
|
||||
class Client:
|
||||
def __init__(self, proxy=None, timeout=30, verify=True, impersonate='safari15_3'):
|
||||
def __init__(self, proxy=None, timeout=30, verify=True, impersonate='safari17_2_ios'):
|
||||
self.proxies = {"http": proxy, "https": proxy}
|
||||
self.timeout = timeout
|
||||
self.verify = verify
|
||||
|
||||
Loading…
Reference in New Issue
Block a user