# decorators.py from typing import List, Optional from App_Function_Libraries.Personas.models import Decorator # Assume Decorator class is already defined in models.py class DecoratorProcessor: """Processes decorators for Lorebook entries.""" def __init__(self, decorators: List[Decorator]): self.decorators = decorators def process(self): """Process decorators based on their definitions.""" for decorator in self.decorators: # Implement processing logic based on decorator.name if decorator.name == 'activate_only_after': self._activate_only_after(decorator.value) elif decorator.name == 'activate_only_every': self._activate_only_every(decorator.value) # Add more decorator handling as needed else: # Handle unknown decorators or ignore pass def _activate_only_after(self, value: Optional[str]): """Handle @@activate_only_after decorator.""" if value and value.isdigit(): count = int(value) # Implement logic to activate only after 'count' messages pass else: # Invalid value; ignore or raise error pass def _activate_only_every(self, value: Optional[str]): """Handle @@activate_only_every decorator.""" if value and value.isdigit(): frequency = int(value) # Implement logic to activate every 'frequency' messages pass else: # Invalid value; ignore or raise error pass # Implement other decorator handlers as needed