Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -631,7 +631,7 @@ async def get_completion(payload: Payload, request: Request, authenticated: bool
|
|
631 |
else:
|
632 |
detail_message += f" - Upstream raw: {error_body.decode('utf-8')[:200]}..." # Limit for logging
|
633 |
except (json.JSONDecodeError, UnicodeDecodeError):
|
634 |
-
detail_message += f" - Upstream raw: {error_body.decode('utf-8', errors='ignore')[:200]}
|
635 |
|
636 |
raise HTTPException(status_code=response.status_code, detail=detail_message)
|
637 |
|
@@ -1256,7 +1256,9 @@ async def startup_event():
|
|
1256 |
"""
|
1257 |
global available_model_ids
|
1258 |
# Load models from a local models.json file first
|
1259 |
-
|
|
|
|
|
1260 |
print(f"Loaded {len(available_model_ids)} model IDs from models.json")
|
1261 |
|
1262 |
# Extend with hardcoded model lists for various providers
|
|
|
631 |
else:
|
632 |
detail_message += f" - Upstream raw: {error_body.decode('utf-8')[:200]}..." # Limit for logging
|
633 |
except (json.JSONDecodeError, UnicodeDecodeError):
|
634 |
+
detail_message += f" - Upstream raw: {error_body.decode('utf-8', errors='ignore')[:200]}"
|
635 |
|
636 |
raise HTTPException(status_code=response.status_code, detail=detail_message)
|
637 |
|
|
|
1256 |
"""
|
1257 |
global available_model_ids
|
1258 |
# Load models from a local models.json file first
|
1259 |
+
models_data = load_models_data()
|
1260 |
+
# Extract model IDs from dicts (assuming each dict has a 'id' key)
|
1261 |
+
available_model_ids = [m['id'] for m in models_data if isinstance(m, dict) and 'id' in m]
|
1262 |
print(f"Loaded {len(available_model_ids)} model IDs from models.json")
|
1263 |
|
1264 |
# Extend with hardcoded model lists for various providers
|