Fix configs validation #66
@@ -6,6 +6,7 @@ from app.interface import *
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
# =====================
|
||||
load_dotenv()
|
||||
configs = AppConfig.load()
|
||||
@@ -30,3 +31,6 @@ if __name__ == "__main__":
|
||||
logging.info("Shutting down due to KeyboardInterrupt")
|
||||
finally:
|
||||
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:
|
||||
"""
|
||||
Validate that the default models and strategy exist in the provided configurations.
|
||||
If any default is not found, a ValueError is raised.
|
||||
Args:
|
||||
models: ModelsConfig instance containing all available models.
|
||||
strategies: list of Strategy instances containing all available strategies.
|
||||
Raises:
|
||||
ValueError if any default model or strategy is not found.
|
||||
"""
|
||||
try:
|
||||
configs.get_strategy_by_name(self.strategy)
|
||||
|
||||
Reference in New Issue
Block a user