Wajahat698 commited on
Commit
b0f61b4
·
verified ·
1 Parent(s): 1ff0a61

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -2212,21 +2212,22 @@ def handle_prompt(prompt):
2212
  full_response = output["output"]
2213
 
2214
  cleaned_text = clean_text(full_response)
 
 
2215
  trust_tip, suggestion = get_trust_tip_and_suggestion()
2216
- combined_text = f"{cleaned_text}\n\n---\n\n**Trust Tip**: {trust_tip}\n\n**Suggestion**: {suggestion}"
2217
- formatted_text = clean_and_format_markdown(combined_text)
2218
 
2219
  with response_placeholder:
2220
  with st.chat_message("assistant"):
2221
- st.markdown(formatted_text, unsafe_allow_html=False)
2222
 
2223
 
2224
  except Exception as e:
2225
  logging.error(f"Error generating response: {e}")
2226
  st.error("An error occurred while generating the response. Please try again.")
2227
 
2228
- st.session_state.chat_history.append({"role": "assistant", "content": formatted_text})
2229
- copy_to_clipboard(formatted_text)
2230
  st.session_state["handled"] = True # Mark as handled
2231
 
2232
  # Call the function to handle the prompt
 
2212
  full_response = output["output"]
2213
 
2214
  cleaned_text = clean_text(full_response)
2215
+ formatted_text = clean_and_format_markdown(cleaned_text)
2216
+
2217
  trust_tip, suggestion = get_trust_tip_and_suggestion()
2218
+ combined_text = f"{formatted_text}\n\n---\n\n**Trust Tip**: {trust_tip}\n\n**Suggestion**: {suggestion}"
 
2219
 
2220
  with response_placeholder:
2221
  with st.chat_message("assistant"):
2222
+ st.write(combined_text)
2223
 
2224
 
2225
  except Exception as e:
2226
  logging.error(f"Error generating response: {e}")
2227
  st.error("An error occurred while generating the response. Please try again.")
2228
 
2229
+ st.session_state.chat_history.append({"role": "assistant", "content": combined_text})
2230
+ copy_to_clipboard(combined_text)
2231
  st.session_state["handled"] = True # Mark as handled
2232
 
2233
  # Call the function to handle the prompt