Refactor pipeline integration

- remove direct pipeline dependency from ChatManager and TelegramApp
- introduce PipelineInputs for better configuration management
This commit is contained in:
2025-10-15 13:28:01 +02:00
parent 13d6baf6af
commit 544e179305
7 changed files with 198 additions and 165 deletions

View File

@@ -104,8 +104,6 @@ class AppConfig(BaseModel):
data = yaml.safe_load(f)
configs = cls(**data)
configs.set_logging_level()
configs.validate_models()
log.info(f"Loaded configuration from {file_path}")
return configs
@@ -115,6 +113,15 @@ class AppConfig(BaseModel):
cls.instance = super(AppConfig, cls).__new__(cls)
return cls.instance
def __init__(self, *args: Any, **kwargs: Any) -> None:
if hasattr(self, '_initialized'):
return
super().__init__(*args, **kwargs)
self.set_logging_level()
self.validate_models()
self._initialized = True
def get_model_by_name(self, name: str) -> AppModel:
"""
Retrieve a model configuration by its name.
@@ -145,17 +152,6 @@ class AppConfig(BaseModel):
return strat
raise ValueError(f"Strategy with name '{name}' not found.")
def get_defaults(self) -> tuple[AppModel, AppModel, Strategy]:
"""
Retrieve the default team model, leader model, and strategy.
Returns:
A tuple containing the default team model (AppModel), leader model (AppModel), and strategy (Strategy).
"""
team_model = self.get_model_by_name(self.agents.team_model)
leader_model = self.get_model_by_name(self.agents.team_leader_model)
strategy = self.get_strategy_by_name(self.agents.strategy)
return team_model, leader_model, strategy
def set_logging_level(self) -> None:
"""
Set the logging level based on the configuration.