mirror of
https://github.com/Yanyutin753/RefreshToV1Api.git
synced 2025-10-17 00:24:13 +00:00
更新请求头
This commit is contained in:
11
main.py
11
main.py
@@ -319,11 +319,9 @@ scheduler.start()
|
|||||||
# PANDORA_UPLOAD_URL = 'files.pandoranext.com'
|
# PANDORA_UPLOAD_URL = 'files.pandoranext.com'
|
||||||
|
|
||||||
|
|
||||||
VERSION = '0.7.6'
|
VERSION = '0.7.7'
|
||||||
# VERSION = 'test'
|
# VERSION = 'test'
|
||||||
UPDATE_INFO = '支持proxy参数'
|
# UPDATE_INFO = '增加Arkose请求头'
|
||||||
|
|
||||||
|
|
||||||
# UPDATE_INFO = '【仅供临时测试使用】 '
|
# UPDATE_INFO = '【仅供临时测试使用】 '
|
||||||
|
|
||||||
# 解析响应中的信息
|
# 解析响应中的信息
|
||||||
@@ -577,7 +575,7 @@ def upload_file(file_content, mime_type, api_key):
|
|||||||
try:
|
try:
|
||||||
width, height = get_image_dimensions(file_content)
|
width, height = get_image_dimensions(file_content)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"图片信息获取异常, 切换为text/plain: {e}")
|
logger.error(f"图片信息获取异常, 自动切换图片大小: {e}")
|
||||||
mime_type = 'text/plain'
|
mime_type = 'text/plain'
|
||||||
|
|
||||||
# logger.debug(f"文件内容: {file_content}")
|
# logger.debug(f"文件内容: {file_content}")
|
||||||
@@ -927,6 +925,9 @@ def send_text_prompt_and_get_response(messages, api_key, stream, model):
|
|||||||
if CUSTOM_ARKOSE:
|
if CUSTOM_ARKOSE:
|
||||||
token = get_token()
|
token = get_token()
|
||||||
payload["arkose_token"] = token
|
payload["arkose_token"] = token
|
||||||
|
# 在headers中添加新字段
|
||||||
|
headers["Openai-Sentinel-Arkose-Token"] = token
|
||||||
|
logger.debug(f"headers: {headers}")
|
||||||
logger.debug(f"payload: {payload}")
|
logger.debug(f"payload: {payload}")
|
||||||
response = requests.post(url, headers=headers, json=payload, stream=True)
|
response = requests.post(url, headers=headers, json=payload, stream=True)
|
||||||
# print(response)
|
# print(response)
|
||||||
|
Reference in New Issue
Block a user