Spaces:
Running
Running
update
Browse files- api_key_sb.py +3 -0
- app.py +3 -4
api_key_sb.py
CHANGED
|
@@ -1,6 +1,9 @@
|
|
| 1 |
from supabase import create_client, Client
|
| 2 |
import os
|
| 3 |
from fastapi import FastAPI, Request, HTTPException, Depends, status
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
# Supabase 配置
|
| 6 |
SUPABASE_URL = os.getenv("SUPABASE_URL")
|
|
|
|
| 1 |
from supabase import create_client, Client
|
| 2 |
import os
|
| 3 |
from fastapi import FastAPI, Request, HTTPException, Depends, status
|
| 4 |
+
from dotenv import load_dotenv
|
| 5 |
+
|
| 6 |
+
load_dotenv()
|
| 7 |
|
| 8 |
# Supabase 配置
|
| 9 |
SUPABASE_URL = os.getenv("SUPABASE_URL")
|
app.py
CHANGED
|
@@ -74,13 +74,12 @@ async def proxy_gemini(request: Request, protocol: ProtocolType, host:str, path:
|
|
| 74 |
|
| 75 |
# 获取API密钥信息
|
| 76 |
api_key_info = await get_api_key_info('gemini-2.5-flash')
|
| 77 |
-
print(api_key_info)
|
| 78 |
-
return "adf"
|
| 79 |
api_key = api_key_info.get('api_key')
|
| 80 |
-
|
| 81 |
-
|
| 82 |
client_headers["Authorization"] = api_key
|
| 83 |
api_key_id = api_key_info.get('api_key_id')
|
|
|
|
| 84 |
|
| 85 |
# return api_key_info
|
| 86 |
# 调用 do_proxy 并返回其结果
|
|
|
|
| 74 |
|
| 75 |
# 获取API密钥信息
|
| 76 |
api_key_info = await get_api_key_info('gemini-2.5-flash')
|
|
|
|
|
|
|
| 77 |
api_key = api_key_info.get('api_key')
|
| 78 |
+
api_key_show = api_key[:5]+'*****'+api_key[-5:]
|
| 79 |
+
print(f"使用API密钥:{api_key_show}")
|
| 80 |
client_headers["Authorization"] = api_key
|
| 81 |
api_key_id = api_key_info.get('api_key_id')
|
| 82 |
+
return "adsf"
|
| 83 |
|
| 84 |
# return api_key_info
|
| 85 |
# 调用 do_proxy 并返回其结果
|