Update app.py
Browse files
app.py
CHANGED
|
@@ -625,15 +625,7 @@ def handsome_images_generations():
|
|
| 625 |
api_key = select_key(request_type, model_name)
|
| 626 |
|
| 627 |
if not api_key:
|
| 628 |
-
|
| 629 |
-
{
|
| 630 |
-
"error": (
|
| 631 |
-
"No available API key for this "
|
| 632 |
-
"request type or all keys have "
|
| 633 |
-
"reached their limits"
|
| 634 |
-
)
|
| 635 |
-
}
|
| 636 |
-
), 429
|
| 637 |
|
| 638 |
headers = {
|
| 639 |
"Authorization": f"Bearer {api_key}",
|
|
@@ -790,6 +782,8 @@ def handsome_chat_completions():
|
|
| 790 |
data = request.get_json()
|
| 791 |
if not data or 'model' not in data:
|
| 792 |
return jsonify({"error": "Invalid request data"}), 400
|
|
|
|
|
|
|
| 793 |
|
| 794 |
model_name = data['model']
|
| 795 |
|
|
|
|
| 625 |
api_key = select_key(request_type, model_name)
|
| 626 |
|
| 627 |
if not api_key:
|
| 628 |
+
return jsonify({"error": ("No available API key for this request type or all keys have reached their limits")}), 429
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 629 |
|
| 630 |
headers = {
|
| 631 |
"Authorization": f"Bearer {api_key}",
|
|
|
|
| 782 |
data = request.get_json()
|
| 783 |
if not data or 'model' not in data:
|
| 784 |
return jsonify({"error": "Invalid request data"}), 400
|
| 785 |
+
if data['model'] not in text_models and data['model'] not in image_models:
|
| 786 |
+
return jsonify({"error": "Invalid model"}), 400
|
| 787 |
|
| 788 |
model_name = data['model']
|
| 789 |
|