acp-ts 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server.js +4 -2
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -1405,8 +1405,9 @@ const chatHtml = `<!DOCTYPE html>
|
|
|
1405
1405
|
} else {
|
|
1406
1406
|
D.input.disabled=false; D.input.placeholder='输入消息...';
|
|
1407
1407
|
}
|
|
1408
|
+
var wasAtBottom=D.msgs.scrollHeight-D.msgs.scrollTop-D.msgs.clientHeight<150;
|
|
1408
1409
|
D.msgs.innerHTML=html;
|
|
1409
|
-
D.msgs.scrollTop=D.msgs.scrollHeight;
|
|
1410
|
+
if(wasAtBottom) D.msgs.scrollTop=D.msgs.scrollHeight;
|
|
1410
1411
|
}
|
|
1411
1412
|
|
|
1412
1413
|
function updateDot(st){
|
|
@@ -1743,8 +1744,9 @@ const chatHtml = `<!DOCTYPE html>
|
|
|
1743
1744
|
'<div class="msg-meta">'+(sent?'我':escH(name))+' · '+t+'</div>' +
|
|
1744
1745
|
'</div></div>';
|
|
1745
1746
|
}).join('');
|
|
1747
|
+
var wasAtBottom=D.msgs.scrollHeight-D.msgs.scrollTop-D.msgs.clientHeight<150;
|
|
1746
1748
|
D.msgs.innerHTML=html;
|
|
1747
|
-
D.msgs.scrollTop=D.msgs.scrollHeight;
|
|
1749
|
+
if(wasAtBottom) D.msgs.scrollTop=D.msgs.scrollHeight;
|
|
1748
1750
|
// 异步加载未缓存的 agent info,加载完成后重新渲染以更新头像
|
|
1749
1751
|
var unique=needFetch.filter(function(v,i,a){ return a.indexOf(v)===i; });
|
|
1750
1752
|
unique.forEach(function(aid){
|