Skip to content

Commit b033b05

Browse files
authored
Fix duplicate output issue in script
Removed redundant code causing output to be shown twice
1 parent 2ad2016 commit b033b05

File tree

1 file changed

+0
-27
lines changed

1 file changed

+0
-27
lines changed

app.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -202,33 +202,6 @@ def stop_stream_callback():
202202
st.session_state.messages[current_assistant_message_idx]["content"] = collected_text
203203
save_chat_history(st.session_state.messages)
204204

205-
# Read More block immediately for new response
206-
toggle_key = f"read_more_{current_assistant_message_idx}"
207-
if toggle_key not in st.session_state:
208-
st.session_state[toggle_key] = False
209-
words = collected_text.split()
210-
if len(words) > 50 and not st.session_state[toggle_key]:
211-
st.markdown(get_truncated_text(collected_text, 50))
212-
else:
213-
st.markdown(collected_text)
214-
215-
col1, col2, col3 = st.columns(3)
216-
with col1:
217-
if len(words) > 50:
218-
label = "Read More" if not st.session_state[toggle_key] else "Show Less"
219-
if st.button(label, key=f"toggle_{current_assistant_message_idx}"):
220-
st.session_state[toggle_key] = not st.session_state[toggle_key]
221-
st.rerun()
222-
with col2:
223-
if st.button("Copy Output", key=f"copy_{current_assistant_message_idx}_final"):
224-
copy_to_clipboard(collected_text)
225-
with col3:
226-
if st.button("🗑️ Delete Response", key=f"delete_{current_assistant_message_idx}_final"):
227-
st.session_state.messages.pop(current_assistant_message_idx)
228-
st.session_state.messages.pop(current_assistant_message_idx - 1)
229-
save_chat_history(st.session_state.messages)
230-
st.rerun()
231-
232205
elif "model_list" not in st.session_state:
233206
st.info("👈 Use the sidebar to enter your credentials and load available models.")
234207
else:

0 commit comments

Comments
 (0)