From 6022f37d6921463ce0e4daea4be37be3a59fd146 Mon Sep 17 00:00:00 2001 From: lanqian528 <5499636+lanqian528@users.noreply.github.com> Date: Fri, 25 Oct 2024 22:53:26 +0800 Subject: [PATCH] v1.5.2 fix chrome124 and cf-https --- .github/workflows/build_docker.yml | 2 +- README.md | 2 +- chatgpt/globals.py | 1 - chatgpt/reverseProxy.py | 3 +++ utils/config.py | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_docker.yml b/.github/workflows/build_docker.yml index 024aef5..7a33f5d 100644 --- a/.github/workflows/build_docker.yml +++ b/.github/workflows/build_docker.yml @@ -37,7 +37,7 @@ jobs: images: lanqian528/chat2api tags: | type=raw,value=latest,enable={{is_default_branch}} - type=raw,value=v1.5.1 + type=raw,value=v1.5.2 - name: Build and push uses: docker/build-push-action@v5 diff --git a/README.md b/README.md index a7946c5..36a7369 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ ## 功能 -### 最新版 v1.5.1 +### 最新版 v1.5.2 > 已完成 > - [x] 流式、非流式传输 diff --git a/chatgpt/globals.py b/chatgpt/globals.py index 1568ad6..7cc3aa2 100644 --- a/chatgpt/globals.py +++ b/chatgpt/globals.py @@ -30,7 +30,6 @@ impersonate_list = [ "chrome119", "chrome120", "chrome123", - "chrome124", "edge99", "edge101", ] diff --git a/chatgpt/reverseProxy.py b/chatgpt/reverseProxy.py index 71397db..6f17848 100644 --- a/chatgpt/reverseProxy.py +++ b/chatgpt/reverseProxy.py @@ -70,9 +70,12 @@ async def chatgpt_reverse_proxy(request: Request, path: str): petrol = "https" else: petrol = "http" + if "x-forwarded-proto" in request.headers: + petrol = request.headers["x-forwarded-proto"] params = dict(request.query_params) request_cookies = dict(request.cookies) + headers = { key: value for key, value in request.headers.items() if (key.lower() not in ["host", "origin", "referer", "user-agent", diff --git a/utils/config.py b/utils/config.py index fc81a5f..3314031 100644 --- a/utils/config.py +++ b/utils/config.py @@ -52,7 +52,7 @@ proxy_url_list = proxy_url.split(',') if proxy_url else [] user_agents_list = ast.literal_eval(user_agents) logger.info("-" * 60) -logger.info("Chat2Api 1.5.1 | https://github.com/lanqian528/chat2api") +logger.info("Chat2Api 1.5.2 | https://github.com/lanqian528/chat2api") logger.info("-" * 60) logger.info("Environment variables:") logger.info("API_PREFIX: " + str(api_prefix))