building-streamlit-chat-ui

Create Streamlit chat interfaces with message history and streaming responses.

629|85|Updated May 4, 2020
One-click install
npx skills add https://github.com/andfanilo/streamlit-echarts --skill building-streamlit-chat-ui-andfanilo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: building-streamlit-chat-ui
Source: https://github.com/andfanilo/streamlit-echarts/tree/main/.claude/skills/developing-with-streamlit/skills/building-streamlit-chat-ui
Command: npx skills add https://github.com/andfanilo/streamlit-echarts --skill building-streamlit-chat-ui-andfanilo

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Streamlit chat primitives are simple but assembling a responsive, stateful conversational UI with streaming responses, file and audio inputs, feedback, and clear message history can be error-prone and repetitive; this Skill provides practical patterns and examples to accelerate that work.

Core Features & Use Cases

  • Message history management: Use st.session_state to persist and render conversation history with role-aware rendering.
  • Streaming assistant responses: Show token-by-token or chunked model output using st.write_stream for a live typing experience.
  • Multimodal inputs: Accept files and audio from users via st.chat_input to support vision or speech workflows.
  • UX enhancements: Add avatars, suggestion chips, and feedback widgets to improve onboarding and collect ratings.
  • Use Case: Build a customer support chatbot that accepts screenshots, transcribes audio questions, streams model answers, and collects thumbs-up/down feedback.

Quick Start

Create a simple Streamlit chat app that stores messages in st.session_state, displays them with st.chat_message, accepts input with st.chat_input (including files or audio), and streams assistant replies with st.write_stream.

Frequently Asked Questions about building-streamlit-chat-ui

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build a chat interface in Streamlit with streaming responses?

Persist conversation history in a Streamlit chat app by storing messages as a list inside st.session_state, then iterate through this list to render role-aware messages with st.chat_message for consistent state management across reruns.

How do I display conversation history with role-based messages in Streamlit?

Display conversation history in Streamlit by storing messages in st.session_state and rendering them with st.chat_message, which supports role-aware formatting for user and assistant messages to maintain clear visual context throughout the chat session.

Can I accept file and audio uploads through Streamlit chat input?

Stream assistant responses in Streamlit chat using st.write_stream, which renders token-by-token or chunked model output to create a live typing experience, while st.session_state maintains the persistent message history.

What is the best way to add feedback widgets and avatars to a Streamlit chatbot?

Add feedback widgets and avatars to a Streamlit chatbot by customizing st.chat_message with avatar parameters and integrating interactive feedback components to collect user ratings, improving UX and onboarding within conversational interfaces.

Why does my Streamlit chat message history disappear on app rerun?

Streamlit chat message history disappears on rerun because messages are not persisted in st.session_state, so storing the conversation list in st.session_state before rendering with st.chat_message ensures state persists across user interactions.