Spaces:
Paused
Paused
Upload 4 files
Browse files
app.py
CHANGED
|
@@ -57,7 +57,7 @@ class APIKeyManager:
|
|
| 57 |
|
| 58 |
key_manager = APIKeyManager()
|
| 59 |
current_api_key = key_manager.get_available_key()
|
| 60 |
-
logger.info(f"Current API key: {current_api_key}")
|
| 61 |
|
| 62 |
GEMINI_MODELS = [
|
| 63 |
{"id": "gemini-pro"},
|
|
@@ -116,7 +116,7 @@ def chat_completions():
|
|
| 116 |
global current_api_key
|
| 117 |
is_authenticated, auth_error, status_code = func.authenticate_request(request)
|
| 118 |
if not is_authenticated:
|
| 119 |
-
return auth_error if auth_error else jsonify({'error': '
|
| 120 |
try:
|
| 121 |
request_data = request.get_json()
|
| 122 |
messages = request_data.get('messages', [])
|
|
@@ -248,7 +248,7 @@ def chat_completions():
|
|
| 248 |
def list_models():
|
| 249 |
is_authenticated, auth_error, status_code = func.authenticate_request(request)
|
| 250 |
if not is_authenticated:
|
| 251 |
-
return auth_error if auth_error else jsonify({'error': '
|
| 252 |
response = {"object": "list", "data": GEMINI_MODELS}
|
| 253 |
return jsonify(response)
|
| 254 |
|
|
|
|
| 57 |
|
| 58 |
key_manager = APIKeyManager()
|
| 59 |
current_api_key = key_manager.get_available_key()
|
| 60 |
+
logger.info(f"Current API key: {current_api_key[:11]}...")
|
| 61 |
|
| 62 |
GEMINI_MODELS = [
|
| 63 |
{"id": "gemini-pro"},
|
|
|
|
| 116 |
global current_api_key
|
| 117 |
is_authenticated, auth_error, status_code = func.authenticate_request(request)
|
| 118 |
if not is_authenticated:
|
| 119 |
+
return auth_error if auth_error else jsonify({'error': '未授权'}), status_code if status_code else 401
|
| 120 |
try:
|
| 121 |
request_data = request.get_json()
|
| 122 |
messages = request_data.get('messages', [])
|
|
|
|
| 248 |
def list_models():
|
| 249 |
is_authenticated, auth_error, status_code = func.authenticate_request(request)
|
| 250 |
if not is_authenticated:
|
| 251 |
+
return auth_error if auth_error else jsonify({'error': '未授权'}), status_code if status_code else 401
|
| 252 |
response = {"object": "list", "data": GEMINI_MODELS}
|
| 253 |
return jsonify(response)
|
| 254 |
|