diff --git a/chatgpt/authorization.py b/chatgpt/authorization.py index 8b7016e..d55b420 100644 --- a/chatgpt/authorization.py +++ b/chatgpt/authorization.py @@ -14,7 +14,7 @@ from utils.Logger import logger def get_req_token(req_token, seed=None): - if configs.auto_seed or not seed: + if configs.auto_seed: available_token_list = list(set(globals.token_list) - set(globals.error_token_list)) length = len(available_token_list) if seed and length > 0: @@ -40,6 +40,7 @@ def get_req_token(req_token, seed=None): else: return req_token else: + seed = req_token if seed not in globals.seed_map.keys(): raise HTTPException(status_code=401, detail={"error": "Invalid Seed"}) return globals.seed_map[seed]["token"] diff --git a/gateway/reverseProxy.py b/gateway/reverseProxy.py index 296d346..0bea0a0 100644 --- a/gateway/reverseProxy.py +++ b/gateway/reverseProxy.py @@ -242,6 +242,7 @@ async def chatgpt_reverse_proxy(request: Request, path: str): return response except Exception: await client.close() - + except HTTPException as e: + raise e except Exception as e: raise HTTPException(status_code=500, detail=str(e)) diff --git a/utils/configs.py b/utils/configs.py index 57f18a5..68a8816 100644 --- a/utils/configs.py +++ b/utils/configs.py @@ -20,7 +20,6 @@ def is_true(x): api_prefix = os.getenv('API_PREFIX', None) -auto_seed = os.getenv('AUTO_SEED', True) authorization = os.getenv('AUTHORIZATION', '').replace(' ', '') chatgpt_base_url = os.getenv('CHATGPT_BASE_URL', 'https://chatgpt.com').replace(' ', '') auth_key = os.getenv('AUTH_KEY', None) @@ -55,6 +54,7 @@ impersonate_list = ast.literal_eval(impersonate_list_str) user_agents_list = ast.literal_eval(user_agents_list_str) enable_gateway = is_true(os.getenv('ENABLE_GATEWAY', False)) +auto_seed = is_true(os.getenv('AUTO_SEED', True)) no_sentinel = is_true(os.getenv('NO_SENTINEL', False)) with open('version.txt') as f: diff --git a/version.txt b/version.txt index 53eeaee..8ebf601 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.6.8-beta2 \ No newline at end of file +1.6.8-beta3 \ No newline at end of file