Streamlit Chat

raw JSON →
0.1.1 verified Fri May 01 auth: no python

A Streamlit component for building chatbot UIs. Current version 0.1.1, requires Python >=3.6. The package provides a simple message display component with avatar support, but is in early maintenance mode with no recent updates.

pip install streamlit-chat
error DuplicateWidgetID: There are multiple identical st_chat_message widgets with the same key.
cause Each `message()` call must have a unique key.
fix
Use dynamic keys: message("text", key=f"msg_{i}").
error ModuleNotFoundError: No module named 'st_chat'
cause Incorrect import path. The correct module is 'streamlit_chat'.
fix
Run import streamlit_chat instead of st_chat.
gotcha The `message` component requires a unique `key` for each call, or Streamlit will raise a DuplicateKey error.
fix Always pass a unique `key` string (e.g., f"msg_{i}") to each `message()` call.
deprecated The package uses the old Streamlit component API and may not be compatible with newer Streamlit versions (>=1.27).
fix Consider using native Streamlit chat elements (`st.chat_message`, `st.chat_input`) instead.
gotcha Avatars are fetched from DiceBear API; network issues can cause avatars to fail silently.
fix Set custom avatars via the `avatar_style` and `seed` parameters, or ensure internet access.

Minimal example displaying two chat messages (bot and user).

import streamlit as st
from streamlit_chat import message

message("Hello, I am a chatbot!", key="chat1")
message("Hi there!", is_user=True, key="chat2")