| Server IP : 54.37.205.81 / Your IP : 216.73.216.76 Web Server : nginx/1.22.1 System : Linux vps-249481fa 6.1.0-50-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.176-1 (2026-07-02) x86_64 User : debian ( 1000) PHP Version : 8.2.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/admin.copyrightchain.it/html/assets/ |
Upload File : |
import{c as y,u as j,r as n,j as e,t as v,g as w,L as N,h as k}from"./index-0V3kacYJ.js";/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const A=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],E=y("brain",A),M="https://app.copyrightchain.it/api/ai",I=({lang:d,certificates:S=[]})=>{const m=v[d],{user:f,deductCredits:g}=j(),[u,l]=n.useState([{role:"assistant",content:d==="it"?"Benvenuto. Sono il tuo Legal AI Advisor. Come posso aiutarti oggi?":"Welcome. I am your Legal AI Advisor. How can I assist you today?"}]),[r,x]=n.useState(""),[c,h]=n.useState(!1),o=n.useRef(null);n.useEffect(()=>{o.current&&(o.current.scrollTop=o.current.scrollHeight)},[u]);const p=async()=>{if(!r.trim()||c||!g(1))return;const s=r.trim();x(""),l(t=>[...t,{role:"user",content:s}]),h(!0);try{const t=sessionStorage.getItem("ccp_client_token")||"";if(!t)throw new Error("session_missing");const i=await fetch(`${M}/client/ai/advisor`,{method:"POST",headers:{"Content-Type":"application/json","X-CCP-Token":t},body:JSON.stringify({prompt:s})}),a=await i.json().catch(()=>null);if(!i.ok||!(a!=null&&a.ok))throw new Error((a==null?void 0:a.error)||"advisor_failed");l(b=>[...b,{role:"assistant",content:a.text||"Errore elaborazione."}])}catch{l(i=>[...i,{role:"assistant",content:"Errore di connessione."}])}finally{h(!1)}};return e.jsxs("div",{className:"h-[calc(100vh-160px)] flex flex-col bg-white rounded-[3rem] border border-slate-100 shadow-2xl overflow-hidden",children:[e.jsxs("div",{className:"p-8 bg-slate-900 text-white flex justify-between items-center",children:[e.jsxs("div",{className:"flex items-center gap-5",children:[e.jsx("div",{className:"bg-blue-600 p-3.5 rounded-2xl",children:e.jsx(E,{size:28})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-black uppercase tracking-tight text-2xl leading-none",children:m.aiAssistant}),e.jsx("p",{className:"text-[10px] font-black tracking-widest uppercase text-blue-400 mt-1",children:"Advisor Engine • 1 ABO / Query"})]})]}),e.jsxs("div",{className:"bg-white/10 px-6 py-2 rounded-2xl border border-white/10 flex items-center gap-2",children:[e.jsx(w,{size:14,className:"text-yellow-400"}),e.jsxs("span",{className:"text-xs font-black",children:[f.credits.balance," ABO"]})]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-10 space-y-10 custom-scrollbar",ref:o,children:[u.map((s,t)=>e.jsx("div",{className:`flex ${s.role==="user"?"justify-end":"justify-start"} animate-in slide-in-from-bottom-6`,children:e.jsx("div",{className:`p-8 rounded-[2.5rem] shadow-sm max-w-[80%] ${s.role==="user"?"bg-blue-600 text-white rounded-tr-none":"bg-slate-50 text-slate-800 rounded-tl-none border border-slate-100"}`,children:e.jsx("div",{className:"text-sm md:text-base font-medium",children:s.content})})},t)),c&&e.jsx("div",{className:"flex justify-start",children:e.jsx(N,{size:32,className:"animate-spin text-blue-600"})})]}),e.jsx("div",{className:"p-10 bg-slate-50 border-t border-slate-100",children:e.jsxs("div",{className:"relative max-w-4xl mx-auto",children:[e.jsx("input",{type:"text",value:r,onChange:s=>x(s.target.value),onKeyDown:s=>s.key==="Enter"&&p(),placeholder:"Fai una domanda legale...",className:"w-full pl-8 pr-20 py-6 rounded-[2.5rem] bg-white shadow-2xl outline-none font-semibold text-slate-700 text-lg"}),e.jsx("button",{onClick:p,disabled:c||!r.trim(),className:"absolute right-4 top-1/2 -translate-y-1/2 p-4 rounded-3xl bg-blue-600 text-white hover:bg-blue-700 shadow-xl disabled:opacity-50",children:e.jsx(k,{size:24})})]})})]})};export{I as default};