File size: 741 Bytes
a18878f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/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