MatteoScript commited on
Commit
b162398
·
verified ·
1 Parent(s): 01ac16e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -12
app.py CHANGED
@@ -77,23 +77,14 @@ def chat_box() :
77
  with st.chat_message(message["role"]):
78
  st.markdown(message["content"])
79
 
80
- def feedback_buttons() :
81
- is_visible = True
82
- def click_handler() :
83
- is_visible = False
84
- if is_visible :
85
- col1, col2 = st.columns(2)
86
- with col1 :
87
- st.button("👍 Soddisfatto", on_click = click_handler,type="primary")
88
- with col2 :
89
- st.button("👎 Deluso", on_click=click_handler, type="secondary")
90
-
91
  def generate_chat_stream(prompt) :
92
  links = []
93
  if st.session_state.rag_enabled :
94
  with st.spinner("Ricerca nei documenti...."):
 
95
  prompt, links = gen_augmented_prompt(prompt=prompt, top_k=st.session_state.top_k)
96
  with st.spinner("Generazione in corso...") :
 
97
  chat_stream = chat(prompt, st.session_state.history,chat_client=CHAT_BOTS[st.session_state.chat_bot] ,
98
  temperature=st.session_state.temp, max_new_tokens=st.session_state.max_tokens)
99
  return chat_stream, links
@@ -132,7 +123,6 @@ init_state()
132
  sidebar()
133
  header()
134
  chat_box()
135
- feedback_buttons()
136
 
137
  if prompt := st.chat_input("Chatta con BonsiAI..."):
138
  st.chat_message("user").markdown(prompt)
 
77
  with st.chat_message(message["role"]):
78
  st.markdown(message["content"])
79
 
 
 
 
 
 
 
 
 
 
 
 
80
  def generate_chat_stream(prompt) :
81
  links = []
82
  if st.session_state.rag_enabled :
83
  with st.spinner("Ricerca nei documenti...."):
84
+ time.sleep(2)
85
  prompt, links = gen_augmented_prompt(prompt=prompt, top_k=st.session_state.top_k)
86
  with st.spinner("Generazione in corso...") :
87
+ time.sleep(2)
88
  chat_stream = chat(prompt, st.session_state.history,chat_client=CHAT_BOTS[st.session_state.chat_bot] ,
89
  temperature=st.session_state.temp, max_new_tokens=st.session_state.max_tokens)
90
  return chat_stream, links
 
123
  sidebar()
124
  header()
125
  chat_box()
 
126
 
127
  if prompt := st.chat_input("Chatta con BonsiAI..."):
128
  st.chat_message("user").markdown(prompt)