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.
Highly inspired by https://python.langchain.com/docs/integrations/chat_loaders/discord
The process has five steps:
- Open your chat in the WeChat desktop app. Select messages you need by mouse-dragging or right-click. Due to restrictions, you can select up to 100 messages once a time.
CMD
/Ctrl
+C
to copy. - Create the chat .txt file by pasting selected messages in a file on your local computer.
- Copy the chat loader definition from below to a local file.
- Initialize the
WeChatChatLoader
with the file path pointed to the text file. - Call
loader.load()
(orloader.lazy_load()
) to perform the conversion.
1. Create message dump
This loader only supports .txt files in the format generated by copying messages in the app to your clipboard and pasting in a file. Below is an example.
%%writefile wechat_chats.txt