Spaces:
Sleeping
Sleeping
adding restriction to play one audio at a time
Browse files- chatbot.py +16 -6
chatbot.py
CHANGED
|
@@ -169,9 +169,19 @@ def render_chatbot(code, output, error):
|
|
| 169 |
st.session_state.chat_display_count += 5
|
| 170 |
st.rerun()
|
| 171 |
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 169 |
st.session_state.chat_display_count += 5
|
| 170 |
st.rerun()
|
| 171 |
|
| 172 |
+
st.markdown("""
|
| 173 |
+
<script>
|
| 174 |
+
const c = window.parent.document.querySelector('.chat-container');
|
| 175 |
+
if (c) c.scrollTop = c.scrollHeight;
|
| 176 |
+
</script>
|
| 177 |
+
|
| 178 |
+
<script>
|
| 179 |
+
document.querySelectorAll('audio').forEach(audio => {
|
| 180 |
+
audio.addEventListener('play', function () {
|
| 181 |
+
document.querySelectorAll('audio').forEach(a => {
|
| 182 |
+
if (a !== this) a.pause();
|
| 183 |
+
});
|
| 184 |
+
});
|
| 185 |
+
});
|
| 186 |
+
</script>
|
| 187 |
+
""", unsafe_allow_html=True)
|