1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[28456],{39596:function(e,a,t){t.d(a,{Z:function(){return l}});let l=(0,t(49141).Z)("braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]])},76134:function(e,a,t){t.d(a,{Z:function(){return l}});let l=(0,t(49141).Z)("file",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]])},61914:function(e,a,t){t.d(a,{Z:function(){return l}});let l=(0,t(49141).Z)("hard-drive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]])},41708:function(e,a,t){t.r(a),t.d(a,{default:function(){return L}});var l=t(45765),i=t(14430),n=t(30853),s=t(83874),d=t(47238),o=t(7641),c=t(39596),r=t(76134),u=t(84236),h=t(48737),m=t(61914),p=t(27442),f=t(90781),v=t(54143),b=t(37793),x=t(60291),g=t(76581),y=t(6447),w=t(72675),j=t(41008),k=t(69603),N=t(28011),D=e=>{let{selectedWidget:a,setRandomUpdate:t}=(0,y.m)(),{bucket:i}=(0,g.A)(),{pushNotice:o,setModal:c}=(0,n.d)(),[r,u]=d.useState(""),[h,m]=d.useState(""),[p,f]=d.useState(""),[v,b]=d.useState(!1);async function D(){if(b(!0),!h)return b(!1),o("Please provide a document name","fail",2e3);if(!r)return b(!1),o("Please provide a document content","fail",2e3);if("vg"===a.agentPlatform){let t=(0,w.D1)(10),l=await fetch("".concat((0,w.MC)({region:"voiceglow-eu"===i?"eu":"na"}),"/v2/agents/").concat(a.ID,"/kb/").concat(t),{method:"PUT",headers:{...await (0,N.z)(),"Content-Type":"application/json",Authorization:"Bearer ".concat(a.SECRET_API_KEY)},body:JSON.stringify({ID:t,content:r,name:h,tags:e.tags||[],userId:a.ownerID,agentId:a.ID,dimensions:(null==a?void 0:a.vg_kbDefaultDimension)||512,metadata:{description:p}})}),n=await l.json();if(!l.ok||!n.success)return b(!1),o(n.message||("KB_DOCS_QUOTA_EXCEEDED"===n.error?"Knowledge base document limit reached. Upgrade your plan or delete unused documents.":"Failed to add document"),"fail",4e3)}else{var l,n;let t=await fetch("/api/vf/kb/add",{method:"POST",body:JSON.stringify({fileContent:r,fileName:h,VF_DIALOGUE_API_KEY:a.VF_DIALOGUE_API_KEY,VF_KB_API_KEY:a.VF_KB_API_KEY,tags:e.tags||[]})}).then(e=>e.json());if(!(null==t?void 0:null===(n=t.content)||void 0===n?void 0:null===(l=n.data)||void 0===l?void 0:l.documentID))return b(!1),c(e=>({...e,active:!1})),o("File not supported","fail",2e3)}o("Added file successfully","success",2e3),c(e=>({...e,active:!1})),t(!0),b(!1)}return(0,l.jsxs)("div",{className:"flex flex-col gap-2 pb-20 px-2",children:[(0,l.jsx)(j.Y,{variant:"faded",label:(0,l.jsx)(x.default,{children:"Document Name"}),value:h,onValueChange:e=>m(e),size:"md"}),(0,l.jsx)(j.Y,{description:"(Recommended) This description will help the LLM retrieve the context better.",variant:"faded",label:(0,l.jsx)(x.default,{children:"Description"}),value:p,onValueChange:e=>f(e),size:"md"}),(0,l.jsx)(k.Y,{size:"md",classNames:{input:"text- "},className:"text-base",placeholder:"Document Content",minRows:5,maxRows:20,variant:"faded",value:r,onValueChange:e=>u(e)},"doc_chunk_view"),(0,l.jsx)(s.A,{isDisabled:v,isLoading:v,onPress:()=>D(),className:"font-bold w-24",color:"primary",variant:"solid",size:"sm",children:(0,l.jsx)(x.default,{children:"+ Add Doc"})})]})},S=t(34859),E=t(83521),_=t(61227),A=t(96073),O=e=>{var a,t,i,o,c,r,u;let{selectedWidget:h,setRandomUpdate:m}=(0,y.m)(),[p,f]=d.useState({url:"",crawl:!0,crawlOptions:{maxPages:5,urlMatchers:[""]}}),{region:v}=(0,E.O)(),{pushNotice:b,setModal:g}=(0,n.d)(),[w,N]=d.useState(!1);async function D(a){var t;if(N(!0),!(null==a?void 0:a.includes("https://"))){b("URL with https:// required","fail",2e3);return}await fetch("".concat((0,_.SwI)({region:v}),"/utils/users/").concat(null==e?void 0:null===(t=e.workspaceData)||void 0===t?void 0:t.uid,"/scrape"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(h.SECRET_API_KEY),"x-vg-region":"na"===v?"na":"eu"},body:JSON.stringify(p)}),N(!1),g(e=>({...e,active:!1})),b("Successfully Added Scrape Job.","success",2e3)}return(0,l.jsxs)("div",{className:"w-full flex flex-col gap-2",children:[(0,l.jsx)(j.Y,{description:(0,l.jsx)(x.default,{children:"The system will automatically discover and list links from this URL. Multiple links can be added by separating each one with a line break."}),classNames:{input:"font-bold"},label:(0,l.jsx)(x.default,{children:"Source URL"}),variant:"faded",size:"md",className:"w-full",value:p.url,onValueChange:e=>f(a=>({...a,url:e}))}),(0,l.jsx)("div",{className:"w-full",children:(0,l.jsx)(A.L,{size:"md",step:10,color:"primary",label:(0,l.jsx)(x.default,{children:"Max Pages"}),showSteps:!0,maxValue:500,minValue:10,defaultValue:20,className:"w-full",value:(null===(a=p.crawlOptions)||void 0===a?void 0:a.maxPages)||20,onChange:e=>{f(a=>({...a,crawlOptions:{...a.crawlOptions,maxPages:e}}))}})}),(0,l.jsx)(k.Y,{description:(0,l.jsxs)(l.Fragment,{children:[(null==p?void 0:null===(i=p.crawlOptions)||void 0===i?void 0:null===(t=i.urlMatchers)||void 0===t?void 0:t.length)?(0,l.jsx)(x.default,{className:"font-bold",children:"".concat(null==p?void 0:null===(c=p.crawlOptions)||void 0===c?void 0:null===(o=c.urlMatchers)||void 0===o?void 0:o.length," matchers detected")}):null,(0,l.jsxs)("p",{children:["Example:",(0,l.jsx)("br",{}),"/collections",(0,l.jsx)("br",{}),"/products",(0,l.jsx)("br",{}),"/blog"]})]}),classNames:{input:"font-bold min-h-0"},label:"Match URLs",variant:"faded",size:"md",className:"w-full",placeholder:"example: /collections",value:(null===(u=p.crawlOptions)||void 0===u?void 0:null===(r=u.urlMatchers)||void 0===r?void 0:r.join("\n"))||"",onValueChange:e=>{f(a=>{var t;return{...a,crawlOptions:{...a.crawlOptions,urlMatchers:[...(null===(t=e.split("\n"))||void 0===t?void 0:t.find(e=>e.trim()))?[...e.split("\n")]:e.trim()?[e]:[]]}}})}}),(0,l.jsx)(s.A,{isLoading:w,color:"primary",onPress:()=>{D(p.url||"")},children:"Start Scraping"})]})},P=t(97652);let C=(0,b.default)(()=>t.e(3152).then(t.bind(t,3152)),{loadableGenerated:{webpack:()=>[3152]}}),I=(0,b.default)(()=>t.e(72183).then(t.bind(t,72183)),{loadableGenerated:{webpack:()=>[72183]}}),T=(0,b.default)(()=>t.e(42638).then(t.bind(t,42638)),{loadableGenerated:{webpack:()=>[42638]}}),Z=(0,b.default)(()=>t.e(10453).then(t.bind(t,10453)),{loadableGenerated:{webpack:()=>[10453]}}),M=(0,b.default)(()=>t.e(38995).then(t.bind(t,38995)),{loadableGenerated:{webpack:()=>[38995]}}),U=(0,b.default)(()=>t.e(70138).then(t.bind(t,70138)),{loadableGenerated:{webpack:()=>[70138]}});(0,b.default)(()=>t.e(95528).then(t.bind(t,95528)),{loadableGenerated:{webpack:()=>[95528]}});var L=e=>{let[a,t]=(0,d.useState)(""),[b,g]=(0,d.useState)([]),{setModal:w}=(0,n.d)();(0,d.useRef)(null);let{orgData:j,selectedWidget:k}=(0,y.m)(),N=[{label:"Text",icon:(0,l.jsx)(o.Z,{className:"w-4 h-4"}),description:"Our systems will scrape the URLs you provide and automatically add them to the agent's knowledge base."},{isDisabled:(null==k?void 0:k.agentPlatform)==="vg",label:(null==k?void 0:k.agentPlatform)==="vg"?"Scraper":"Sitemap",icon:(0,l.jsx)(c.Z,{className:"w-4 h-4"}),description:"Our systems will scrape the URLs you provide and automatically add them to the agent's knowledge base."},{label:"File",icon:(0,l.jsx)(r.Z,{className:"w-4 h-4"}),description:"Our systems will scrape the URLs you provide and automatically add them to the agent's knowledge base."},{label:"URL",icon:(0,l.jsx)(u.Z,{className:"w-4 h-4"}),description:"Our systems will scrape the URLs you provide and automatically add them to the agent's knowledge base."},{isDisabled:(null==k?void 0:k.agentPlatform)!=="vg",label:"Vision",icon:(0,l.jsx)(h.Z,{className:"w-4 h-4"}),description:"Upload PDFs/Word/images. Each embedded image is described by AI and saved as editable markdown."},{isDisabled:(null==k?void 0:k.agentPlatform)!=="vg",label:"Drive",icon:(0,l.jsx)(m.Z,{className:"w-4 h-4"}),description:"Import Drive folders/files into one clean markdown catalog (CDN images + descriptions) for this agent's KB."},{isDisabled:(null==k?void 0:k.agentPlatform)!=="vg",label:"YouTube",icon:(0,l.jsx)(p.Z,{className:"w-4 h-4"}),description:"Download YouTube videos/Shorts, transcribe the audio, and save the transcript as a knowledge-base document."}],E=(()=>{var a;if(!e.initialSource)return 0;let t="Sitemap"===e.initialSource||"Scraper"===e.initialSource?(null==k?void 0:k.agentPlatform)==="vg"?"Scraper":"Sitemap":e.initialSource,l=N.findIndex(e=>e.label===t);return l<0||(null===(a=N[l])||void 0===a?void 0:a.isDisabled)?0:l})(),[_,A]=(0,d.useState)(E);return(0,l.jsx)(P.Z,{innerContainerClass:"h-[90vh] vg-kb--add-source-modal vgd-kb--add-source-modal",children:(0,l.jsxs)(f.M,{children:[(0,l.jsx)(v.E.div,{layout:!0,className:"flex-shrink-0 w-full flex justify-between gap-10 vg-kb--add-source-header",children:(0,l.jsx)(i.Z,{icon:(0,l.jsx)(o.Z,{className:"w-16 h-16 text-primary"}),desc:"Select a data type to add and our systems will magically handle the rest.",title:"Add a data source",inline:!0})},"header-upload-vf-doc"),(0,l.jsx)(v.E.div,{layout:!0,className:"flex-shrink-0 flex gap-2",children:N.map((e,a)=>(0,l.jsxs)(s.A,{isDisabled:e.isDisabled,className:"flex gap-1 justify-center items-center",color:a===_?"primary":"default",variant:"bordered",size:"sm",onPress:()=>A(a),children:[e.icon,e.label]},"kb_add_source_index_".concat(a)))},"add-vf-doc-controls"),(0,l.jsxs)(v.E.div,{initial:{height:"auto"},animate:{height:"auto"},exit:{height:"auto"},children:[(0,l.jsx)(x.default,{className:"font-bold opacity-80 text-small",children:"Tags"}),(0,l.jsx)(S.Z,{tags:b,setNewTags:g,predefinedTags:null==j?void 0:j.predefinedTags,disallowAnyTags:null==j?void 0:j.disallowAnyTags})]},"add-vf-doc-tags"),(0,l.jsx)(v.E.div,{className:"relative w-full h-full vg-kb--add-source-body",children:(0,l.jsxs)(f.M,{children:[0===_&&(0,l.jsx)(v.E.div,{className:"absolute left-0 top-0 w-full h-full",initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},children:(0,l.jsx)(D,{tags:b})},"vf-add-doc-tags-".concat(_)),1===_&&(0,l.jsx)(v.E.div,{className:"absolute left-0 top-0 w-full h-full",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:(null==k?void 0:k.agentPlatform)==="vg"?(0,l.jsx)(O,{workspaceData:null==e?void 0:e.workspaceData}):(0,l.jsx)(I,{tags:b})},"vf-add-doc-body-".concat(_)),2===_&&(0,l.jsx)(v.E.div,{className:"absolute left-0 top-0 w-full h-full",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:(0,l.jsx)(T,{tags:b})},"vf-add-doc-body-".concat(_)),3===_?(0,l.jsx)(v.E.div,{className:"absolute left-0 top-0 w-full h-full",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:(0,l.jsx)(C,{tags:b})},"vf-add-doc-body-".concat(_)):null,4===_?(0,l.jsx)(v.E.div,{className:"absolute left-0 top-0 w-full h-full",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:(0,l.jsx)(Z,{tags:b})},"vf-add-doc-body-".concat(_)):null,5===_?(0,l.jsx)(v.E.div,{className:"absolute left-0 top-0 w-full h-full",initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},children:(0,l.jsx)(M,{tags:b})},"vf-add-doc-body-".concat(_)):null,6===_?(0,l.jsx)(v.E.div,{className:"absolute left-0 top-0 w-full h-full",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:(0,l.jsx)(U,{tags:b})},"vf-add-doc-body-".concat(_)):null]})},"thing-vf-body-upload")]})})}},28011:function(e,a,t){t.d(a,{z:function(){return s}});var l=t(84648),i=t(42081),n=t(50328);async function s(e){try{let i=(0,l.getAuth)(n.clientAuthApp).currentUser;if(i){var a,t,s;return Object.fromEntries(Object.entries({"x-kb-actor-type":"client","x-kb-actor-uid":(null==e?void 0:null===(a=e.clientData)||void 0===a?void 0:a.ID)||i.uid||"","x-kb-actor-email":(null==e?void 0:null===(t=e.clientData)||void 0===t?void 0:t.email)||i.email||"","x-kb-actor-name":(null==e?void 0:null===(s=e.clientData)||void 0===s?void 0:s.name)||i.displayName||""}).filter(e=>{let[,a]=e;return!!a}))}}catch(e){}try{let e=(0,l.getAuth)((0,i.mainAppRef)()).currentUser;if(e)return Object.fromEntries(Object.entries({"x-kb-actor-type":"user","x-kb-actor-uid":e.uid||"","x-kb-actor-email":e.email||"","x-kb-actor-name":e.displayName||""}).filter(e=>{let[,a]=e;return!!a}))}catch(e){}return{}}}}]);
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.