kaleidoskop-hug
commited on
Commit
•
8d2df67
1
Parent(s):
76c37db
Update app.py
Browse files
app.py
CHANGED
@@ -89,10 +89,17 @@ if selected_model not in st.session_state:
|
|
89 |
if "messages" not in st.session_state:
|
90 |
st.session_state.messages = []
|
91 |
|
|
|
|
|
|
|
92 |
# Display chat messages from history on app rerun
|
|
|
93 |
for message in st.session_state.messages:
|
|
|
94 |
with st.chat_message(message["role"]):
|
95 |
-
st.
|
|
|
|
|
96 |
|
97 |
|
98 |
if "remove" not in st.session_state:
|
|
|
89 |
if "messages" not in st.session_state:
|
90 |
st.session_state.messages = []
|
91 |
|
92 |
+
def remove_message(position):
|
93 |
+
st.toast("remove message no:" + position)
|
94 |
+
|
95 |
# Display chat messages from history on app rerun
|
96 |
+
pos = 0
|
97 |
for message in st.session_state.messages:
|
98 |
+
pos++
|
99 |
with st.chat_message(message["role"]):
|
100 |
+
cols = st.columns([9,1])
|
101 |
+
cols[1].markdown(message["content"])
|
102 |
+
cols[2].button("remove", key=button_remove_message, args=[pos], on_click=remove_message)
|
103 |
|
104 |
|
105 |
if "remove" not in st.session_state:
|