kaleidoskop-hug commited on
Commit
ee22b54
1 Parent(s): d8e5078

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -11
app.py CHANGED
@@ -80,20 +80,9 @@ if "messages" not in st.session_state:
80
  st.session_state.messages = []
81
 
82
 
83
- # Display chat messages from history on app rerun
84
- pos = 0
85
- for message in st.session_state.messages:
86
- pos=pos+1
87
- with st.chat_message(message["role"]):
88
- col1, col2 = st.columns([9,1])
89
- col1.markdown(message["content"])
90
- col2.button("remove-"+str(pos), key="button_remove_message_"+str(pos), args=[pos], on_click=remove_message)
91
-
92
-
93
  def remove_message(position):
94
  st.toast("remove message no:" + position)
95
 
96
-
97
  if "remove" not in st.session_state:
98
  st.session_state.remove= False
99
 
@@ -108,6 +97,14 @@ if st.session_state.remove:
108
  st.rerun()
109
 
110
 
 
 
 
 
 
 
 
 
111
 
112
  # Accept user input
113
  if prompt := st.chat_input(f"Hi I'm {selected_model}, ask me a question"):
 
80
  st.session_state.messages = []
81
 
82
 
 
 
 
 
 
 
 
 
 
 
83
  def remove_message(position):
84
  st.toast("remove message no:" + position)
85
 
 
86
  if "remove" not in st.session_state:
87
  st.session_state.remove= False
88
 
 
97
  st.rerun()
98
 
99
 
100
+ # Display chat messages from history on app rerun
101
+ pos = 0
102
+ for message in st.session_state.messages:
103
+ pos=pos+1
104
+ with st.chat_message(message["role"]):
105
+ col1, col2 = st.columns([9,1])
106
+ col1.markdown(message["content"])
107
+ col2.button("remove-"+str(pos), key="button_remove_message_"+str(pos), args=[pos], on_click=remove_message)
108
 
109
  # Accept user input
110
  if prompt := st.chat_input(f"Hi I'm {selected_model}, ask me a question"):