Metadata-Version: 2.1
Name: streamlit-chatbox
Version: 0.1.2
Summary: A chat box used in streamlit
Home-page: https://github.com/liunux4odoo/streamlit-chatbox
Author: liunux
Author-email: liunux@qq.com
License: UNKNOWN
Platform: UNKNOWN
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: streamlit

# Chatbox component for streamlit

A Streamlit component to show chat messages.

## Features

- user can custom the bg_color and icon of message senders.
- support streaming output.

This make it easy to chat with LLMs in streamlit.


## Install

just `pip install streamlit-chatbox`

## Usage examples

```python
import streamlit as st
from streamlit_chatbox import st_chatbox
import time


st.write('start to chat')
streaming = st.checkbox('streaming', False)
chat_box = st_chatbox(
	greetings=['welcome to chat', '\n```streamlit``` is a great tool!'])


q = st.text_input('input', placeholder='input your question here')
if q:
    chat_box.user_say(q)
    text = f'my answer to:\n\n{q}\n\n```this is some code```'
    if streaming:
        chat_box.robot_stream(text)
    else:
        chat_box.robot_say(text)

chat_box.output_messages()
```

use `help(st_chatbox)` to see more custom params.


![demo](https://github.com/liunux4odoo/streamlit-chatbox/blob/master/demo.gif)

