全国统一热线

0755-23170120
EN
新闻资讯
服务热线

0755-23170120

手机:18688976300(彭生) 15222276387(白生)

邮箱:pengwl@honred.com

QQ:176496342

地址:深圳市宝安石岩润腾工业园A1栋二层

当前位置:首页 >> 新闻资讯 >> 行业新闻

LED显示屏行业2026上半年六大事件回顾

发布时间: 来源:鸿锐达科技 浏览次数:6
same content
温馨提示:设置未来时间可定时发布!
'+ ''+ '
'; document.body.appendChild(panel); // ===== State ===== var msgsEl=document.getElementById('hon-msgs'); var input=document.getElementById('hon-chat-input'); var sendBtn=document.getElementById('hon-send'); var quickEl=document.getElementById('hon-quick'); var isOpen=false,sending=false; var hist=[]; try{var s=sessionStorage.getItem('honred_chat_v1');if(s)hist=JSON.parse(s)}catch(e){} if(!hist.length)hist.push({role:'agent',content:labels.welcome,time:Date.now()}); function save(){try{sessionStorage.setItem('honred_chat_v1',JSON.stringify(hist.slice(-50)))}catch(e){}} function render(){ var h=''; for(var i=0;i'+esc(m.content)+'
'+fmt(m.time)+'
'; } } msgsEl.innerHTML=h;msgsEl.scrollTop=msgsEl.scrollHeight; } quickEl.innerHTML=labels.quick.map(function(q,i){return '';}).join(''); function esc(s){return (s||'').replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"').replace(/\n/g,'
')} function fmt(t){var d=new Date(t);return d.toLocaleTimeString([],{hour:'2-digit',minute:'2-digit'})} function addMsg(role,content){hist.push({role:role,content:content,time:Date.now()});save();render();} // ===== Position Panel ===== function positionPanel(){ var trigger=document.getElementById('hon-ai-trigger'); if(!trigger||window.innerWidth<=990){ // Mobile: full screen - no position needed return; } var rect=trigger.getBoundingClientRect(); var ph=520; // panel height var vh=window.innerHeight; var top=rect.top+rect.height/2-ph/2; // Clamp to viewport top=Math.max(20,Math.min(top,vh-ph-20)); panel.style.top=top+'px'; panel.style.right='84px'; // 57px toolbar + 17px offset + 10px gap panel.style.bottom='auto'; } // ===== Toggle ===== function openChat(){ if(!isOpen){ positionPanel(); panel.className='visible'; isOpen=true; render(); setTimeout(function(){input.focus()},400); } } function closeChat(){ panel.className='hidden'; isOpen=false; } // ===== Send ===== function send(txt){ if(sending)return; txt=txt||input.value.trim(); if(!txt)return; addMsg('user',txt); input.value='';input.style.height='auto'; sending=true;sendBtn.disabled=true; hist.push({role:'typing',content:'',time:Date.now()});render(); var msgs=[{role:'system',content:labels.sys}]; for(var i=0;i16)msgs=[msgs[0]].concat(msgs.slice(-15)); fetch(API,{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({messages:msgs})}) .then(function(r){if(!r.ok)throw new Error('HTTP '+r.status);return r.json()}) .then(function(d){ hist=hist.filter(function(m){return m.role!=='typing'}); if(d.choices&&d.choices[0])addMsg('agent',d.choices[0].message.content); else addMsg('agent',labels.error); sending=false;sendBtn.disabled=false;input.focus(); }) .catch(function(){ hist=hist.filter(function(m){return m.role!=='typing'}); sending=false;sendBtn.disabled=false; addMsg('agent',labels.netErr); }); } // ===== Bind Events ===== // Toolbar trigger var triggerLi=document.getElementById('hon-ai-trigger'); if(triggerLi){ var triggerLink=triggerLi.querySelector('a')||triggerLi; triggerLink.onclick=function(e){ if(isOpen)closeChat();else openChat(); }; } // Panel controls document.getElementById('hon-close').onclick=closeChat; document.getElementById('hon-clear').onclick=function(){ if(confirm(labels.clear)){ hist=[{role:'agent',content:labels.welcome,time:Date.now()}]; save();render(); } }; sendBtn.onclick=function(){send()}; input.onkeydown=function(e){if(e.key==='Enter'&&!e.shiftKey){e.preventDefault();send()}}; input.oninput=function(){this.style.height='auto';this.style.height=Math.min(this.scrollHeight,120)+'px'}; quickEl.onclick=function(e){ if(e.target.tagName==='BUTTON'){ var q=labels.quick[parseInt(e.target.getAttribute('data-q'))]; if(q)send(q); } }; // Reposition on resize window.addEventListener('resize',function(){ if(isOpen)positionPanel(); }); // Keyboard shortcut: Escape to close document.addEventListener('keydown',function(e){ if(e.key==='Escape'&&isOpen)closeChat(); }); render(); })();