PageSourceSearch

https://www.cerebralcircuit.ai/_nuxt/BrPYJ8rP.js

js cerebralcircuit.ai collected 2026-10-05 15:09:02 UTC 12,315 bytes, 3 lines download raw bytes

1import{_ as j,g as w,i as D,P as b,N as I,a,b as t,c as n,I as h,t as p,j as d,v as m,a9 as f,d as c,a8 as v,F as S,r as A,f as P,h as g}from"./BIu5PYOD.js";import{o as y}from"./Djb_ty7H.js";const N={data(){return{editProject:!1,botList:[],project:{},dirty:{name:!1,description:!1,status:!1,order:!1,image_url:!1},projectID:(this._.provides[b]||this.$route).query.project_id,updates:[{attributeName:"name",newValue:"New Project Name Here"},{attributeName:"description",newValue:"New desc Here"},{attributeName:"status",newValue:"Status here ACTIVE, INACTIVE or HIDDEN"},{attributeName:"order",newValue:0}],duplicateDialog:!1,duplicateForm:{aiProfileID:null,sourceName:"",newProfileName:"",duplicateStyling:!0,duplicateFunctions:!0,duplicateSchema:!1},pendingDup:!1,dupError:null}},watch:{"$route.query.project_id"(l){this.projectID=l,this.getAllBots()}},created(){this.fromUUID=(this._.provides[b]||this.$route).query.fru},computed:{hasDirty(){return Object.values(this.dirty).some(l=>l===!0)},canSubmitDup(){return this.duplicateForm.aiProfileID&&this.duplicateForm.newProfileName&&this.duplicateForm.newProfileName.trim().length>=3}},mounted(){this.getAllBots()},methods:{openDuplicate(l){this.dupError=null,this.duplicateForm={aiProfileID:l.id,sourceName:l.name||`AI #${l.id}`,newProfileName:`${l.name} (Copy)`,duplicateStyling:!0,duplicateFunctions:!0,duplicateSchema:!1},this.duplicateDialog=!0},closeDuplicate(){this.duplicateDialog=!1,this.pendingDup=!1,this.dupError=null},async submitDuplicate(){if(this.canSubmitDup){this.pendingDup=!0,this.dupError=null;try{const l=await fetch(`${this.$config.public.APIBASEURL}/admin/duplicate-ai-profile`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:`${localStorage.getItem("AI-Session")}`},body:JSON.stringify({aiProfileID:this.duplicateForm.aiProfileID,newProfileName:this.duplicateForm.newProfileName.trim(),duplicateStyling:!!this.duplicateForm.duplicateStyling,duplicateFunctions:!!this.duplicateForm.duplicateFunctions,duplicateSchema:!!this.duplicateForm.duplicateSchema,projectID:this.projectID||null})});if(!l.ok){const r=l.headers.get("content-type")||"";let u="Could not duplicate profile";r.includes("application/json")?u=(await l.json())?.error||u:u=await l.text(),l.status===401?this.dupError=u||"Unauthorized":l.status===404?this.dupError="Source AI Profile not found":this.dupError=u,this.pendingDup=!1;return}const{newAIProfile:e}=await l.json();this.pendingDup=!1,this.duplicateDialog=!1,alert(`Duplicated: ${e?.name||"New AI"}
2Chat Hash: ${e?.chat_hash||"-"}
3MSISDN: ${e?.msisdn||"-"}`),await this.getAllBots(),e?.id&&this.$router.push(`/admin/bot/summary?id=${e.id}`)}catch(l){console.error("Duplicate error:",l),this.dupError="Unexpected error duplicating profile",this.pendingDup=!1}}},async updateProject(){const l=[];for(const[e,r]of Object.entries(this.dirty))r===!0&&l.push({attributeName:e,newValue:this.project[e]});try{(await fetch(`${this.$config.public.APIBASEURL}/admin/ai/project/update`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:`${localStorage.getItem("AI-Session")}`},body:JSON.stringify({project_id:this.projectID,updates:l})})).ok&&(this.dirty={name:!1,description:!1,status:!1,order:!1,image_url:!1},this.editProject=!1)}catch(e){alert("Error updating project"),console.log("Fetch error:",e)}},async getProject(){try{const l=await fetch(`${this.$config.public.APIBASEURL}/admin/ai/project?project_id=`+this.projectID,{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:`${localStorage.getItem("AI-Session")}`}});if(l.ok){let e=await l.json();this.project=e.project,this.editProject=!0}}catch(l){console.log("Fetch error:",l)}},UserIsAdmin(){const l=localStorage.getItem("AI-Session");if(!l)return!1;try{return y(l).roles?.includes("ADMIN")===!0}catch{return!1}}
3,UserCanDuplicate(){const l=localStorage.getItem("AI-Session");if(!l)return!1;try{const r=y(l).roles||[];return r.includes("ADMIN")||r.includes("MANAGER")}catch{return!1}},async getAllBots(){if(!localStorage.getItem("AI-Session")){this.redirectToLogin();return}try{const l=await fetch(`${this.$config.public.APIBASEURL}/admin/ai/list?projectID=`+(this.projectID?this.projectID:""),{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:`${localStorage.getItem("AI-Session")}`}});if(l.ok){let e=await l.json();for(let r=0;r<e.length;r++)try{e[r].styling&&e[r].styling.styling_payload&&(e[r].styling.stylingPayloadObject=JSON.parse(e[r].styling.styling_payload))}catch{}this.botList=e}else this.redirectToLogin()}catch(l){console.log("Fetch error:",l),this.redirectToLogin()}},redirectToLogin(){this.$router.push("/admin/login")}}},k={class:"bg-black min-h-screen py-8"},C={key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4"},F={class:"relative w-full max-w-xl rounded-lg border border-[#3aa5ad] bg-black p-5 shadow-xl"},E=["value"],U={class:"mt-1 text-xs text-gray-400"},V={class:"grid grid-cols-1 gap-3 sm:grid-cols-3"},T={class:"inline-flex items-center gap-2 text-white"},_={class:"inline-flex items-center gap-2 text-white"},O={class:"inline-flex items-center gap-2 text-white"},B={key:0,class:"text-sm text-red-400"},L={class:"flex items-center gap-3 pt-2"},M=["disabled"],z={key:0},H={key:1},R={key:1,class:"fixed right-2 top-2 h-screen w-full bg-black"},K={class:"grid grid-cols-1 gap-4"},q=["src"],G={key:0,type:"submit",class:"mt-4 rounded-md bg-[#3aa5ad] p-2 text-white"},J={class:"mx-auto w-5/6"},X={class:"mx-auto grid w-5/6 grid-cols-1 gap-8 p-2 sm:grid-cols-3"},Y=["href"],Q=["src"],W={class:"flex-grow"},Z={class:"mt-4 px-4 pt-1 text-lg font-bold text-gray-900 sm:text-xl"},$={class:"px-4 pb-1 text-sm"},ee={class:"mt-2 max-w-sm px-4 py-1 text-gray-700"},te={key:1,class:"bg-[#3aa5ad] py-1 text-center text-sm font-bold text-yellow-100"},oe={class:"flex gap-2 p-2"},le=["href"],se=["onClick"];function ie(l,e,r,u,s,i){const x=I;return a(),w(x,null,{default:D(()=>[t("div",k,[s.duplicateDialog?(a(),n("div",C,[t("div",F,[t("button",{class:"absolute right-3 top-3 text-2xl text-[#3aa5ad]",onClick:e[0]||(e[0]=(...o)=>i.closeDuplicate&&i.closeDuplicate(...o)),"aria-label":"Close duplicate modal"},"×"),e[25]||(e[25]=t("h2",{class:"mb-4 text-2xl font-bold text-[#3aa5ad]"},"Duplicate AI Profile",-1)),t("form",{onSubmit:e[6]||(e[6]=h((...o)=>i.submitDuplicate&&i.submitDuplicate(...o),["prevent"])),class:"space-y-4"},[t("div",null,[e[20]||(e[20]=t("label",{class:"mb-1 block text-sm font-bold text-[#3aa5ad]"},"Source AI (ID)",-1)),t("input",{class:"w-full rounded-md border border-[#3aa5ad] bg-black p-2 text-white",value:s.duplicateForm.aiProfileID,readonly:""},null,8,E),t("p",U,"Name: "+p(s.duplicateForm.sourceName),1)]),t("div",null,[e[21]||(e[21]=t("label",{class:"mb-1 block text-sm font-bold text-[#3aa5ad]"},"New Profile Name",-1)),d(t("input",{"onUpdate:modelValue":e[1]||(e[1]=o=>s.duplicateForm.newProfileName=o),class:"w-full rounded-md border border-[#3aa5ad] bg-black p-2 text-white",placeholder:"e.g. Support Assistant (Copy)",required:""},null,512),[[m,s.duplicateForm.newProfileName,void 0,{trim:!0}]])]),t("div",V,[t("label",T,[d(t("input",{type:"checkbox","onUpdate:modelValue":e[2]||(e[2]=o=>s.duplicateForm.duplicateStyling=o)},null,512),[[f,s.duplicateForm.duplicateStyling]]),e[22]||(e[22]=t("span",null,"Duplicate Styling",-1))]),t("label",_,[d(t("input",{type:"checkbox","onUpdate:modelValue":e[3]||(e[3]=o=>s.duplicateForm.duplicateFunctions=o)},null,512),[[f,s.duplicateForm.duplicateFunctions]]),e[23]||(e[23]=t("span",null,"Duplicate Functions",-1))]),t("label",O,[d(t("input",{type:"checkbox","onUpdate:modelValue":e[4]||(e[4]=o=>s.duplicateForm.duplicateSchema=o)},null,512),[[f,s.duplicateForm.duplicateSchema]]),e[24]||(e[24]=t("span",null,"Duplicate CMS Schemas",-1))])]),s.dupError?(a(),n("p",B,p(s.dupError),1)):c("",!0),t("div",L,[t("button",{type:"submit",class:"rounded-md bg-[#3aa5ad] px-4 py-2 text-white disabled:opacity-60",disabled:s.pendingDup||!i.canSubmitDup},[s.pendingDup?(a(),n("span",H,"Creating…")):(a(),n("span",z,"Create Duplicate"))],8,M),t("button",{type:"button",class:"rounded-md border border-[#3aa5ad] px-4 py-2 text-[#3aa5ad]",onClick:e[5]||(e[5]=(...o)=>i.closeDuplicate&&i.closeDuplicate(...o))},"Cancel")])],32)])])):c("",!0),s.editProject?(a(),n("div",R,[t("button",{class:"absolute right-2 top-2 text-2xl text-[#3aa5ad]",onClick:e[7]||(e[7]=o=>s.editProject=!1)},"X"),t("form",{onSubmit:e[18]||(e[18]=h((...o)=>i.updateProject&&i.updateProject(...o),["prevent"])),class:"p-4"},[e[32]||(e[32]=t("h2",{class:"text-2xl font-bold text-[#3aa5ad]"},"Edit Project",-1)),t("div",K,[t("div",null,[e[26]||(e[26]=t("label",{class:"font-bold text-[#3aa5ad]"},"Project Name",-1)),d(t("input",{"onUpdate:modelValue":e[8]||(e[8]=o=>s.project.name=o),onKeyup:e[9]||(e[9]=o=>s.dirty.name=!0),class:"rounded-md border border-[#3aa5ad] p-2"},null,544),[[m,s.project.name]])]),t("div",null,[e[27]||(e[27]=t("label",{class:"font-bold text-[#3aa5ad]"},"Description",-1)),d(t("input",{"onUpdate:modelValue":e[10]||(e[10]=o=>s.project.description=o),onKeyup:e[11]||(e[11]=o=>s.dirty.description=!0),class:"rounded-md border border-[#3aa5ad] p-2"},null,544),[[m,s.project.description]])]),t("div",null,[e[28]||(e[28]=t("label",{class:"font-bold text-[#3aa5ad]"},"Image",-1)),t("img",{src:s.project.image_url,class:"h-20 w-20 rounded-md border border-[#3aa5ad]"},null,8,q),d(t("input",{"onUpdate:modelValue":e[12]||(e[12]=o=>s.project.image_url=o),onKeyup:e[13]||(e[13]=o=>s.dirty.image_url=!0),class:"rounded-md border border-[#3aa5ad] p-2"},null,544),[[m,s.project.image_url]])]),t("div",null,[e[30]||(e[30]=t("label",{class:"font-bold text-[#3aa5ad]"},"status",-1)),d(t("select",{"onUpdate:modelValue":e[14]||(e[14]=o=>s.project.status=o),onChange:e[15]||(e[15]=o=>s.dirty.status=!0),class:"rounded-md border border-[#3aa5ad] p-2"},[...e[29]||(e[29]=[t("option",{value:"ACTIVE"},"ACTIVE",-1),t("option",{value:"INACTIVE"},"INACTIVE",-1),t("option",{value:"HIDDEN"},"HIDDEN",-1)])],544),[[v,s.project.status]])]),t("div",null,[e[31]||(e[31]=t("label",{class:"font-bold text-[#3aa5ad]"},"Order",-1)),d(t("input",{"onUpdate:modelValue":e[16]||(e[16]=o=>s.project.order=o),onKeyup:e[17]||(e[17]=o=>s.dirty.order=!0),type:"number",class:"rounded-md border border-[#3aa5ad] p-2"},null,544),[[m,s.project.order,void 0,{number:!0}]])])]),i.hasDirty?(a(),n("button",G,"Save Changes")):c("",!0)],32)])):c("",!0),e[35]||(e[35]=t("h2",{class:"mx-auto w-5/6 border-l-4 border-[#3aa5ad] pl-4 text-2xl font-bold text-white"},"Explore your AI Assistants",-1)),t("div",J,[i.UserIsAdmin()===!0&&s.projectID?(a(),n("button",{key:0,class:"w-fit roun
3ded-full bg-[#3aa5ad] px-12 py-2 text-white hover:bg-black",onClick:e[19]||(e[19]=(...o)=>i.getProject&&i.getProject(...o))},"Edit Project")):c("",!0)]),t("div",X,[(a(!0),n(S,null,A(s.botList,o=>(a(),n("div",{key:o.id,class:"flex flex-col justify-between overflow-hidden rounded-md bg-white shadow-md transition-all hover:scale-105 hover:shadow-lg"},[t("a",{href:"bot/summary?id="+o.id,class:"flex-grow"},[o&&o.styling&&o.styling.stylingPayloadObject?(a(),n("div",{key:0,class:"flex flex-row gap-2",style:P(`border-top: solid 6px ${o.styling.stylingPayloadObject?.styles?.accentColour||"#fff"}`)},[t("img",{alt:"Art",src:o.styling.stylingPayloadObject?.profileUrl||"/images/icon.svg",class:"ml-2 mt-5 h-20 w-20 flex-none rounded-full shadow-lg"},null,8,Q),t("div",W,[t("h3",Z,p(o.name),1),t("p",$,"Known as: "+p(o.styling.stylingPayloadObject?.name||"Unset"),1),t("p",ee,[g(p(o.email),1),e[33]||(e[33]=t("br",null,null,-1)),g(p(o.msisdn),1)])])],4)):(a(),n("div",te,[...e[34]||(e[34]=[g(" NO STYLING FOUND,",-1),t("br",null,null,-1),g(" will not render ",-1)])]))],8,Y),t("div",oe,[t("a",{href:"bot/summary?id="+o.id,class:"h-12 flex-1 rounded-md border-2 border-white bg-black px-4 py-2 text-center text-white hover:bg-[#3aa5ad]"}
3,"Manage Bot",8,le),i.UserCanDuplicate()?(a(),n("button",{key:0,class:"h-12 flex-1 rounded-md border-2 border-[#3aa5ad] bg-white px-4 py-2 text-center text-black hover:bg-[#e6ffff]",onClick:re=>i.openDuplicate(o)}," Duplicate ",8,se)):c("",!0)])]))),128))])])]),_:1})}const de=j(N,[["render",ie]]);export{de as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.