acp-ts 1.1.1 → 1.1.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 +7 -9
- package/package.json +2 -1
package/dist/server.js
CHANGED
|
@@ -765,7 +765,7 @@ const chatHtml = `<!DOCTYPE html>
|
|
|
765
765
|
} catch(err){ alert('删除失败: ' + err.message); }
|
|
766
766
|
}
|
|
767
767
|
|
|
768
|
-
function initDom(){ D.myAid=$('myAid'); D.sList=$('sessionList'); D.title=$('chatTitle'); D.msgs=$('messages'); D.input=$('messageInput'); D.sendBtn=$('sendBtn'); D.dot=$('statusDot'); D.modal=$('modal'); D.tInput=$('targetAidInput'); D.cBtn=$('connectBtn'); D.sidebar=$('sidebar'); D.aidSel=$('aidSelect'); D.aidDot=$('aidOnlineDot'); D.
|
|
768
|
+
function initDom(){ D.myAid=$('myAid'); D.sList=$('sessionList'); D.title=$('chatTitle'); D.msgs=$('messages'); D.input=$('messageInput'); D.sendBtn=$('sendBtn'); D.dot=$('statusDot'); D.modal=$('modal'); D.tInput=$('targetAidInput'); D.cBtn=$('connectBtn'); D.sidebar=$('sidebar'); D.aidSel=$('aidSelect'); D.aidDot=$('aidOnlineDot'); D.aidStatusToggle=$('aidStatusToggle'); D.aidStatusText=$('aidStatusText'); }
|
|
769
769
|
|
|
770
770
|
async function init(){
|
|
771
771
|
initDom();
|
|
@@ -787,14 +787,13 @@ const chatHtml = `<!DOCTYPE html>
|
|
|
787
787
|
S.aidList.forEach(function(a){
|
|
788
788
|
var sel=a.aid===S.aid?' selected':'';
|
|
789
789
|
if(a.aid===S.aid) curOnline=a.online;
|
|
790
|
-
|
|
791
|
-
html+='<option value="'+escH(a.aid)+'"'+sel+'>'+escH(label)+'</option>';
|
|
790
|
+
html+='<option value="'+escH(a.aid)+'"'+sel+'>'+escH(a.aid)+'</option>';
|
|
792
791
|
});
|
|
793
792
|
D.aidSel.innerHTML=html;
|
|
794
|
-
D.aidDot.className='
|
|
795
|
-
D.
|
|
796
|
-
D.
|
|
797
|
-
D.
|
|
793
|
+
D.aidDot.className='status-indicator '+(curOnline?'online':'offline');
|
|
794
|
+
D.aidStatusText.textContent=curOnline?'已上线':'离线';
|
|
795
|
+
D.aidStatusText.style.color=curOnline?'#10b981':'#64748b';
|
|
796
|
+
D.aidStatusToggle.title=curOnline?'点击下线':'点击上线';
|
|
798
797
|
}
|
|
799
798
|
|
|
800
799
|
async function switchAid(aid){
|
|
@@ -825,7 +824,7 @@ const chatHtml = `<!DOCTYPE html>
|
|
|
825
824
|
async function toggleOnline(){
|
|
826
825
|
var info=S.aidList.find(function(a){ return a.aid===S.aid; });
|
|
827
826
|
var isOnline=info&&info.online;
|
|
828
|
-
D.
|
|
827
|
+
D.aidStatusText.textContent='...';
|
|
829
828
|
try {
|
|
830
829
|
if(isOnline){
|
|
831
830
|
await fetch('/api/aid/offline',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({aid:S.aid})});
|
|
@@ -836,7 +835,6 @@ const chatHtml = `<!DOCTYPE html>
|
|
|
836
835
|
S.aidList=d.aidStatus||[];
|
|
837
836
|
renderAidSelect();
|
|
838
837
|
} catch(e){}
|
|
839
|
-
D.aidBtn.disabled=false;
|
|
840
838
|
}
|
|
841
839
|
|
|
842
840
|
var _pollCount=0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "acp-ts",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "基于 WebSocket 的智能体通信库,提供智能体身份管理和实时通信功能",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "tsc",
|
|
12
|
+
"prepublishOnly": "npm run build",
|
|
12
13
|
"start": "node dist/cli.js"
|
|
13
14
|
},
|
|
14
15
|
"files": [
|