RomZay commited on
Commit
16a6f01
·
verified ·
1 Parent(s): e37f59b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -1
app.py CHANGED
@@ -127,7 +127,28 @@ 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;}", js="handleAutoScrollChat.js") as demo:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
 
132
  with gr.Column(visible=True) as auth_view:
133
  gr.Markdown("## P-MSQ Authorization")
 
127
 
128
  return messages_html
129
 
130
+ js =
131
+ """
132
+ function Scrolldown() {
133
+ let targetNode = document.querySelector('#chatbox-container');
134
+
135
+ if (!targetNode) {
136
+ console.error('Chat container not found');
137
+ return;
138
+ }
139
+
140
+ const config = { childList: true, subtree: true };
141
+
142
+ const callback = (mutationList, observer) => {
143
+ targetNode.scrollTop = targetNode.scrollHeight;
144
+ };
145
+
146
+ const observer = new MutationObserver(callback);
147
+
148
+ observer.observe(targetNode, config);
149
+ }
150
+ """
151
+ with gr.Blocks(css=".chatbox {height: 400px; overflow-y: auto; border: 1px solid #262626; padding: 10px; background-color: #171717;}", js=js) as demo:
152
 
153
  with gr.Column(visible=True) as auth_view:
154
  gr.Markdown("## P-MSQ Authorization")