File size: 511 Bytes
a602459 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import time
import streamlit as st
def clear_uploader():
st.rerun()
def undo():
if len(st.session_state.messages) > 0:
st.query_params.clear()
msg = st.session_state.messages.pop()
if msg["role"] == "assistant" and "cost" in st.session_state:
st.session_state.cost.pop()
time.sleep(0.1)
st.rerun()
def restart():
st.query_params.clear()
st.session_state.messages = []
st.session_state.cost = []
time.sleep(0.2)
clear_uploader() |