Skip to content

Commit 6820a42

Browse files
committed
v1.8.6-beta1
1 parent a1c01bf commit 6820a42

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed

chatgpt/ChatService.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ async def get_chat_requirements(self):
183183
url = f'{self.base_url}/sentinel/chat-requirements'
184184
headers = self.base_headers.copy()
185185
try:
186-
config = get_config(self.user_agent)
186+
config = get_config(self.user_agent, self.req_token)
187187
p = get_requirements_token(config)
188188
data = {'p': p}
189189
r = await self.ss.post(url, headers=headers, json=data, timeout=5)

chatgpt/proofofWork.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88
from html.parser import HTMLParser
99

1010
import pybase64
11+
import diskcache as dc
1112

1213
from utils.Logger import logger
1314
from utils.configs import conversation_only
1415

1516
cores = [8, 16, 24, 32]
1617
timeLayout = "%a %b %d %Y %H:%M:%S"
1718

19+
cache = dc.Cache('./data/pow_config_cache')
1820
cached_scripts = []
1921
cached_dpl = ""
2022
cached_time = 0
@@ -430,9 +432,10 @@ def get_parse_time():
430432
return now.strftime(timeLayout) + " GMT-0500 (Eastern Standard Time)"
431433

432434

433-
def get_config(user_agent):
435+
@cache.memoize(expire=3600 * 24 * 7)
436+
def get_config(user_agent, req_token=None):
434437
config = [
435-
random.randint(1080, 1440+1080),
438+
random.choice([1920 + 1080, 2560 + 1440, 1920 + 1200, 2560 + 1600]),
436439
get_parse_time(),
437440
4294705152,
438441
0,

gateway/backend.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ async def sentinel_chat_conversations(request: Request):
306306
clients = client
307307

308308
try:
309-
config = get_config(user_agent)
309+
config = get_config(user_agent, session_id)
310310
p = get_requirements_token(config)
311311
data = {'p': p}
312312
r = await clients.post(f'{host_url}/backend-api/sentinel/chat-requirements', headers=headers, json=data,
@@ -406,7 +406,7 @@ async def chat_conversations(request: Request):
406406
sentinel_tokens = openai_sentinel_tokens_cache.get(req_token, {})
407407
openai_sentinel_tokens_cache.pop(req_token, None)
408408
if not sentinel_tokens:
409-
config = get_config(user_agent)
409+
config = get_config(user_agent, session_id)
410410
p = get_requirements_token(config)
411411
data = {'p': p}
412412
r = await clients.post(f'{host_url}/backend-api/sentinel/chat-requirements', headers=headers, json=data,

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ pybase64
1010
jinja2
1111
APScheduler
1212
ua-generator
13-
pyjwt
13+
pyjwt
14+
diskcache

version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.8.5-beta2
1+
1.8.6-beta1

0 commit comments

Comments
 (0)