Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
CHANGED
|
@@ -62,17 +62,23 @@ async def lifespan(app: FastAPI):
|
|
| 62 |
logger.info(f"Environment: {'HuggingFace Spaces' if settings.is_huggingface_spaces else 'Development'}")
|
| 63 |
logger.info(f"Anthropic Model: {settings.anthropic_model.value}")
|
| 64 |
|
| 65 |
-
# Initialize model manager
|
| 66 |
model_manager = get_model_manager()
|
| 67 |
-
health_status = await model_manager.health_check()
|
| 68 |
|
| 69 |
-
#
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
|
| 77 |
logger.info("Application startup completed successfully")
|
| 78 |
|
|
|
|
| 62 |
logger.info(f"Environment: {'HuggingFace Spaces' if settings.is_huggingface_spaces else 'Development'}")
|
| 63 |
logger.info(f"Anthropic Model: {settings.anthropic_model.value}")
|
| 64 |
|
| 65 |
+
# Initialize model manager with graceful degradation
|
| 66 |
model_manager = get_model_manager()
|
|
|
|
| 67 |
|
| 68 |
+
# Try to initialize with minimal validation
|
| 69 |
+
try:
|
| 70 |
+
# Only validate the primary model, not all models
|
| 71 |
+
primary_client = model_manager.get_client(settings.anthropic_model)
|
| 72 |
+
if primary_client:
|
| 73 |
+
app_state["anthropic_client_initialized"] = True
|
| 74 |
+
logger.info(f"Anthropic integration initialized with primary model: {settings.anthropic_model.value}")
|
| 75 |
+
else:
|
| 76 |
+
logger.warning("Primary model not available, but continuing startup")
|
| 77 |
+
app_state["anthropic_client_initialized"] = False
|
| 78 |
+
except Exception as model_error:
|
| 79 |
+
logger.warning(f"Model validation failed during startup: {str(model_error)}")
|
| 80 |
+
logger.info("Continuing startup without full model validation")
|
| 81 |
+
app_state["anthropic_client_initialized"] = False
|
| 82 |
|
| 83 |
logger.info("Application startup completed successfully")
|
| 84 |
|