Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -207,12 +207,21 @@ with st.sidebar:
|
|
207 |
<button id="copy-log-btn" style='font-size: 1em; padding: 0.5em;' onclick='copyLog()'>Copy Conversation History</button>
|
208 |
|
209 |
<script>
|
|
|
210 |
function copyLog() {{
|
211 |
-
navigator.clipboard.writeText(decodeURIComponent(
|
212 |
-
|
213 |
copyBtn.innerHTML = "Copied!";
|
214 |
setTimeout(function(){{ copyBtn.innerHTML = "Copy Conversation History"; }}, 2000);
|
215 |
}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
216 |
</script>
|
217 |
"""
|
218 |
html(copy_log_button_html, height=50)
|
|
|
207 |
<button id="copy-log-btn" style='font-size: 1em; padding: 0.5em;' onclick='copyLog()'>Copy Conversation History</button>
|
208 |
|
209 |
<script>
|
210 |
+
const log_text_escaped = "{log_text_escaped}";
|
211 |
function copyLog() {{
|
212 |
+
navigator.clipboard.writeText(decodeURIComponent(log_text_escaped));
|
213 |
+
const copyBtn = document.getElementById("copy-log-btn");
|
214 |
copyBtn.innerHTML = "Copied!";
|
215 |
setTimeout(function(){{ copyBtn.innerHTML = "Copy Conversation History"; }}, 2000);
|
216 |
}}
|
217 |
+
window.parent.document.addEventListener('keydown', (e) => {{
|
218 |
+
if ( e.code == "Pause" ){{
|
219 |
+
window.parent.navigator.clipboard.writeText(decodeURIComponent(log_text_escaped));
|
220 |
+
const copyBtn = document.getElementById("copy-log-btn");
|
221 |
+
copyBtn.innerHTML = "Copied!";
|
222 |
+
setTimeout(function(){{ copyBtn.innerHTML = "Copy Conversation History"; }}, 2000);
|
223 |
+
}}
|
224 |
+
}} , false);
|
225 |
</script>
|
226 |
"""
|
227 |
html(copy_log_button_html, height=50)
|