| """ | |
| title: API Fallback Router | |
| author: nerdur | |
| description: Automatski prebacuje na rezervni model ako primarni provajder ne odgovara ili je spor. | |
| """ | |
| from pydantic import BaseModel | |
| from typing import Optional | |
| class Filter: | |
| class Valves(BaseModel): | |
| enabled: bool = True | |
| def __init__(self): | |
| self.valves = self.Valves() | |
| def inlet(self, body: dict, __user__: Optional[dict] = None) -> dict: | |
| if not self.valves.enabled: | |
| return body | |
| print(f"API Router: Prosljeđujem upit na {body.get('model')}") | |
| return body | |