better error handling in main if any of error occurs during setup
This commit is contained in:
@@ -6,6 +6,7 @@ from app.interface import *
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
try:
|
||||||
# =====================
|
# =====================
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
configs = AppConfig.load()
|
configs = AppConfig.load()
|
||||||
@@ -30,3 +31,6 @@ if __name__ == "__main__":
|
|||||||
logging.info("Shutting down due to KeyboardInterrupt")
|
logging.info("Shutting down due to KeyboardInterrupt")
|
||||||
finally:
|
finally:
|
||||||
gradio.close()
|
gradio.close()
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
logging.error(f"Application failed to start: {e}")
|
||||||
|
|||||||
@@ -152,9 +152,12 @@ class AgentsConfigs(BaseModel):
|
|||||||
def validate_defaults(self, configs: 'AppConfig') -> None:
|
def validate_defaults(self, configs: 'AppConfig') -> None:
|
||||||
"""
|
"""
|
||||||
Validate that the default models and strategy exist in the provided configurations.
|
Validate that the default models and strategy exist in the provided configurations.
|
||||||
|
If any default is not found, a ValueError is raised.
|
||||||
Args:
|
Args:
|
||||||
models: ModelsConfig instance containing all available models.
|
models: ModelsConfig instance containing all available models.
|
||||||
strategies: list of Strategy instances containing all available strategies.
|
strategies: list of Strategy instances containing all available strategies.
|
||||||
|
Raises:
|
||||||
|
ValueError if any default model or strategy is not found.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
configs.get_strategy_by_name(self.strategy)
|
configs.get_strategy_by_name(self.strategy)
|
||||||
|
|||||||
Reference in New Issue
Block a user