Improved Streamlit Chat UI πŸ’¬

Hi Streamlit-lovers,

I’ve coded this side project that aims to add new functionalities to the standard Streamlit chat interface:

  • :inbox_tray: Chat history export (in JSON format)
  • :broom: Clear chat
  • :repeat: Rerun last question
  • :+1: and :-1: feedback buttons (registered in the logs)
  • :speech_balloon: tokens count
  • :woman_technologist: chat avatars personalization

The video below shows how they integrate into the UI:
streamlit-chat-improvement-30

The logs corresponding to the feedback buttons are:

INFO:root:2024-05-22 14:35:23: positive: [{"role": "user", "content": "1+1"}, {"role": "assistant", "content": "1+1 equals 2."}]
INFO:root:2024-05-22 14:35:30: negative: [{"role": "user", "content": "2+2"}, {"role": "assistant", "content": "2 + 2 equals 4."}]

The demo hosted here is limited to 3 questions and/or 300 tokens.

The code does not leverage all possible improvements offered by Streamlit (like caching) so I look forward to getting pull requests to make this small project better :grin:

GitHub repo: GitHub - pierrelouisbescond/streamlit-chat-ui-improvement

Hope to get some feedback!
Pierre-Louis

4 Likes