File size: 859 Bytes
b966bc9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
26
#!/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_, avatar_style='adventurer')  # display all the previous message

placeholder = st.empty()  # placeholder for latest message
input_ = st.text_input("请向我提问:")
message_history.append(input_)

with placeholder.container():
    # message(message_history[-1], avatar_style='adventurer')  # display the latest message
    message(message_history[-1], is_user=True)  # align's the message to the right