Keldos commited on
Commit
316589d
1 Parent(s): 26d33a9

fix: 修复toggle按钮切换另一条消息或无效的问题

Browse files
web_assets/javascript/ChuanhuChat.js CHANGED
@@ -348,7 +348,7 @@ function chatbotContentChanged(attempt = 1) {
348
  disableSendBtn();
349
  // gradioApp().querySelectorAll('#chuanhu-chatbot .message-wrap .message.user').forEach((userElement) => {addAvatars(userElement, 'user')});
350
  // gradioApp().querySelectorAll('#chuanhu-chatbot > .wrapper > .wrap > .message-wrap .message-row.bot-row').forEach(addChuanhuButton);
351
- gradioApp().querySelectorAll('#chuanhu-chatbot .message-wrap .message-row.bot-row').forEach(addChuanhuButton);
352
  if (chatbotIndicator.classList.contains('hide')) {
353
  setLatestMessage();
354
  setChatList();
 
348
  disableSendBtn();
349
  // gradioApp().querySelectorAll('#chuanhu-chatbot .message-wrap .message.user').forEach((userElement) => {addAvatars(userElement, 'user')});
350
  // gradioApp().querySelectorAll('#chuanhu-chatbot > .wrapper > .wrap > .message-wrap .message-row.bot-row').forEach(addChuanhuButton);
351
+ gradioApp().querySelectorAll('#chuanhu-chatbot .message-wrap .message.bot').forEach(addChuanhuButton);
352
  if (chatbotIndicator.classList.contains('hide')) {
353
  setLatestMessage();
354
  setChatList();
web_assets/javascript/message-button.js CHANGED
@@ -1,10 +1,10 @@
1
 
2
  // 为 bot 消息添加复制与切换显示按钮 以及最新消息加上重新生成,删除最新消息,嗯。
3
 
4
- function addChuanhuButton(botRow) {
5
 
6
- botElement = botRow.querySelector('.message.bot');
7
- isLatestMessage = botElement.classList.contains('latest');
8
 
9
  var rawMessage = botElement.querySelector('.raw-message');
10
  var mdMessage = botElement.querySelector('.md-message');
 
1
 
2
  // 为 bot 消息添加复制与切换显示按钮 以及最新消息加上重新生成,删除最新消息,嗯。
3
 
4
+ function addChuanhuButton(botElement) {
5
 
6
+ // botElement = botRow.querySelector('.message.bot');
7
+ var isLatestMessage = botElement.classList.contains('latest');
8
 
9
  var rawMessage = botElement.querySelector('.raw-message');
10
  var mdMessage = botElement.querySelector('.md-message');