(self, chat_id: str)
| 93 | KEEP_RECENT = 10 |
| 94 | |
| 95 | def __init__(self, chat_id: str) -> None: |
| 96 | self.chat_id = chat_id |
| 97 | safe_id = re.sub(r'[<>:"/\\|?*\x00-\x1f]', '_', chat_id)[:120] |
| 98 | self._path = _CHAT_MEMORY_DIR / f"{safe_id}.json" |
| 99 | self._summary: str = "" |
| 100 | self._messages: list[dict[str, str]] = [] |
| 101 | self._facts: list[str] = [] |
| 102 | self._invalidated = False |
| 103 | self._load() |
| 104 | |
| 105 | def _load(self) -> None: |
| 106 | if self._path.exists(): |