mwe11s commited on
Commit
4012705
·
1 Parent(s): 540a813

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -11
app.py CHANGED
@@ -40,25 +40,26 @@ def cs_body():
40
 
41
  # Chat input
42
  if prompt := st.chat_input("How Can I Help?"):
43
- st.session_state.messages.append({"role": "user", "content": prompt, "type": "text"})
44
  with chat.chat_message("user"):
45
  st.markdown(prompt)
46
  # Assistant working
47
  with st.chat_message("assistant"):
48
  message_placeholder = st.empty()
49
  message_placeholder.write("I am working..")
50
- st.session_state.messages.append({"role": "assistant", "content": "I am working..", "type": "text"})
51
-
52
- for message in st.session_state.messages:
53
- with st.chat_message(message["role"]):
54
- # if type is text
55
- if message["type"] == "text":
56
- st.markdown(message["content"])
57
- # if type is dataframe
58
- if message["type"] == "dataframe":
59
- st.dataframe(message["content"])
60
 
 
 
 
 
 
 
 
 
61
 
 
 
62
 
63
  env.subheader('Enviornment:')
64
  return None
 
40
 
41
  # Chat input
42
  if prompt := st.chat_input("How Can I Help?"):
43
+ # st.session_state.messages.append({"role": "user", "content": prompt, "type": "text"})
44
  with chat.chat_message("user"):
45
  st.markdown(prompt)
46
  # Assistant working
47
  with st.chat_message("assistant"):
48
  message_placeholder = st.empty()
49
  message_placeholder.write("I am working..")
50
+ # st.session_state.messages.append({"role": "assistant", "content": "I am working..", "type": "text"})
 
 
 
 
 
 
 
 
 
51
 
52
+ for message in st.session_state.messages:
53
+ with st.chat_message(message["role"]):
54
+ # if type is text
55
+ if message["type"] == "text":
56
+ st.markdown(message["content"])
57
+ # if type is dataframe
58
+ if message["type"] == "dataframe":
59
+ st.dataframe(message["content"])
60
 
61
+ st.session_state.messages.append({"role": "assistant", "content": "I am working..", "type": "text"})
62
+ st.session_state.messages.append({"role": "user", "content": prompt, "type": "text"})
63
 
64
  env.subheader('Enviornment:')
65
  return None