mestreamlit / pages /992_streamlit_chat.py
yuanjie
update
a18878f
raw
history blame
No virus
741 Bytes
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Project : Python.
# @File : 991_streamlit_apex_charts
# @Time : 2022/10/17 上午10:48
# @Author : yuanjie
# @WeChat : meutils
# @Software : PyCharm
# @Description :
import streamlit as st
from streamlit_chat import message
message_history = ["展示信息"]
for message_ in message_history:
message(message_) # display all the previous message
placeholder = st.empty() # placeholder for latest message
input_ = st.text_input("you:")
message_history.append(input_)
with placeholder.container():
message(message_history[-1], ) # display the latest message
message(message_history[-1], is_user=True) # align's the message to the right