import json from typing import Dict from .config import Config import random class ResponseGenerator: def __init__(self, config: Config): with config.responses_path.open('r', encoding='utf-8') as file: self.responses: Dict[str, list] = json.load(file) def generate(self, response_key: str) -> str: return random.choice(self.responses.get(response_key, ["Przepraszam, nie rozumiem. Możesz to powtórzyć?"]))