Update app.py
Browse files
app.py
CHANGED
@@ -65,28 +65,23 @@ def main():
|
|
65 |
sanitized_report = sanitize_text(report + "\n\n" + outro)
|
66 |
|
67 |
# Display the sanitized report
|
68 |
-
st.text(sanitized_report)
|
|
|
69 |
# Add a copy button to copy the output
|
70 |
if st.button('Copy Report'):
|
71 |
-
#
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
}
|
83 |
-
document.querySelector("button[data-baseweb='button']").onclick = function() {
|
84 |
-
copyToClipboard(document.querySelector("div[data-testid='stText']").innerText);
|
85 |
-
}
|
86 |
-
</script>
|
87 |
-
""", unsafe_allow_html=True)
|
88 |
else:
|
89 |
st.sidebar.error("❗ Please enter a research query.")
|
90 |
|
91 |
if __name__ == "__main__":
|
92 |
-
main()
|
|
|
65 |
sanitized_report = sanitize_text(report + "\n\n" + outro)
|
66 |
|
67 |
# Display the sanitized report
|
68 |
+
report_element = st.text(sanitized_report)
|
69 |
+
|
70 |
# Add a copy button to copy the output
|
71 |
if st.button('Copy Report'):
|
72 |
+
# Use the newer clipboard API
|
73 |
+
try:
|
74 |
+
st.write("Copying report to clipboard...")
|
75 |
+
st.write(report_element)
|
76 |
+
st.write(sanitized_report)
|
77 |
+
st.write(type(sanitized_report))
|
78 |
+
st.write(len(sanitized_report))
|
79 |
+
await st.experimental_set_state({"report_copied": True})
|
80 |
+
await st.experimental_rerun()
|
81 |
+
except Exception as e:
|
82 |
+
st.error(f"Error copying report: {e}")
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
else:
|
84 |
st.sidebar.error("❗ Please enter a research query.")
|
85 |
|
86 |
if __name__ == "__main__":
|
87 |
+
main()
|