geqintan commited on
Commit
1376244
·
1 Parent(s): d3dbd7b
Files changed (1) hide show
  1. app.py +3 -0
app.py CHANGED
@@ -38,6 +38,9 @@ async def proxy_gemini(request: Request, path: str):
38
  # 移除FastAPI自带的Host头,避免Gemini校验报错
39
  client_headers.pop("host", None)
40
 
 
 
 
41
  # 添加Authorization头,用于Gemini的OpenAI兼容API
42
  if GEMINI_API_KEY:
43
  client_headers["Authorization"] = f"Bearer {GEMINI_API_KEY}"
 
38
  # 移除FastAPI自带的Host头,避免Gemini校验报错
39
  client_headers.pop("host", None)
40
 
41
+ # 将User-Agent改为curl/8.7.1,以模拟curl请求
42
+ client_headers["User-Agent"] = "curl/8.7.1"
43
+
44
  # 添加Authorization头,用于Gemini的OpenAI兼容API
45
  if GEMINI_API_KEY:
46
  client_headers["Authorization"] = f"Bearer {GEMINI_API_KEY}"