tanbushi commited on
Commit
94edfbb
·
1 Parent(s): b9ab4c6
Files changed (2) hide show
  1. api_key_sb.py +0 -2
  2. proxy.py +8 -2
api_key_sb.py CHANGED
@@ -39,8 +39,6 @@ async def get_api_key_info(model: str = None):
39
  except Exception as e:
40
  raise HTTPException(status_code=500, detail="更新API密钥运行时间失败!")
41
 
42
-
43
-
44
  return api_key_info
45
  else:
46
  return None
 
39
  except Exception as e:
40
  raise HTTPException(status_code=500, detail="更新API密钥运行时间失败!")
41
 
 
 
42
  return api_key_info
43
  else:
44
  return None
proxy.py CHANGED
@@ -26,8 +26,14 @@ async def do_proxy(url: str, method: str, headers: dict, content: str, max_retri
26
 
27
  # 获取API密钥信息
28
  api_key_info = await get_api_key_info('gemini-2.5-flash')
29
- api_key = api_key_info.get('api_key')
30
- api_key_id = api_key_info.get('api_key_id')
 
 
 
 
 
 
31
  api_key_show = api_key[:5]+'*****'+api_key[-5:]
32
  print(f"使用API密钥:{api_key_show}")
33
  headers["Authorization"] = f"Bearer {api_key}"
 
26
 
27
  # 获取API密钥信息
28
  api_key_info = await get_api_key_info('gemini-2.5-flash')
29
+ # api_key = api_key_info.get('api_key')
30
+ # api_key_id = api_key_info.get('api_key_id')
31
+
32
+ #测试数据
33
+ api_key = 'AIzaSyCmfwmoumyALzXfklzUAwCm5ge25IFs-pg'
34
+ api_key_id = 2
35
+
36
+
37
  api_key_show = api_key[:5]+'*****'+api_key[-5:]
38
  print(f"使用API密钥:{api_key_show}")
39
  headers["Authorization"] = f"Bearer {api_key}"