yym68686 commited on
Commit
52d3f47
·
1 Parent(s): 55564a6

🐛 Bug: Fix the bug where Vercel fails to start successfully.

Browse files
Files changed (1) hide show
  1. main.py +3 -0
main.py CHANGED
@@ -1348,6 +1348,9 @@ async def get_api_key(request: Request, x_api_key: Optional[str] = Depends(api_k
1348
  # print(f"Header x_api_key: {x_api_key}") # 添加此行
1349
  # logger.info(f"x_api_key: {x_api_key} {x_api_key == 'your_admin_api_key'}")
1350
 
 
 
 
1351
  if x_api_key == app.state.admin_api_key: # 替换为实际的管理员API密钥
1352
  return x_api_key
1353
  else:
 
1348
  # print(f"Header x_api_key: {x_api_key}") # 添加此行
1349
  # logger.info(f"x_api_key: {x_api_key} {x_api_key == 'your_admin_api_key'}")
1350
 
1351
+ if not hasattr(app.state, 'config'):
1352
+ await ensure_config(request, lambda: None)
1353
+
1354
  if x_api_key == app.state.admin_api_key: # 替换为实际的管理员API密钥
1355
  return x_api_key
1356
  else: