khoj 1.38.1.dev15__py3-none-any.whl → 1.38.1.dev20__py3-none-any.whl
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.
- khoj/interface/compiled/404/index.html +2 -2
- khoj/interface/compiled/_next/static/chunks/2327-9b55980a1895caa4.js +1 -0
- khoj/interface/compiled/_next/static/chunks/{5427-88bd2db4b3075cac.js → 5427-ec87e7fa4b0d76cb.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/{5477-ca75f51d5d37d614.js → 5477-060a89922423c280.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/{8515-010dd769c584b672.js → 8515-f305779d95dd5780.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/9636-f844be9cdb5ed1f4.js +1 -0
- khoj/interface/compiled/_next/static/chunks/app/agents/{layout-5961c3717e1d8813.js → layout-948ca256650845ce.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/agents/{page-0d31f76257d6ec11.js → page-2283250647a2f2f8.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/automations/{page-c6180af69fc9c766.js → page-6053c64e8b1b6d5a.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/chat/{layout-3e25af7224d678a0.js → layout-603285e3b1400e74.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/chat/{page-e3f298848d59803b.js → page-d273748c128b0103.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/{page-df51e61295c4a9b5.js → page-90807725cac7011b.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/search/{layout-9ccd090dcc2aa58a.js → layout-d7f7528ff387fba5.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/search/{page-098017fa7f6ba0bf.js → page-1df7b236b30620f7.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/settings/page-4f837cd629de236e.js +1 -0
- khoj/interface/compiled/_next/static/chunks/app/share/chat/{layout-9cc742afcea0b421.js → layout-246d0e8125219fff.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/share/chat/{page-61f5aa755a5d5612.js → page-33d056fbcb8ec85d.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/{webpack-007693a5b13eeec5.js → webpack-639e8a9d35bd5e13.js} +1 -1
- khoj/interface/compiled/_next/static/css/37a73b87f02df402.css +1 -0
- khoj/interface/compiled/_next/static/css/9c223d337a984468.css +25 -0
- khoj/interface/compiled/_next/static/css/f29752d6e1be7624.css +1 -0
- khoj/interface/compiled/_next/static/css/{0db53bacf81896f5.css → fca983d49c3dd1a3.css} +1 -1
- khoj/interface/compiled/agents/index.html +2 -2
- khoj/interface/compiled/agents/index.txt +3 -3
- khoj/interface/compiled/automations/index.html +2 -2
- khoj/interface/compiled/automations/index.txt +2 -2
- khoj/interface/compiled/chat/index.html +2 -2
- khoj/interface/compiled/chat/index.txt +3 -3
- khoj/interface/compiled/index.html +2 -2
- khoj/interface/compiled/index.txt +2 -2
- khoj/interface/compiled/search/index.html +2 -2
- khoj/interface/compiled/search/index.txt +3 -3
- khoj/interface/compiled/settings/index.html +2 -2
- khoj/interface/compiled/settings/index.txt +2 -2
- khoj/interface/compiled/share/chat/index.html +2 -2
- khoj/interface/compiled/share/chat/index.txt +3 -3
- khoj/processor/tools/run_code.py +1 -1
- khoj/utils/initialization.py +23 -14
- {khoj-1.38.1.dev15.dist-info → khoj-1.38.1.dev20.dist-info}/METADATA +1 -1
- {khoj-1.38.1.dev15.dist-info → khoj-1.38.1.dev20.dist-info}/RECORD +45 -45
- khoj/interface/compiled/_next/static/chunks/1160-8e7e42e77145b712.js +0 -1
- khoj/interface/compiled/_next/static/chunks/2327-b21ecded25471e6c.js +0 -1
- khoj/interface/compiled/_next/static/chunks/app/settings/page-1ff027f4e0a5c468.js +0 -1
- khoj/interface/compiled/_next/static/css/0ddca54f48cc6850.css +0 -25
- khoj/interface/compiled/_next/static/css/bb7ea98028b368f3.css +0 -1
- khoj/interface/compiled/_next/static/css/ee66643a6a5bf71c.css +0 -1
- /khoj/interface/compiled/_next/static/{84WDM8lQeEuWfXWCeRW44 → hSqGOMXQbPL50fGlyEXrA}/_buildManifest.js +0 -0
- /khoj/interface/compiled/_next/static/{84WDM8lQeEuWfXWCeRW44 → hSqGOMXQbPL50fGlyEXrA}/_ssgManifest.js +0 -0
- {khoj-1.38.1.dev15.dist-info → khoj-1.38.1.dev20.dist-info}/WHEEL +0 -0
- {khoj-1.38.1.dev15.dist-info → khoj-1.38.1.dev20.dist-info}/entry_points.txt +0 -0
- {khoj-1.38.1.dev15.dist-info → khoj-1.38.1.dev20.dist-info}/licenses/LICENSE +0 -0
khoj/interface/compiled/_next/static/chunks/{5427-88bd2db4b3075cac.js → 5427-ec87e7fa4b0d76cb.js}
RENAMED
@@ -1 +1 @@
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5427],{25427:function(e,t,s){"use strict";s.d(t,{EY:function(){return eo},ks:function(){return ec},bc:function(){return ei}});var a=s(57437),l=s(71159),r=s.n(l),n=s(2265),i=s(62869),o=s(52023),c=s(80854),d=s(27909),u=s(63329),m=s(2452),h=s(41317),x=s(86967),f=s(19841),p=s(57757),j=s(75419),g=s(96108),v=s(78299),b=s(87296),N=s(89203),y=s(38513),w=s(70602),k=s(64697),_=s(45178),C=s(2049),z=s(31229),S=s(66070),T=s(26110),I=s(33494),V=s(42225),P=s(84671),O=s(65613),R=s(15681),q=s(29501),B=s(95186),F=s(13590),W=s(76818),E=s(53647),J=s(49027),M=s(962);let A=M.fC,D=M.wy,Z=M.Fw;var X=s(94508),Y=s(23518),G=s(59199),K=s(37099),L=s(32759),$=s(57054),Q=s(97673),U=s(81103),H=s(20271);let ee=H.fC,et=n.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)(H.aV,{ref:t,className:(0,X.cn)("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",s),...l})});et.displayName=H.aV.displayName;let es=n.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)(H.xz,{ref:t,className:(0,X.cn)("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",s),...l})});es.displayName=H.xz.displayName;let ea=n.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)(H.VY,{ref:t,className:(0,X.cn)("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",s),...l})});ea.displayName=H.VY.displayName;var el=s(19378);async function er(e,t){let s="/login?next=/agents?agent=".concat(e);if(!t){window.location.href=s;return}let a=await fetch("/api/chat/sessions?agent_slug=".concat(encodeURIComponent(e)),{method:"POST"}),l=await a.json();200==a.status?window.location.href="/chat?conversationId=".concat(l.conversation_id):403==a.status||401==a.status?window.location.href=s:alert("Failed to start chat session")}function en(e){var t;let s=(null===(t=e.text)||void 0===t?void 0:t.replace(/^\w/,e=>e.toUpperCase()))||"";return(0,a.jsx)(U.pn,{children:(0,a.jsxs)(U.u,{children:[(0,a.jsx)(U._v,{asChild:!0,children:(0,a.jsx)("div",{className:"text-sm",children:e.hoverText||s})}),(0,a.jsx)(U.aJ,{className:"cursor-text",children:(0,a.jsxs)("div",{className:"flex items-center space-x-2 rounded-full border-accent-500 border p-1.5",children:[(0,a.jsx)("div",{className:"text-muted-foreground",children:e.icon}),s&&s.length>0&&(0,a.jsx)("div",{className:"text-muted-foreground text-sm",children:s})]})})]})})}let ei=z.z.object({name:z.z.string({required_error:"Name is required"}).min(1,"Name is required"),persona:z.z.string({required_error:"Personality is required"}).min(1,"Personality is required"),color:z.z.string({required_error:"Color is required"}).min(1,"Color is required"),icon:z.z.string({required_error:"Icon is required"}).min(1,"Icon is required"),privacy_level:z.z.string({required_error:"Privacy level is required"}).min(1,"Privacy level is required"),chat_model:z.z.string({required_error:"Chat model is required"}).min(1,"Chat model is required"),files:z.z.array(z.z.string()).default([]).optional(),input_tools:z.z.array(z.z.string()).default([]).optional(),output_modes:z.z.array(z.z.string()).default([]).optional()});function eo(e){var t;let[s,l]=(0,n.useState)(e.agentSlug===e.data.slug),[j,g]=(0,n.useState)(!1),[v,b]=(0,n.useState)(null),N=(0,a.jsx)(o.H,{}),y="Private agents are only visible to you.";"public"===e.data.privacy_level?(N=(0,a.jsx)(c.T,{}),y="Public agents are visible to everyone."):"protected"===e.data.privacy_level&&(N=(0,a.jsx)(d.M,{}),y="Protected agents are visible to anyone with a direct link.");let w=e.userProfile,k=(0,q.cI)({resolver:(0,F.F)(ei),defaultValues:{name:e.data.name,persona:e.data.persona,color:e.data.color,icon:e.data.icon,privacy_level:e.data.privacy_level,chat_model:e.data.chat_model,files:e.data.files,input_tools:e.data.input_tools,output_modes:e.data.output_modes}});(0,n.useEffect)(()=>{k.reset({name:e.data.name,persona:e.data.persona,color:e.data.color,icon:e.data.icon,privacy_level:e.data.privacy_level,chat_model:e.data.chat_model,files:e.data.files,input_tools:e.data.input_tools,output_modes:e.data.output_modes})},[e.data]),s&&window.history.pushState({},"Khoj AI - Agent ".concat(e.data.slug),"/agents?agent=".concat(e.data.slug));let _=(0,P.oz)(e.data.color);function C(){return(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-1",children:[e.editCard&&(0,a.jsx)(en,{icon:N,text:e.data.privacy_level,hoverText:y}),e.data.files&&e.data.files.length>0&&(0,a.jsx)(en,{icon:(0,a.jsx)(u.f,{}),text:"knowledge",hoverText:"The agent has a custom knowledge base with ".concat(e.data.files.length," documents. It can use them to give you answers.")}),(0,a.jsx)(en,{icon:(0,a.jsx)(m.a,{}),text:e.data.chat_model,hoverText:"The agent uses the ".concat(e.data.chat_model," model to chat with you.")}),e.data.output_modes.map(t=>(0,a.jsx)(en,{icon:(0,V.vH)(t),hoverText:"".concat(t,": ").concat(e.outputModeOptions[t])},t)),e.data.input_tools.map(t=>(0,a.jsx)(en,{icon:(0,V.vH)(t),hoverText:"".concat(t,": ").concat(e.inputToolOptions[t])},t))]})}return(0,a.jsxs)(S.Zb,{className:"shadow-md rounded-xl hover:shadow-lg dark:bg-muted",children:[j&&(0,a.jsx)(I.Z,{onOpenChange:g,isMobileWidth:e.isMobileWidth}),(0,a.jsx)(S.Ol,{children:(0,a.jsx)(S.ll,{children:(0,a.jsxs)(T.Vq,{open:s,onOpenChange:()=>{l(!s),window.history.pushState({},"Khoj AI - Agents","/agents")},children:[(0,a.jsx)(T.hg,{className:"focus-visible:outline-none",children:(0,a.jsxs)("div",{className:"flex items-center relative top-2",children:[(0,V.TI)(e.data.icon,e.data.color),e.data.name]})}),(0,a.jsxs)("div",{className:"flex float-right",children:[e.editCard&&(0,a.jsx)("div",{className:"float-right",children:(0,a.jsxs)($.J2,{children:[(0,a.jsx)($.xo,{children:(0,a.jsx)(i.z,{className:"bg-[hsl(var(--background))] w-10 h-10 p-0 rounded-xl border dark:border-neutral-700 shadow-sm hover:bg-stone-100 dark:hover:bg-neutral-900",children:(0,a.jsx)(h.F,{className:"w-6 h-6 ".concat((0,P.oz)(e.data.color))})})}),(0,a.jsxs)($.yk,{className:"w-fit grid p-1",side:"bottom",align:"end",children:[(0,a.jsxs)(i.z,{className:"items-center justify-start",variant:"ghost",onClick:()=>l(!0),children:[(0,a.jsx)(x.z,{className:"w-4 h-4 mr-2"}),"Edit"]}),e.editCard&&"private"!==e.data.privacy_level&&(0,a.jsx)(Q.Z,{buttonTitle:"Share",title:"Share Agent",description:"Share a link to this agent with others. They'll be able to chat with it, and ask questions to all of its knowledge base.",buttonVariant:"ghost",includeIcon:!0,url:"".concat(window.location.origin,"/agents?agent=").concat(e.data.slug)}),e.data.creator===(null==w?void 0:w.username)&&(0,a.jsxs)(i.z,{className:"items-center justify-start",variant:"destructive",onClick:()=>{fetch("/api/agents/".concat(e.data.slug),{method:"DELETE"}).then(()=>{e.setAgentChangeTriggered(!0)})},children:[(0,a.jsx)(f.r,{className:"w-4 h-4 mr-2"}),"Delete"]})]})]})}),(null===(t=e.showChatButton)||void 0===t||t)&&(0,a.jsx)("div",{className:"float-right ml-2",children:e.userProfile?(0,a.jsx)(i.z,{className:"bg-[hsl(var(--background))] w-10 h-10 p-0 rounded-xl border dark:border-neutral-700 shadow-sm hover:bg-stone-100 dark:hover:bg-neutral-900",onClick:()=>er(e.data.slug,w),children:(0,a.jsx)(p.g,{className:"w-6 h-6 ".concat((0,P.oz)(e.data.color))})}):(0,a.jsx)(i.z,{className:"bg-[hsl(var(--background))] w-14 h-14 rounded-xl border dark:border-neutral-700 shadow-sm hover:bg-stone-100 dark:hover:bg-neutral-900",onClick:()=>g(!0),children:(0,a.jsx)(p.g,{className:"w-6 h-6 ".concat((0,P.oz)(e.data.color))})})})]}),e.editCard?(0,a.jsxs)(T.cZ,{className:"lg:max-w-screen-lg py-4 overflow-y-scroll h-full md:h-4/6 rounded-lg flex flex-col",children:[(0,a.jsxs)(J.$N,{children:["Edit ",(0,a.jsx)("b",{children:e.data.name})]}),(0,a.jsx)(ec,{form:k,onSubmit:t=>{let s=e.editCard?"PATCH":"POST",a=t;e.editCard&&(a={...t,slug:e.data.slug}),fetch("/api/agents",{method:s,headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}).then(t=>{200===t.status?(k.reset(),l(!1),b(null),e.setAgentChangeTriggered(!0)):t.json().then(e=>{console.error(e),k.clearErrors(),e.error&&b(e.error)})}).catch(e=>{console.error("Error:",e),b(e),k.clearErrors()})},create:!1,errors:v,filesOptions:e.filesOptions,modelOptions:e.modelOptions,slug:e.data.slug,inputToolOptions:e.inputToolOptions,isSubscribed:e.isSubscribed,outputModeOptions:e.outputModeOptions})]}):(0,a.jsxs)(T.cZ,{className:"whitespace-pre-line max-h-[80vh] max-w-[90vw] md:max-w-[50vw] rounded-lg",children:[(0,a.jsx)(T.fK,{children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,V.TI)(e.data.icon,e.data.color),(0,a.jsx)("p",{className:"font-bold text-lg",children:(0,a.jsx)(J.$N,{children:e.data.name})})]})}),(0,a.jsx)("div",{className:"max-h-[60vh] overflow-y-scroll text-neutral-500 dark:text-white",children:e.data.persona}),(0,a.jsx)("div",{className:"flex flex-wrap items-center gap-1",children:C()}),(0,a.jsx)(T.cN,{children:(0,a.jsxs)(i.z,{className:"pt-6 pb-6 ".concat(_," bg-white dark:bg-[hsl(var(--background))] text-neutral-500 dark:text-white border-2 border-stone-100 shadow-sm rounded-xl hover:bg-stone-100 dark:hover:bg-neutral-900 dark:border-neutral-700"),onClick:()=>{er(e.data.slug,w),l(!1)},children:[(0,a.jsx)(p.g,{className:"w-6 h-6 m-2 ".concat((0,P.oz)(e.data.color))}),"Start Chatting"]})})]})]})})}),(0,a.jsx)(S.aY,{children:(0,a.jsx)("div",{className:r().agentPersonality,children:(0,a.jsx)("button",{className:"".concat(r().infoButton," text-neutral-500 dark:text-white"),onClick:()=>l(!0),children:(0,a.jsx)("p",{children:e.data.persona})})})}),(0,a.jsx)(S.eW,{children:(0,a.jsx)("div",{className:"flex flex-wrap items-center gap-1",children:C()})})]})}function ec(e){let[t,s]=(0,n.useState)(!1),l=(0,V.BI)(),r=P.xF,o=(0,P.oz)(e.form.getValues("color")),[c,d]=(0,n.useState)(!1),[u,m]=(0,n.useState)(null),[h,x]=(0,n.useState)(null),[f,p]=(0,n.useState)(!1),[z,S]=(0,n.useState)(0),[T,I]=(0,n.useState)([]),[q,F]=(0,n.useState)([]),[J,M]=(0,n.useState)(0),[Q,U]=(0,n.useState)(!1),H=["public","private","protected"],er=[{fields:[{name:"name",label:"Name"},{name:"persona",label:"Personality"},{name:"color",label:"Color"},{name:"icon",label:"Icon"}],label:"1. Basic Settings",tabName:"basic"},{fields:[{name:"chat_model",label:"Chat Model"},{name:"privacy_level",label:"Privacy Level"}],label:"2. Model & Privacy",tabName:"customize"},{fields:[{name:"files",label:"Knowledge Base"}],label:"3. Knowledge Base",tabName:"knowledge"},{fields:[{name:"input_tools",label:"Input Tools"},{name:"output_modes",label:"Output Modes"}],label:"4. Tools",tabName:"tools"}],en=(0,n.useRef)(null);function eo(e){e.preventDefault(),d(!0)}function ec(e){e.preventDefault(),d(!1)}function ed(e){e.preventDefault(),d(!1),e.dataTransfer.files&&eu(e.dataTransfer.files)}function eu(e){(0,G.ko)(e,m,p,x,I)}function em(){en&&en.current&&en.current.click()}function eh(e){e.target.files&&eu(e.target.files)}(0,n.useEffect)(()=>{if(f||S(0),f){let e=setInterval(()=>{S(e=>{let t=e+(Math.floor(5*Math.random())+1);return t<100?t:100})},800);return()=>clearInterval(e)}},[f]),(0,n.useEffect)(()=>{F(Array.from(new Set([...q,...e.form.getValues("files")||[],...e.filesOptions||[]])))},[]),(0,n.useEffect)(()=>{T.length>0&&(ef(T),F(e=>[...e,...T]))},[T]),(0,n.useEffect)(()=>{e.errors&&s(!1)},[e.errors]);let ex=t=>{console.log("Submitting",t),e.onSubmit(t),s(!0)},ef=t=>{for(let s of t){let t=e.form.getValues("files")||[],a=t.includes(s)?t.filter(e=>e!==s):[...t,s];e.form.setValue("files",a)}},ep=t=>{try{return ei.parse(e.form.getValues()),!0}catch(s){let e=s.errors.reduce((e,t)=>(e[t.path[0]]=t.message,e),{});for(let s of t.fields)if(e[s.name])return!1;return!0}};if(Q)return(0,a.jsx)(K.aR,{open:!0,children:(0,a.jsxs)(K._T,{children:[(0,a.jsx)(K.fY,{children:(0,a.jsx)(K.f$,{children:"Upgrade to Futurist"})}),(0,a.jsxs)(K.yT,{children:["You need to be a Futurist subscriber to create more agents."," ",(0,a.jsx)("a",{href:"/settings",children:"Upgrade now"}),"."]}),(0,a.jsxs)(K.xo,{children:[(0,a.jsx)(K.le,{onClick:()=>{U(!1)},children:"Cancel"}),(0,a.jsx)(K.OL,{onClick:()=>{window.location.href="/settings"},children:"Continue"})]})]})});let ej=t=>{switch(t){case"name":return(0,a.jsx)(R.Wi,{control:e.form.control,name:"name",render:e=>{let{field:t}=e;return(0,a.jsxs)(R.xJ,{className:"space-y-0 grid gap-2",children:[(0,a.jsx)(R.lX,{children:"Name"}),(0,a.jsx)(R.pf,{children:"What should this agent be called? Pick something descriptive & memorable."}),(0,a.jsx)(R.NI,{children:(0,a.jsx)(B.I,{className:"dark:bg-muted",placeholder:"Biologist",...t})}),(0,a.jsx)(R.zG,{})]})}},t);case"chat_model":return(0,a.jsx)(R.Wi,{control:e.form.control,name:"chat_model",render:t=>{let{field:s}=t;return(0,a.jsxs)(R.xJ,{className:"my-2 grid gap-2",children:[(0,a.jsx)(R.lX,{children:"Chat Model"}),(0,a.jsx)(R.pf,{children:e.isSubscribed?(0,a.jsx)("p",{children:"Which chat model would you like to use?"}):(0,a.jsxs)("p",{className:"text-secondary-foreground",children:["Upgrade to the ",(0,a.jsx)("a",{href:"/settings",children:"Futurist plan"})," to access all models."]})}),(0,a.jsxs)(E.Ph,{onValueChange:s.onChange,defaultValue:s.value,disabled:!e.isSubscribed,children:[(0,a.jsx)(R.NI,{children:(0,a.jsx)(E.i4,{className:"text-left dark:bg-muted",children:(0,a.jsx)(E.ki,{})})}),(0,a.jsx)(E.Bw,{className:"items-start space-y-1 inline-flex flex-col",children:e.modelOptions.map(e=>(0,a.jsx)(E.Ql,{value:e.name,children:(0,a.jsx)("div",{className:"flex items-center space-x-2",children:e.name})},e.id))})]}),(0,a.jsx)(R.zG,{})]})}},t);case"privacy_level":return(0,a.jsx)(R.Wi,{control:e.form.control,name:"privacy_level",render:e=>{let{field:t}=e;return(0,a.jsxs)(R.xJ,{className:"my-2 grid gap-2",children:[(0,a.jsx)(R.lX,{children:(0,a.jsx)("div",{children:"Privacy Level"})}),(0,a.jsx)(R.pf,{children:(0,a.jsxs)($.J2,{children:[(0,a.jsx)($.xo,{asChild:!0,children:(0,a.jsx)(i.z,{variant:"ghost",className:"p-0 h-fit",children:(0,a.jsxs)("span",{className:"items-center flex gap-1 text-sm",children:[(0,a.jsx)(j.k,{className:"inline"}),(0,a.jsx)("p",{className:"text-sm",children:"Learn more"})]})})}),(0,a.jsxs)($.yk,{children:[(0,a.jsx)("b",{children:"Private"}),": only visible to you.",(0,a.jsx)("br",{}),(0,a.jsx)("b",{children:"Protected"}),": visible to anyone with a link.",(0,a.jsx)("br",{}),(0,a.jsx)("b",{children:"Public"}),": visible to everyone.",(0,a.jsx)("br",{}),"All public agents will be reviewed by us before they are launched."]})]})}),(0,a.jsxs)(E.Ph,{onValueChange:t.onChange,defaultValue:t.value,children:[(0,a.jsx)(R.NI,{children:(0,a.jsx)(E.i4,{className:"w-[200px] dark:bg-muted",children:(0,a.jsx)(E.ki,{placeholder:"private"})})}),(0,a.jsx)(E.Bw,{className:"items-center space-y-1 inline-flex flex-col",children:H.map(e=>(0,a.jsx)(E.Ql,{value:e,children:(0,a.jsx)("div",{className:"flex items-center space-x-2",children:e})},e))})]}),(0,a.jsx)(R.zG,{})]})}},t);case"color":return(0,a.jsx)(R.Wi,{control:e.form.control,name:"color",render:e=>{let{field:t}=e;return(0,a.jsxs)(R.xJ,{className:"space-y-3 my-2",children:[(0,a.jsx)(R.lX,{children:"Color"}),(0,a.jsxs)(E.Ph,{onValueChange:t.onChange,defaultValue:t.value,children:[(0,a.jsx)(R.NI,{children:(0,a.jsx)(E.i4,{className:"w-[200px] dark:bg-muted",children:(0,a.jsx)(E.ki,{placeholder:"Color"})})}),(0,a.jsx)(E.Bw,{className:"items-center space-y-1 inline-flex flex-col",children:r.map(e=>(0,a.jsx)(E.Ql,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(g.C,{className:"w-6 h-6 mr-2 ".concat((0,P.oz)(e)),weight:"fill"}),e]})},e))})]}),(0,a.jsx)(R.zG,{})]})}},t);case"icon":return(0,a.jsx)(R.Wi,{control:e.form.control,name:"icon",render:t=>{let{field:s}=t;return(0,a.jsxs)(R.xJ,{className:"space-y-3 my-2",children:[(0,a.jsx)(R.lX,{children:"Icon"}),(0,a.jsxs)(E.Ph,{onValueChange:s.onChange,defaultValue:s.value,children:[(0,a.jsx)(R.NI,{children:(0,a.jsx)(E.i4,{className:"w-[200px] dark:bg-muted",children:(0,a.jsx)(E.ki,{placeholder:"Icon"})})}),(0,a.jsx)(E.Bw,{className:"items-center space-y-1 inline-flex flex-col",children:l.map(t=>(0,a.jsx)(E.Ql,{value:t,children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,V.TI)(t,e.form.getValues("color"),"w-6","h-6"),t]})},t))})]}),(0,a.jsx)(R.zG,{})]})}},t);case"persona":return(0,a.jsx)(R.Wi,{control:e.form.control,name:"persona",render:e=>{let{field:t}=e;return(0,a.jsxs)(R.xJ,{className:"space-y-1 my-2 grid gap-2",children:[(0,a.jsx)(R.lX,{children:"Personality"}),(0,a.jsx)(R.pf,{children:"What is the personality, thought process, or tuning of this agent? This is where you can provide any instructions to the agent."}),(0,a.jsx)(R.NI,{children:(0,a.jsx)(W.g,{className:"dark:bg-muted focus:outline-none focus-visible:border-orange-500 focus-visible:border-2",placeholder:"You are an excellent biologist, at the top of your field in marine biology.",...t})}),(0,a.jsx)(R.zG,{})]})}},t);case"files":return(0,a.jsx)(R.Wi,{control:e.form.control,name:"files",render:t=>{let{field:s}=t;return(0,a.jsxs)(R.xJ,{className:"my-2 flex flex-col gap-2",children:[(0,a.jsx)(R.lX,{children:"Knowledge Base"}),(0,a.jsxs)(R.pf,{children:["Which information should be part of its digital brain?"," ",(0,a.jsx)("a",{href:"/settings",children:"Manage data"}),"."]}),(0,a.jsxs)(A,{children:[(0,a.jsxs)(D,{className:"flex items-center justify-between text-sm gap-2 bg-muted p-2 rounded-lg",children:[(0,a.jsx)(v.K,{}),s.value&&s.value.length>0?"".concat(s.value.length," files selected"):"Select files"]}),(0,a.jsx)(Z,{className:"m-1",children:(0,a.jsxs)(Y.mY,{children:[(0,a.jsx)(K.aR,{open:null!==u||null!=h,children:(0,a.jsxs)(K._T,{children:[(0,a.jsx)(K.fY,{children:(0,a.jsx)(K.f$,{children:"Alert"})}),(0,a.jsx)(K.yT,{children:u||h}),(0,a.jsx)(K.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>{m(null),x(null),p(!1)},children:"Close"})]})}),(0,a.jsxs)("div",{className:"flex flex-col h-full cursor-pointer",onDragOver:eo,onDragLeave:ec,onDrop:ed,onClick:em,children:[(0,a.jsx)("input",{type:"file",multiple:!0,ref:en,style:{display:"none"},onChange:eh}),(0,a.jsx)("div",{className:"flex-none p-4",children:f&&(0,a.jsx)(L.E,{indicatorColor:"bg-slate-500",className:"w-full h-2 rounded-full",value:z})}),(0,a.jsx)("div",{className:"flex-none p-4 bg-secondary border-b ".concat(c?"animate-pulse":""," rounded-lg"),children:(0,a.jsx)("div",{className:"flex items-center justify-center w-full h-16 border-2 border-dashed border-gray-300 rounded-lg",children:c?(0,a.jsxs)("div",{className:"flex items-center justify-center w-full h-full",children:[(0,a.jsx)(b.u,{className:"h-6 w-6 mr-2"}),(0,a.jsx)("span",{children:"Drop files to upload"})]}):(0,a.jsxs)("div",{className:"flex items-center justify-center w-full h-full",children:[(0,a.jsx)(N.v,{className:"h-6 w-6 mr-2"}),(0,a.jsx)("span",{children:"Drag and drop files here"})]})})})]}),(0,a.jsx)(Y.sZ,{placeholder:"Select files..."}),(0,a.jsxs)(Y.e8,{children:[(0,a.jsx)(Y.rb,{children:"No files found."}),(0,a.jsx)(Y.fu,{children:q.map(t=>(0,a.jsxs)(Y.di,{value:t,className:"break-all",onSelect:()=>{let s=e.form.getValues("files")||[],a=s.includes(t)?s.filter(e=>e!==t):[...s,t];e.form.setValue("files",a)},children:[(0,a.jsx)(y.J,{className:(0,X.cn)("mr-2 h-4 w-4",s.value&&s.value.includes(t)?"opacity-100":"opacity-0")}),t]},t))})]})]})})]})]})}},t);case"input_tools":return(0,a.jsx)(R.Wi,{control:e.form.control,name:"input_tools",render:t=>{let{field:s}=t;return(0,a.jsxs)(R.xJ,{className:"flex flex-col gap-2 my-2",children:[(0,a.jsx)(R.lX,{children:"Restrict Input Tools"}),(0,a.jsxs)(R.pf,{children:["Which knowledge retrieval tools should this agent be limited to?",(0,a.jsx)("br",{}),(0,a.jsx)("b",{children:"Default:"})," No limitations."]}),(0,a.jsxs)(A,{children:[(0,a.jsxs)(D,{className:"flex items-center justify-between text-sm gap-2 bg-muted p-2 rounded-lg",children:[(0,a.jsx)(v.K,{}),s.value&&s.value.length>0?"".concat(s.value.length," tools selected"):"All tools"]}),(0,a.jsx)(Z,{children:(0,a.jsx)(Y.mY,{children:(0,a.jsx)(Y.e8,{children:(0,a.jsx)(Y.fu,{children:Object.entries(e.inputToolOptions).map(t=>{let[l,r]=t;return(0,a.jsxs)(Y.di,{value:l,onSelect:()=>{let t=e.form.getValues("input_tools")||[],s=t.includes(l)?t.filter(e=>e!==l):[...t,l];e.form.setValue("input_tools",s)},children:[(0,a.jsx)(y.J,{className:(0,X.cn)("mr-2 h-4 w-4",s.value&&s.value.includes(l)?"opacity-100":"opacity-0")}),(0,a.jsxs)("div",{className:(0,X.cn)("flex items-center space-x-2"),children:[(0,a.jsx)("p",{children:(0,a.jsx)("b",{children:l})}),(0,a.jsx)("p",{children:r})]})]},l)})})})})})]})]})}},t);case"output_modes":return(0,a.jsx)(R.Wi,{control:e.form.control,name:"output_modes",render:t=>{let{field:s}=t;return(0,a.jsxs)(R.xJ,{className:"flex flex-col gap-2 my-2",children:[(0,a.jsx)(R.lX,{children:"Restrict Output Modes"}),(0,a.jsxs)(R.pf,{children:["Which output modes should this agent be limited to?",(0,a.jsx)("br",{}),(0,a.jsx)("b",{children:"Default:"})," No limitations."]}),(0,a.jsxs)(A,{children:[(0,a.jsxs)(D,{className:"flex items-center justify-between text-sm gap-2 bg-muted p-2 rounded-lg",children:[(0,a.jsx)(v.K,{}),s.value&&s.value.length>0?"".concat(s.value.length," modes selected"):"All modes"]}),(0,a.jsx)(Z,{children:(0,a.jsx)(Y.mY,{children:(0,a.jsx)(Y.e8,{children:(0,a.jsx)(Y.fu,{children:Object.entries(e.outputModeOptions).map(t=>{let[l,r]=t;return(0,a.jsxs)(Y.di,{value:l,onSelect:()=>{let t=e.form.getValues("output_modes")||[],s=t.includes(l)?t.filter(e=>e!==l):[...t,l];e.form.setValue("output_modes",s)},children:[(0,a.jsx)(y.J,{className:(0,X.cn)("mr-2 h-4 w-4",s.value&&s.value.includes(l)?"opacity-100":"opacity-0")}),(0,a.jsxs)("div",{className:(0,X.cn)("flex items-center space-x-2"),children:[(0,a.jsx)("p",{children:(0,a.jsx)("b",{children:l})}),(0,a.jsx)("p",{children:r})]})]},l)})})})})})]})]})}},t);default:return null}};return(0,a.jsxs)(R.l0,{...e.form,children:[(0,a.jsx)(el.x,{className:"h-full",children:(0,a.jsxs)("form",{onSubmit:e.form.handleSubmit(ex),className:"space-y-6 pb-4 px-4 h-full flex flex-col justify-between",children:[(0,a.jsxs)(ee,{defaultValue:"basic",value:er[J].tabName,children:[(0,a.jsx)(et,{className:"grid grid-cols-2 md:grid-cols-4 gap-2 h-fit",children:er.map(e=>(0,a.jsxs)(es,{value:e.tabName,className:"text-center ".concat(ep(e)?"":"text-red-500"),onClick:()=>M(er.findIndex(t=>t.tabName===e.tabName)),children:[e.label," ",!ep(e)&&"*"]},e.tabName))}),er.map(e=>(0,a.jsx)(ea,{value:e.tabName,children:e.fields.map(e=>ej(e.name))},e.tabName))]}),e.errors&&(0,a.jsx)(O.bZ,{className:"bg-secondary border-none my-4",children:(0,a.jsxs)(O.X,{className:"flex items-center gap-1",children:[(0,a.jsx)(w.f,{weight:"fill",className:"h-4 w-4 text-yellow-400 inline"}),(0,a.jsx)("span",{children:e.errors})]})})]})}),(0,a.jsxs)("div",{className:"flex justify-between mt-1 left-0 right-0 bg-background p-1",children:[(0,a.jsxs)(i.z,{type:"button",variant:"outline",onClick:e=>{e.preventDefault(),J>0&&M(J-1)},disabled:0===J,className:"items-center ".concat(t?"bg-stone-100 dark:bg-neutral-900":""," text-white ").concat(o),children:[(0,a.jsx)(k.X,{className:"mr-2 h-4 w-4"}),"Previous"]}),J<er.length-1?(0,a.jsxs)(i.z,{type:"button",variant:"outline",onClick:e=>{e.preventDefault(),J<er.length-1&&M(J+1)},disabled:!ep(er[J]),className:"items-center ".concat(t?"bg-stone-100 dark:bg-neutral-900":""," text-white ").concat(o),children:["Continue",(0,a.jsx)(_.o,{className:"ml-2 h-4 w-4"})]}):(0,a.jsxs)(i.z,{type:"submit",variant:"outline",disabled:t,onClick:e.form.handleSubmit(ex),className:"items-center ".concat(t?"bg-stone-100 dark:bg-neutral-900":""," text-white ").concat(o),children:[(0,a.jsx)(C.B,{className:"h-4 w-4 mr-2"}),t?"Booting...":"Save"]})]})]})}},97673:function(e,t,s){"use strict";s.d(t,{Z:function(){return c}});var a=s(57437),l=s(26110),r=s(62869),n=s(95186),i=s(26815),o=s(92457);function c(e){var t;return(0,a.jsxs)(l.Vq,{children:[(0,a.jsx)(l.hg,{asChild:!0,onClick:e.onShare,children:(0,a.jsxs)(r.z,{size:"sm",className:"".concat(e.buttonClassName||"px-3"),variant:null!==(t=e.buttonVariant)&&void 0!==t?t:"default",children:[e.includeIcon&&(0,a.jsx)(o.m,{className:"w-4 h-4 mr-2"}),e.buttonTitle]})}),(0,a.jsxs)(l.cZ,{children:[(0,a.jsxs)(l.fK,{children:[(0,a.jsx)(l.$N,{children:e.title}),(0,a.jsx)(l.Be,{children:e.description})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsxs)("div",{className:"grid flex-1 gap-2",children:[(0,a.jsx)(i._,{htmlFor:"link",className:"sr-only",children:"Link"}),(0,a.jsx)(n.I,{id:"link",defaultValue:e.url,readOnly:!0})]}),(0,a.jsx)(r.z,{type:"submit",size:"sm",className:"px-3",onClick:()=>(function(e){let t=navigator.clipboard;t&&t.writeText(e)})(e.url),children:(0,a.jsx)("span",{children:"Copy"})})]})]})]})}},65613:function(e,t,s){"use strict";s.d(t,{X:function(){return c},bZ:function(){return o}});var a=s(57437),l=s(2265),r=s(90535),n=s(94508);let i=(0,r.j)("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),o=l.forwardRef((e,t)=>{let{className:s,variant:l,...r}=e;return(0,a.jsx)("div",{ref:t,role:"alert",className:(0,n.cn)(i({variant:l}),s),...r})});o.displayName="Alert",l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)("h5",{ref:t,className:(0,n.cn)("mb-1 font-medium leading-none tracking-tight",s),...l})}).displayName="AlertTitle";let c=l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)("div",{ref:t,className:(0,n.cn)("text-sm [&_p]:leading-relaxed",s),...l})});c.displayName="AlertDescription"},15681:function(e,t,s){"use strict";s.d(t,{NI:function(){return p},Wi:function(){return u},l0:function(){return c},lX:function(){return f},pf:function(){return j},xJ:function(){return x},zG:function(){return g}});var a=s(57437),l=s(2265),r=s(37053),n=s(29501),i=s(94508),o=s(26815);let c=n.RV,d=l.createContext({}),u=e=>{let{...t}=e;return(0,a.jsx)(d.Provider,{value:{name:t.name},children:(0,a.jsx)(n.Qr,{...t})})},m=()=>{let e=l.useContext(d),t=l.useContext(h),{getFieldState:s,formState:a}=(0,n.Gc)(),r=s(e.name,a);if(!e)throw Error("useFormField should be used within <FormField>");let{id:i}=t;return{id:i,name:e.name,formItemId:"".concat(i,"-form-item"),formDescriptionId:"".concat(i,"-form-item-description"),formMessageId:"".concat(i,"-form-item-message"),...r}},h=l.createContext({}),x=l.forwardRef((e,t)=>{let{className:s,...r}=e,n=l.useId();return(0,a.jsx)(h.Provider,{value:{id:n},children:(0,a.jsx)("div",{ref:t,className:(0,i.cn)("space-y-2",s),...r})})});x.displayName="FormItem";let f=l.forwardRef((e,t)=>{let{className:s,...l}=e,{error:r,formItemId:n}=m();return(0,a.jsx)(o._,{ref:t,className:(0,i.cn)(r&&"text-destructive",s),htmlFor:n,...l})});f.displayName="FormLabel";let p=l.forwardRef((e,t)=>{let{...s}=e,{error:l,formItemId:n,formDescriptionId:i,formMessageId:o}=m();return(0,a.jsx)(r.g7,{ref:t,id:n,"aria-describedby":l?"".concat(i," ").concat(o):"".concat(i),"aria-invalid":!!l,...s})});p.displayName="FormControl";let j=l.forwardRef((e,t)=>{let{className:s,...l}=e,{formDescriptionId:r}=m();return(0,a.jsx)("p",{ref:t,id:r,className:(0,i.cn)("text-sm text-muted-foreground",s),...l})});j.displayName="FormDescription";let g=l.forwardRef((e,t)=>{let{className:s,children:l,...r}=e,{error:n,formMessageId:o}=m(),c=n?String(null==n?void 0:n.message):l;return c?(0,a.jsx)("p",{ref:t,id:o,className:(0,i.cn)("text-sm font-medium text-destructive",s),...r,children:c}):null});g.displayName="FormMessage"},26815:function(e,t,s){"use strict";s.d(t,{_:function(){return c}});var a=s(57437),l=s(2265),r=s(6394),n=s(90535),i=s(94508);let o=(0,n.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),c=l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)(r.f,{ref:t,className:(0,i.cn)(o(),s),...l})});c.displayName=r.f.displayName},53647:function(e,t,s){"use strict";s.d(t,{Bw:function(){return f},Ph:function(){return d},Ql:function(){return p},i4:function(){return m},ki:function(){return u}});var a=s(57437),l=s(2265),r=s(56873),n=s(40875),i=s(22135),o=s(30401),c=s(94508);let d=r.fC;r.ZA;let u=r.B4,m=l.forwardRef((e,t)=>{let{className:s,children:l,...i}=e;return(0,a.jsxs)(r.xz,{ref:t,className:(0,c.cn)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",s),...i,children:[l,(0,a.jsx)(r.JO,{asChild:!0,children:(0,a.jsx)(n.Z,{className:"h-4 w-4 opacity-50"})})]})});m.displayName=r.xz.displayName;let h=l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)(r.u_,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",s),...l,children:(0,a.jsx)(i.Z,{className:"h-4 w-4"})})});h.displayName=r.u_.displayName;let x=l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)(r.$G,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",s),...l,children:(0,a.jsx)(n.Z,{className:"h-4 w-4"})})});x.displayName=r.$G.displayName;let f=l.forwardRef((e,t)=>{let{className:s,children:l,position:n="popper",...i}=e;return(0,a.jsx)(r.h_,{children:(0,a.jsxs)(r.VY,{ref:t,className:(0,c.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===n&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",s),position:n,...i,children:[(0,a.jsx)(h,{}),(0,a.jsx)(r.l_,{className:(0,c.cn)("p-1","popper"===n&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:l}),(0,a.jsx)(x,{})]})})});f.displayName=r.VY.displayName,l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)(r.__,{ref:t,className:(0,c.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",s),...l})}).displayName=r.__.displayName;let p=l.forwardRef((e,t)=>{let{className:s,children:l,...n}=e;return(0,a.jsxs)(r.ck,{ref:t,className:(0,c.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),...n,children:[(0,a.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,a.jsx)(r.wU,{children:(0,a.jsx)(o.Z,{className:"h-4 w-4"})})}),(0,a.jsx)(r.eT,{children:l})]})});p.displayName=r.ck.displayName,l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)(r.Z0,{ref:t,className:(0,c.cn)("-mx-1 my-1 h-px bg-muted",s),...l})}).displayName=r.Z0.displayName},71159:function(e){e.exports={agentPersonality:"agentCard_agentPersonality__MmRlN",infoButton:"agentCard_infoButton__heh_w"}}}]);
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5427],{25427:function(e,t,s){"use strict";s.d(t,{EY:function(){return eo},ks:function(){return ec},bc:function(){return ei}});var a=s(57437),l=s(71159),r=s.n(l),n=s(2265),i=s(62869),o=s(52023),c=s(80854),d=s(27909),u=s(63329),m=s(2452),h=s(41317),x=s(86967),f=s(19841),p=s(57757),j=s(75419),g=s(96108),v=s(78299),b=s(87296),N=s(89203),y=s(38513),w=s(70602),k=s(64697),_=s(45178),C=s(2049),z=s(31229),S=s(66070),T=s(26110),I=s(39535),V=s(42225),P=s(84671),O=s(65613),R=s(15681),q=s(29501),B=s(95186),F=s(13590),W=s(76818),E=s(53647),J=s(49027),M=s(962);let A=M.fC,D=M.wy,Z=M.Fw;var X=s(94508),Y=s(23518),G=s(59199),K=s(37099),L=s(32759),$=s(57054),Q=s(97673),U=s(81103),H=s(20271);let ee=H.fC,et=n.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)(H.aV,{ref:t,className:(0,X.cn)("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",s),...l})});et.displayName=H.aV.displayName;let es=n.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)(H.xz,{ref:t,className:(0,X.cn)("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",s),...l})});es.displayName=H.xz.displayName;let ea=n.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)(H.VY,{ref:t,className:(0,X.cn)("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",s),...l})});ea.displayName=H.VY.displayName;var el=s(19378);async function er(e,t){let s="/login?next=/agents?agent=".concat(e);if(!t){window.location.href=s;return}let a=await fetch("/api/chat/sessions?agent_slug=".concat(encodeURIComponent(e)),{method:"POST"}),l=await a.json();200==a.status?window.location.href="/chat?conversationId=".concat(l.conversation_id):403==a.status||401==a.status?window.location.href=s:alert("Failed to start chat session")}function en(e){var t;let s=(null===(t=e.text)||void 0===t?void 0:t.replace(/^\w/,e=>e.toUpperCase()))||"";return(0,a.jsx)(U.pn,{children:(0,a.jsxs)(U.u,{children:[(0,a.jsx)(U._v,{asChild:!0,children:(0,a.jsx)("div",{className:"text-sm",children:e.hoverText||s})}),(0,a.jsx)(U.aJ,{className:"cursor-text",children:(0,a.jsxs)("div",{className:"flex items-center space-x-2 rounded-full border-accent-500 border p-1.5",children:[(0,a.jsx)("div",{className:"text-muted-foreground",children:e.icon}),s&&s.length>0&&(0,a.jsx)("div",{className:"text-muted-foreground text-sm",children:s})]})})]})})}let ei=z.z.object({name:z.z.string({required_error:"Name is required"}).min(1,"Name is required"),persona:z.z.string({required_error:"Personality is required"}).min(1,"Personality is required"),color:z.z.string({required_error:"Color is required"}).min(1,"Color is required"),icon:z.z.string({required_error:"Icon is required"}).min(1,"Icon is required"),privacy_level:z.z.string({required_error:"Privacy level is required"}).min(1,"Privacy level is required"),chat_model:z.z.string({required_error:"Chat model is required"}).min(1,"Chat model is required"),files:z.z.array(z.z.string()).default([]).optional(),input_tools:z.z.array(z.z.string()).default([]).optional(),output_modes:z.z.array(z.z.string()).default([]).optional()});function eo(e){var t;let[s,l]=(0,n.useState)(e.agentSlug===e.data.slug),[j,g]=(0,n.useState)(!1),[v,b]=(0,n.useState)(null),N=(0,a.jsx)(o.H,{}),y="Private agents are only visible to you.";"public"===e.data.privacy_level?(N=(0,a.jsx)(c.T,{}),y="Public agents are visible to everyone."):"protected"===e.data.privacy_level&&(N=(0,a.jsx)(d.M,{}),y="Protected agents are visible to anyone with a direct link.");let w=e.userProfile,k=(0,q.cI)({resolver:(0,F.F)(ei),defaultValues:{name:e.data.name,persona:e.data.persona,color:e.data.color,icon:e.data.icon,privacy_level:e.data.privacy_level,chat_model:e.data.chat_model,files:e.data.files,input_tools:e.data.input_tools,output_modes:e.data.output_modes}});(0,n.useEffect)(()=>{k.reset({name:e.data.name,persona:e.data.persona,color:e.data.color,icon:e.data.icon,privacy_level:e.data.privacy_level,chat_model:e.data.chat_model,files:e.data.files,input_tools:e.data.input_tools,output_modes:e.data.output_modes})},[e.data]),s&&window.history.pushState({},"Khoj AI - Agent ".concat(e.data.slug),"/agents?agent=".concat(e.data.slug));let _=(0,P.oz)(e.data.color);function C(){return(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-1",children:[e.editCard&&(0,a.jsx)(en,{icon:N,text:e.data.privacy_level,hoverText:y}),e.data.files&&e.data.files.length>0&&(0,a.jsx)(en,{icon:(0,a.jsx)(u.f,{}),text:"knowledge",hoverText:"The agent has a custom knowledge base with ".concat(e.data.files.length," documents. It can use them to give you answers.")}),(0,a.jsx)(en,{icon:(0,a.jsx)(m.a,{}),text:e.data.chat_model,hoverText:"The agent uses the ".concat(e.data.chat_model," model to chat with you.")}),e.data.output_modes.map(t=>(0,a.jsx)(en,{icon:(0,V.vH)(t),hoverText:"".concat(t,": ").concat(e.outputModeOptions[t])},t)),e.data.input_tools.map(t=>(0,a.jsx)(en,{icon:(0,V.vH)(t),hoverText:"".concat(t,": ").concat(e.inputToolOptions[t])},t))]})}return(0,a.jsxs)(S.Zb,{className:"shadow-md rounded-xl hover:shadow-lg dark:bg-muted",children:[j&&(0,a.jsx)(I.Z,{onOpenChange:g,isMobileWidth:e.isMobileWidth}),(0,a.jsx)(S.Ol,{children:(0,a.jsx)(S.ll,{children:(0,a.jsxs)(T.Vq,{open:s,onOpenChange:()=>{l(!s),window.history.pushState({},"Khoj AI - Agents","/agents")},children:[(0,a.jsx)(T.hg,{className:"focus-visible:outline-none",children:(0,a.jsxs)("div",{className:"flex items-center relative top-2",children:[(0,V.TI)(e.data.icon,e.data.color),e.data.name]})}),(0,a.jsxs)("div",{className:"flex float-right",children:[e.editCard&&(0,a.jsx)("div",{className:"float-right",children:(0,a.jsxs)($.J2,{children:[(0,a.jsx)($.xo,{children:(0,a.jsx)(i.z,{className:"bg-[hsl(var(--background))] w-10 h-10 p-0 rounded-xl border dark:border-neutral-700 shadow-sm hover:bg-stone-100 dark:hover:bg-neutral-900",children:(0,a.jsx)(h.F,{className:"w-6 h-6 ".concat((0,P.oz)(e.data.color))})})}),(0,a.jsxs)($.yk,{className:"w-fit grid p-1",side:"bottom",align:"end",children:[(0,a.jsxs)(i.z,{className:"items-center justify-start",variant:"ghost",onClick:()=>l(!0),children:[(0,a.jsx)(x.z,{className:"w-4 h-4 mr-2"}),"Edit"]}),e.editCard&&"private"!==e.data.privacy_level&&(0,a.jsx)(Q.Z,{buttonTitle:"Share",title:"Share Agent",description:"Share a link to this agent with others. They'll be able to chat with it, and ask questions to all of its knowledge base.",buttonVariant:"ghost",includeIcon:!0,url:"".concat(window.location.origin,"/agents?agent=").concat(e.data.slug)}),e.data.creator===(null==w?void 0:w.username)&&(0,a.jsxs)(i.z,{className:"items-center justify-start",variant:"destructive",onClick:()=>{fetch("/api/agents/".concat(e.data.slug),{method:"DELETE"}).then(()=>{e.setAgentChangeTriggered(!0)})},children:[(0,a.jsx)(f.r,{className:"w-4 h-4 mr-2"}),"Delete"]})]})]})}),(null===(t=e.showChatButton)||void 0===t||t)&&(0,a.jsx)("div",{className:"float-right ml-2",children:e.userProfile?(0,a.jsx)(i.z,{className:"bg-[hsl(var(--background))] w-10 h-10 p-0 rounded-xl border dark:border-neutral-700 shadow-sm hover:bg-stone-100 dark:hover:bg-neutral-900",onClick:()=>er(e.data.slug,w),children:(0,a.jsx)(p.g,{className:"w-6 h-6 ".concat((0,P.oz)(e.data.color))})}):(0,a.jsx)(i.z,{className:"bg-[hsl(var(--background))] w-14 h-14 rounded-xl border dark:border-neutral-700 shadow-sm hover:bg-stone-100 dark:hover:bg-neutral-900",onClick:()=>g(!0),children:(0,a.jsx)(p.g,{className:"w-6 h-6 ".concat((0,P.oz)(e.data.color))})})})]}),e.editCard?(0,a.jsxs)(T.cZ,{className:"lg:max-w-screen-lg py-4 overflow-y-scroll h-full md:h-4/6 rounded-lg flex flex-col",children:[(0,a.jsxs)(J.$N,{children:["Edit ",(0,a.jsx)("b",{children:e.data.name})]}),(0,a.jsx)(ec,{form:k,onSubmit:t=>{let s=e.editCard?"PATCH":"POST",a=t;e.editCard&&(a={...t,slug:e.data.slug}),fetch("/api/agents",{method:s,headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}).then(t=>{200===t.status?(k.reset(),l(!1),b(null),e.setAgentChangeTriggered(!0)):t.json().then(e=>{console.error(e),k.clearErrors(),e.error&&b(e.error)})}).catch(e=>{console.error("Error:",e),b(e),k.clearErrors()})},create:!1,errors:v,filesOptions:e.filesOptions,modelOptions:e.modelOptions,slug:e.data.slug,inputToolOptions:e.inputToolOptions,isSubscribed:e.isSubscribed,outputModeOptions:e.outputModeOptions})]}):(0,a.jsxs)(T.cZ,{className:"whitespace-pre-line max-h-[80vh] max-w-[90vw] md:max-w-[50vw] rounded-lg",children:[(0,a.jsx)(T.fK,{children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,V.TI)(e.data.icon,e.data.color),(0,a.jsx)("p",{className:"font-bold text-lg",children:(0,a.jsx)(J.$N,{children:e.data.name})})]})}),(0,a.jsx)("div",{className:"max-h-[60vh] overflow-y-scroll text-neutral-500 dark:text-white",children:e.data.persona}),(0,a.jsx)("div",{className:"flex flex-wrap items-center gap-1",children:C()}),(0,a.jsx)(T.cN,{children:(0,a.jsxs)(i.z,{className:"pt-6 pb-6 ".concat(_," bg-white dark:bg-[hsl(var(--background))] text-neutral-500 dark:text-white border-2 border-stone-100 shadow-sm rounded-xl hover:bg-stone-100 dark:hover:bg-neutral-900 dark:border-neutral-700"),onClick:()=>{er(e.data.slug,w),l(!1)},children:[(0,a.jsx)(p.g,{className:"w-6 h-6 m-2 ".concat((0,P.oz)(e.data.color))}),"Start Chatting"]})})]})]})})}),(0,a.jsx)(S.aY,{children:(0,a.jsx)("div",{className:r().agentPersonality,children:(0,a.jsx)("button",{className:"".concat(r().infoButton," text-neutral-500 dark:text-white"),onClick:()=>l(!0),children:(0,a.jsx)("p",{children:e.data.persona})})})}),(0,a.jsx)(S.eW,{children:(0,a.jsx)("div",{className:"flex flex-wrap items-center gap-1",children:C()})})]})}function ec(e){let[t,s]=(0,n.useState)(!1),l=(0,V.BI)(),r=P.xF,o=(0,P.oz)(e.form.getValues("color")),[c,d]=(0,n.useState)(!1),[u,m]=(0,n.useState)(null),[h,x]=(0,n.useState)(null),[f,p]=(0,n.useState)(!1),[z,S]=(0,n.useState)(0),[T,I]=(0,n.useState)([]),[q,F]=(0,n.useState)([]),[J,M]=(0,n.useState)(0),[Q,U]=(0,n.useState)(!1),H=["public","private","protected"],er=[{fields:[{name:"name",label:"Name"},{name:"persona",label:"Personality"},{name:"color",label:"Color"},{name:"icon",label:"Icon"}],label:"1. Basic Settings",tabName:"basic"},{fields:[{name:"chat_model",label:"Chat Model"},{name:"privacy_level",label:"Privacy Level"}],label:"2. Model & Privacy",tabName:"customize"},{fields:[{name:"files",label:"Knowledge Base"}],label:"3. Knowledge Base",tabName:"knowledge"},{fields:[{name:"input_tools",label:"Input Tools"},{name:"output_modes",label:"Output Modes"}],label:"4. Tools",tabName:"tools"}],en=(0,n.useRef)(null);function eo(e){e.preventDefault(),d(!0)}function ec(e){e.preventDefault(),d(!1)}function ed(e){e.preventDefault(),d(!1),e.dataTransfer.files&&eu(e.dataTransfer.files)}function eu(e){(0,G.ko)(e,m,p,x,I)}function em(){en&&en.current&&en.current.click()}function eh(e){e.target.files&&eu(e.target.files)}(0,n.useEffect)(()=>{if(f||S(0),f){let e=setInterval(()=>{S(e=>{let t=e+(Math.floor(5*Math.random())+1);return t<100?t:100})},800);return()=>clearInterval(e)}},[f]),(0,n.useEffect)(()=>{F(Array.from(new Set([...q,...e.form.getValues("files")||[],...e.filesOptions||[]])))},[]),(0,n.useEffect)(()=>{T.length>0&&(ef(T),F(e=>[...e,...T]))},[T]),(0,n.useEffect)(()=>{e.errors&&s(!1)},[e.errors]);let ex=t=>{console.log("Submitting",t),e.onSubmit(t),s(!0)},ef=t=>{for(let s of t){let t=e.form.getValues("files")||[],a=t.includes(s)?t.filter(e=>e!==s):[...t,s];e.form.setValue("files",a)}},ep=t=>{try{return ei.parse(e.form.getValues()),!0}catch(s){let e=s.errors.reduce((e,t)=>(e[t.path[0]]=t.message,e),{});for(let s of t.fields)if(e[s.name])return!1;return!0}};if(Q)return(0,a.jsx)(K.aR,{open:!0,children:(0,a.jsxs)(K._T,{children:[(0,a.jsx)(K.fY,{children:(0,a.jsx)(K.f$,{children:"Upgrade to Futurist"})}),(0,a.jsxs)(K.yT,{children:["You need to be a Futurist subscriber to create more agents."," ",(0,a.jsx)("a",{href:"/settings",children:"Upgrade now"}),"."]}),(0,a.jsxs)(K.xo,{children:[(0,a.jsx)(K.le,{onClick:()=>{U(!1)},children:"Cancel"}),(0,a.jsx)(K.OL,{onClick:()=>{window.location.href="/settings"},children:"Continue"})]})]})});let ej=t=>{switch(t){case"name":return(0,a.jsx)(R.Wi,{control:e.form.control,name:"name",render:e=>{let{field:t}=e;return(0,a.jsxs)(R.xJ,{className:"space-y-0 grid gap-2",children:[(0,a.jsx)(R.lX,{children:"Name"}),(0,a.jsx)(R.pf,{children:"What should this agent be called? Pick something descriptive & memorable."}),(0,a.jsx)(R.NI,{children:(0,a.jsx)(B.I,{className:"dark:bg-muted",placeholder:"Biologist",...t})}),(0,a.jsx)(R.zG,{})]})}},t);case"chat_model":return(0,a.jsx)(R.Wi,{control:e.form.control,name:"chat_model",render:t=>{let{field:s}=t;return(0,a.jsxs)(R.xJ,{className:"my-2 grid gap-2",children:[(0,a.jsx)(R.lX,{children:"Chat Model"}),(0,a.jsx)(R.pf,{children:e.isSubscribed?(0,a.jsx)("p",{children:"Which chat model would you like to use?"}):(0,a.jsxs)("p",{className:"text-secondary-foreground",children:["Upgrade to the ",(0,a.jsx)("a",{href:"/settings",children:"Futurist plan"})," to access all models."]})}),(0,a.jsxs)(E.Ph,{onValueChange:s.onChange,defaultValue:s.value,disabled:!e.isSubscribed,children:[(0,a.jsx)(R.NI,{children:(0,a.jsx)(E.i4,{className:"text-left dark:bg-muted",children:(0,a.jsx)(E.ki,{})})}),(0,a.jsx)(E.Bw,{className:"items-start space-y-1 inline-flex flex-col",children:e.modelOptions.map(e=>(0,a.jsx)(E.Ql,{value:e.name,children:(0,a.jsx)("div",{className:"flex items-center space-x-2",children:e.name})},e.id))})]}),(0,a.jsx)(R.zG,{})]})}},t);case"privacy_level":return(0,a.jsx)(R.Wi,{control:e.form.control,name:"privacy_level",render:e=>{let{field:t}=e;return(0,a.jsxs)(R.xJ,{className:"my-2 grid gap-2",children:[(0,a.jsx)(R.lX,{children:(0,a.jsx)("div",{children:"Privacy Level"})}),(0,a.jsx)(R.pf,{children:(0,a.jsxs)($.J2,{children:[(0,a.jsx)($.xo,{asChild:!0,children:(0,a.jsx)(i.z,{variant:"ghost",className:"p-0 h-fit",children:(0,a.jsxs)("span",{className:"items-center flex gap-1 text-sm",children:[(0,a.jsx)(j.k,{className:"inline"}),(0,a.jsx)("p",{className:"text-sm",children:"Learn more"})]})})}),(0,a.jsxs)($.yk,{children:[(0,a.jsx)("b",{children:"Private"}),": only visible to you.",(0,a.jsx)("br",{}),(0,a.jsx)("b",{children:"Protected"}),": visible to anyone with a link.",(0,a.jsx)("br",{}),(0,a.jsx)("b",{children:"Public"}),": visible to everyone.",(0,a.jsx)("br",{}),"All public agents will be reviewed by us before they are launched."]})]})}),(0,a.jsxs)(E.Ph,{onValueChange:t.onChange,defaultValue:t.value,children:[(0,a.jsx)(R.NI,{children:(0,a.jsx)(E.i4,{className:"w-[200px] dark:bg-muted",children:(0,a.jsx)(E.ki,{placeholder:"private"})})}),(0,a.jsx)(E.Bw,{className:"items-center space-y-1 inline-flex flex-col",children:H.map(e=>(0,a.jsx)(E.Ql,{value:e,children:(0,a.jsx)("div",{className:"flex items-center space-x-2",children:e})},e))})]}),(0,a.jsx)(R.zG,{})]})}},t);case"color":return(0,a.jsx)(R.Wi,{control:e.form.control,name:"color",render:e=>{let{field:t}=e;return(0,a.jsxs)(R.xJ,{className:"space-y-3 my-2",children:[(0,a.jsx)(R.lX,{children:"Color"}),(0,a.jsxs)(E.Ph,{onValueChange:t.onChange,defaultValue:t.value,children:[(0,a.jsx)(R.NI,{children:(0,a.jsx)(E.i4,{className:"w-[200px] dark:bg-muted",children:(0,a.jsx)(E.ki,{placeholder:"Color"})})}),(0,a.jsx)(E.Bw,{className:"items-center space-y-1 inline-flex flex-col",children:r.map(e=>(0,a.jsx)(E.Ql,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(g.C,{className:"w-6 h-6 mr-2 ".concat((0,P.oz)(e)),weight:"fill"}),e]})},e))})]}),(0,a.jsx)(R.zG,{})]})}},t);case"icon":return(0,a.jsx)(R.Wi,{control:e.form.control,name:"icon",render:t=>{let{field:s}=t;return(0,a.jsxs)(R.xJ,{className:"space-y-3 my-2",children:[(0,a.jsx)(R.lX,{children:"Icon"}),(0,a.jsxs)(E.Ph,{onValueChange:s.onChange,defaultValue:s.value,children:[(0,a.jsx)(R.NI,{children:(0,a.jsx)(E.i4,{className:"w-[200px] dark:bg-muted",children:(0,a.jsx)(E.ki,{placeholder:"Icon"})})}),(0,a.jsx)(E.Bw,{className:"items-center space-y-1 inline-flex flex-col",children:l.map(t=>(0,a.jsx)(E.Ql,{value:t,children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,V.TI)(t,e.form.getValues("color"),"w-6","h-6"),t]})},t))})]}),(0,a.jsx)(R.zG,{})]})}},t);case"persona":return(0,a.jsx)(R.Wi,{control:e.form.control,name:"persona",render:e=>{let{field:t}=e;return(0,a.jsxs)(R.xJ,{className:"space-y-1 my-2 grid gap-2",children:[(0,a.jsx)(R.lX,{children:"Personality"}),(0,a.jsx)(R.pf,{children:"What is the personality, thought process, or tuning of this agent? This is where you can provide any instructions to the agent."}),(0,a.jsx)(R.NI,{children:(0,a.jsx)(W.g,{className:"dark:bg-muted focus:outline-none focus-visible:border-orange-500 focus-visible:border-2",placeholder:"You are an excellent biologist, at the top of your field in marine biology.",...t})}),(0,a.jsx)(R.zG,{})]})}},t);case"files":return(0,a.jsx)(R.Wi,{control:e.form.control,name:"files",render:t=>{let{field:s}=t;return(0,a.jsxs)(R.xJ,{className:"my-2 flex flex-col gap-2",children:[(0,a.jsx)(R.lX,{children:"Knowledge Base"}),(0,a.jsxs)(R.pf,{children:["Which information should be part of its digital brain?"," ",(0,a.jsx)("a",{href:"/settings",children:"Manage data"}),"."]}),(0,a.jsxs)(A,{children:[(0,a.jsxs)(D,{className:"flex items-center justify-between text-sm gap-2 bg-muted p-2 rounded-lg",children:[(0,a.jsx)(v.K,{}),s.value&&s.value.length>0?"".concat(s.value.length," files selected"):"Select files"]}),(0,a.jsx)(Z,{className:"m-1",children:(0,a.jsxs)(Y.mY,{children:[(0,a.jsx)(K.aR,{open:null!==u||null!=h,children:(0,a.jsxs)(K._T,{children:[(0,a.jsx)(K.fY,{children:(0,a.jsx)(K.f$,{children:"Alert"})}),(0,a.jsx)(K.yT,{children:u||h}),(0,a.jsx)(K.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>{m(null),x(null),p(!1)},children:"Close"})]})}),(0,a.jsxs)("div",{className:"flex flex-col h-full cursor-pointer",onDragOver:eo,onDragLeave:ec,onDrop:ed,onClick:em,children:[(0,a.jsx)("input",{type:"file",multiple:!0,ref:en,style:{display:"none"},onChange:eh}),(0,a.jsx)("div",{className:"flex-none p-4",children:f&&(0,a.jsx)(L.E,{indicatorColor:"bg-slate-500",className:"w-full h-2 rounded-full",value:z})}),(0,a.jsx)("div",{className:"flex-none p-4 bg-secondary border-b ".concat(c?"animate-pulse":""," rounded-lg"),children:(0,a.jsx)("div",{className:"flex items-center justify-center w-full h-16 border-2 border-dashed border-gray-300 rounded-lg",children:c?(0,a.jsxs)("div",{className:"flex items-center justify-center w-full h-full",children:[(0,a.jsx)(b.u,{className:"h-6 w-6 mr-2"}),(0,a.jsx)("span",{children:"Drop files to upload"})]}):(0,a.jsxs)("div",{className:"flex items-center justify-center w-full h-full",children:[(0,a.jsx)(N.v,{className:"h-6 w-6 mr-2"}),(0,a.jsx)("span",{children:"Drag and drop files here"})]})})})]}),(0,a.jsx)(Y.sZ,{placeholder:"Select files..."}),(0,a.jsxs)(Y.e8,{children:[(0,a.jsx)(Y.rb,{children:"No files found."}),(0,a.jsx)(Y.fu,{children:q.map(t=>(0,a.jsxs)(Y.di,{value:t,className:"break-all",onSelect:()=>{let s=e.form.getValues("files")||[],a=s.includes(t)?s.filter(e=>e!==t):[...s,t];e.form.setValue("files",a)},children:[(0,a.jsx)(y.J,{className:(0,X.cn)("mr-2 h-4 w-4",s.value&&s.value.includes(t)?"opacity-100":"opacity-0")}),t]},t))})]})]})})]})]})}},t);case"input_tools":return(0,a.jsx)(R.Wi,{control:e.form.control,name:"input_tools",render:t=>{let{field:s}=t;return(0,a.jsxs)(R.xJ,{className:"flex flex-col gap-2 my-2",children:[(0,a.jsx)(R.lX,{children:"Restrict Input Tools"}),(0,a.jsxs)(R.pf,{children:["Which knowledge retrieval tools should this agent be limited to?",(0,a.jsx)("br",{}),(0,a.jsx)("b",{children:"Default:"})," No limitations."]}),(0,a.jsxs)(A,{children:[(0,a.jsxs)(D,{className:"flex items-center justify-between text-sm gap-2 bg-muted p-2 rounded-lg",children:[(0,a.jsx)(v.K,{}),s.value&&s.value.length>0?"".concat(s.value.length," tools selected"):"All tools"]}),(0,a.jsx)(Z,{children:(0,a.jsx)(Y.mY,{children:(0,a.jsx)(Y.e8,{children:(0,a.jsx)(Y.fu,{children:Object.entries(e.inputToolOptions).map(t=>{let[l,r]=t;return(0,a.jsxs)(Y.di,{value:l,onSelect:()=>{let t=e.form.getValues("input_tools")||[],s=t.includes(l)?t.filter(e=>e!==l):[...t,l];e.form.setValue("input_tools",s)},children:[(0,a.jsx)(y.J,{className:(0,X.cn)("mr-2 h-4 w-4",s.value&&s.value.includes(l)?"opacity-100":"opacity-0")}),(0,a.jsxs)("div",{className:(0,X.cn)("flex items-center space-x-2"),children:[(0,a.jsx)("p",{children:(0,a.jsx)("b",{children:l})}),(0,a.jsx)("p",{children:r})]})]},l)})})})})})]})]})}},t);case"output_modes":return(0,a.jsx)(R.Wi,{control:e.form.control,name:"output_modes",render:t=>{let{field:s}=t;return(0,a.jsxs)(R.xJ,{className:"flex flex-col gap-2 my-2",children:[(0,a.jsx)(R.lX,{children:"Restrict Output Modes"}),(0,a.jsxs)(R.pf,{children:["Which output modes should this agent be limited to?",(0,a.jsx)("br",{}),(0,a.jsx)("b",{children:"Default:"})," No limitations."]}),(0,a.jsxs)(A,{children:[(0,a.jsxs)(D,{className:"flex items-center justify-between text-sm gap-2 bg-muted p-2 rounded-lg",children:[(0,a.jsx)(v.K,{}),s.value&&s.value.length>0?"".concat(s.value.length," modes selected"):"All modes"]}),(0,a.jsx)(Z,{children:(0,a.jsx)(Y.mY,{children:(0,a.jsx)(Y.e8,{children:(0,a.jsx)(Y.fu,{children:Object.entries(e.outputModeOptions).map(t=>{let[l,r]=t;return(0,a.jsxs)(Y.di,{value:l,onSelect:()=>{let t=e.form.getValues("output_modes")||[],s=t.includes(l)?t.filter(e=>e!==l):[...t,l];e.form.setValue("output_modes",s)},children:[(0,a.jsx)(y.J,{className:(0,X.cn)("mr-2 h-4 w-4",s.value&&s.value.includes(l)?"opacity-100":"opacity-0")}),(0,a.jsxs)("div",{className:(0,X.cn)("flex items-center space-x-2"),children:[(0,a.jsx)("p",{children:(0,a.jsx)("b",{children:l})}),(0,a.jsx)("p",{children:r})]})]},l)})})})})})]})]})}},t);default:return null}};return(0,a.jsxs)(R.l0,{...e.form,children:[(0,a.jsx)(el.x,{className:"h-full",children:(0,a.jsxs)("form",{onSubmit:e.form.handleSubmit(ex),className:"space-y-6 pb-4 px-4 h-full flex flex-col justify-between",children:[(0,a.jsxs)(ee,{defaultValue:"basic",value:er[J].tabName,children:[(0,a.jsx)(et,{className:"grid grid-cols-2 md:grid-cols-4 gap-2 h-fit",children:er.map(e=>(0,a.jsxs)(es,{value:e.tabName,className:"text-center ".concat(ep(e)?"":"text-red-500"),onClick:()=>M(er.findIndex(t=>t.tabName===e.tabName)),children:[e.label," ",!ep(e)&&"*"]},e.tabName))}),er.map(e=>(0,a.jsx)(ea,{value:e.tabName,children:e.fields.map(e=>ej(e.name))},e.tabName))]}),e.errors&&(0,a.jsx)(O.bZ,{className:"bg-secondary border-none my-4",children:(0,a.jsxs)(O.X,{className:"flex items-center gap-1",children:[(0,a.jsx)(w.f,{weight:"fill",className:"h-4 w-4 text-yellow-400 inline"}),(0,a.jsx)("span",{children:e.errors})]})})]})}),(0,a.jsxs)("div",{className:"flex justify-between mt-1 left-0 right-0 bg-background p-1",children:[(0,a.jsxs)(i.z,{type:"button",variant:"outline",onClick:e=>{e.preventDefault(),J>0&&M(J-1)},disabled:0===J,className:"items-center ".concat(t?"bg-stone-100 dark:bg-neutral-900":""," text-white ").concat(o),children:[(0,a.jsx)(k.X,{className:"mr-2 h-4 w-4"}),"Previous"]}),J<er.length-1?(0,a.jsxs)(i.z,{type:"button",variant:"outline",onClick:e=>{e.preventDefault(),J<er.length-1&&M(J+1)},disabled:!ep(er[J]),className:"items-center ".concat(t?"bg-stone-100 dark:bg-neutral-900":""," text-white ").concat(o),children:["Continue",(0,a.jsx)(_.o,{className:"ml-2 h-4 w-4"})]}):(0,a.jsxs)(i.z,{type:"submit",variant:"outline",disabled:t,onClick:e.form.handleSubmit(ex),className:"items-center ".concat(t?"bg-stone-100 dark:bg-neutral-900":""," text-white ").concat(o),children:[(0,a.jsx)(C.B,{className:"h-4 w-4 mr-2"}),t?"Booting...":"Save"]})]})]})}},97673:function(e,t,s){"use strict";s.d(t,{Z:function(){return c}});var a=s(57437),l=s(26110),r=s(62869),n=s(95186),i=s(26815),o=s(92457);function c(e){var t;return(0,a.jsxs)(l.Vq,{children:[(0,a.jsx)(l.hg,{asChild:!0,onClick:e.onShare,children:(0,a.jsxs)(r.z,{size:"sm",className:"".concat(e.buttonClassName||"px-3"),variant:null!==(t=e.buttonVariant)&&void 0!==t?t:"default",children:[e.includeIcon&&(0,a.jsx)(o.m,{className:"w-4 h-4 mr-2"}),e.buttonTitle]})}),(0,a.jsxs)(l.cZ,{children:[(0,a.jsxs)(l.fK,{children:[(0,a.jsx)(l.$N,{children:e.title}),(0,a.jsx)(l.Be,{children:e.description})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsxs)("div",{className:"grid flex-1 gap-2",children:[(0,a.jsx)(i._,{htmlFor:"link",className:"sr-only",children:"Link"}),(0,a.jsx)(n.I,{id:"link",defaultValue:e.url,readOnly:!0})]}),(0,a.jsx)(r.z,{type:"submit",size:"sm",className:"px-3",onClick:()=>(function(e){let t=navigator.clipboard;t&&t.writeText(e)})(e.url),children:(0,a.jsx)("span",{children:"Copy"})})]})]})]})}},65613:function(e,t,s){"use strict";s.d(t,{X:function(){return c},bZ:function(){return o}});var a=s(57437),l=s(2265),r=s(90535),n=s(94508);let i=(0,r.j)("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),o=l.forwardRef((e,t)=>{let{className:s,variant:l,...r}=e;return(0,a.jsx)("div",{ref:t,role:"alert",className:(0,n.cn)(i({variant:l}),s),...r})});o.displayName="Alert",l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)("h5",{ref:t,className:(0,n.cn)("mb-1 font-medium leading-none tracking-tight",s),...l})}).displayName="AlertTitle";let c=l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)("div",{ref:t,className:(0,n.cn)("text-sm [&_p]:leading-relaxed",s),...l})});c.displayName="AlertDescription"},15681:function(e,t,s){"use strict";s.d(t,{NI:function(){return p},Wi:function(){return u},l0:function(){return c},lX:function(){return f},pf:function(){return j},xJ:function(){return x},zG:function(){return g}});var a=s(57437),l=s(2265),r=s(37053),n=s(29501),i=s(94508),o=s(26815);let c=n.RV,d=l.createContext({}),u=e=>{let{...t}=e;return(0,a.jsx)(d.Provider,{value:{name:t.name},children:(0,a.jsx)(n.Qr,{...t})})},m=()=>{let e=l.useContext(d),t=l.useContext(h),{getFieldState:s,formState:a}=(0,n.Gc)(),r=s(e.name,a);if(!e)throw Error("useFormField should be used within <FormField>");let{id:i}=t;return{id:i,name:e.name,formItemId:"".concat(i,"-form-item"),formDescriptionId:"".concat(i,"-form-item-description"),formMessageId:"".concat(i,"-form-item-message"),...r}},h=l.createContext({}),x=l.forwardRef((e,t)=>{let{className:s,...r}=e,n=l.useId();return(0,a.jsx)(h.Provider,{value:{id:n},children:(0,a.jsx)("div",{ref:t,className:(0,i.cn)("space-y-2",s),...r})})});x.displayName="FormItem";let f=l.forwardRef((e,t)=>{let{className:s,...l}=e,{error:r,formItemId:n}=m();return(0,a.jsx)(o._,{ref:t,className:(0,i.cn)(r&&"text-destructive",s),htmlFor:n,...l})});f.displayName="FormLabel";let p=l.forwardRef((e,t)=>{let{...s}=e,{error:l,formItemId:n,formDescriptionId:i,formMessageId:o}=m();return(0,a.jsx)(r.g7,{ref:t,id:n,"aria-describedby":l?"".concat(i," ").concat(o):"".concat(i),"aria-invalid":!!l,...s})});p.displayName="FormControl";let j=l.forwardRef((e,t)=>{let{className:s,...l}=e,{formDescriptionId:r}=m();return(0,a.jsx)("p",{ref:t,id:r,className:(0,i.cn)("text-sm text-muted-foreground",s),...l})});j.displayName="FormDescription";let g=l.forwardRef((e,t)=>{let{className:s,children:l,...r}=e,{error:n,formMessageId:o}=m(),c=n?String(null==n?void 0:n.message):l;return c?(0,a.jsx)("p",{ref:t,id:o,className:(0,i.cn)("text-sm font-medium text-destructive",s),...r,children:c}):null});g.displayName="FormMessage"},26815:function(e,t,s){"use strict";s.d(t,{_:function(){return c}});var a=s(57437),l=s(2265),r=s(6394),n=s(90535),i=s(94508);let o=(0,n.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),c=l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)(r.f,{ref:t,className:(0,i.cn)(o(),s),...l})});c.displayName=r.f.displayName},53647:function(e,t,s){"use strict";s.d(t,{Bw:function(){return f},Ph:function(){return d},Ql:function(){return p},i4:function(){return m},ki:function(){return u}});var a=s(57437),l=s(2265),r=s(56873),n=s(40875),i=s(22135),o=s(30401),c=s(94508);let d=r.fC;r.ZA;let u=r.B4,m=l.forwardRef((e,t)=>{let{className:s,children:l,...i}=e;return(0,a.jsxs)(r.xz,{ref:t,className:(0,c.cn)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",s),...i,children:[l,(0,a.jsx)(r.JO,{asChild:!0,children:(0,a.jsx)(n.Z,{className:"h-4 w-4 opacity-50"})})]})});m.displayName=r.xz.displayName;let h=l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)(r.u_,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",s),...l,children:(0,a.jsx)(i.Z,{className:"h-4 w-4"})})});h.displayName=r.u_.displayName;let x=l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)(r.$G,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",s),...l,children:(0,a.jsx)(n.Z,{className:"h-4 w-4"})})});x.displayName=r.$G.displayName;let f=l.forwardRef((e,t)=>{let{className:s,children:l,position:n="popper",...i}=e;return(0,a.jsx)(r.h_,{children:(0,a.jsxs)(r.VY,{ref:t,className:(0,c.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===n&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",s),position:n,...i,children:[(0,a.jsx)(h,{}),(0,a.jsx)(r.l_,{className:(0,c.cn)("p-1","popper"===n&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:l}),(0,a.jsx)(x,{})]})})});f.displayName=r.VY.displayName,l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)(r.__,{ref:t,className:(0,c.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",s),...l})}).displayName=r.__.displayName;let p=l.forwardRef((e,t)=>{let{className:s,children:l,...n}=e;return(0,a.jsxs)(r.ck,{ref:t,className:(0,c.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),...n,children:[(0,a.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,a.jsx)(r.wU,{children:(0,a.jsx)(o.Z,{className:"h-4 w-4"})})}),(0,a.jsx)(r.eT,{children:l})]})});p.displayName=r.ck.displayName,l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)(r.Z0,{ref:t,className:(0,c.cn)("-mx-1 my-1 h-px bg-muted",s),...l})}).displayName=r.Z0.displayName},71159:function(e){e.exports={agentPersonality:"agentCard_agentPersonality__MmRlN",infoButton:"agentCard_infoButton__heh_w"}}}]);
|
khoj/interface/compiled/_next/static/chunks/{5477-ca75f51d5d37d614.js → 5477-060a89922423c280.js}
RENAMED
@@ -1 +1 @@
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5477],{5477:function(e,t,a){"use strict";a.d(t,{$:function(){return r},a:function(){return O}});var s,r,n=a(57437),l=a(26442),o=a.n(l),i=a(2265),c=a(18848);a(2446);var d=a(12144),u=a(10107),h=a(19715),f=a(35849),g=a(4203),x=a(51549),m=a(62340),p=a(23518),j=a(37099),b=a(62869),v=a(32759),w=a(57054),y=a(27312),N=a(76818),k=a(81103),C=a(84671),E=a(33494),D=a(14308),S=a(42225),M=a(59199),R=a(7436),T=a(26110),z=a(19378);(s=r||(r={})).MESSAGE="message",s.FILE="file",s.RESEARCH="research";let O=(0,i.forwardRef)((e,t)=>{let[a,s]=(0,i.useState)(""),r=(0,i.useRef)(null),l=(0,i.useRef)(null),O=(0,i.useRef)(null),[A,I]=(0,i.useState)(null),[L,_]=(0,i.useState)(null),[P,F]=(0,i.useState)(!1),[W,U]=(0,i.useState)(null),[$,H]=(0,i.useState)(!1),[J,B]=(0,i.useState)(!1),[K,Y]=(0,i.useState)([]),[Z,X]=(0,i.useState)([]),[q,G]=(0,i.useState)(null),[V,Q]=(0,i.useState)([]),[ee,et]=(0,i.useState)(!1),[ea,es]=(0,i.useState)(null),[er,en]=(0,i.useState)(0),[el,eo]=(0,i.useState)(!1),[ei,ec]=(0,i.useState)(!1),[ed,eu]=(0,i.useState)(e.isResearchModeEnabled||!1);function eh(){if(J&&(B(!1),Y([]),Z.forEach(t=>e.sendImage(t))),!a.trim())return;if(!e.isLoggedIn){U("Hey there, you need to be signed in to send messages to Khoj AI"),H(!0);return}let t=a.trim(),r=e.chatOptionsData&&Object.keys(e.chatOptionsData).some(e=>t.startsWith("/".concat(e)));ed&&!r&&(t="/research ".concat(t)),e.sendMessage(t),G(null),Q([]),s("")}function ef(a){var s,r;if(!e.isLoggedIn){U("Please login to chat with your files"),H(!0);return}let n=["jpg","jpeg","png","webp"],l=[];for(let e=0;e<a.length;e++){let t=a[e],s=t.name.split(".").pop();n.includes(s||"")&&l.push(c.Z.sanitize(URL.createObjectURL(t)))}l.length>0&&(B(!0),Y(e=>[...e,...l]),null==t||null===(r=t.current)||void 0===r||r.focus());let o=Array.from(a).filter(e=>!n.includes(e.name.split(".").pop()||"")),i=o?Array.from(o).concat(Array.from(q||[])):Array.from(q||[]);if(i.length>0){for(let e=0;e<i.length;e++)if(i[e].size>10485760){I("File ".concat(i[e].name," is too large. Please upload files smaller than 10 MB."));return}let t=new DataTransfer;i.forEach(e=>t.items.add(e)),eg(t.files).then(a=>{e.setUploadedFiles(a),G(t.files),Q(a)})}null==t||null===(s=t.current)||void 0===s||s.focus()}async function eg(e){let t=await (0,M.M1)(e);F(!0);try{let e=await fetch("/api/content/convert",{method:"POST",body:t});if(F(!1),!e.ok)throw Error("HTTP error! status: ".concat(e.status));return await e.json()}catch(e){return _("Error converting files. "+e+". Please try again, or contact team@khoj.dev if the issue persists."),console.error("Error converting files:",e),[]}}async function ex(){try{let e=await navigator.mediaDevices.getUserMedia({audio:!0}),t=new MediaRecorder(e,{mimeType:"audio/webm"}),a=[];t.ondataavailable=async e=>{a.push(e.data);let t=new Blob(a,{type:"audio/webm"}),r=new FormData;r.append("file",t);try{let e=await fetch("/api/transcribe",{method:"POST",body:r});if(!e.ok)throw Error("Network response was not ok");let t=await e.json();s(t.text.trim())}catch(e){console.error("Error sending audio to server:",e)}},t.start(1500),t.onstop=async()=>{let e=new Blob(a,{type:"audio/webm"}),r=new FormData;r.append("file",e);try{let e=await fetch("/api/transcribe",{method:"POST",body:r});if(!e.ok)throw Error("Network response was not ok");let a=await e.json();t.stream.getTracks().forEach(e=>e.stop()),es(null),s(a.text.trim())}catch(e){console.error("Error sending audio to server:",e)}},es(t)}catch(e){console.error("Error getting microphone",e)}}return(0,i.useEffect)(()=>{if(P||en(0),P){let e=setInterval(()=>{en(e=>{let t=e+(Math.floor(5*Math.random())+1);return t<100?t:100})},800);return()=>clearInterval(e)}},[P]),(0,i.useEffect)(()=>{var a;void 0!==e.prefillMessage&&(s(e.prefillMessage),null==t||null===(a=t.current)||void 0===a||a.focus())},[e.prefillMessage]),(0,i.useEffect)(()=>{var a,s,r;"message"===e.focus?null==t||null===(a=t.current)||void 0===a||a.focus():"file"===e.focus?null===(s=l.current)||void 0===s||s.focus():"research"===e.focus&&(null===(r=O.current)||void 0===r||r.focus())},[e.focus]),(0,i.useEffect)(()=>{async function e(){K.length>0&&X(await Promise.all(K.map(async e=>{let t=await fetch(e),a=await t.blob();return new Promise(e=>{let t=new FileReader;t.onload=()=>e(t.result),t.readAsDataURL(a)})}))),F(!1)}F(!0),e()},[K]),(0,i.useEffect)(()=>{e.isResearchModeEnabled&&eu(e.isResearchModeEnabled)},[e.isResearchModeEnabled]),(0,i.useEffect)(()=>{!ee&&ea&&ea.stop(),ee&&!ea&&ex()},[ee,ea]),(0,i.useEffect)(()=>{(null==t?void 0:t.current)&&(t.current.style.height="auto",t.current.style.height=Math.max(t.current.scrollHeight-24,64)+"px",a.startsWith("/")&&1===a.split(" ").length?ec(!0):ec(!1))},[a]),(0,n.jsxs)(n.Fragment,{children:[$&&W&&(0,n.jsx)(E.Z,{onOpenChange:H,isMobileWidth:e.isMobileWidth}),P&&(0,n.jsx)(j.aR,{open:P,children:(0,n.jsxs)(j._T,{children:[(0,n.jsx)(j.fY,{children:(0,n.jsx)(j.f$,{children:"Uploading data. Please wait."})}),(0,n.jsx)(j.yT,{children:(0,n.jsx)(v.E,{indicatorColor:"bg-slate-500",className:"w-full h-2 rounded-full",value:er})}),(0,n.jsx)(j.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>F(!1),children:"Dismiss"})]})}),A&&(0,n.jsx)(j.aR,{open:null!==A,children:(0,n.jsxs)(j._T,{children:[(0,n.jsx)(j.fY,{children:(0,n.jsx)(j.f$,{children:"Data Upload Warning"})}),(0,n.jsx)(j.yT,{children:A}),(0,n.jsx)(j.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>I(null),children:"Close"})]})}),L&&(0,n.jsx)(j.aR,{open:null!==L,children:(0,n.jsxs)(j._T,{children:[(0,n.jsxs)(j.fY,{children:[(0,n.jsx)(j.f$,{children:"Oh no!"}),(0,n.jsx)(j.yT,{children:"Something went wrong while uploading your data"})]}),(0,n.jsx)(j.yT,{children:L}),(0,n.jsx)(j.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>_(null),children:"Close"})]})}),ei&&(0,n.jsx)("div",{className:"flex justify-center text-center",children:(0,n.jsxs)(w.J2,{open:ei,onOpenChange:ec,children:[(0,n.jsx)(y.xo,{className:"flex justify-center text-center"}),(0,n.jsx)(w.yk,{onOpenAutoFocus:e=>e.preventDefault(),className:"".concat(e.isMobileWidth?"w-[100vw]":"w-full"," rounded-md"),side:"bottom",align:"center",sideOffset:e.conversationId?0:80,alignOffset:0,children:(0,n.jsxs)(p.mY,{className:"max-w-full",children:[(0,n.jsx)(p.sZ,{placeholder:"Type a command or search...",value:a,className:"hidden"}),(0,n.jsxs)(p.e8,{children:[(0,n.jsx)(p.rb,{children:"No matching commands."}),(0,n.jsx)(p.fu,{heading:"Agent Tools",children:e.chatOptionsData&&Object.entries(e.chatOptionsData).map(e=>{let[t,a]=e;return(0,n.jsx)(p.di,{className:"text-md",onSelect:()=>{s("/".concat(t," "))},children:(0,n.jsxs)("div",{className:"grid grid-cols-1 gap-1",children:[(0,n.jsxs)("div",{className:"font-bold flex items-center",children:[(0,S.vH)(t,"h-4 w-4 mr-2"),"/",t]}),(0,n.jsx)("div",{children:a})]})},t)})}),(0,n.jsx)(p.zz,{})]})]})})]})}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 overflow-x-auto",children:[J&&K.map((e,t)=>(0,n.jsxs)("div",{className:"relative flex-shrink-0 pb-3 pt-2 group",children:[(0,n.jsx)("img",{src:e,alt:"img-".concat(t),className:"w-auto h-16 object-cover rounded-xl"}),(0,n.jsx)(b.z,{variant:"ghost",size:"icon",className:"absolute -top-0 -right-2 h-5 w-5 rounded-full bg-neutral-200 dark:bg-neutral-600 hover:bg-neutral-300 dark:hover:bg-neutral-500 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>{Y(e=>e.filter((e,a)=>a!==t)),X(e=>e.filter((e,a)=>a!==t)),1===K.length&&B(!1)},children:(0,n.jsx)(d.X,{className:"h-3 w-3"})})]},t)),V&&Array.from(V).map((t,a)=>(0,n.jsxs)(T.Vq,{children:[(0,n.jsx)(T.hg,{asChild:!0,children:(0,n.jsxs)("div",{className:"relative flex-shrink-0 p-2 group",children:[(0,n.jsx)("div",{className:"w-auto h-16 object-cover rounded-xl ".concat(e.agentColor?(0,C.tp)(e.agentColor):"bg-orange-300 hover:bg-orange-500"," bg-opacity-15"),children:(0,n.jsxs)("div",{className:"flex p-2 flex-col justify-start items-start h-full",children:[(0,n.jsx)("span",{className:"text-sm font-bold text-neutral-500 dark:text-neutral-400 text-ellipsis truncate max-w-[200px] break-words",children:t.name}),(0,n.jsxs)("span",{className:"flex items-center gap-1",children:[(0,S.Le)(t.file_type),(0,n.jsx)("span",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:(0,R.xq)(t.size)})]})]})}),(0,n.jsx)(b.z,{variant:"ghost",size:"icon",className:"absolute -top-0 -right-2 h-5 w-5 rounded-full bg-neutral-200 dark:bg-neutral-600 hover:bg-neutral-300 dark:hover:bg-neutral-500 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>{G(a=>{let s=t.name;if(!a)return null;let r=Array.from(a).filter(e=>e.name!==s),n=new DataTransfer;r.forEach(e=>n.items.add(e));let l=V.filter(e=>e.name!==s);return e.setUploadedFiles(l),Q(l),n.files})},children:(0,n.jsx)(d.X,{className:"h-3 w-3"})})]},a)}),(0,n.jsxs)(T.cZ,{children:[(0,n.jsx)(T.fK,{children:(0,n.jsx)(T.$N,{children:t.name})}),(0,n.jsx)(T.Be,{children:(0,n.jsx)(z.x,{className:"h-72 w-full rounded-md",children:t.content})})]})]},a))]}),(0,n.jsxs)("div",{className:"".concat(o().actualInputArea," justify-between dark:bg-neutral-700 relative ").concat(el&&"animate-pulse"),onDragOver:function(e){e.preventDefault(),eo(!0)},onDragLeave:function(e){e.preventDefault(),eo(!1)},onDrop:function(e){e.preventDefault(),eo(!1),e.dataTransfer.files&&ef(e.dataTransfer.files)},children:[(0,n.jsx)("input",{type:"file",accept:".pdf,.doc,.docx,.txt,.md,.org,.jpg,.jpeg,.png,.webp,.py,.js,.json,.html,.css",multiple:!0,ref:r,onChange:function(e){e.target.files&&ef(e.target.files)},style:{display:"none"}}),(0,n.jsx)("div",{className:"flex items-center",children:(0,n.jsx)(k.pn,{children:(0,n.jsxs)(k.u,{children:[(0,n.jsx)(k.aJ,{asChild:!0,children:(0,n.jsx)(b.z,{variant:"ghost",className:"!bg-none p-0 m-2 h-auto text-3xl rounded-full text-gray-300 hover:text-gray-500",disabled:e.sendDisabled||!e.isLoggedIn,onClick:function(){r.current&&r.current.click()},ref:l,children:(0,n.jsx)(u.p,{className:"w-8 h-8"})})}),(0,n.jsx)(k._v,{children:"Attach a PDF, plain text file, or image"})]})})}),(0,n.jsx)("div",{className:"flex-grow flex flex-col w-full gap-1.5 relative",children:(0,n.jsx)(N.g,{ref:t,className:"border-none focus:border-none\n focus:outline-none focus-visible:ring-transparent\n w-full h-16 min-h-16 max-h-[128px] md:py-4 rounded-lg resize-none dark:bg-neutral-700\n ".concat(e.isMobileWidth?"text-md":"text-lg"),placeholder:"Type / to see a list of commands",id:"message",autoFocus:!0,value:a,onKeyDown:t=>{"Enter"!==t.key||t.shiftKey||e.isMobileWidth||e.sendDisabled||(B(!1),Y([]),t.preventDefault(),eh())},onChange:e=>s(e.target.value),disabled:ee})}),(0,n.jsxs)("div",{className:"flex items-end pb-2",children:[ee?(0,n.jsx)(k.pn,{children:(0,n.jsxs)(k.u,{children:[(0,n.jsx)(k.aJ,{asChild:!0,children:(0,n.jsx)(b.z,{variant:"default",className:"".concat(!ee&&"hidden"," ").concat(e.agentColor?(0,C.tp)(e.agentColor):"bg-orange-300 hover:bg-orange-500"," rounded-full p-1 m-2 h-auto text-3xl transition transform md:hover:-translate-y-1"),onClick:()=>{et(!ee)},disabled:e.sendDisabled||!e.isLoggedIn,children:(0,n.jsx)(h.d,{weight:"fill",className:"w-6 h-6"})})}),(0,n.jsx)(k._v,{children:"Click to stop recording and transcribe your voice."})]})}):ea?(0,n.jsx)(D.l,{}):(0,n.jsx)(k.pn,{children:(0,n.jsxs)(k.u,{children:[(0,n.jsx)(k.aJ,{asChild:!0,children:e.sendDisabled?(0,n.jsx)(b.z,{variant:"default",className:"".concat(e.agentColor?(0,C.tp)(e.agentColor):"bg-orange-300 hover:bg-orange-500"," rounded-full p-1 m-2 h-auto text-3xl transition transform md:hover:-translate-y-1"),onClick:()=>{e.setTriggeredAbort(!0)},children:(0,n.jsx)(h.d,{weight:"fill",className:"w-6 h-6"})}):(0,n.jsx)(b.z,{variant:"default",className:"".concat(!a||ee||"hidden"," ").concat(e.agentColor?(0,C.tp)(e.agentColor):"bg-orange-300 hover:bg-orange-500"," rounded-full p-1 m-2 h-auto text-3xl transition transform md:hover:-translate-y-1"),disabled:e.sendDisabled||!e.isLoggedIn,onClick:()=>{s("Listening..."),et(!ee)},children:(0,n.jsx)(f.P,{weight:"fill",className:"w-6 h-6"})})}),(0,n.jsx)(k._v,{children:e.sendDisabled?"Click here to stop the streaming.":"Click to transcribe your message with voice."})]})}),(0,n.jsx)(b.z,{className:"".concat((!a||ee||e.sendDisabled)&&"hidden"," ").concat(e.agentColor?(0,C.tp)(e.agentColor):"bg-orange-300 hover:bg-orange-500"," rounded-full p-1 m-2 h-auto text-3xl transition transform md:hover:-translate-y-1"),disabled:e.sendDisabled||!e.isLoggedIn,onClick:eh,children:(0,n.jsx)(g.a,{className:"w-6 h-6",weight:"bold"})})]})]}),(0,n.jsx)(k.pn,{children:(0,n.jsxs)(k.u,{children:[(0,n.jsx)(k.aJ,{asChild:!0,children:(0,n.jsxs)(b.z,{variant:"ghost",className:"float-right justify-center gap-1 flex items-center p-1.5 mr-2 h-fit",disabled:e.sendDisabled||!e.isLoggedIn,ref:O,onClick:()=>{var e;eu(!ed),null==t||null===(e=t.current)||void 0===e||e.focus()},children:[(0,n.jsx)("span",{className:"text-muted-foreground text-sm",children:"Research Mode"}),ed?(0,n.jsx)(x.W,{weight:"fill",className:"w-6 h-6 inline-block ".concat(e.agentColor?(0,C.oz)(e.agentColor):(0,C.oz)("orange")," rounded-full")}):(0,n.jsx)(m.$,{weight:"fill",className:"w-6 h-6 inline-block ".concat((0,C.oz)("gray")," rounded-full")})]})}),(0,n.jsx)(k._v,{className:"text-xs",children:"Research Mode allows you to get more deeply researched, detailed responses. Response times may be longer."})]})})]})]})});O.displayName="ChatInputArea"},32759:function(e,t,a){"use strict";a.d(t,{E:function(){return o}});var s=a(57437),r=a(2265),n=a(60610),l=a(94508);let o=r.forwardRef((e,t)=>{let{className:a,value:r,indicatorColor:o,...i}=e;return(0,s.jsx)(n.fC,{ref:t,className:(0,l.cn)("relative h-4 w-full overflow-hidden rounded-full bg-secondary",a),...i,children:(0,s.jsx)(n.z$,{className:"h-full w-full flex-1 bg-primary transition-all ".concat(o),style:{transform:"translateX(-".concat(100-(r||0),"%)")}})})});o.displayName=n.fC.displayName},76818:function(e,t,a){"use strict";a.d(t,{g:function(){return l}});var s=a(57437),r=a(2265),n=a(94508);let l=r.forwardRef((e,t)=>{let{className:a,...r}=e;return(0,s.jsx)("textarea",{className:(0,n.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",a),ref:t,...r})});l.displayName="Textarea"},26442:function(e){e.exports={actualInputArea:"chatInputArea_actualInputArea__Ha6cN"}}}]);
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5477],{5477:function(e,t,a){"use strict";a.d(t,{$:function(){return r},a:function(){return O}});var s,r,n=a(57437),l=a(26442),o=a.n(l),i=a(2265),c=a(18848);a(2446);var d=a(12144),u=a(10107),h=a(19715),f=a(35849),g=a(4203),x=a(51549),m=a(62340),p=a(23518),j=a(37099),b=a(62869),v=a(32759),w=a(57054),y=a(27312),N=a(76818),k=a(81103),C=a(84671),E=a(39535),D=a(14308),S=a(42225),M=a(59199),R=a(7436),T=a(26110),z=a(19378);(s=r||(r={})).MESSAGE="message",s.FILE="file",s.RESEARCH="research";let O=(0,i.forwardRef)((e,t)=>{let[a,s]=(0,i.useState)(""),r=(0,i.useRef)(null),l=(0,i.useRef)(null),O=(0,i.useRef)(null),[A,I]=(0,i.useState)(null),[L,_]=(0,i.useState)(null),[P,F]=(0,i.useState)(!1),[W,U]=(0,i.useState)(null),[$,H]=(0,i.useState)(!1),[J,B]=(0,i.useState)(!1),[K,Y]=(0,i.useState)([]),[Z,X]=(0,i.useState)([]),[q,G]=(0,i.useState)(null),[V,Q]=(0,i.useState)([]),[ee,et]=(0,i.useState)(!1),[ea,es]=(0,i.useState)(null),[er,en]=(0,i.useState)(0),[el,eo]=(0,i.useState)(!1),[ei,ec]=(0,i.useState)(!1),[ed,eu]=(0,i.useState)(e.isResearchModeEnabled||!1);function eh(){if(J&&(B(!1),Y([]),Z.forEach(t=>e.sendImage(t))),!a.trim())return;if(!e.isLoggedIn){U("Hey there, you need to be signed in to send messages to Khoj AI"),H(!0);return}let t=a.trim(),r=e.chatOptionsData&&Object.keys(e.chatOptionsData).some(e=>t.startsWith("/".concat(e)));ed&&!r&&(t="/research ".concat(t)),e.sendMessage(t),G(null),Q([]),s("")}function ef(a){var s,r;if(!e.isLoggedIn){U("Please login to chat with your files"),H(!0);return}let n=["jpg","jpeg","png","webp"],l=[];for(let e=0;e<a.length;e++){let t=a[e],s=t.name.split(".").pop();n.includes(s||"")&&l.push(c.Z.sanitize(URL.createObjectURL(t)))}l.length>0&&(B(!0),Y(e=>[...e,...l]),null==t||null===(r=t.current)||void 0===r||r.focus());let o=Array.from(a).filter(e=>!n.includes(e.name.split(".").pop()||"")),i=o?Array.from(o).concat(Array.from(q||[])):Array.from(q||[]);if(i.length>0){for(let e=0;e<i.length;e++)if(i[e].size>10485760){I("File ".concat(i[e].name," is too large. Please upload files smaller than 10 MB."));return}let t=new DataTransfer;i.forEach(e=>t.items.add(e)),eg(t.files).then(a=>{e.setUploadedFiles(a),G(t.files),Q(a)})}null==t||null===(s=t.current)||void 0===s||s.focus()}async function eg(e){let t=await (0,M.M1)(e);F(!0);try{let e=await fetch("/api/content/convert",{method:"POST",body:t});if(F(!1),!e.ok)throw Error("HTTP error! status: ".concat(e.status));return await e.json()}catch(e){return _("Error converting files. "+e+". Please try again, or contact team@khoj.dev if the issue persists."),console.error("Error converting files:",e),[]}}async function ex(){try{let e=await navigator.mediaDevices.getUserMedia({audio:!0}),t=new MediaRecorder(e,{mimeType:"audio/webm"}),a=[];t.ondataavailable=async e=>{a.push(e.data);let t=new Blob(a,{type:"audio/webm"}),r=new FormData;r.append("file",t);try{let e=await fetch("/api/transcribe",{method:"POST",body:r});if(!e.ok)throw Error("Network response was not ok");let t=await e.json();s(t.text.trim())}catch(e){console.error("Error sending audio to server:",e)}},t.start(1500),t.onstop=async()=>{let e=new Blob(a,{type:"audio/webm"}),r=new FormData;r.append("file",e);try{let e=await fetch("/api/transcribe",{method:"POST",body:r});if(!e.ok)throw Error("Network response was not ok");let a=await e.json();t.stream.getTracks().forEach(e=>e.stop()),es(null),s(a.text.trim())}catch(e){console.error("Error sending audio to server:",e)}},es(t)}catch(e){console.error("Error getting microphone",e)}}return(0,i.useEffect)(()=>{if(P||en(0),P){let e=setInterval(()=>{en(e=>{let t=e+(Math.floor(5*Math.random())+1);return t<100?t:100})},800);return()=>clearInterval(e)}},[P]),(0,i.useEffect)(()=>{var a;void 0!==e.prefillMessage&&(s(e.prefillMessage),null==t||null===(a=t.current)||void 0===a||a.focus())},[e.prefillMessage]),(0,i.useEffect)(()=>{var a,s,r;"message"===e.focus?null==t||null===(a=t.current)||void 0===a||a.focus():"file"===e.focus?null===(s=l.current)||void 0===s||s.focus():"research"===e.focus&&(null===(r=O.current)||void 0===r||r.focus())},[e.focus]),(0,i.useEffect)(()=>{async function e(){K.length>0&&X(await Promise.all(K.map(async e=>{let t=await fetch(e),a=await t.blob();return new Promise(e=>{let t=new FileReader;t.onload=()=>e(t.result),t.readAsDataURL(a)})}))),F(!1)}F(!0),e()},[K]),(0,i.useEffect)(()=>{e.isResearchModeEnabled&&eu(e.isResearchModeEnabled)},[e.isResearchModeEnabled]),(0,i.useEffect)(()=>{!ee&&ea&&ea.stop(),ee&&!ea&&ex()},[ee,ea]),(0,i.useEffect)(()=>{(null==t?void 0:t.current)&&(t.current.style.height="auto",t.current.style.height=Math.max(t.current.scrollHeight-24,64)+"px",a.startsWith("/")&&1===a.split(" ").length?ec(!0):ec(!1))},[a]),(0,n.jsxs)(n.Fragment,{children:[$&&W&&(0,n.jsx)(E.Z,{onOpenChange:H,isMobileWidth:e.isMobileWidth}),P&&(0,n.jsx)(j.aR,{open:P,children:(0,n.jsxs)(j._T,{children:[(0,n.jsx)(j.fY,{children:(0,n.jsx)(j.f$,{children:"Uploading data. Please wait."})}),(0,n.jsx)(j.yT,{children:(0,n.jsx)(v.E,{indicatorColor:"bg-slate-500",className:"w-full h-2 rounded-full",value:er})}),(0,n.jsx)(j.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>F(!1),children:"Dismiss"})]})}),A&&(0,n.jsx)(j.aR,{open:null!==A,children:(0,n.jsxs)(j._T,{children:[(0,n.jsx)(j.fY,{children:(0,n.jsx)(j.f$,{children:"Data Upload Warning"})}),(0,n.jsx)(j.yT,{children:A}),(0,n.jsx)(j.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>I(null),children:"Close"})]})}),L&&(0,n.jsx)(j.aR,{open:null!==L,children:(0,n.jsxs)(j._T,{children:[(0,n.jsxs)(j.fY,{children:[(0,n.jsx)(j.f$,{children:"Oh no!"}),(0,n.jsx)(j.yT,{children:"Something went wrong while uploading your data"})]}),(0,n.jsx)(j.yT,{children:L}),(0,n.jsx)(j.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>_(null),children:"Close"})]})}),ei&&(0,n.jsx)("div",{className:"flex justify-center text-center",children:(0,n.jsxs)(w.J2,{open:ei,onOpenChange:ec,children:[(0,n.jsx)(y.xo,{className:"flex justify-center text-center"}),(0,n.jsx)(w.yk,{onOpenAutoFocus:e=>e.preventDefault(),className:"".concat(e.isMobileWidth?"w-[100vw]":"w-full"," rounded-md"),side:"bottom",align:"center",sideOffset:e.conversationId?0:80,alignOffset:0,children:(0,n.jsxs)(p.mY,{className:"max-w-full",children:[(0,n.jsx)(p.sZ,{placeholder:"Type a command or search...",value:a,className:"hidden"}),(0,n.jsxs)(p.e8,{children:[(0,n.jsx)(p.rb,{children:"No matching commands."}),(0,n.jsx)(p.fu,{heading:"Agent Tools",children:e.chatOptionsData&&Object.entries(e.chatOptionsData).map(e=>{let[t,a]=e;return(0,n.jsx)(p.di,{className:"text-md",onSelect:()=>{s("/".concat(t," "))},children:(0,n.jsxs)("div",{className:"grid grid-cols-1 gap-1",children:[(0,n.jsxs)("div",{className:"font-bold flex items-center",children:[(0,S.vH)(t,"h-4 w-4 mr-2"),"/",t]}),(0,n.jsx)("div",{children:a})]})},t)})}),(0,n.jsx)(p.zz,{})]})]})})]})}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 overflow-x-auto",children:[J&&K.map((e,t)=>(0,n.jsxs)("div",{className:"relative flex-shrink-0 pb-3 pt-2 group",children:[(0,n.jsx)("img",{src:e,alt:"img-".concat(t),className:"w-auto h-16 object-cover rounded-xl"}),(0,n.jsx)(b.z,{variant:"ghost",size:"icon",className:"absolute -top-0 -right-2 h-5 w-5 rounded-full bg-neutral-200 dark:bg-neutral-600 hover:bg-neutral-300 dark:hover:bg-neutral-500 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>{Y(e=>e.filter((e,a)=>a!==t)),X(e=>e.filter((e,a)=>a!==t)),1===K.length&&B(!1)},children:(0,n.jsx)(d.X,{className:"h-3 w-3"})})]},t)),V&&Array.from(V).map((t,a)=>(0,n.jsxs)(T.Vq,{children:[(0,n.jsx)(T.hg,{asChild:!0,children:(0,n.jsxs)("div",{className:"relative flex-shrink-0 p-2 group",children:[(0,n.jsx)("div",{className:"w-auto h-16 object-cover rounded-xl ".concat(e.agentColor?(0,C.tp)(e.agentColor):"bg-orange-300 hover:bg-orange-500"," bg-opacity-15"),children:(0,n.jsxs)("div",{className:"flex p-2 flex-col justify-start items-start h-full",children:[(0,n.jsx)("span",{className:"text-sm font-bold text-neutral-500 dark:text-neutral-400 text-ellipsis truncate max-w-[200px] break-words",children:t.name}),(0,n.jsxs)("span",{className:"flex items-center gap-1",children:[(0,S.Le)(t.file_type),(0,n.jsx)("span",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:(0,R.xq)(t.size)})]})]})}),(0,n.jsx)(b.z,{variant:"ghost",size:"icon",className:"absolute -top-0 -right-2 h-5 w-5 rounded-full bg-neutral-200 dark:bg-neutral-600 hover:bg-neutral-300 dark:hover:bg-neutral-500 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>{G(a=>{let s=t.name;if(!a)return null;let r=Array.from(a).filter(e=>e.name!==s),n=new DataTransfer;r.forEach(e=>n.items.add(e));let l=V.filter(e=>e.name!==s);return e.setUploadedFiles(l),Q(l),n.files})},children:(0,n.jsx)(d.X,{className:"h-3 w-3"})})]},a)}),(0,n.jsxs)(T.cZ,{children:[(0,n.jsx)(T.fK,{children:(0,n.jsx)(T.$N,{children:t.name})}),(0,n.jsx)(T.Be,{children:(0,n.jsx)(z.x,{className:"h-72 w-full rounded-md",children:t.content})})]})]},a))]}),(0,n.jsxs)("div",{className:"".concat(o().actualInputArea," justify-between dark:bg-neutral-700 relative ").concat(el&&"animate-pulse"),onDragOver:function(e){e.preventDefault(),eo(!0)},onDragLeave:function(e){e.preventDefault(),eo(!1)},onDrop:function(e){e.preventDefault(),eo(!1),e.dataTransfer.files&&ef(e.dataTransfer.files)},children:[(0,n.jsx)("input",{type:"file",accept:".pdf,.doc,.docx,.txt,.md,.org,.jpg,.jpeg,.png,.webp,.py,.js,.json,.html,.css",multiple:!0,ref:r,onChange:function(e){e.target.files&&ef(e.target.files)},style:{display:"none"}}),(0,n.jsx)("div",{className:"flex items-center",children:(0,n.jsx)(k.pn,{children:(0,n.jsxs)(k.u,{children:[(0,n.jsx)(k.aJ,{asChild:!0,children:(0,n.jsx)(b.z,{variant:"ghost",className:"!bg-none p-0 m-2 h-auto text-3xl rounded-full text-gray-300 hover:text-gray-500",disabled:e.sendDisabled||!e.isLoggedIn,onClick:function(){r.current&&r.current.click()},ref:l,children:(0,n.jsx)(u.p,{className:"w-8 h-8"})})}),(0,n.jsx)(k._v,{children:"Attach a PDF, plain text file, or image"})]})})}),(0,n.jsx)("div",{className:"flex-grow flex flex-col w-full gap-1.5 relative",children:(0,n.jsx)(N.g,{ref:t,className:"border-none focus:border-none\n focus:outline-none focus-visible:ring-transparent\n w-full h-16 min-h-16 max-h-[128px] md:py-4 rounded-lg resize-none dark:bg-neutral-700\n ".concat(e.isMobileWidth?"text-md":"text-lg"),placeholder:"Type / to see a list of commands",id:"message",autoFocus:!0,value:a,onKeyDown:t=>{"Enter"!==t.key||t.shiftKey||e.isMobileWidth||e.sendDisabled||(B(!1),Y([]),t.preventDefault(),eh())},onChange:e=>s(e.target.value),disabled:ee})}),(0,n.jsxs)("div",{className:"flex items-end pb-2",children:[ee?(0,n.jsx)(k.pn,{children:(0,n.jsxs)(k.u,{children:[(0,n.jsx)(k.aJ,{asChild:!0,children:(0,n.jsx)(b.z,{variant:"default",className:"".concat(!ee&&"hidden"," ").concat(e.agentColor?(0,C.tp)(e.agentColor):"bg-orange-300 hover:bg-orange-500"," rounded-full p-1 m-2 h-auto text-3xl transition transform md:hover:-translate-y-1"),onClick:()=>{et(!ee)},disabled:e.sendDisabled||!e.isLoggedIn,children:(0,n.jsx)(h.d,{weight:"fill",className:"w-6 h-6"})})}),(0,n.jsx)(k._v,{children:"Click to stop recording and transcribe your voice."})]})}):ea?(0,n.jsx)(D.l,{}):(0,n.jsx)(k.pn,{children:(0,n.jsxs)(k.u,{children:[(0,n.jsx)(k.aJ,{asChild:!0,children:e.sendDisabled?(0,n.jsx)(b.z,{variant:"default",className:"".concat(e.agentColor?(0,C.tp)(e.agentColor):"bg-orange-300 hover:bg-orange-500"," rounded-full p-1 m-2 h-auto text-3xl transition transform md:hover:-translate-y-1"),onClick:()=>{e.setTriggeredAbort(!0)},children:(0,n.jsx)(h.d,{weight:"fill",className:"w-6 h-6"})}):(0,n.jsx)(b.z,{variant:"default",className:"".concat(!a||ee||"hidden"," ").concat(e.agentColor?(0,C.tp)(e.agentColor):"bg-orange-300 hover:bg-orange-500"," rounded-full p-1 m-2 h-auto text-3xl transition transform md:hover:-translate-y-1"),disabled:e.sendDisabled||!e.isLoggedIn,onClick:()=>{s("Listening..."),et(!ee)},children:(0,n.jsx)(f.P,{weight:"fill",className:"w-6 h-6"})})}),(0,n.jsx)(k._v,{children:e.sendDisabled?"Click here to stop the streaming.":"Click to transcribe your message with voice."})]})}),(0,n.jsx)(b.z,{className:"".concat((!a||ee||e.sendDisabled)&&"hidden"," ").concat(e.agentColor?(0,C.tp)(e.agentColor):"bg-orange-300 hover:bg-orange-500"," rounded-full p-1 m-2 h-auto text-3xl transition transform md:hover:-translate-y-1"),disabled:e.sendDisabled||!e.isLoggedIn,onClick:eh,children:(0,n.jsx)(g.a,{className:"w-6 h-6",weight:"bold"})})]})]}),(0,n.jsx)(k.pn,{children:(0,n.jsxs)(k.u,{children:[(0,n.jsx)(k.aJ,{asChild:!0,children:(0,n.jsxs)(b.z,{variant:"ghost",className:"float-right justify-center gap-1 flex items-center p-1.5 mr-2 h-fit",disabled:e.sendDisabled||!e.isLoggedIn,ref:O,onClick:()=>{var e;eu(!ed),null==t||null===(e=t.current)||void 0===e||e.focus()},children:[(0,n.jsx)("span",{className:"text-muted-foreground text-sm",children:"Research Mode"}),ed?(0,n.jsx)(x.W,{weight:"fill",className:"w-6 h-6 inline-block ".concat(e.agentColor?(0,C.oz)(e.agentColor):(0,C.oz)("orange")," rounded-full")}):(0,n.jsx)(m.$,{weight:"fill",className:"w-6 h-6 inline-block ".concat((0,C.oz)("gray")," rounded-full")})]})}),(0,n.jsx)(k._v,{className:"text-xs",children:"Research Mode allows you to get more deeply researched, detailed responses. Response times may be longer."})]})})]})]})});O.displayName="ChatInputArea"},32759:function(e,t,a){"use strict";a.d(t,{E:function(){return o}});var s=a(57437),r=a(2265),n=a(60610),l=a(94508);let o=r.forwardRef((e,t)=>{let{className:a,value:r,indicatorColor:o,...i}=e;return(0,s.jsx)(n.fC,{ref:t,className:(0,l.cn)("relative h-4 w-full overflow-hidden rounded-full bg-secondary",a),...i,children:(0,s.jsx)(n.z$,{className:"h-full w-full flex-1 bg-primary transition-all ".concat(o),style:{transform:"translateX(-".concat(100-(r||0),"%)")}})})});o.displayName=n.fC.displayName},76818:function(e,t,a){"use strict";a.d(t,{g:function(){return l}});var s=a(57437),r=a(2265),n=a(94508);let l=r.forwardRef((e,t)=>{let{className:a,...r}=e;return(0,s.jsx)("textarea",{className:(0,n.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",a),ref:t,...r})});l.displayName="Textarea"},26442:function(e){e.exports={actualInputArea:"chatInputArea_actualInputArea__Ha6cN"}}}]);
|