It’s a chat application, few buttons gets created when the LLM model gives out a response.
there are few functions these buttons execute when clicked on.
the problem is when any of these buttons are clicked all created buttons disappear.
with st.chat_message(“assistant”, avatar=ast):
st.markdown(model_response)
for idx, doc in enumerate(result[“source_documents”]):
pagenum = result[“source_documents”][idx].metadata[“page”] + 1
searchterm = result[“source_documents”][idx].page_content
newsearchterm = " “.join(searchterm.split(”\n"))
st.button(
str(idx + 1),
on_click=displayPDFwithnum,
args=(pdf_path, pagenum, newsearchterm),
)
1,2,3,4 are the buttons it populates, and based on the button click, there is a function that runs at the backend to write certain content on the screen.
when one of these buttons are clicked, the content gets written on the screen but the buttons disappear. it is not allowing me to click on a different button to see the contents of other buttons.