Spaces:
Running
Running
Update app.py
Browse files76 unmodified lines7778798081828384858687888990808182838485868788899032 unmodified lines12312412513512612712876 unmodified lines with st.chat_message(message["role"]): st.markdown(message["content"])
def feedback_buttons() : is_visible = True def click_handler() : is_visible = False if is_visible : col1, col2 = st.columns(2) with col1 : st.button("👍 Soddisfatto", on_click = click_handler,type="primary") with col2 : st.button("👎 Deluso", on_click=click_handler, type="secondary")
def generate_chat_stream(prompt) : links = [] if st.session_state.rag_enabled : with st.spinner("Ricerca nei documenti...."): time.sleep(2) prompt, links = gen_augmented_prompt(prompt=prompt, top_k=st.session_state.top_k) with st.spinner("Generazione in corso...") : time.sleep(2) chat_stream = chat(prompt, st.session_state.history,chat_client=CHAT_BOTS[st.session_state.chat_bot] , temperature=st.session_state.temp, max_new_tokens=st.session_state.max_tokens) return chat_stream, links32 unmodified linessidebar()header()chat_box()feedback_buttons()
if prompt := st.chat_input("Chatta con BonsiAI..."): st.chat_message("user").markdown(prompt)app.py+2-12