Spaces:
Sleeping
Sleeping
update
Browse files- api_key_sb.py +1 -1
- proxy.py +3 -8
api_key_sb.py
CHANGED
|
@@ -53,7 +53,7 @@ async def update_api_key_ran_at(api_key_id: str, ran_at_time: datetime = None):
|
|
| 53 |
|
| 54 |
print(f"尝试更新 API 密钥 {api_key_id} 的 ran_at 为 {current_local_time}")
|
| 55 |
response = supabase.table("airs_api_keys").update({"ran_at": current_local_time}).eq("id", api_key_id).execute()
|
| 56 |
-
print(f'API 密钥 {api_key_id} 的 ran_at 更新成功为 {current_local_time}.
|
| 57 |
|
| 58 |
# 验证更新是否成功
|
| 59 |
verification_response = supabase.from_('airs_api_keys').select('ran_at').eq('id', api_key_id).single().execute()
|
|
|
|
| 53 |
|
| 54 |
print(f"尝试更新 API 密钥 {api_key_id} 的 ran_at 为 {current_local_time}")
|
| 55 |
response = supabase.table("airs_api_keys").update({"ran_at": current_local_time}).eq("id", api_key_id).execute()
|
| 56 |
+
print(f'API 密钥 {api_key_id} 的 ran_at 更新成功为 {current_local_time}. ')
|
| 57 |
|
| 58 |
# 验证更新是否成功
|
| 59 |
verification_response = supabase.from_('airs_api_keys').select('ran_at').eq('id', api_key_id).single().execute()
|
proxy.py
CHANGED
|
@@ -21,14 +21,9 @@ async def do_proxy(url: str, method: str, headers: dict, content: str, max_retri
|
|
| 21 |
for attempt in range(max_retries):
|
| 22 |
|
| 23 |
# 获取API密钥信息
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
# 测试数据
|
| 29 |
-
api_key = "AIzaSyDsaoUoniTmq2wbq22J4lo1riJ8MhOTfVI"
|
| 30 |
-
api_key_id=10
|
| 31 |
-
|
| 32 |
api_key_show = api_key[:5]+'*****'+api_key[-5:]
|
| 33 |
print(f"使用API密钥:{api_key_show}")
|
| 34 |
headers["Authorization"] = f"Bearer {api_key}"
|
|
|
|
| 21 |
for attempt in range(max_retries):
|
| 22 |
|
| 23 |
# 获取API密钥信息
|
| 24 |
+
api_key_info = await get_api_key_info('gemini-2.5-flash')
|
| 25 |
+
api_key = api_key_info.get('api_key')
|
| 26 |
+
api_key_id = api_key_info.get('api_key_id')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
api_key_show = api_key[:5]+'*****'+api_key[-5:]
|
| 28 |
print(f"使用API密钥:{api_key_show}")
|
| 29 |
headers["Authorization"] = f"Bearer {api_key}"
|