Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -127,7 +127,7 @@ def render_message(history):
|
|
| 127 |
|
| 128 |
return messages_html
|
| 129 |
|
| 130 |
-
with gr.Blocks(css=".chatbox {height: 400px; overflow-y: auto; border: 1px solid #262626; padding: 10px; background-color: #171717;}") as demo:
|
| 131 |
|
| 132 |
with gr.Column(visible=True) as auth_view:
|
| 133 |
gr.Markdown("## P-MSQ Authorization")
|
|
@@ -221,23 +221,6 @@ with gr.Blocks(css=".chatbox {height: 400px; overflow-y: auto; border: 1px solid
|
|
| 221 |
auth_button.click(authorize_and_proceed, inputs=[api_user_input, api_key_input], outputs=[auth_view, chat_view, chatbot_output, history_state])
|
| 222 |
save_instructions_btn.click(save_custom_instructions, inputs=[api_key_input, system_instructions_input], outputs=auth_status)
|
| 223 |
demo.load(lambda: None, [], None)
|
| 224 |
-
demo.append(gr.HTML("""
|
| 225 |
-
<script>
|
| 226 |
-
function scrollToBottom() {
|
| 227 |
-
const container = document.getElementById('chatbox-container');
|
| 228 |
-
if (container) {
|
| 229 |
-
container.scrollTop = container.scrollHeight;
|
| 230 |
-
}
|
| 231 |
-
}
|
| 232 |
-
|
| 233 |
-
// Scroll to bottom after the page has loaded
|
| 234 |
-
window.onload = scrollToBottom;
|
| 235 |
-
|
| 236 |
-
// Observe changes in the chatbox container to scroll on new messages
|
| 237 |
-
const observer = new MutationObserver(scrollToBottom);
|
| 238 |
-
observer.observe(document.getElementById('chatbox-container'), { childList: true, subtree: true });
|
| 239 |
-
</script>
|
| 240 |
-
"""))
|
| 241 |
demo.launch()
|
| 242 |
if __name__ == "__main__":
|
| 243 |
demo.queue = False
|
|
|
|
| 127 |
|
| 128 |
return messages_html
|
| 129 |
|
| 130 |
+
with gr.Blocks(css=".chatbox {height: 400px; overflow-y: auto; border: 1px solid #262626; padding: 10px; background-color: #171717;}", js='handleAutoScrollChat.js') as demo:
|
| 131 |
|
| 132 |
with gr.Column(visible=True) as auth_view:
|
| 133 |
gr.Markdown("## P-MSQ Authorization")
|
|
|
|
| 221 |
auth_button.click(authorize_and_proceed, inputs=[api_user_input, api_key_input], outputs=[auth_view, chat_view, chatbot_output, history_state])
|
| 222 |
save_instructions_btn.click(save_custom_instructions, inputs=[api_key_input, system_instructions_input], outputs=auth_status)
|
| 223 |
demo.load(lambda: None, [], None)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 224 |
demo.launch()
|
| 225 |
if __name__ == "__main__":
|
| 226 |
demo.queue = False
|