Skip to content

Commit

Permalink
更新请求头
Browse files Browse the repository at this point in the history
  • Loading branch information
Yanyutin753 authored Feb 9, 2024
1 parent 676247a commit 673f474
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,11 +319,9 @@ def generate_gpts_payload(model, messages):
# PANDORA_UPLOAD_URL = 'files.pandoranext.com'


VERSION = '0.7.6'
VERSION = '0.7.7'
# VERSION = 'test'
UPDATE_INFO = '支持proxy参数'


# UPDATE_INFO = '增加Arkose请求头'
# UPDATE_INFO = '【仅供临时测试使用】 '

# 解析响应中的信息
Expand Down Expand Up @@ -577,7 +575,7 @@ def upload_file(file_content, mime_type, api_key):
try:
width, height = get_image_dimensions(file_content)
except Exception as e:
logger.error(f"图片信息获取异常, 切换为text/plain{e}")
logger.error(f"图片信息获取异常, 自动切换图片大小{e}")
mime_type = 'text/plain'

# logger.debug(f"文件内容: {file_content}")
Expand Down Expand Up @@ -927,6 +925,9 @@ def send_text_prompt_and_get_response(messages, api_key, stream, model):
if CUSTOM_ARKOSE:
token = get_token()
payload["arkose_token"] = token
# 在headers中添加新字段
headers["Openai-Sentinel-Arkose-Token"] = token
logger.debug(f"headers: {headers}")
logger.debug(f"payload: {payload}")
response = requests.post(url, headers=headers, json=payload, stream=True)
# print(response)
Expand Down

0 comments on commit 673f474

Please sign in to comment.