Skip to content

Commit

Permalink
v1.7.1-beta1 oai-language setting
Browse files Browse the repository at this point in the history
  • Loading branch information
lanqian528 committed Nov 19, 2024
1 parent ae17aa9 commit 2e2a673
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions chatgpt/ChatService.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from utils.Client import Client
from utils.Logger import logger
from utils.configs import (
proxy_url_list,
chatgpt_base_url_list,
ark0se_token_url_list,
history_disabled,
Expand All @@ -27,6 +26,7 @@
check_model,
auth_key,
turnstile_solver_url,
oai_language,
)


Expand Down Expand Up @@ -101,7 +101,7 @@ async def set_dynamic_data(self, data):
'accept-language': 'en-US,en;q=0.9',
'content-type': 'application/json',
'oai-device-id': self.oai_device_id,
'oai-language': 'en-US',
'oai-language': oai_language,
'origin': self.host_url,
'priority': 'u=1, i',
'referer': f'{self.host_url}/',
Expand Down
2 changes: 1 addition & 1 deletion chatgpt/authorization.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def get_req_token(req_token, seed=None):
def get_fp(req_token):
fp = globals.fp_map.get(req_token, {})
if fp and fp.get("user-agent") and fp.get("impersonate"):
if "proxy_url" in fp.keys() and fp["proxy_url"] and fp["proxy_url"] not in configs.proxy_url_list:
if "proxy_url" in fp.keys() and fp["proxy_url"] is None and fp["proxy_url"] not in configs.proxy_url_list:
fp["proxy_url"] = random.choice(configs.proxy_url_list) if configs.proxy_url_list else None
globals.fp_map[req_token] = fp
with open(globals.FP_FILE, "w", encoding="utf-8") as f:
Expand Down
2 changes: 2 additions & 0 deletions utils/configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def is_true(x):
check_model = is_true(os.getenv('CHECK_MODEL', False))
scheduled_refresh = is_true(os.getenv('SCHEDULED_REFRESH', False))
random_token = is_true(os.getenv('RANDOM_TOKEN', True))
oai_language = os.getenv('OAI_LANGUAGE', 'zh-CN')

authorization_list = authorization.split(',') if authorization else []
chatgpt_base_url_list = chatgpt_base_url.split(',') if chatgpt_base_url else []
Expand Down Expand Up @@ -84,6 +85,7 @@ def is_true(x):
logger.info("CHECK_MODEL: " + str(check_model))
logger.info("SCHEDULED_REFRESH: " + str(scheduled_refresh))
logger.info("RANDOM_TOKEN: " + str(random_token))
logger.info("OAI_LANGUAGE: " + str(oai_language))
logger.info("------------------------- Gateway --------------------------")
logger.info("ENABLE_GATEWAY: " + str(enable_gateway))
logger.info("AUTO_SEED: " + str(auto_seed))
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.7.0-beta5
1.7.1-beta1

0 comments on commit 2e2a673

Please sign in to comment.