yizhangliu commited on
Commit
f97bb4e
1 Parent(s): 25a5a47

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -6
app.py CHANGED
@@ -75,18 +75,25 @@ start_work = """async() => {
75
  page2.style.display = "block";
76
 
77
  window['div_count'] = 0;
 
 
78
  window['checkChange'] = function checkChange() {
79
  try {
80
- chat_bot = window['gradioEl'].querySelectorAll('#chat_bot')[0];
81
- chat_bot1 = window['gradioEl'].querySelectorAll('#chat_bot1')[0];
82
- if (chat_bot.children[2].children[0].children.length > window['div_count']) {
83
- new_len = chat_bot.children[2].children[0].children.length - window['div_count'];
84
  for (var i = 0; i < new_len; i++) {
85
- new_div = chat_bot.children[2].children[0].children[window['div_count'] + i].cloneNode(true);
86
- chat_bot1.children[2].children[0].appendChild(new_div);
87
  }
88
  window['div_count'] = chat_bot.children[2].children[0].children.length;
89
  }
 
 
 
 
 
 
 
90
  } catch(e) {
91
  }
92
  }
 
75
  page2.style.display = "block";
76
 
77
  window['div_count'] = 0;
78
+ window['chat_bot'] = window['gradioEl'].querySelectorAll('#chat_bot')[0];
79
+ window['chat_bot1'] = window['gradioEl'].querySelectorAll('#chat_bot1')[0];
80
  window['checkChange'] = function checkChange() {
81
  try {
82
+ if (window['chat_bot'].children[2].children[0].children.length > window['div_count']) {
83
+ new_len = window['chat_bot'].children[2].children[0].children.length - window['div_count'];
 
 
84
  for (var i = 0; i < new_len; i++) {
85
+ new_div = window['chat_bot'].children[2].children[0].children[window['div_count'] + i].cloneNode(true);
86
+ window['chat_bot1'].children[2].children[0].appendChild(new_div);
87
  }
88
  window['div_count'] = chat_bot.children[2].children[0].children.length;
89
  }
90
+ for (var i = 0; i < window['chat_bot1'].children[0].children.length; i++) {
91
+ window['chat_bot1'].children[0].removeChild(window['chat_bot1'].children[0].children[i]);
92
+ }
93
+ for (var i = 0; i < window['chat_bot'].children[0].children.length; i++) {
94
+ new_div = window['chat_bot'].children[0].children[i].cloneNode(true);
95
+ window['chat_bot1'].children[0].appendChild(new_div);
96
+ }
97
  } catch(e) {
98
  }
99
  }