RomZay commited on
Commit
96e8db9
·
verified ·
1 Parent(s): 3d49e62

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -7
app.py CHANGED
@@ -129,23 +129,25 @@ def render_message(history):
129
 
130
  js = """
131
  function Scrolldown() {
132
-
133
  const messagesContainer = document.getElementById('messages');
134
-
 
 
 
135
  const observer = new MutationObserver((mutationsList, observer) => {
136
  for (const mutation of mutationsList) {
137
  if (mutation.type === 'childList') {
138
  const chatboxContainer = document.getElementById('chatbox-container');
139
- chatboxContainer.scrollTop = chatboxContainer.scrollHeight;
 
 
140
  }
141
  }
142
  });
143
-
144
  const config = { childList: true };
145
-
146
  observer.observe(messagesContainer, config);
147
- console.log('Observing')
148
- }
149
  """
150
 
151
 
 
129
 
130
  js = """
131
  function Scrolldown() {
 
132
  const messagesContainer = document.getElementById('messages');
133
+ if (!messagesContainer) {
134
+ console.error('Messages container not found!');
135
+ return;
136
+ }
137
  const observer = new MutationObserver((mutationsList, observer) => {
138
  for (const mutation of mutationsList) {
139
  if (mutation.type === 'childList') {
140
  const chatboxContainer = document.getElementById('chatbox-container');
141
+ if (chatboxContainer) {
142
+ chatboxContainer.scrollTop = chatboxContainer.scrollHeight;
143
+ }
144
  }
145
  }
146
  });
 
147
  const config = { childList: true };
 
148
  observer.observe(messagesContainer, config);
149
+ console.log('Observing');
150
+ }
151
  """
152
 
153