currently does not support import loggingimport refrom typing import Iterator, Listfrom langchain.schema import HumanMessage, BaseMessagefrom langchain.chat_loaders import base as chat_loaderslogger = logging.getLogger()class WeChatChatLoader(chat_loaders.BaseChatLoader):        def __init__(self, path: str):        """        Initialize the Discord chat loader.        Args:            path: Path to the exported Discord chat text file.        """        self.path = path        self._message_line_regex = re.compile(            r"(?P<sender>.+?) (?P<timestamp>\d{4}/\d{2}/\d{2} \d{1,2}:\d{2} (?:AM|PM))",  # noqa            # flags=re.DOTALL,        )    def _append_message_to_results(        self,        results: List,        current_sender: str,        current_timestamp: str,        current_content: List[str],    ):        content = "\n".join(current_content).strip()        # skip non-text messages like stickers, images, etc.        if not re.match(r"\[.*\]", content):            results.append(                HumanMessage(                    content=content,                    additional_kwargs={                        "sender": current_sender,                        "events": [{"message_time": current_timestamp}],                    },                )            )        return results    def _load_single_chat_session_from_txt(        self, file_path: str    ) -> chat_loaders.ChatSession:        """        Load a single chat session from a text file.        Args:            file_path: Path to the text file containing the chat messages.        Returns:            A `ChatSession` object containing the loaded chat messages.        """        with open(file_path, "r", encoding="utf-8") as file:            lines = file.readlines()        results: List[BaseMessage] = []        current_sender = None        current_timestamp = None        current_content = []        for line in lines:            if re.match(self._message_line_regex, line):                if current_sender
There is not yet a straightforward way to export personal WeChat messages. However if you just need no more than few hundreds of messages for model fine-tuning or few-shot examples, this notebook shows how to create your own chat loader that works on copy-pasted WeChat messages to a list of LangChain messages.
There is not yet a straightforward way to export personal WeChat messages. However if you just need no more than few hundreds of messages for model fine-tuning or few-shot examples, this notebook shows how to create your own chat loader that works on copy-pasted WeChat messages to a list of LangChain messages. ->: currently does not support import loggingimport refrom typing import Iterator, Listfrom langchain.schema import HumanMessage, BaseMessagefrom langchain.chat_loaders import base as chat_loaderslogger = logging.getLogger()class WeChatChatLoader(chat_loaders.BaseChatLoader):        def __init__(self, path: str):        """        Initialize the Discord chat loader.        Args:            path: Path to the exported Discord chat text file.        """        self.path = path        self._message_line_regex = re.compile(            r"(?P<sender>.+?) (?P<timestamp>\d{4}/\d{2}/\d{2} \d{1,2}:\d{2} (?:AM|PM))",  # noqa            # flags=re.DOTALL,        )    def _append_message_to_results(        self,        results: List,        current_sender: str,        current_timestamp: str,        current_content: List[str],    ):        content = "\n".join(current_content).strip()        # skip non-text messages like stickers, images, etc.        if not re.match(r"\[.*\]", content):            results.append(                HumanMessage(                    content=content,                    additional_kwargs={                        "sender": current_sender,                        "events": [{"message_time": current_timestamp}],                    },                )            )        return results    def _load_single_chat_session_from_txt(        self, file_path: str    ) -> chat_loaders.ChatSession:        """        Load a single chat session from a text file.        Args:            file_path: Path to the text file containing the chat messages.        Returns:            A `ChatSession` object containing the loaded chat messages.        """        with open(file_path, "r", encoding="utf-8") as file:            lines = file.readlines()        results: List[BaseMessage] = []        current_sender = None        current_timestamp = None        current_content = []        for line in lines:            if re.match(self._message_line_regex, line):                if current_sender