kaleidoskop-hug
commited on
Commit
•
d9ee789
1
Parent(s):
99d07ac
Update app.py
Browse files
app.py
CHANGED
@@ -85,9 +85,9 @@ for message in st.session_state.messages:
|
|
85 |
with st.chat_message(message["role"]):
|
86 |
col1, col2 = st.columns([9,1])
|
87 |
col1.markdown(message["content"])
|
88 |
-
col2.button("edit
|
89 |
if message["role"] == "assistant":
|
90 |
-
col2.button(
|
91 |
|
92 |
# Accept user input
|
93 |
if prompt := st.chat_input(f"Hi I'm {selected_model}, ask me a question"):
|
@@ -96,7 +96,7 @@ if prompt := st.chat_input(f"Hi I'm {selected_model}, ask me a question"):
|
|
96 |
with st.chat_message("user"):
|
97 |
col1, col2 = st.columns([9,1])
|
98 |
col1.markdown(prompt)
|
99 |
-
col2.button("edit
|
100 |
st.session_state.messages.append({"role": "user", "content": prompt})
|
101 |
|
102 |
# Display assistant response in chat message container
|
@@ -106,12 +106,12 @@ if prompt := st.chat_input(f"Hi I'm {selected_model}, ask me a question"):
|
|
106 |
with st.chat_message("assistant"):
|
107 |
col1, col2 = st.columns([9,1])
|
108 |
response = col1.write_stream(assistant["stream"])
|
109 |
-
col2.button("edit
|
110 |
-
col2.button(
|
111 |
else:
|
112 |
with st.chat_message("assistant"):
|
113 |
col1, col2 = st.columns([9,1])
|
114 |
response = col1.write("Failure!")
|
115 |
-
col2.button(
|
116 |
|
117 |
st.session_state.messages.append({"role": "assistant", "content": response})
|
|
|
85 |
with st.chat_message(message["role"]):
|
86 |
col1, col2 = st.columns([9,1])
|
87 |
col1.markdown(message["content"])
|
88 |
+
col2.button("", icon = ":material/edit:", key="button_edit_message_"+str(pos), args=[pos], on_click=edit_message)
|
89 |
if message["role"] == "assistant":
|
90 |
+
col2.button("", icon = ":material/delete:", key="button_remove_message_"+str(pos), args=[pos], on_click=remove_message)
|
91 |
|
92 |
# Accept user input
|
93 |
if prompt := st.chat_input(f"Hi I'm {selected_model}, ask me a question"):
|
|
|
96 |
with st.chat_message("user"):
|
97 |
col1, col2 = st.columns([9,1])
|
98 |
col1.markdown(prompt)
|
99 |
+
col2.button("", icon = ":material/edit:", key="button_edit_message_"+str(pos), args=[pos], on_click=edit_message)
|
100 |
st.session_state.messages.append({"role": "user", "content": prompt})
|
101 |
|
102 |
# Display assistant response in chat message container
|
|
|
106 |
with st.chat_message("assistant"):
|
107 |
col1, col2 = st.columns([9,1])
|
108 |
response = col1.write_stream(assistant["stream"])
|
109 |
+
col2.button("", icon = ":material/edit:", key="button_edit_message_"+str(pos), args=[pos], on_click=edit_message)
|
110 |
+
col2.button("", icon = ":material/delete:", key="button_remove_message_"+str(pos), args=[pos], on_click=remove_message)
|
111 |
else:
|
112 |
with st.chat_message("assistant"):
|
113 |
col1, col2 = st.columns([9,1])
|
114 |
response = col1.write("Failure!")
|
115 |
+
col2.button("", icon = ":material/delete:", key="button_remove_message_"+str(pos), args=[pos], on_click=remove_message)
|
116 |
|
117 |
st.session_state.messages.append({"role": "assistant", "content": response})
|