langchain-ai / chat-langchain

https://chat.langchain.com
MIT License
5.17k stars 1.23k forks source link

How to store the chat history in DB using Postgres #236

Open thanhtd1012 opened 9 months ago

thanhtd1012 commented 9 months ago

Hi all,

I clone this repo and run it correctly. Now, I would like to store the chat history in DB using PostgresChatMessageHistory. How to do it? Please help me. Thank you so much!

eyurtsev commented 8 months ago

Hi @thanhtd1012,

There are examples on saving chat history in langserve repo:

https://github.com/langchain-ai/langserve/tree/main/examples/chat_with_persistence_and_user https://github.com/langchain-ai/langserve/tree/main/examples/chat_with_persistence