kaleidoskop-hug
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -64,8 +64,19 @@ st.sidebar.button('Reset Chat', on_click=reset_conversation) #Reset button
|
|
64 |
st.sidebar.write(f"You're now chatting with **{selected_model}**")
|
65 |
st.sidebar.markdown("*Generated content may be inaccurate or false.*")
|
66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
def edit_message(position):
|
68 |
st.toast("try to edit message no: " + str(position))
|
|
|
|
|
|
|
69 |
|
70 |
def remove_message(position):
|
71 |
st.toast("try to remove message no: " + str(position-1) + " and "+ str(position))
|
|
|
64 |
st.sidebar.write(f"You're now chatting with **{selected_model}**")
|
65 |
st.sidebar.markdown("*Generated content may be inaccurate or false.*")
|
66 |
|
67 |
+
@st.dialog("Edit Message")
|
68 |
+
def edit_text(text):
|
69 |
+
reason = st.text_input("{text}")
|
70 |
+
if st.button("Submit"):
|
71 |
+
resturn text
|
72 |
+
if st.button("Cancel"):
|
73 |
+
return ""
|
74 |
+
|
75 |
def edit_message(position):
|
76 |
st.toast("try to edit message no: " + str(position))
|
77 |
+
text = edit_text(st.session_state.messages[position])
|
78 |
+
st.toast("result: " + text)
|
79 |
+
|
80 |
|
81 |
def remove_message(position):
|
82 |
st.toast("try to remove message no: " + str(position-1) + " and "+ str(position))
|