update pow

This commit is contained in:
lanqian528 2024-10-16 19:47:06 +08:00
parent b46538e14c
commit 2dc1cb5371
4 changed files with 16 additions and 17 deletions

View File

@ -37,7 +37,7 @@ jobs:
images: lanqian528/chat2api
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value=v1.4.10
type=raw,value=v1.4.11
- name: Build and push
uses: docker/build-push-action@v5

View File

@ -28,7 +28,7 @@
## 功能
### 最新版 v1.4.10
### 最新版 v1.4.11
> 已完成
> - [x] 流式、非流式传输

View File

@ -388,7 +388,6 @@ class ScriptSrcParser(HTMLParser):
if "src" in attrs_dict:
src = attrs_dict["src"]
cached_scripts.append(src)
print(cached_scripts)
match = re.search(r"c/[^/]*/_", src)
if match:
cached_dpl = match.group(0)
@ -396,19 +395,18 @@ class ScriptSrcParser(HTMLParser):
def get_data_build_from_html(html_content):
global cached_scripts, cached_dpl, cached_time
parser = ScriptSrcParser()
parser.feed(html_content)
get_data_build_from_document_element(html_content)
return cached_dpl
def get_data_build_from_document_element(html_content):
global cached_dpl, cached_time
match = re.search(r'<html[^>]*data-build="([^"]*)"', html_content)
if match:
data_build = match.group(1)
cached_time = int(time.time())
logger.info(f"Found dpl: {data_build}")
if not cached_scripts:
cached_scripts.append("https://chatgpt.com/backend-api/sentinel/sdk.js")
if not cached_dpl:
match = re.search(r'<html[^>]*data-build="([^"]*)"', html_content)
if match:
data_build = match.group(1)
cached_dpl = data_build
cached_time = int(time.time())
logger.info(f"Found dpl: {cached_dpl}")
async def get_dpl(service):
@ -428,8 +426,9 @@ async def get_dpl(service):
raise Exception("No Cached DPL")
else:
return True
except Exception:
cached_dpl = "remix-prod-14f2d9d20b1dff8b7a6ecf23d472dbc30191dfaa"
except Exception as e:
logger.info(f"Failed to get dpl: {e}")
cached_dpl = None
cached_time = int(time.time())
return False

View File

@ -49,7 +49,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.4.10 | https://github.com/lanqian528/chat2api")
logger.info("Chat2Api 1.4.11 | https://github.com/lanqian528/chat2api")
logger.info("-" * 60)
logger.info("Environment variables:")
logger.info("API_PREFIX: " + str(api_prefix))