from typing import Dict, List # chat_manager.py class ChatManager: def __init__(self): self.user_chats: Dict[str, List[Dict]] = {} def initialize_chat(self, sender_id: str) -> None: if sender_id not in self.user_chats: self.user_chats[sender_id] = [ {"role": "user", "parts": "This is the chat history so far"} ] def append_message(self, sender_id: str, role: str, content: str) -> None: if content: self.user_chats[sender_id].append({"role": role, "parts": content}) def get_chat_history(self, sender_id: str) -> List[Dict]: return self.user_chats.get(sender_id, [])