khoj 1.26.4.dev1__py3-none-any.whl → 1.26.5.dev1__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.
Files changed (62) hide show
  1. khoj/configure.py +1 -1
  2. khoj/interface/compiled/404/index.html +1 -1
  3. khoj/interface/compiled/_next/static/chunks/1210.132a7e1910006bbb.js +1 -0
  4. khoj/interface/compiled/_next/static/chunks/1459.690bf20e7d7b7090.js +1 -0
  5. khoj/interface/compiled/_next/static/chunks/1603-bfc0b26e32ad88e3.js +1 -0
  6. khoj/interface/compiled/_next/static/chunks/2697-bb10ec86ebcca385.js +1 -0
  7. khoj/interface/compiled/_next/static/chunks/3423-eb32a39c25b5dbda.js +1 -0
  8. khoj/interface/compiled/_next/static/chunks/6327-18f0b45cc5a13afb.js +3 -0
  9. khoj/interface/compiled/_next/static/chunks/{4086-2c74808ba38a5a0f.js → 8840-b8d7b9f0923c6651.js} +1 -1
  10. khoj/interface/compiled/_next/static/chunks/9417-759984ad62caa3dc.js +1 -0
  11. khoj/interface/compiled/_next/static/chunks/94ca1967.5584df65931cfe83.js +1 -0
  12. khoj/interface/compiled/_next/static/chunks/964ecbae.ea4eab2a3a835ffe.js +1 -0
  13. khoj/interface/compiled/_next/static/chunks/app/agents/{page-f143de7e45d62ede.js → page-997bf85681256672.js} +1 -1
  14. khoj/interface/compiled/_next/static/chunks/app/chat/page-419c190ac5b39123.js +1 -0
  15. khoj/interface/compiled/_next/static/chunks/app/factchecker/{page-7ab093711c27041c.js → page-f544113d240423e9.js} +1 -1
  16. khoj/interface/compiled/_next/static/chunks/app/{page-fada198096eab47f.js → page-effe774a274068d0.js} +1 -1
  17. khoj/interface/compiled/_next/static/chunks/app/search/{page-a7e036689b6507ff.js → page-3ada11cda5050eeb.js} +1 -1
  18. khoj/interface/compiled/_next/static/chunks/app/share/chat/page-c785d87140978658.js +1 -0
  19. khoj/interface/compiled/_next/static/chunks/webpack-1949487b3f5c4efd.js +1 -0
  20. khoj/interface/compiled/_next/static/css/{c808691c459e3887.css → 3cf13271869a4aeb.css} +1 -1
  21. khoj/interface/compiled/_next/static/css/{dfb67a9287720a2b.css → 74b5ee1b0a24da95.css} +1 -1
  22. khoj/interface/compiled/_next/static/css/a136fb7d9a729586.css +25 -0
  23. khoj/interface/compiled/agents/index.html +1 -1
  24. khoj/interface/compiled/agents/index.txt +2 -2
  25. khoj/interface/compiled/automations/index.html +1 -1
  26. khoj/interface/compiled/automations/index.txt +2 -2
  27. khoj/interface/compiled/chat/index.html +1 -1
  28. khoj/interface/compiled/chat/index.txt +2 -2
  29. khoj/interface/compiled/factchecker/index.html +1 -1
  30. khoj/interface/compiled/factchecker/index.txt +2 -2
  31. khoj/interface/compiled/index.html +1 -1
  32. khoj/interface/compiled/index.txt +2 -2
  33. khoj/interface/compiled/search/index.html +1 -1
  34. khoj/interface/compiled/search/index.txt +2 -2
  35. khoj/interface/compiled/settings/index.html +1 -1
  36. khoj/interface/compiled/settings/index.txt +2 -2
  37. khoj/interface/compiled/share/chat/index.html +1 -1
  38. khoj/interface/compiled/share/chat/index.txt +2 -2
  39. khoj/processor/conversation/prompts.py +144 -0
  40. khoj/processor/conversation/utils.py +4 -1
  41. khoj/routers/api_chat.py +52 -0
  42. khoj/routers/auth.py +2 -2
  43. khoj/routers/helpers.py +129 -0
  44. khoj/routers/subscription.py +1 -1
  45. khoj/routers/web_client.py +0 -11
  46. khoj/utils/helpers.py +5 -1
  47. {khoj-1.26.4.dev1.dist-info → khoj-1.26.5.dev1.dist-info}/METADATA +1 -1
  48. {khoj-1.26.4.dev1.dist-info → khoj-1.26.5.dev1.dist-info}/RECORD +53 -49
  49. khoj/interface/compiled/_next/static/chunks/1603-fa3ee48860b9dc5c.js +0 -1
  50. khoj/interface/compiled/_next/static/chunks/2697-a38d01981ad3bdf8.js +0 -1
  51. khoj/interface/compiled/_next/static/chunks/4051-2cf66369d6ca0f1d.js +0 -3
  52. khoj/interface/compiled/_next/static/chunks/9178-899fe9a6b754ecfe.js +0 -1
  53. khoj/interface/compiled/_next/static/chunks/9417-46ed3aaa639c85ef.js +0 -1
  54. khoj/interface/compiled/_next/static/chunks/app/chat/page-91abcb71846922b7.js +0 -1
  55. khoj/interface/compiled/_next/static/chunks/app/share/chat/page-c5d2b9076e5390b2.js +0 -1
  56. khoj/interface/compiled/_next/static/chunks/webpack-04b88b82f99a666b.js +0 -1
  57. khoj/interface/compiled/_next/static/css/b9a6bf04305d98d7.css +0 -25
  58. /khoj/interface/compiled/_next/static/{SUksBq3lfCLUy--GvK6cX → vW2_hpiFhbzDnW-hI6gYl}/_buildManifest.js +0 -0
  59. /khoj/interface/compiled/_next/static/{SUksBq3lfCLUy--GvK6cX → vW2_hpiFhbzDnW-hI6gYl}/_ssgManifest.js +0 -0
  60. {khoj-1.26.4.dev1.dist-info → khoj-1.26.5.dev1.dist-info}/WHEEL +0 -0
  61. {khoj-1.26.4.dev1.dist-info → khoj-1.26.5.dev1.dist-info}/entry_points.txt +0 -0
  62. {khoj-1.26.4.dev1.dist-info → khoj-1.26.5.dev1.dist-info}/licenses/LICENSE +0 -0
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9718],{1813:function(e,t,s){Promise.resolve().then(s.bind(s,45050))},45050:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return em}});var a=s(57437),l=s(15283),n=s.n(l),r=s(29039),i=s(2265),o=s(79306),c=s(50495),d=s(58284),u=s(5989),h=s(12275),m=s(18444),x=s(31784),f=s(20319),p=s(98750),g=s(55362),j=s(57691),v=s(68029),b=s(68131),N=s(83632),y=s(9950),w=s(35418),_=s(84120),C=s(95289),k=s(26100),S=s(26058),O=s(15780),z=s(64945),T=s(59772),I=s(36013),P=s(90837),R=s(66820),V=s(58485),M=s(48861),A=s(89417),E=s(58575),B=s(47412),Z=s(69591),q=s(32653),F=s(39343),L=s(83102),W=s(31014),D=s(93146),J=s(46294),X=s(13304),Y=s(40882);let G=Y.fC,U=Y.wy,K=Y.Fw;var $=s(37440),Q=s(42491),H=s(9557),ee=s(6780),et=s(70571),es=s(19573),ea=s(18642),el=s(19666);async function en(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 er(e){var t;let s=(null===(t=e.text)||void 0===t?void 0:t.replace(/^\w/,e=>e.toUpperCase()))||"";return(0,a.jsx)(el.pn,{children:(0,a.jsxs)(el.u,{children:[(0,a.jsx)(el._v,{asChild:!0,children:(0,a.jsx)("div",{className:"text-sm",children:e.hoverText||s})}),(0,a.jsx)(el.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=()=>window.fetch("/api/agents").then(e=>e.json()).catch(e=>console.log(e)),eo=e=>fetch(e).then(e=>e.json());function ec(e){let[t,s]=(0,i.useState)(e.agentSlug===e.data.slug),[l,r]=(0,i.useState)(!1),[o,v]=(0,i.useState)(null),b=(0,a.jsx)(d.H,{}),N="Private agents are only visible to you.";"public"===e.data.privacy_level?(b=(0,a.jsx)(u.T,{}),N="Public agents are visible to everyone."):"protected"===e.data.privacy_level&&(b=(0,a.jsx)(h.M,{}),N="Protected agents are visible to anyone with a direct link.");let y=e.userProfile,w=(0,F.cI)({resolver:(0,W.F)(ed),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,i.useEffect)(()=>{w.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]),t&&window.history.pushState({},"Khoj AI - Agent ".concat(e.data.slug),"/agents?agent=".concat(e.data.slug));let _=(0,E.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)(er,{icon:b,text:e.data.privacy_level,hoverText:N}),e.data.files&&e.data.files.length>0&&(0,a.jsx)(er,{icon:(0,a.jsx)(m.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)(er,{icon:(0,a.jsx)(x.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)(er,{icon:(0,A.vH)(t),hoverText:"".concat(t,": ").concat(e.outputModeOptions[t])},t)),e.data.input_tools.map(t=>(0,a.jsx)(er,{icon:(0,A.vH)(t),hoverText:"".concat(t,": ").concat(e.inputToolOptions[t])},t))]})}return(0,a.jsxs)(I.Zb,{className:"shadow-sm bg-gradient-to-b from-white 20% to-".concat(e.data.color?e.data.color:"gray","-100/50 dark:from-[hsl(var(--background))] dark:to-").concat(e.data.color?e.data.color:"gray","-950/50 rounded-xl hover:shadow-md"),children:[l&&(0,a.jsx)(R.Z,{loginRedirectMessage:"Sign in to start chatting with ".concat(e.data.name),onOpenChange:r}),(0,a.jsx)(I.Ol,{children:(0,a.jsx)(I.ll,{children:(0,a.jsxs)(P.Vq,{open:t,onOpenChange:()=>{s(!t),window.history.pushState({},"Khoj AI - Agents","/agents")},children:[(0,a.jsx)(P.hg,{children:(0,a.jsxs)("div",{className:"flex items-center relative top-2",children:[(0,A.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)(es.J2,{children:[(0,a.jsx)(es.xo,{children:(0,a.jsx)(c.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)(f.F,{className:"w-6 h-6 ".concat((0,E.oz)(e.data.color))})})}),(0,a.jsxs)(es.yk,{className:"w-fit grid p-1",side:"bottom",align:"end",children:[(0,a.jsxs)(c.z,{className:"items-center justify-start",variant:"ghost",onClick:()=>s(!0),children:[(0,a.jsx)(p.z,{className:"w-4 h-4 mr-2"}),"Edit"]}),e.editCard&&"private"!==e.data.privacy_level&&(0,a.jsx)(ea.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==y?void 0:y.username)&&(0,a.jsxs)(c.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)(g.r,{className:"w-4 h-4 mr-2"}),"Delete"]})]})]})}),(0,a.jsx)("div",{className:"float-right",children:e.userProfile?(0,a.jsx)(c.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:()=>en(e.data.slug,y),children:(0,a.jsx)(j.g,{className:"w-6 h-6 ".concat((0,E.oz)(e.data.color))})}):(0,a.jsx)(c.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:()=>r(!0),children:(0,a.jsx)(j.g,{className:"w-6 h-6 ".concat((0,E.oz)(e.data.color))})})})]}),e.editCard?(0,a.jsxs)(P.cZ,{className:"lg:max-w-screen-lg overflow-y-scroll max-h-screen",children:[(0,a.jsxs)(X.$N,{children:["Edit ",(0,a.jsx)("b",{children:e.data.name})]}),(0,a.jsx)(eu,{form:w,onSubmit:t=>{let a=e.editCard?"PATCH":"POST",l=t;e.editCard&&(l={...t,slug:e.data.slug}),fetch("/api/agents",{method:a,headers:{"Content-Type":"application/json"},body:JSON.stringify(l)}).then(t=>{200===t.status?(w.reset(),s(!1),v(null),e.setAgentChangeTriggered(!0)):t.json().then(e=>{console.error(e),w.clearErrors(),e.error&&v(e.error)})}).catch(e=>{console.error("Error:",e),v(e),w.clearErrors()})},create:!1,errors:o,filesOptions:e.filesOptions,modelOptions:e.modelOptions,slug:e.data.slug,inputToolOptions:e.inputToolOptions,isSubscribed:e.isSubscribed,outputModeOptions:e.outputModeOptions})]}):(0,a.jsxs)(P.cZ,{className:"whitespace-pre-line max-h-[80vh] max-w-[90vw] rounded-lg",children:[(0,a.jsx)(P.fK,{children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,A.TI)(e.data.icon,e.data.color),(0,a.jsx)("p",{className:"font-bold text-lg",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)(P.cN,{children:(0,a.jsxs)(c.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:()=>{en(e.data.slug,y),s(!1)},children:[(0,a.jsx)(j.g,{className:"w-6 h-6 m-2 ".concat((0,E.oz)(e.data.color))}),"Start Chatting"]})})]})]})})}),(0,a.jsx)(I.aY,{children:(0,a.jsx)("div",{className:n().agentPersonality,children:(0,a.jsx)("button",{className:"".concat(n().infoButton," text-neutral-500 dark:text-white"),onClick:()=>s(!0),children:(0,a.jsx)("p",{children:e.data.persona})})})}),(0,a.jsx)(I.eW,{children:(0,a.jsx)("div",{className:"flex flex-wrap items-center gap-1",children:C()})})]})}let ed=T.z.object({name:T.z.string({required_error:"Name is required"}).min(1,"Name is required"),persona:T.z.string({required_error:"Personality is required"}).min(1,"Personality is required"),color:T.z.string({required_error:"Color is required"}).min(1,"Color is required"),icon:T.z.string({required_error:"Icon is required"}).min(1,"Icon is required"),privacy_level:T.z.string({required_error:"Privacy level is required"}).min(1,"Privacy level is required"),chat_model:T.z.string({required_error:"Chat model is required"}).min(1,"Chat model is required"),files:T.z.array(T.z.string()).default([]).optional(),input_tools:T.z.array(T.z.string()).default([]).optional(),output_modes:T.z.array(T.z.string()).default([]).optional()});function eu(e){let[t,s]=(0,i.useState)(!1),l=(0,A.BI)(),n=E.xF,r=(0,E.oz)(e.form.getValues("color")),[o,d]=(0,i.useState)(!1),[u,h]=(0,i.useState)(null),[m,x]=(0,i.useState)(null),[f,p]=(0,i.useState)(!1),[g,j]=(0,i.useState)(0),[z,T]=(0,i.useState)([]),[I,P]=(0,i.useState)([]),[R,V]=(0,i.useState)(0),[M,Z]=(0,i.useState)(!0),F=["public","private","protected"],W=[{fields:[{name:"name",label:"Name"},{name:"persona",label:"Personality"}],label:"Basic Settings"},{fields:[{name:"color",label:"Color"},{name:"icon",label:"Icon"},{name:"chat_model",label:"Chat Model"},{name:"privacy_level",label:"Privacy Level"}],label:"Customization & Access"},{fields:[{name:"files",label:"Knowledge Base"},{name:"input_tools",label:"Input Tools"},{name:"output_modes",label:"Output Modes"}],label:"Advanced Settings"}],X=(0,i.useRef)(null);function Y(e){e.preventDefault(),d(!0)}function ea(e){e.preventDefault(),d(!1)}function el(e){e.preventDefault(),d(!1),e.dataTransfer.files&&en(e.dataTransfer.files)}function en(e){(0,H.ko)(e,h,p,x,T)}function er(){X&&X.current&&X.current.click()}function ei(e){e.target.files&&en(e.target.files)}(0,i.useEffect)(()=>{if(f||j(0),f){let e=setInterval(()=>{j(e=>{let t=e+(Math.floor(5*Math.random())+1);return t<100?t:100})},800);return()=>clearInterval(e)}},[f]),(0,i.useEffect)(()=>{P(Array.from(new Set([...I,...e.form.getValues("files")||[],...e.filesOptions||[]])))},[]),(0,i.useEffect)(()=>{z.length>0&&(eo(z),P(e=>[...e,...z]))},[z]),(0,i.useEffect)(()=>{e.errors&&s(!1)},[e.errors]);let eo=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)}};if(!e.isSubscribed&&M)return(0,a.jsx)(ee.aR,{open:!0,children:(0,a.jsxs)(ee._T,{children:[(0,a.jsx)(ee.fY,{children:(0,a.jsx)(ee.f$,{children:"Upgrade to Futurist"})}),(0,a.jsxs)(ee.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)(ee.xo,{children:[(0,a.jsx)(ee.le,{onClick:()=>{Z(!1)},children:"Cancel"}),(0,a.jsx)(ee.OL,{onClick:()=>{window.location.href="/settings"},children:"Continue"})]})]})});let ec=t=>{switch(t){case"name":return(0,a.jsx)(q.Wi,{control:e.form.control,name:"name",render:e=>{let{field:t}=e;return(0,a.jsxs)(q.xJ,{className:"space-y-0 grid gap-2",children:[(0,a.jsx)(q.lX,{children:"Name"}),(0,a.jsx)(q.pf,{children:"What should this agent be called? Pick something descriptive & memorable."}),(0,a.jsx)(q.NI,{children:(0,a.jsx)(L.I,{placeholder:"Biologist",...t})}),(0,a.jsx)(q.zG,{})]})}},t);case"chat_model":return(0,a.jsx)(q.Wi,{control:e.form.control,name:"chat_model",render:t=>{let{field:s}=t;return(0,a.jsxs)(q.xJ,{className:"space-y-1 grid gap-2",children:[(0,a.jsx)(q.lX,{children:"Chat Model"}),(0,a.jsx)(q.pf,{children:"Which large language model should this agent use?"}),(0,a.jsxs)(J.Ph,{onValueChange:s.onChange,defaultValue:s.value,children:[(0,a.jsx)(q.NI,{children:(0,a.jsx)(J.i4,{className:"text-left",children:(0,a.jsx)(J.ki,{})})}),(0,a.jsx)(J.Bw,{className:"items-start space-y-1 inline-flex flex-col",children:e.modelOptions.map(e=>(0,a.jsx)(J.Ql,{value:e.name,children:(0,a.jsx)("div",{className:"flex items-center space-x-2",children:e.name})},e.id))})]}),(0,a.jsx)(q.zG,{})]})}},t);case"privacy_level":return(0,a.jsx)(q.Wi,{control:e.form.control,name:"privacy_level",render:e=>{let{field:t}=e;return(0,a.jsxs)(q.xJ,{className:"space-y-1 grid gap-2",children:[(0,a.jsx)(q.lX,{children:(0,a.jsx)("div",{children:"Privacy Level"})}),(0,a.jsx)(q.pf,{children:(0,a.jsxs)(es.J2,{children:[(0,a.jsx)(es.xo,{asChild:!0,children:(0,a.jsx)(c.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)(v.k,{className:"inline"}),(0,a.jsx)("p",{className:"text-sm",children:"Learn more"})]})})}),(0,a.jsxs)(es.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)(J.Ph,{onValueChange:t.onChange,defaultValue:t.value,children:[(0,a.jsx)(q.NI,{children:(0,a.jsx)(J.i4,{className:"w-[200px]",children:(0,a.jsx)(J.ki,{placeholder:"private"})})}),(0,a.jsx)(J.Bw,{className:"items-center space-y-1 inline-flex flex-col",children:F.map(e=>(0,a.jsx)(J.Ql,{value:e,children:(0,a.jsx)("div",{className:"flex items-center space-x-2",children:e})},e))})]}),(0,a.jsx)(q.zG,{})]})}},t);case"color":return(0,a.jsx)(q.Wi,{control:e.form.control,name:"color",render:e=>{let{field:t}=e;return(0,a.jsxs)(q.xJ,{className:"space-y-3",children:[(0,a.jsx)(q.lX,{children:"Color"}),(0,a.jsx)(q.pf,{children:"Choose a color for your agent."}),(0,a.jsxs)(J.Ph,{onValueChange:t.onChange,defaultValue:t.value,children:[(0,a.jsx)(q.NI,{children:(0,a.jsx)(J.i4,{className:"w-[200px]",children:(0,a.jsx)(J.ki,{placeholder:"Color"})})}),(0,a.jsx)(J.Bw,{className:"items-center space-y-1 inline-flex flex-col",children:n.map(e=>(0,a.jsx)(J.Ql,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(b.C,{className:"w-6 h-6 mr-2 ".concat((0,E.oz)(e)),weight:"fill"}),e]})},e))})]}),(0,a.jsx)(q.zG,{})]})}},t);case"icon":return(0,a.jsx)(q.Wi,{control:e.form.control,name:"icon",render:t=>{let{field:s}=t;return(0,a.jsxs)(q.xJ,{className:"space-y-3",children:[(0,a.jsx)(q.lX,{children:"Icon"}),(0,a.jsx)(q.pf,{children:"Choose an icon for your agent."}),(0,a.jsxs)(J.Ph,{onValueChange:s.onChange,defaultValue:s.value,children:[(0,a.jsx)(q.NI,{children:(0,a.jsx)(J.i4,{className:"w-[200px]",children:(0,a.jsx)(J.ki,{placeholder:"Icon"})})}),(0,a.jsx)(J.Bw,{className:"items-center space-y-1 inline-flex flex-col",children:l.map(t=>(0,a.jsx)(J.Ql,{value:t,children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,A.TI)(t,e.form.getValues("color"),"w-6","h-6"),t]})},t))})]}),(0,a.jsx)(q.zG,{})]})}},t);case"persona":return(0,a.jsx)(q.Wi,{control:e.form.control,name:"persona",render:e=>{let{field:t}=e;return(0,a.jsxs)(q.xJ,{className:"space-y-1 grid gap-2",children:[(0,a.jsx)(q.lX,{children:"Personality"}),(0,a.jsx)(q.pf,{children:"What is the personality, thought process, or tuning of this agent? Get creative; this is how you can influence the agent constitution."}),(0,a.jsx)(q.NI,{children:(0,a.jsx)(D.g,{placeholder:"You are an excellent biologist, at the top of your field in marine biology.",...t})}),(0,a.jsx)(q.zG,{})]})}},t);case"files":return(0,a.jsx)(q.Wi,{control:e.form.control,name:"files",render:t=>{let{field:s}=t;return(0,a.jsxs)(q.xJ,{className:"flex flex-col gap-2",children:[(0,a.jsx)(q.lX,{children:"Knowledge Base"}),(0,a.jsxs)(q.pf,{children:["Which information should be part of its digital brain?"," ",(0,a.jsx)("a",{href:"/settings",children:"Manage data"}),"."]}),(0,a.jsxs)(G,{children:[(0,a.jsxs)(U,{className:"flex items-center justify-between text-sm gap-2",children:[(0,a.jsx)(N.K,{}),s.value&&s.value.length>0?"".concat(s.value.length," files selected"):"Select files"]}),(0,a.jsx)(K,{children:(0,a.jsxs)(Q.mY,{children:[(0,a.jsx)(ee.aR,{open:null!==u||null!=m,children:(0,a.jsxs)(ee._T,{children:[(0,a.jsx)(ee.fY,{children:(0,a.jsx)(ee.f$,{children:"Alert"})}),(0,a.jsx)(ee.yT,{children:u||m}),(0,a.jsx)(ee.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>{h(null),x(null),p(!1)},children:"Close"})]})}),(0,a.jsxs)("div",{className:"flex flex-col h-full cursor-pointer",onDragOver:Y,onDragLeave:ea,onDrop:el,onClick:er,children:[(0,a.jsx)("input",{type:"file",multiple:!0,ref:X,style:{display:"none"},onChange:ei}),(0,a.jsx)("div",{className:"flex-none p-4",children:f&&(0,a.jsx)(et.E,{indicatorColor:"bg-slate-500",className:"w-full h-2 rounded-full",value:g})}),(0,a.jsx)("div",{className:"flex-none p-4 bg-secondary border-b ".concat(o?"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:o?(0,a.jsxs)("div",{className:"flex items-center justify-center w-full h-full",children:[(0,a.jsx)(y.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)(w.v,{className:"h-6 w-6 mr-2"}),(0,a.jsx)("span",{children:"Drag and drop files here"})]})})})]}),(0,a.jsx)(Q.sZ,{placeholder:"Select files..."}),(0,a.jsxs)(Q.e8,{children:[(0,a.jsx)(Q.rb,{children:"No files found."}),(0,a.jsx)(Q.fu,{children:I.map(t=>(0,a.jsxs)(Q.di,{value:t,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)(_.J,{className:(0,$.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)(q.Wi,{control:e.form.control,name:"input_tools",render:t=>{let{field:s}=t;return(0,a.jsxs)(q.xJ,{className:"flex flex-col gap-2",children:[(0,a.jsx)(q.lX,{children:"Restrict Input Tools"}),(0,a.jsxs)(q.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)(G,{children:[(0,a.jsxs)(U,{className:"flex items-center justify-between text-sm gap-2",children:[(0,a.jsx)(N.K,{}),s.value&&s.value.length>0?"".concat(s.value.length," tools selected"):"All tools"]}),(0,a.jsx)(K,{children:(0,a.jsx)(Q.mY,{children:(0,a.jsx)(Q.e8,{children:(0,a.jsx)(Q.fu,{children:Object.entries(e.inputToolOptions).map(t=>{let[l,n]=t;return(0,a.jsxs)(Q.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)(_.J,{className:(0,$.cn)("mr-2 h-4 w-4",s.value&&s.value.includes(l)?"opacity-100":"opacity-0")}),(0,a.jsxs)("div",{className:(0,$.cn)("flex items-center space-x-2"),children:[(0,a.jsx)("p",{children:(0,a.jsx)("b",{children:l})}),(0,a.jsx)("p",{children:n})]})]},l)})})})})})]})]})}},t);case"output_modes":return(0,a.jsx)(q.Wi,{control:e.form.control,name:"output_modes",render:t=>{let{field:s}=t;return(0,a.jsxs)(q.xJ,{className:"flex flex-col gap-2",children:[(0,a.jsx)(q.lX,{children:"Restrict Output Modes"}),(0,a.jsxs)(q.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)(G,{children:[(0,a.jsxs)(U,{className:"flex items-center justify-between text-sm gap-2",children:[(0,a.jsx)(N.K,{}),s.value&&s.value.length>0?"".concat(s.value.length," modes selected"):"All modes"]}),(0,a.jsx)(K,{children:(0,a.jsx)(Q.mY,{children:(0,a.jsx)(Q.e8,{children:(0,a.jsx)(Q.fu,{children:Object.entries(e.outputModeOptions).map(t=>{let[l,n]=t;return(0,a.jsxs)(Q.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)(_.J,{className:(0,$.cn)("mr-2 h-4 w-4",s.value&&s.value.includes(l)?"opacity-100":"opacity-0")}),(0,a.jsxs)("div",{className:(0,$.cn)("flex items-center space-x-2"),children:[(0,a.jsx)("p",{children:(0,a.jsx)("b",{children:l})}),(0,a.jsx)("p",{children:n})]})]},l)})})})})})]})]})}},t);default:return null}};return(0,a.jsx)(q.l0,{...e.form,children:(0,a.jsxs)("form",{onSubmit:e.form.handleSubmit(t=>{e.onSubmit(t),s(!0)}),className:"space-y-6",children:[(0,a.jsx)("div",{className:"space-y-6",children:W[R].label}),R<W.length&&W[R].fields.map(e=>ec(e.name)),(0,a.jsxs)("div",{className:"flex justify-between mt-4",children:[(0,a.jsxs)(c.z,{type:"button",variant:"outline",onClick:e=>{e.preventDefault(),R>0&&V(R-1)},disabled:0===R,className:"items-center ".concat(t?"bg-stone-100 dark:bg-neutral-900":""," text-white ").concat(r),children:[(0,a.jsx)(C.X,{className:"mr-2 h-4 w-4"}),"Previous"]}),R<W.length-1?(0,a.jsxs)(c.z,{type:"button",variant:"outline",onClick:e=>{e.preventDefault(),R<W.length-1&&V(R+1)},disabled:!(t=>{try{return ed.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}})(W[R]),className:"items-center ".concat(t?"bg-stone-100 dark:bg-neutral-900":""," text-white ").concat(r),children:["Next",(0,a.jsx)(k.o,{className:"ml-2 h-4 w-4"})]}):(0,a.jsxs)(c.z,{type:"submit",variant:"outline",disabled:t||!e.isSubscribed,className:"items-center ".concat(t?"bg-stone-100 dark:bg-neutral-900":""," text-white ").concat(r),children:[(0,a.jsx)(S.B,{className:"h-4 w-4 mr-2"}),t?"Booting...":"Save"]})]}),e.errors&&(0,a.jsx)(B.bZ,{className:"bg-secondary border-none my-4",children:(0,a.jsxs)(B.X,{className:"flex items-center gap-1",children:[(0,a.jsx)(O.f,{weight:"fill",className:"h-4 w-4 text-yellow-400 inline"}),(0,a.jsx)("span",{children:e.errors})]})})]})})}function eh(e){let[t,s]=(0,i.useState)(!1),[l,n]=(0,i.useState)(null),[r,o]=(0,i.useState)(!0),c=(0,F.cI)({resolver:(0,W.F)(ed),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.selectedChatModelOption,files:[]}});return(0,i.useEffect)(()=>{c.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.selectedChatModelOption,files:[]})},[e.selectedChatModelOption,e.data]),(0,a.jsxs)(P.Vq,{open:t,onOpenChange:s,children:[(0,a.jsx)(P.hg,{children:(0,a.jsxs)("div",{className:"flex items-center text-md gap-2",children:[(0,a.jsx)(w.v,{}),"Create Agent"]})}),(0,a.jsxs)(P.cZ,{className:"lg:max-w-screen-lg overflow-y-scroll max-h-screen",children:[(0,a.jsx)(P.fK,{children:"Create Agent"}),!e.userProfile&&r&&(0,a.jsx)(R.Z,{loginRedirectMessage:"Sign in to start chatting with a specialized agent",onOpenChange:o}),(0,a.jsx)(eu,{form:c,onSubmit:t=>{fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then(t=>{200===t.status?(c.reset(),s(!1),n(null),e.setAgentChangeTriggered(!0)):t.json().then(e=>{console.error(e),e.error&&n(e.error)})}).catch(e=>{console.error("Error:",e),n(e)})},create:!0,errors:l,filesOptions:e.filesOptions,modelOptions:e.modelOptions,inputToolOptions:e.inputToolOptions,outputModeOptions:e.outputModeOptions,isSubscribed:e.isSubscribed})]})]})}function em(){let{data:e,error:t,mutate:s}=(0,r.ZP)("agents",ei,{revalidateOnFocus:!1}),l=(0,o.GW)(),{userConfig:c}=(0,o.h2)(!0),[d,u]=(0,i.useState)(!1),h=(0,Z.IC)(),[m,x]=(0,i.useState)([]),[f,p]=(0,i.useState)([]),[g,j]=(0,i.useState)(null),{data:v,error:b}=(0,r.ZP)(c?"/api/content/computer":null,eo),{data:N,error:y}=(0,r.ZP)("/api/agents/options",eo),[w,_]=(0,i.useState)(!1);if((0,i.useEffect)(()=>{w&&(s(),_(!1))},[w]),(0,i.useEffect)(()=>{if(e){x(e.filter(e=>e.creator===(null==l?void 0:l.username)));let t=e.filter(e=>"private"!==e.privacy_level&&e.creator!==(null==l?void 0:l.username));p(t);{let s=new URLSearchParams(window.location.search).get("agent");if(s){j(s);let a=e.find(e=>e.slug===s);a||(a=t.find(e=>e.slug===s)),a||fetch("/api/agents/".concat(s)).then(e=>{if(404===e.status)throw Error("Agent not found");return e.json()}).then(e=>{"protected"===e.privacy_level&&p(t=>[...t,e])})}}}},[e,l]),t)return(0,a.jsxs)("main",{className:n().main,children:[(0,a.jsx)("div",{className:"".concat(n().titleBar," text-5xl"),children:"Agents"}),(0,a.jsx)("div",{className:n().agentList,children:"Error loading agents"})]});if(!e)return(0,a.jsx)("main",{className:n().main,children:(0,a.jsxs)("div",{className:n().agentList,children:[(0,a.jsx)(V.l,{})," booting up your agents"]})});let C=(null==c?void 0:c.chat_model_options)||[],k=(null==c?void 0:c.selected_chat_model_config)||0,S=(null==c?void 0:c.subscription_state)&&[o.o9.SUBSCRIBED.valueOf(),o.o9.TRIAL.valueOf(),o.o9.UNSUBSCRIBED.valueOf()].includes(c.subscription_state)||!1,O=C.find(e=>e.id===k);return(0,a.jsx)("main",{className:"w-full mx-auto",children:(0,a.jsxs)("div",{className:"grid w-full mx-auto",children:[(0,a.jsx)("div",{className:"".concat(n().sidePanel," top-0"),children:(0,a.jsx)(M.ZP,{conversationId:null,uploadedFiles:[],isMobileWidth:h})}),(0,a.jsxs)("div",{className:"".concat(n().pageLayout," w-full"),children:[(0,a.jsxs)("div",{className:"pt-6 md:pt-8 flex justify-between",children:[(0,a.jsx)("h1",{className:"text-3xl flex items-center",children:"Agents"}),(0,a.jsx)("div",{className:"ml-auto float-right border p-2 pt-3 rounded-xl font-bold hover:bg-stone-100 dark:hover:bg-neutral-900",children:(0,a.jsx)(eh,{data:{slug:"",name:"",persona:"",color:"",icon:"",privacy_level:"private",managed_by_admin:!1,chat_model:"",input_tools:[],output_modes:[]},userProfile:l,isMobileWidth:h,filesOptions:v||[],modelOptions:(null==c?void 0:c.chat_model_options)||[],selectedChatModelOption:(null==O?void 0:O.name)||"",isSubscribed:S,setAgentChangeTriggered:_,inputToolOptions:(null==N?void 0:N.input_tools)||{},outputModeOptions:(null==N?void 0:N.output_modes)||{}})})]}),d&&(0,a.jsx)(R.Z,{loginRedirectMessage:"Sign in to start chatting with a specialized agent",onOpenChange:u}),(0,a.jsx)(B.bZ,{className:"bg-secondary border-none my-4",children:(0,a.jsxs)(B.X,{children:[(0,a.jsx)(z.B,{weight:"fill",className:"h-4 w-4 text-purple-400 inline"}),(0,a.jsx)("span",{className:"font-bold",children:"How it works"})," Use any of these specialized personas to tune your conversation to your needs."]})}),(0,a.jsx)("div",{className:"pt-6 md:pt-8",children:(0,a.jsx)("div",{className:"".concat(n().agentList),children:m.map(e=>(0,a.jsx)(ec,{data:e,userProfile:l,isMobileWidth:h,filesOptions:null!=v?v:[],selectedChatModelOption:(null==O?void 0:O.name)||"",isSubscribed:S,setAgentChangeTriggered:_,modelOptions:(null==c?void 0:c.chat_model_options)||[],editCard:!0,agentSlug:g||"",inputToolOptions:(null==N?void 0:N.input_tools)||{},outputModeOptions:(null==N?void 0:N.output_modes)||{}},e.slug))})}),(0,a.jsxs)("div",{className:"pt-6 md:pt-8",children:[(0,a.jsx)("h2",{className:"text-2xl",children:"Explore"}),(0,a.jsx)("div",{className:"".concat(n().agentList),children:f.map(e=>(0,a.jsx)(ec,{data:e,userProfile:l,isMobileWidth:h,editCard:!1,filesOptions:null!=v?v:[],selectedChatModelOption:(null==O?void 0:O.name)||"",isSubscribed:S,setAgentChangeTriggered:_,modelOptions:(null==c?void 0:c.chat_model_options)||[],agentSlug:g||"",inputToolOptions:(null==N?void 0:N.input_tools)||{},outputModeOptions:(null==N?void 0:N.output_modes)||{}},e.slug))})]})]})]})})}},66820:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});var a=s(57437),l=s(6780),n=s(87138);function r(e){return(0,a.jsx)(l.aR,{open:!0,onOpenChange:e.onOpenChange,children:(0,a.jsxs)(l._T,{children:[(0,a.jsx)(l.fY,{children:(0,a.jsx)(l.f$,{children:"Sign in to Khoj to continue"})}),(0,a.jsxs)(l.yT,{children:[e.loginRedirectMessage,". By logging in, you agree to our"," ",(0,a.jsx)(n.default,{href:"https://khoj.dev/terms-of-service",children:"Terms of Service."})]}),(0,a.jsxs)(l.xo,{children:[(0,a.jsx)(l.le,{children:"Dismiss"}),(0,a.jsx)(l.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>{window.location.href="/login?next=".concat(encodeURIComponent(window.location.pathname))},children:(0,a.jsxs)(n.default,{href:"/login?next=".concat(encodeURIComponent(window.location.pathname)),children:[" ","Login"]})})]})]})})}},18642:function(e,t,s){"use strict";s.d(t,{Z:function(){return c}});var a=s(57437),l=s(90837),n=s(50495),r=s(83102),i=s(67135),o=s(34797);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)(n.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)(r.I,{id:"link",defaultValue:e.url,readOnly:!0})]}),(0,a.jsx)(n.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"})})]})]})]})}},47412:function(e,t,s){"use strict";s.d(t,{X:function(){return c},bZ:function(){return o}});var a=s(57437),l=s(2265),n=s(12218),r=s(37440);let i=(0,n.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,...n}=e;return(0,a.jsx)("div",{ref:t,role:"alert",className:(0,r.cn)(i({variant:l}),s),...n})});o.displayName="Alert",l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)("h5",{ref:t,className:(0,r.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,r.cn)("text-sm [&_p]:leading-relaxed",s),...l})});c.displayName="AlertDescription"},32653: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 g},xJ:function(){return x},zG:function(){return j}});var a=s(57437),l=s(2265),n=s(71538),r=s(39343),i=s(37440),o=s(67135);let c=r.RV,d=l.createContext({}),u=e=>{let{...t}=e;return(0,a.jsx)(d.Provider,{value:{name:t.name},children:(0,a.jsx)(r.Qr,{...t})})},h=()=>{let e=l.useContext(d),t=l.useContext(m),{getFieldState:s,formState:a}=(0,r.Gc)(),n=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"),...n}},m=l.createContext({}),x=l.forwardRef((e,t)=>{let{className:s,...n}=e,r=l.useId();return(0,a.jsx)(m.Provider,{value:{id:r},children:(0,a.jsx)("div",{ref:t,className:(0,i.cn)("space-y-2",s),...n})})});x.displayName="FormItem";let f=l.forwardRef((e,t)=>{let{className:s,...l}=e,{error:n,formItemId:r}=h();return(0,a.jsx)(o._,{ref:t,className:(0,i.cn)(n&&"text-destructive",s),htmlFor:r,...l})});f.displayName="FormLabel";let p=l.forwardRef((e,t)=>{let{...s}=e,{error:l,formItemId:r,formDescriptionId:i,formMessageId:o}=h();return(0,a.jsx)(n.g7,{ref:t,id:r,"aria-describedby":l?"".concat(i," ").concat(o):"".concat(i),"aria-invalid":!!l,...s})});p.displayName="FormControl";let g=l.forwardRef((e,t)=>{let{className:s,...l}=e,{formDescriptionId:n}=h();return(0,a.jsx)("p",{ref:t,id:n,className:(0,i.cn)("text-sm text-muted-foreground",s),...l})});g.displayName="FormDescription";let j=l.forwardRef((e,t)=>{let{className:s,children:l,...n}=e,{error:r,formMessageId:o}=h(),c=r?String(null==r?void 0:r.message):l;return c?(0,a.jsx)("p",{ref:t,id:o,className:(0,i.cn)("text-sm font-medium text-destructive",s),...n,children:c}):null});j.displayName="FormMessage"},67135:function(e,t,s){"use strict";s.d(t,{_:function(){return c}});var a=s(57437),l=s(2265),n=s(38364),r=s(12218),i=s(37440);let o=(0,r.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)(n.f,{ref:t,className:(0,i.cn)(o(),s),...l})});c.displayName=n.f.displayName},70571:function(e,t,s){"use strict";s.d(t,{E:function(){return i}});var a=s(57437),l=s(2265),n=s(52431),r=s(37440);let i=l.forwardRef((e,t)=>{let{className:s,value:l,indicatorColor:i,...o}=e;return(0,a.jsx)(n.fC,{ref:t,className:(0,r.cn)("relative h-4 w-full overflow-hidden rounded-full bg-secondary",s),...o,children:(0,a.jsx)(n.z$,{className:"h-full w-full flex-1 bg-primary transition-all ".concat(i),style:{transform:"translateX(-".concat(100-(l||0),"%)")}})})});i.displayName=n.fC.displayName},46294:function(e,t,s){"use strict";s.d(t,{Bw:function(){return f},Ph:function(){return d},Ql:function(){return p},i4:function(){return h},ki:function(){return u}});var a=s(57437),l=s(2265),n=s(77539),r=s(42421),i=s(14392),o=s(22468),c=s(37440);let d=n.fC;n.ZA;let u=n.B4,h=l.forwardRef((e,t)=>{let{className:s,children:l,...i}=e;return(0,a.jsxs)(n.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)(n.JO,{asChild:!0,children:(0,a.jsx)(r.Z,{className:"h-4 w-4 opacity-50"})})]})});h.displayName=n.xz.displayName;let m=l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)(n.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"})})});m.displayName=n.u_.displayName;let x=l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)(n.$G,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",s),...l,children:(0,a.jsx)(r.Z,{className:"h-4 w-4"})})});x.displayName=n.$G.displayName;let f=l.forwardRef((e,t)=>{let{className:s,children:l,position:r="popper",...i}=e;return(0,a.jsx)(n.h_,{children:(0,a.jsxs)(n.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"===r&&"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:r,...i,children:[(0,a.jsx)(m,{}),(0,a.jsx)(n.l_,{className:(0,c.cn)("p-1","popper"===r&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:l}),(0,a.jsx)(x,{})]})})});f.displayName=n.VY.displayName,l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)(n.__,{ref:t,className:(0,c.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",s),...l})}).displayName=n.__.displayName;let p=l.forwardRef((e,t)=>{let{className:s,children:l,...r}=e;return(0,a.jsxs)(n.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),...r,children:[(0,a.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,a.jsx)(n.wU,{children:(0,a.jsx)(o.Z,{className:"h-4 w-4"})})}),(0,a.jsx)(n.eT,{children:l})]})});p.displayName=n.ck.displayName,l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)(n.Z0,{ref:t,className:(0,c.cn)("-mx-1 my-1 h-px bg-muted",s),...l})}).displayName=n.Z0.displayName},93146:function(e,t,s){"use strict";s.d(t,{g:function(){return r}});var a=s(57437),l=s(2265),n=s(37440);let r=l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.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 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",s),ref:t,...l})});r.displayName="Textarea"},19666:function(e,t,s){"use strict";s.d(t,{_v:function(){return d},aJ:function(){return c},pn:function(){return i},u:function(){return o}});var a=s(57437),l=s(2265),n=s(27071),r=s(37440);let i=n.zt,o=n.fC,c=n.xz,d=l.forwardRef((e,t)=>{let{className:s,sideOffset:l=4,...i}=e;return(0,a.jsx)(n.VY,{ref:t,sideOffset:l,className:(0,r.cn)("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",s),...i})});d.displayName=n.VY.displayName},15283:function(e){e.exports={titleBar:"agents_titleBar__FzYbY",agentPersonality:"agents_agentPersonality__o0Ysz",pageLayout:"agents_pageLayout__gR3S3",sidePanel:"agents_sidePanel__wGVGc",infoButton:"agents_infoButton__NqI7E",agentList:"agents_agentList__XVx4A"}}},function(e){e.O(0,[9460,8918,9001,3062,4086,3110,51,7762,1603,9417,2971,7023,1744],function(){return e(e.s=1813)}),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9718],{1813:function(e,t,s){Promise.resolve().then(s.bind(s,45050))},45050:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return em}});var a=s(57437),l=s(15283),n=s.n(l),r=s(29039),i=s(2265),o=s(79306),c=s(50495),d=s(58284),u=s(5989),h=s(12275),m=s(18444),x=s(31784),f=s(20319),p=s(98750),g=s(55362),j=s(57691),v=s(68029),b=s(68131),N=s(83632),y=s(9950),w=s(35418),_=s(84120),C=s(95289),k=s(26100),S=s(26058),O=s(15780),z=s(64945),T=s(59772),I=s(36013),P=s(90837),R=s(66820),V=s(58485),M=s(48861),A=s(89417),E=s(58575),B=s(47412),Z=s(69591),q=s(32653),F=s(39343),L=s(83102),W=s(31014),D=s(93146),J=s(46294),X=s(13304),Y=s(40882);let G=Y.fC,U=Y.wy,K=Y.Fw;var $=s(37440),Q=s(42491),H=s(9557),ee=s(6780),et=s(70571),es=s(19573),ea=s(18642),el=s(19666);async function en(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 er(e){var t;let s=(null===(t=e.text)||void 0===t?void 0:t.replace(/^\w/,e=>e.toUpperCase()))||"";return(0,a.jsx)(el.pn,{children:(0,a.jsxs)(el.u,{children:[(0,a.jsx)(el._v,{asChild:!0,children:(0,a.jsx)("div",{className:"text-sm",children:e.hoverText||s})}),(0,a.jsx)(el.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=()=>window.fetch("/api/agents").then(e=>e.json()).catch(e=>console.log(e)),eo=e=>fetch(e).then(e=>e.json());function ec(e){let[t,s]=(0,i.useState)(e.agentSlug===e.data.slug),[l,r]=(0,i.useState)(!1),[o,v]=(0,i.useState)(null),b=(0,a.jsx)(d.H,{}),N="Private agents are only visible to you.";"public"===e.data.privacy_level?(b=(0,a.jsx)(u.T,{}),N="Public agents are visible to everyone."):"protected"===e.data.privacy_level&&(b=(0,a.jsx)(h.M,{}),N="Protected agents are visible to anyone with a direct link.");let y=e.userProfile,w=(0,F.cI)({resolver:(0,W.F)(ed),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,i.useEffect)(()=>{w.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]),t&&window.history.pushState({},"Khoj AI - Agent ".concat(e.data.slug),"/agents?agent=".concat(e.data.slug));let _=(0,E.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)(er,{icon:b,text:e.data.privacy_level,hoverText:N}),e.data.files&&e.data.files.length>0&&(0,a.jsx)(er,{icon:(0,a.jsx)(m.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)(er,{icon:(0,a.jsx)(x.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)(er,{icon:(0,A.vH)(t),hoverText:"".concat(t,": ").concat(e.outputModeOptions[t])},t)),e.data.input_tools.map(t=>(0,a.jsx)(er,{icon:(0,A.vH)(t),hoverText:"".concat(t,": ").concat(e.inputToolOptions[t])},t))]})}return(0,a.jsxs)(I.Zb,{className:"shadow-sm bg-gradient-to-b from-white 20% to-".concat(e.data.color?e.data.color:"gray","-100/50 dark:from-[hsl(var(--background))] dark:to-").concat(e.data.color?e.data.color:"gray","-950/50 rounded-xl hover:shadow-md"),children:[l&&(0,a.jsx)(R.Z,{loginRedirectMessage:"Sign in to start chatting with ".concat(e.data.name),onOpenChange:r}),(0,a.jsx)(I.Ol,{children:(0,a.jsx)(I.ll,{children:(0,a.jsxs)(P.Vq,{open:t,onOpenChange:()=>{s(!t),window.history.pushState({},"Khoj AI - Agents","/agents")},children:[(0,a.jsx)(P.hg,{children:(0,a.jsxs)("div",{className:"flex items-center relative top-2",children:[(0,A.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)(es.J2,{children:[(0,a.jsx)(es.xo,{children:(0,a.jsx)(c.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)(f.F,{className:"w-6 h-6 ".concat((0,E.oz)(e.data.color))})})}),(0,a.jsxs)(es.yk,{className:"w-fit grid p-1",side:"bottom",align:"end",children:[(0,a.jsxs)(c.z,{className:"items-center justify-start",variant:"ghost",onClick:()=>s(!0),children:[(0,a.jsx)(p.z,{className:"w-4 h-4 mr-2"}),"Edit"]}),e.editCard&&"private"!==e.data.privacy_level&&(0,a.jsx)(ea.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==y?void 0:y.username)&&(0,a.jsxs)(c.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)(g.r,{className:"w-4 h-4 mr-2"}),"Delete"]})]})]})}),(0,a.jsx)("div",{className:"float-right",children:e.userProfile?(0,a.jsx)(c.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:()=>en(e.data.slug,y),children:(0,a.jsx)(j.g,{className:"w-6 h-6 ".concat((0,E.oz)(e.data.color))})}):(0,a.jsx)(c.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:()=>r(!0),children:(0,a.jsx)(j.g,{className:"w-6 h-6 ".concat((0,E.oz)(e.data.color))})})})]}),e.editCard?(0,a.jsxs)(P.cZ,{className:"lg:max-w-screen-lg overflow-y-scroll max-h-screen",children:[(0,a.jsxs)(X.$N,{children:["Edit ",(0,a.jsx)("b",{children:e.data.name})]}),(0,a.jsx)(eu,{form:w,onSubmit:t=>{let a=e.editCard?"PATCH":"POST",l=t;e.editCard&&(l={...t,slug:e.data.slug}),fetch("/api/agents",{method:a,headers:{"Content-Type":"application/json"},body:JSON.stringify(l)}).then(t=>{200===t.status?(w.reset(),s(!1),v(null),e.setAgentChangeTriggered(!0)):t.json().then(e=>{console.error(e),w.clearErrors(),e.error&&v(e.error)})}).catch(e=>{console.error("Error:",e),v(e),w.clearErrors()})},create:!1,errors:o,filesOptions:e.filesOptions,modelOptions:e.modelOptions,slug:e.data.slug,inputToolOptions:e.inputToolOptions,isSubscribed:e.isSubscribed,outputModeOptions:e.outputModeOptions})]}):(0,a.jsxs)(P.cZ,{className:"whitespace-pre-line max-h-[80vh] max-w-[90vw] rounded-lg",children:[(0,a.jsx)(P.fK,{children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,A.TI)(e.data.icon,e.data.color),(0,a.jsx)("p",{className:"font-bold text-lg",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)(P.cN,{children:(0,a.jsxs)(c.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:()=>{en(e.data.slug,y),s(!1)},children:[(0,a.jsx)(j.g,{className:"w-6 h-6 m-2 ".concat((0,E.oz)(e.data.color))}),"Start Chatting"]})})]})]})})}),(0,a.jsx)(I.aY,{children:(0,a.jsx)("div",{className:n().agentPersonality,children:(0,a.jsx)("button",{className:"".concat(n().infoButton," text-neutral-500 dark:text-white"),onClick:()=>s(!0),children:(0,a.jsx)("p",{children:e.data.persona})})})}),(0,a.jsx)(I.eW,{children:(0,a.jsx)("div",{className:"flex flex-wrap items-center gap-1",children:C()})})]})}let ed=T.z.object({name:T.z.string({required_error:"Name is required"}).min(1,"Name is required"),persona:T.z.string({required_error:"Personality is required"}).min(1,"Personality is required"),color:T.z.string({required_error:"Color is required"}).min(1,"Color is required"),icon:T.z.string({required_error:"Icon is required"}).min(1,"Icon is required"),privacy_level:T.z.string({required_error:"Privacy level is required"}).min(1,"Privacy level is required"),chat_model:T.z.string({required_error:"Chat model is required"}).min(1,"Chat model is required"),files:T.z.array(T.z.string()).default([]).optional(),input_tools:T.z.array(T.z.string()).default([]).optional(),output_modes:T.z.array(T.z.string()).default([]).optional()});function eu(e){let[t,s]=(0,i.useState)(!1),l=(0,A.BI)(),n=E.xF,r=(0,E.oz)(e.form.getValues("color")),[o,d]=(0,i.useState)(!1),[u,h]=(0,i.useState)(null),[m,x]=(0,i.useState)(null),[f,p]=(0,i.useState)(!1),[g,j]=(0,i.useState)(0),[z,T]=(0,i.useState)([]),[I,P]=(0,i.useState)([]),[R,V]=(0,i.useState)(0),[M,Z]=(0,i.useState)(!0),F=["public","private","protected"],W=[{fields:[{name:"name",label:"Name"},{name:"persona",label:"Personality"}],label:"Basic Settings"},{fields:[{name:"color",label:"Color"},{name:"icon",label:"Icon"},{name:"chat_model",label:"Chat Model"},{name:"privacy_level",label:"Privacy Level"}],label:"Customization & Access"},{fields:[{name:"files",label:"Knowledge Base"},{name:"input_tools",label:"Input Tools"},{name:"output_modes",label:"Output Modes"}],label:"Advanced Settings"}],X=(0,i.useRef)(null);function Y(e){e.preventDefault(),d(!0)}function ea(e){e.preventDefault(),d(!1)}function el(e){e.preventDefault(),d(!1),e.dataTransfer.files&&en(e.dataTransfer.files)}function en(e){(0,H.ko)(e,h,p,x,T)}function er(){X&&X.current&&X.current.click()}function ei(e){e.target.files&&en(e.target.files)}(0,i.useEffect)(()=>{if(f||j(0),f){let e=setInterval(()=>{j(e=>{let t=e+(Math.floor(5*Math.random())+1);return t<100?t:100})},800);return()=>clearInterval(e)}},[f]),(0,i.useEffect)(()=>{P(Array.from(new Set([...I,...e.form.getValues("files")||[],...e.filesOptions||[]])))},[]),(0,i.useEffect)(()=>{z.length>0&&(eo(z),P(e=>[...e,...z]))},[z]),(0,i.useEffect)(()=>{e.errors&&s(!1)},[e.errors]);let eo=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)}};if(!e.isSubscribed&&M)return(0,a.jsx)(ee.aR,{open:!0,children:(0,a.jsxs)(ee._T,{children:[(0,a.jsx)(ee.fY,{children:(0,a.jsx)(ee.f$,{children:"Upgrade to Futurist"})}),(0,a.jsxs)(ee.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)(ee.xo,{children:[(0,a.jsx)(ee.le,{onClick:()=>{Z(!1)},children:"Cancel"}),(0,a.jsx)(ee.OL,{onClick:()=>{window.location.href="/settings"},children:"Continue"})]})]})});let ec=t=>{switch(t){case"name":return(0,a.jsx)(q.Wi,{control:e.form.control,name:"name",render:e=>{let{field:t}=e;return(0,a.jsxs)(q.xJ,{className:"space-y-0 grid gap-2",children:[(0,a.jsx)(q.lX,{children:"Name"}),(0,a.jsx)(q.pf,{children:"What should this agent be called? Pick something descriptive & memorable."}),(0,a.jsx)(q.NI,{children:(0,a.jsx)(L.I,{placeholder:"Biologist",...t})}),(0,a.jsx)(q.zG,{})]})}},t);case"chat_model":return(0,a.jsx)(q.Wi,{control:e.form.control,name:"chat_model",render:t=>{let{field:s}=t;return(0,a.jsxs)(q.xJ,{className:"space-y-1 grid gap-2",children:[(0,a.jsx)(q.lX,{children:"Chat Model"}),(0,a.jsx)(q.pf,{children:"Which large language model should this agent use?"}),(0,a.jsxs)(J.Ph,{onValueChange:s.onChange,defaultValue:s.value,children:[(0,a.jsx)(q.NI,{children:(0,a.jsx)(J.i4,{className:"text-left",children:(0,a.jsx)(J.ki,{})})}),(0,a.jsx)(J.Bw,{className:"items-start space-y-1 inline-flex flex-col",children:e.modelOptions.map(e=>(0,a.jsx)(J.Ql,{value:e.name,children:(0,a.jsx)("div",{className:"flex items-center space-x-2",children:e.name})},e.id))})]}),(0,a.jsx)(q.zG,{})]})}},t);case"privacy_level":return(0,a.jsx)(q.Wi,{control:e.form.control,name:"privacy_level",render:e=>{let{field:t}=e;return(0,a.jsxs)(q.xJ,{className:"space-y-1 grid gap-2",children:[(0,a.jsx)(q.lX,{children:(0,a.jsx)("div",{children:"Privacy Level"})}),(0,a.jsx)(q.pf,{children:(0,a.jsxs)(es.J2,{children:[(0,a.jsx)(es.xo,{asChild:!0,children:(0,a.jsx)(c.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)(v.k,{className:"inline"}),(0,a.jsx)("p",{className:"text-sm",children:"Learn more"})]})})}),(0,a.jsxs)(es.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)(J.Ph,{onValueChange:t.onChange,defaultValue:t.value,children:[(0,a.jsx)(q.NI,{children:(0,a.jsx)(J.i4,{className:"w-[200px]",children:(0,a.jsx)(J.ki,{placeholder:"private"})})}),(0,a.jsx)(J.Bw,{className:"items-center space-y-1 inline-flex flex-col",children:F.map(e=>(0,a.jsx)(J.Ql,{value:e,children:(0,a.jsx)("div",{className:"flex items-center space-x-2",children:e})},e))})]}),(0,a.jsx)(q.zG,{})]})}},t);case"color":return(0,a.jsx)(q.Wi,{control:e.form.control,name:"color",render:e=>{let{field:t}=e;return(0,a.jsxs)(q.xJ,{className:"space-y-3",children:[(0,a.jsx)(q.lX,{children:"Color"}),(0,a.jsx)(q.pf,{children:"Choose a color for your agent."}),(0,a.jsxs)(J.Ph,{onValueChange:t.onChange,defaultValue:t.value,children:[(0,a.jsx)(q.NI,{children:(0,a.jsx)(J.i4,{className:"w-[200px]",children:(0,a.jsx)(J.ki,{placeholder:"Color"})})}),(0,a.jsx)(J.Bw,{className:"items-center space-y-1 inline-flex flex-col",children:n.map(e=>(0,a.jsx)(J.Ql,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(b.C,{className:"w-6 h-6 mr-2 ".concat((0,E.oz)(e)),weight:"fill"}),e]})},e))})]}),(0,a.jsx)(q.zG,{})]})}},t);case"icon":return(0,a.jsx)(q.Wi,{control:e.form.control,name:"icon",render:t=>{let{field:s}=t;return(0,a.jsxs)(q.xJ,{className:"space-y-3",children:[(0,a.jsx)(q.lX,{children:"Icon"}),(0,a.jsx)(q.pf,{children:"Choose an icon for your agent."}),(0,a.jsxs)(J.Ph,{onValueChange:s.onChange,defaultValue:s.value,children:[(0,a.jsx)(q.NI,{children:(0,a.jsx)(J.i4,{className:"w-[200px]",children:(0,a.jsx)(J.ki,{placeholder:"Icon"})})}),(0,a.jsx)(J.Bw,{className:"items-center space-y-1 inline-flex flex-col",children:l.map(t=>(0,a.jsx)(J.Ql,{value:t,children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,A.TI)(t,e.form.getValues("color"),"w-6","h-6"),t]})},t))})]}),(0,a.jsx)(q.zG,{})]})}},t);case"persona":return(0,a.jsx)(q.Wi,{control:e.form.control,name:"persona",render:e=>{let{field:t}=e;return(0,a.jsxs)(q.xJ,{className:"space-y-1 grid gap-2",children:[(0,a.jsx)(q.lX,{children:"Personality"}),(0,a.jsx)(q.pf,{children:"What is the personality, thought process, or tuning of this agent? Get creative; this is how you can influence the agent constitution."}),(0,a.jsx)(q.NI,{children:(0,a.jsx)(D.g,{placeholder:"You are an excellent biologist, at the top of your field in marine biology.",...t})}),(0,a.jsx)(q.zG,{})]})}},t);case"files":return(0,a.jsx)(q.Wi,{control:e.form.control,name:"files",render:t=>{let{field:s}=t;return(0,a.jsxs)(q.xJ,{className:"flex flex-col gap-2",children:[(0,a.jsx)(q.lX,{children:"Knowledge Base"}),(0,a.jsxs)(q.pf,{children:["Which information should be part of its digital brain?"," ",(0,a.jsx)("a",{href:"/settings",children:"Manage data"}),"."]}),(0,a.jsxs)(G,{children:[(0,a.jsxs)(U,{className:"flex items-center justify-between text-sm gap-2",children:[(0,a.jsx)(N.K,{}),s.value&&s.value.length>0?"".concat(s.value.length," files selected"):"Select files"]}),(0,a.jsx)(K,{children:(0,a.jsxs)(Q.mY,{children:[(0,a.jsx)(ee.aR,{open:null!==u||null!=m,children:(0,a.jsxs)(ee._T,{children:[(0,a.jsx)(ee.fY,{children:(0,a.jsx)(ee.f$,{children:"Alert"})}),(0,a.jsx)(ee.yT,{children:u||m}),(0,a.jsx)(ee.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>{h(null),x(null),p(!1)},children:"Close"})]})}),(0,a.jsxs)("div",{className:"flex flex-col h-full cursor-pointer",onDragOver:Y,onDragLeave:ea,onDrop:el,onClick:er,children:[(0,a.jsx)("input",{type:"file",multiple:!0,ref:X,style:{display:"none"},onChange:ei}),(0,a.jsx)("div",{className:"flex-none p-4",children:f&&(0,a.jsx)(et.E,{indicatorColor:"bg-slate-500",className:"w-full h-2 rounded-full",value:g})}),(0,a.jsx)("div",{className:"flex-none p-4 bg-secondary border-b ".concat(o?"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:o?(0,a.jsxs)("div",{className:"flex items-center justify-center w-full h-full",children:[(0,a.jsx)(y.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)(w.v,{className:"h-6 w-6 mr-2"}),(0,a.jsx)("span",{children:"Drag and drop files here"})]})})})]}),(0,a.jsx)(Q.sZ,{placeholder:"Select files..."}),(0,a.jsxs)(Q.e8,{children:[(0,a.jsx)(Q.rb,{children:"No files found."}),(0,a.jsx)(Q.fu,{children:I.map(t=>(0,a.jsxs)(Q.di,{value:t,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)(_.J,{className:(0,$.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)(q.Wi,{control:e.form.control,name:"input_tools",render:t=>{let{field:s}=t;return(0,a.jsxs)(q.xJ,{className:"flex flex-col gap-2",children:[(0,a.jsx)(q.lX,{children:"Restrict Input Tools"}),(0,a.jsxs)(q.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)(G,{children:[(0,a.jsxs)(U,{className:"flex items-center justify-between text-sm gap-2",children:[(0,a.jsx)(N.K,{}),s.value&&s.value.length>0?"".concat(s.value.length," tools selected"):"All tools"]}),(0,a.jsx)(K,{children:(0,a.jsx)(Q.mY,{children:(0,a.jsx)(Q.e8,{children:(0,a.jsx)(Q.fu,{children:Object.entries(e.inputToolOptions).map(t=>{let[l,n]=t;return(0,a.jsxs)(Q.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)(_.J,{className:(0,$.cn)("mr-2 h-4 w-4",s.value&&s.value.includes(l)?"opacity-100":"opacity-0")}),(0,a.jsxs)("div",{className:(0,$.cn)("flex items-center space-x-2"),children:[(0,a.jsx)("p",{children:(0,a.jsx)("b",{children:l})}),(0,a.jsx)("p",{children:n})]})]},l)})})})})})]})]})}},t);case"output_modes":return(0,a.jsx)(q.Wi,{control:e.form.control,name:"output_modes",render:t=>{let{field:s}=t;return(0,a.jsxs)(q.xJ,{className:"flex flex-col gap-2",children:[(0,a.jsx)(q.lX,{children:"Restrict Output Modes"}),(0,a.jsxs)(q.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)(G,{children:[(0,a.jsxs)(U,{className:"flex items-center justify-between text-sm gap-2",children:[(0,a.jsx)(N.K,{}),s.value&&s.value.length>0?"".concat(s.value.length," modes selected"):"All modes"]}),(0,a.jsx)(K,{children:(0,a.jsx)(Q.mY,{children:(0,a.jsx)(Q.e8,{children:(0,a.jsx)(Q.fu,{children:Object.entries(e.outputModeOptions).map(t=>{let[l,n]=t;return(0,a.jsxs)(Q.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)(_.J,{className:(0,$.cn)("mr-2 h-4 w-4",s.value&&s.value.includes(l)?"opacity-100":"opacity-0")}),(0,a.jsxs)("div",{className:(0,$.cn)("flex items-center space-x-2"),children:[(0,a.jsx)("p",{children:(0,a.jsx)("b",{children:l})}),(0,a.jsx)("p",{children:n})]})]},l)})})})})})]})]})}},t);default:return null}};return(0,a.jsx)(q.l0,{...e.form,children:(0,a.jsxs)("form",{onSubmit:e.form.handleSubmit(t=>{e.onSubmit(t),s(!0)}),className:"space-y-6",children:[(0,a.jsx)("div",{className:"space-y-6",children:W[R].label}),R<W.length&&W[R].fields.map(e=>ec(e.name)),(0,a.jsxs)("div",{className:"flex justify-between mt-4",children:[(0,a.jsxs)(c.z,{type:"button",variant:"outline",onClick:e=>{e.preventDefault(),R>0&&V(R-1)},disabled:0===R,className:"items-center ".concat(t?"bg-stone-100 dark:bg-neutral-900":""," text-white ").concat(r),children:[(0,a.jsx)(C.X,{className:"mr-2 h-4 w-4"}),"Previous"]}),R<W.length-1?(0,a.jsxs)(c.z,{type:"button",variant:"outline",onClick:e=>{e.preventDefault(),R<W.length-1&&V(R+1)},disabled:!(t=>{try{return ed.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}})(W[R]),className:"items-center ".concat(t?"bg-stone-100 dark:bg-neutral-900":""," text-white ").concat(r),children:["Next",(0,a.jsx)(k.o,{className:"ml-2 h-4 w-4"})]}):(0,a.jsxs)(c.z,{type:"submit",variant:"outline",disabled:t||!e.isSubscribed,className:"items-center ".concat(t?"bg-stone-100 dark:bg-neutral-900":""," text-white ").concat(r),children:[(0,a.jsx)(S.B,{className:"h-4 w-4 mr-2"}),t?"Booting...":"Save"]})]}),e.errors&&(0,a.jsx)(B.bZ,{className:"bg-secondary border-none my-4",children:(0,a.jsxs)(B.X,{className:"flex items-center gap-1",children:[(0,a.jsx)(O.f,{weight:"fill",className:"h-4 w-4 text-yellow-400 inline"}),(0,a.jsx)("span",{children:e.errors})]})})]})})}function eh(e){let[t,s]=(0,i.useState)(!1),[l,n]=(0,i.useState)(null),[r,o]=(0,i.useState)(!0),c=(0,F.cI)({resolver:(0,W.F)(ed),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.selectedChatModelOption,files:[]}});return(0,i.useEffect)(()=>{c.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.selectedChatModelOption,files:[]})},[e.selectedChatModelOption,e.data]),(0,a.jsxs)(P.Vq,{open:t,onOpenChange:s,children:[(0,a.jsx)(P.hg,{children:(0,a.jsxs)("div",{className:"flex items-center text-md gap-2",children:[(0,a.jsx)(w.v,{}),"Create Agent"]})}),(0,a.jsxs)(P.cZ,{className:"lg:max-w-screen-lg overflow-y-scroll max-h-screen",children:[(0,a.jsx)(P.fK,{children:"Create Agent"}),!e.userProfile&&r&&(0,a.jsx)(R.Z,{loginRedirectMessage:"Sign in to start chatting with a specialized agent",onOpenChange:o}),(0,a.jsx)(eu,{form:c,onSubmit:t=>{fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then(t=>{200===t.status?(c.reset(),s(!1),n(null),e.setAgentChangeTriggered(!0)):t.json().then(e=>{console.error(e),e.error&&n(e.error)})}).catch(e=>{console.error("Error:",e),n(e)})},create:!0,errors:l,filesOptions:e.filesOptions,modelOptions:e.modelOptions,inputToolOptions:e.inputToolOptions,outputModeOptions:e.outputModeOptions,isSubscribed:e.isSubscribed})]})]})}function em(){let{data:e,error:t,mutate:s}=(0,r.ZP)("agents",ei,{revalidateOnFocus:!1}),l=(0,o.GW)(),{userConfig:c}=(0,o.h2)(!0),[d,u]=(0,i.useState)(!1),h=(0,Z.IC)(),[m,x]=(0,i.useState)([]),[f,p]=(0,i.useState)([]),[g,j]=(0,i.useState)(null),{data:v,error:b}=(0,r.ZP)(c?"/api/content/computer":null,eo),{data:N,error:y}=(0,r.ZP)("/api/agents/options",eo),[w,_]=(0,i.useState)(!1);if((0,i.useEffect)(()=>{w&&(s(),_(!1))},[w]),(0,i.useEffect)(()=>{if(e){x(e.filter(e=>e.creator===(null==l?void 0:l.username)));let t=e.filter(e=>"private"!==e.privacy_level&&e.creator!==(null==l?void 0:l.username));p(t);{let s=new URLSearchParams(window.location.search).get("agent");if(s){j(s);let a=e.find(e=>e.slug===s);a||(a=t.find(e=>e.slug===s)),a||fetch("/api/agents/".concat(s)).then(e=>{if(404===e.status)throw Error("Agent not found");return e.json()}).then(e=>{"protected"===e.privacy_level&&p(t=>[...t,e])})}}}},[e,l]),t)return(0,a.jsxs)("main",{className:n().main,children:[(0,a.jsx)("div",{className:"".concat(n().titleBar," text-5xl"),children:"Agents"}),(0,a.jsx)("div",{className:n().agentList,children:"Error loading agents"})]});if(!e)return(0,a.jsx)("main",{className:n().main,children:(0,a.jsxs)("div",{className:n().agentList,children:[(0,a.jsx)(V.l,{})," booting up your agents"]})});let C=(null==c?void 0:c.chat_model_options)||[],k=(null==c?void 0:c.selected_chat_model_config)||0,S=(null==c?void 0:c.subscription_state)&&[o.o9.SUBSCRIBED.valueOf(),o.o9.TRIAL.valueOf(),o.o9.UNSUBSCRIBED.valueOf()].includes(c.subscription_state)||!1,O=C.find(e=>e.id===k);return(0,a.jsx)("main",{className:"w-full mx-auto",children:(0,a.jsxs)("div",{className:"grid w-full mx-auto",children:[(0,a.jsx)("div",{className:"".concat(n().sidePanel," top-0"),children:(0,a.jsx)(M.ZP,{conversationId:null,uploadedFiles:[],isMobileWidth:h})}),(0,a.jsxs)("div",{className:"".concat(n().pageLayout," w-full"),children:[(0,a.jsxs)("div",{className:"pt-6 md:pt-8 flex justify-between",children:[(0,a.jsx)("h1",{className:"text-3xl flex items-center",children:"Agents"}),(0,a.jsx)("div",{className:"ml-auto float-right border p-2 pt-3 rounded-xl font-bold hover:bg-stone-100 dark:hover:bg-neutral-900",children:(0,a.jsx)(eh,{data:{slug:"",name:"",persona:"",color:"",icon:"",privacy_level:"private",managed_by_admin:!1,chat_model:"",input_tools:[],output_modes:[]},userProfile:l,isMobileWidth:h,filesOptions:v||[],modelOptions:(null==c?void 0:c.chat_model_options)||[],selectedChatModelOption:(null==O?void 0:O.name)||"",isSubscribed:S,setAgentChangeTriggered:_,inputToolOptions:(null==N?void 0:N.input_tools)||{},outputModeOptions:(null==N?void 0:N.output_modes)||{}})})]}),d&&(0,a.jsx)(R.Z,{loginRedirectMessage:"Sign in to start chatting with a specialized agent",onOpenChange:u}),(0,a.jsx)(B.bZ,{className:"bg-secondary border-none my-4",children:(0,a.jsxs)(B.X,{children:[(0,a.jsx)(z.B,{weight:"fill",className:"h-4 w-4 text-purple-400 inline"}),(0,a.jsx)("span",{className:"font-bold",children:"How it works"})," Use any of these specialized personas to tune your conversation to your needs."]})}),(0,a.jsx)("div",{className:"pt-6 md:pt-8",children:(0,a.jsx)("div",{className:"".concat(n().agentList),children:m.map(e=>(0,a.jsx)(ec,{data:e,userProfile:l,isMobileWidth:h,filesOptions:null!=v?v:[],selectedChatModelOption:(null==O?void 0:O.name)||"",isSubscribed:S,setAgentChangeTriggered:_,modelOptions:(null==c?void 0:c.chat_model_options)||[],editCard:!0,agentSlug:g||"",inputToolOptions:(null==N?void 0:N.input_tools)||{},outputModeOptions:(null==N?void 0:N.output_modes)||{}},e.slug))})}),(0,a.jsxs)("div",{className:"pt-6 md:pt-8",children:[(0,a.jsx)("h2",{className:"text-2xl",children:"Explore"}),(0,a.jsx)("div",{className:"".concat(n().agentList),children:f.map(e=>(0,a.jsx)(ec,{data:e,userProfile:l,isMobileWidth:h,editCard:!1,filesOptions:null!=v?v:[],selectedChatModelOption:(null==O?void 0:O.name)||"",isSubscribed:S,setAgentChangeTriggered:_,modelOptions:(null==c?void 0:c.chat_model_options)||[],agentSlug:g||"",inputToolOptions:(null==N?void 0:N.input_tools)||{},outputModeOptions:(null==N?void 0:N.output_modes)||{}},e.slug))})]})]})]})})}},66820:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});var a=s(57437),l=s(6780),n=s(87138);function r(e){return(0,a.jsx)(l.aR,{open:!0,onOpenChange:e.onOpenChange,children:(0,a.jsxs)(l._T,{children:[(0,a.jsx)(l.fY,{children:(0,a.jsx)(l.f$,{children:"Sign in to Khoj to continue"})}),(0,a.jsxs)(l.yT,{children:[e.loginRedirectMessage,". By logging in, you agree to our"," ",(0,a.jsx)(n.default,{href:"https://khoj.dev/terms-of-service",children:"Terms of Service."})]}),(0,a.jsxs)(l.xo,{children:[(0,a.jsx)(l.le,{children:"Dismiss"}),(0,a.jsx)(l.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>{window.location.href="/login?next=".concat(encodeURIComponent(window.location.pathname))},children:(0,a.jsxs)(n.default,{href:"/login?next=".concat(encodeURIComponent(window.location.pathname)),children:[" ","Login"]})})]})]})})}},18642:function(e,t,s){"use strict";s.d(t,{Z:function(){return c}});var a=s(57437),l=s(90837),n=s(50495),r=s(83102),i=s(67135),o=s(34797);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)(n.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)(r.I,{id:"link",defaultValue:e.url,readOnly:!0})]}),(0,a.jsx)(n.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"})})]})]})]})}},47412:function(e,t,s){"use strict";s.d(t,{X:function(){return c},bZ:function(){return o}});var a=s(57437),l=s(2265),n=s(12218),r=s(37440);let i=(0,n.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,...n}=e;return(0,a.jsx)("div",{ref:t,role:"alert",className:(0,r.cn)(i({variant:l}),s),...n})});o.displayName="Alert",l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)("h5",{ref:t,className:(0,r.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,r.cn)("text-sm [&_p]:leading-relaxed",s),...l})});c.displayName="AlertDescription"},32653: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 g},xJ:function(){return x},zG:function(){return j}});var a=s(57437),l=s(2265),n=s(71538),r=s(39343),i=s(37440),o=s(67135);let c=r.RV,d=l.createContext({}),u=e=>{let{...t}=e;return(0,a.jsx)(d.Provider,{value:{name:t.name},children:(0,a.jsx)(r.Qr,{...t})})},h=()=>{let e=l.useContext(d),t=l.useContext(m),{getFieldState:s,formState:a}=(0,r.Gc)(),n=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"),...n}},m=l.createContext({}),x=l.forwardRef((e,t)=>{let{className:s,...n}=e,r=l.useId();return(0,a.jsx)(m.Provider,{value:{id:r},children:(0,a.jsx)("div",{ref:t,className:(0,i.cn)("space-y-2",s),...n})})});x.displayName="FormItem";let f=l.forwardRef((e,t)=>{let{className:s,...l}=e,{error:n,formItemId:r}=h();return(0,a.jsx)(o._,{ref:t,className:(0,i.cn)(n&&"text-destructive",s),htmlFor:r,...l})});f.displayName="FormLabel";let p=l.forwardRef((e,t)=>{let{...s}=e,{error:l,formItemId:r,formDescriptionId:i,formMessageId:o}=h();return(0,a.jsx)(n.g7,{ref:t,id:r,"aria-describedby":l?"".concat(i," ").concat(o):"".concat(i),"aria-invalid":!!l,...s})});p.displayName="FormControl";let g=l.forwardRef((e,t)=>{let{className:s,...l}=e,{formDescriptionId:n}=h();return(0,a.jsx)("p",{ref:t,id:n,className:(0,i.cn)("text-sm text-muted-foreground",s),...l})});g.displayName="FormDescription";let j=l.forwardRef((e,t)=>{let{className:s,children:l,...n}=e,{error:r,formMessageId:o}=h(),c=r?String(null==r?void 0:r.message):l;return c?(0,a.jsx)("p",{ref:t,id:o,className:(0,i.cn)("text-sm font-medium text-destructive",s),...n,children:c}):null});j.displayName="FormMessage"},67135:function(e,t,s){"use strict";s.d(t,{_:function(){return c}});var a=s(57437),l=s(2265),n=s(38364),r=s(12218),i=s(37440);let o=(0,r.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)(n.f,{ref:t,className:(0,i.cn)(o(),s),...l})});c.displayName=n.f.displayName},70571:function(e,t,s){"use strict";s.d(t,{E:function(){return i}});var a=s(57437),l=s(2265),n=s(52431),r=s(37440);let i=l.forwardRef((e,t)=>{let{className:s,value:l,indicatorColor:i,...o}=e;return(0,a.jsx)(n.fC,{ref:t,className:(0,r.cn)("relative h-4 w-full overflow-hidden rounded-full bg-secondary",s),...o,children:(0,a.jsx)(n.z$,{className:"h-full w-full flex-1 bg-primary transition-all ".concat(i),style:{transform:"translateX(-".concat(100-(l||0),"%)")}})})});i.displayName=n.fC.displayName},46294:function(e,t,s){"use strict";s.d(t,{Bw:function(){return f},Ph:function(){return d},Ql:function(){return p},i4:function(){return h},ki:function(){return u}});var a=s(57437),l=s(2265),n=s(77539),r=s(42421),i=s(14392),o=s(22468),c=s(37440);let d=n.fC;n.ZA;let u=n.B4,h=l.forwardRef((e,t)=>{let{className:s,children:l,...i}=e;return(0,a.jsxs)(n.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)(n.JO,{asChild:!0,children:(0,a.jsx)(r.Z,{className:"h-4 w-4 opacity-50"})})]})});h.displayName=n.xz.displayName;let m=l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)(n.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"})})});m.displayName=n.u_.displayName;let x=l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)(n.$G,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",s),...l,children:(0,a.jsx)(r.Z,{className:"h-4 w-4"})})});x.displayName=n.$G.displayName;let f=l.forwardRef((e,t)=>{let{className:s,children:l,position:r="popper",...i}=e;return(0,a.jsx)(n.h_,{children:(0,a.jsxs)(n.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"===r&&"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:r,...i,children:[(0,a.jsx)(m,{}),(0,a.jsx)(n.l_,{className:(0,c.cn)("p-1","popper"===r&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:l}),(0,a.jsx)(x,{})]})})});f.displayName=n.VY.displayName,l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)(n.__,{ref:t,className:(0,c.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",s),...l})}).displayName=n.__.displayName;let p=l.forwardRef((e,t)=>{let{className:s,children:l,...r}=e;return(0,a.jsxs)(n.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),...r,children:[(0,a.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,a.jsx)(n.wU,{children:(0,a.jsx)(o.Z,{className:"h-4 w-4"})})}),(0,a.jsx)(n.eT,{children:l})]})});p.displayName=n.ck.displayName,l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)(n.Z0,{ref:t,className:(0,c.cn)("-mx-1 my-1 h-px bg-muted",s),...l})}).displayName=n.Z0.displayName},93146:function(e,t,s){"use strict";s.d(t,{g:function(){return r}});var a=s(57437),l=s(2265),n=s(37440);let r=l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.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 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",s),ref:t,...l})});r.displayName="Textarea"},19666:function(e,t,s){"use strict";s.d(t,{_v:function(){return d},aJ:function(){return c},pn:function(){return i},u:function(){return o}});var a=s(57437),l=s(2265),n=s(27071),r=s(37440);let i=n.zt,o=n.fC,c=n.xz,d=l.forwardRef((e,t)=>{let{className:s,sideOffset:l=4,...i}=e;return(0,a.jsx)(n.VY,{ref:t,sideOffset:l,className:(0,r.cn)("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",s),...i})});d.displayName=n.VY.displayName},15283:function(e){e.exports={titleBar:"agents_titleBar__FzYbY",agentPersonality:"agents_agentPersonality__o0Ysz",pageLayout:"agents_pageLayout__gR3S3",sidePanel:"agents_sidePanel__wGVGc",infoButton:"agents_infoButton__NqI7E",agentList:"agents_agentList__XVx4A"}}},function(e){e.O(0,[9460,8918,9001,3062,8840,3110,51,7762,1603,9417,2971,7023,1744],function(){return e(e.s=1813)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1929],{39929:function(e,t,s){Promise.resolve().then(s.bind(s,38874))},38874:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return p}});var a=s(57437),o=s(65104),n=s.n(o),i=s(2265),r=s(48861),c=s(82697),l=s(16463),d=s(58485),u=s(9557);s(7395);var h=s(69591),m=s(59479),g=s(79306);function f(e){let t=(0,l.useSearchParams)().get("conversationId"),[s,o]=(0,i.useState)(""),[r,d]=(0,i.useState)(null),[u,h]=(0,i.useState)(!1),[g,f]=(0,i.useState)(null),p=e.setQueryToProcess,x=e.onConversationIdChange,_=e.isMobileWidth?"w-full":"w-4/6";if((0,i.useEffect)(()=>{r&&e.setImage64(encodeURIComponent(r))},[r,e.setImage64]),(0,i.useEffect)(()=>{let t=localStorage.getItem("image");t&&(d(t),e.setImage64(encodeURIComponent(t)),localStorage.removeItem("image"));let s=localStorage.getItem("message");s&&(h(!0),p(s))},[p]),(0,i.useEffect)(()=>{s&&(h(!0),p(s))},[s,p]),(0,i.useEffect)(()=>{t&&(null==x||x(t))},[t,x]),(0,i.useEffect)(()=>{e.streamedMessages&&e.streamedMessages.length>0&&e.streamedMessages[e.streamedMessages.length-1].completed?h(!1):o("")},[e.streamedMessages]),!t){window.location.href="/";return}return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:n().chatBodyFull,children:(0,a.jsx)(c.Z,{conversationId:t,setTitle:e.setTitle,setAgent:f,pendingMessage:u?s:"",incomingMessages:e.streamedMessages,customClassName:_})}),(0,a.jsx)("div",{className:"".concat(n().inputBox," p-1 md:px-2 shadow-md bg-background align-middle items-center justify-center dark:bg-neutral-700 dark:border-0 dark:shadow-sm rounded-t-2xl rounded-b-none md:rounded-xl h-fit ").concat(_," mr-auto ml-auto"),children:(0,a.jsx)(m.Z,{agentColor:null==g?void 0:g.color,isLoggedIn:e.isLoggedIn,sendMessage:e=>o(e),sendImage:e=>d(e),sendDisabled:u,chatOptionsData:e.chatOptionsData,conversationId:t,isMobileWidth:e.isMobileWidth,setUploadedFiles:e.setUploadedFiles})})]})}function p(){let e="Khoj AI - Chat",[t,s]=(0,i.useState)(null),[o,c]=(0,i.useState)(!0),[l,m]=(0,i.useState)(e),[p,x]=(0,i.useState)(null),[_,y]=(0,i.useState)([]),[w,I]=(0,i.useState)(""),[S,b]=(0,i.useState)(!1),[v,j]=(0,i.useState)([]),[B,C]=(0,i.useState)(""),E=(0,h.k6)()||{timezone:Intl.DateTimeFormat().resolvedOptions().timeZone},T=(0,g.GW)(),M=(0,h.IC)();async function k(e){if(!e.ok)throw Error(e.statusText);if(!e.body)throw Error("Response body is null");let t=e.body.getReader(),s=new TextDecoder,a="␃\uD83D\uDD1A␗",o="",n=[],i={};for(;;){let e;let{done:r,value:c}=await t.read();if(r){I(""),b(!1),C("");break}for(o+=s.decode(c,{stream:!0});-1!==(e=o.indexOf(a));){let t=o.slice(0,e);if(o=o.slice(e+a.length),t){let e=_.find(e=>!e.completed);if(!e){console.error("No current message found");return}({context:n,onlineContext:i}=(0,u.VK)(t,e,n,i)),y([..._])}}}}async function N(){if(localStorage.removeItem("message"),!w||!p)return;let e={q:w,conversation_id:p,stream:!0,...E&&{city:E.city,region:E.region,country:E.country,country_code:E.countryCode,timezone:E.timezone},...B&&{image:B}},t=await fetch("/api/chat?client=web",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});try{await k(t)}catch(s){console.error(s);let e=_.find(e=>!e.completed);if(!e)return;let t=s.message;t.includes("Error in input stream")?e.rawResponse="Woops! The connection broke while I was writing my thoughts down. Maybe try again in a bit or dislike this message if the issue persists?":e.rawResponse="Umm, not sure what just happened. I see this error message: ".concat(t,". Could you try again or dislike this message if the issue persists?"),e.completed=!0,y([..._]),I(""),b(!1)}}return((0,i.useEffect)(()=>{fetch("/api/chat/options").then(e=>e.json()).then(e=>{c(!1),e&&s(e)}).catch(e=>{console.error(e)}),(0,h.EK)()},[]),(0,i.useEffect)(()=>{if(w){let e={rawResponse:"",trainOfThought:[],context:[],onlineContext:{},completed:!1,timestamp:new Date().toISOString(),rawQuery:w||"",uploadedImageData:decodeURIComponent(B)};y(t=>[...t,e]),b(!0)}},[w]),(0,i.useEffect)(()=>{S&&N()},[S]),o)?(0,a.jsx)(d.Z,{}):(0,a.jsxs)("div",{className:"".concat(n().main," ").concat(n().chatLayout),children:[(0,a.jsx)("title",{children:"".concat(e).concat(l&&l!==e?": ".concat(l):"")}),(0,a.jsx)("div",{children:(0,a.jsx)(r.ZP,{conversationId:p,uploadedFiles:v,isMobileWidth:M})}),(0,a.jsx)("div",{className:n().chatBox,children:(0,a.jsxs)("div",{className:n().chatBoxBody,children:[!M&&p&&(0,a.jsxs)("div",{className:"".concat(n().chatTitleWrapper," text-nowrap text-ellipsis overflow-hidden max-w-screen-md grid items-top font-bold mr-8 pt-6 col-auto h-fit"),children:[l&&(0,a.jsx)("h2",{className:"text-lg text-ellipsis whitespace-nowrap overflow-x-hidden",children:l}),(0,a.jsx)(r.En,{conversationId:p,setTitle:m,sizing:"md"})]}),(0,a.jsx)(i.Suspense,{fallback:(0,a.jsx)(d.Z,{}),children:(0,a.jsx)(f,{isLoggedIn:null!==T,streamedMessages:_,chatOptionsData:t,setTitle:m,setQueryToProcess:I,setUploadedFiles:j,isMobileWidth:M,onConversationIdChange:e=>{x(e)},setImage64:C})})]})})]})}},16463:function(e,t,s){"use strict";var a=s(71169);s.o(a,"useSearchParams")&&s.d(t,{useSearchParams:function(){return a.useSearchParams}})},65104:function(e){e.exports={main:"chat_main__8xQu5",suggestions:"chat_suggestions__m8n2t",inputBox:"chat_inputBox__LOFws",chatBodyFull:"chat_chatBodyFull__FfKEK",chatBody:"chat_chatBody__sS1LX",chatLayout:"chat_chatLayout__pR203",chatBox:"chat_chatBox__FBct_",titleBar:"chat_titleBar__R5QlK",chatBoxBody:"chat_chatBoxBody__qT_SC",agentIndicator:"chat_agentIndicator__8V55w",chatTitleWrapper:"chat_chatTitleWrapper__6ChWq"}}},function(e){e.O(0,[8918,929,3954,9001,3062,8840,121,3110,6327,1603,9417,3423,9479,2697,2971,7023,1744],function(){return e(e.s=39929)}),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6894],{71884:function(e,t,n){Promise.resolve().then(n.bind(n,69769))},18642:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var i=n(57437),a=n(90837),r=n(50495),s=n(83102),o=n(67135),l=n(34797);function c(e){var t;return(0,i.jsxs)(a.Vq,{children:[(0,i.jsx)(a.hg,{asChild:!0,onClick:e.onShare,children:(0,i.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,i.jsx)(l.m,{className:"w-4 h-4 mr-2"}),e.buttonTitle]})}),(0,i.jsxs)(a.cZ,{children:[(0,i.jsxs)(a.fK,{children:[(0,i.jsx)(a.$N,{children:e.title}),(0,i.jsx)(a.Be,{children:e.description})]}),(0,i.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,i.jsxs)("div",{className:"grid flex-1 gap-2",children:[(0,i.jsx)(o._,{htmlFor:"link",className:"sr-only",children:"Link"}),(0,i.jsx)(s.I,{id:"link",defaultValue:e.url,readOnly:!0})]}),(0,i.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,i.jsx)("span",{children:"Copy"})})]})]})]})}},69769:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return E}});var i=n(57437),a=n(34209),r=n.n(a),s=n(79306),o=n(2265),l=n(89178),c=n(29039),d=n(6780),f=n(53907),h=n.n(f);let u=async e=>(await fetch(e,{method:"GET",headers:{"Content-Type":"application/json"}})).json(),m=e=>{let{data:t,error:n}=(0,c.ZP)(e,u);return{data:t,isLoading:!n&&!t,isError:n}},p=async e=>(await fetch(e,{method:"GET",headers:{"Content-Type":"application/json"}})).json(),x=e=>{let{data:t,error:n}=(0,c.ZP)(e,p);return{data:t,isLoading:!n&&!t,isError:n}},k=e=>{let{data:t}=m("/api/model/chat/options"),{data:n}=x("/api/model/chat"),[a,r]=o.useState(!1),l=(0,s.GW)(),c=e.setModelUsed;return((0,o.useEffect)(()=>{c&&n&&c(n)},[n,c]),t)?(0,i.jsxs)("div",{className:h().modelPicker,children:[(0,i.jsx)("select",{className:h().modelPicker,onChange:n=>{let i=Number(n.target.value),a=t.find(e=>e.id===i);a?function(t){if(!l){r(!0);return}e.setModelUsed&&e.setModelUsed(t),fetch("/api/model/chat?id="+String(t.id),{method:"POST",body:JSON.stringify(t)}).then(e=>{if(!e.ok)throw Error("Failed to select model")}).catch(e=>{console.error("Failed to select model",e)})}(a):console.error("Selected model not found",n.target.value)},disabled:e.disabled,children:null==t?void 0:t.map(t=>(0,i.jsx)("option",{value:t.id,selected:e.initialModel?t.id===e.initialModel.id:(null==n?void 0:n.id)===t.id,children:t.chat_model},t.id))}),(0,i.jsx)(d.aR,{open:a,onOpenChange:r,children:(0,i.jsxs)(d._T,{children:[(0,i.jsxs)(d.fY,{children:[(0,i.jsx)(d.f$,{children:"You must be logged in to configure your model."}),(0,i.jsxs)(d.yT,{children:["Once you create an account with Khoj, you can configure your model and use a whole suite of other features. Check out our"," ",(0,i.jsx)("a",{href:"https://docs.khoj.dev/",children:"documentation"})," to learn more."]})]}),(0,i.jsxs)(d.xo,{children:[(0,i.jsx)(d.le,{children:"Cancel"}),(0,i.jsx)(d.OL,{onClick:()=>{window.location.href=window.location.origin+"/login"},children:"Sign in"})]})]})})]}):(0,i.jsx)("div",{children:"Loading..."})};var j=n(18642),v=n(83102),b=n(50495),g=n(36013),y=n(87138),_=n(48861),C=n(69591);let w=()=>(0,i.jsx)("div",{className:r().loading,children:(0,i.jsxs)("div",{className:r().loadingVerification,children:["Researching...",(0,i.jsxs)("div",{className:r().spinner,children:[(0,i.jsx)("div",{className:"".concat(r().dot1," bg-blue-300")}),(0,i.jsx)("div",{className:"".concat(r().dot2," bg-blue-300")})]})]})});async function N(e,t,n,i,a){n(!0);let r="".concat("Limit your search to reputable sources. Search the internet for relevant supporting or refuting information. Do not reference my notes. Refuse to answer any queries that are not falsifiable by informing me that you will not answer the question. You're not permitted to ask follow-up questions, so do the best with what you have. Respond with **TRUE** or **FALSE** or **INCONCLUSIVE**, then provide your justification. Fact Check:"," ").concat(e);try{var s;let e=await fetch("".concat("/api/chat","?client=web"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({q:r,conversation_id:t,stream:!0})});if(!e.body)throw Error("No response body found");let n=null===(s=e.body)||void 0===s?void 0:s.getReader(),o=new TextDecoder,l="";for(;;){let{done:e,value:t}=await n.read();if(e)break;let r=o.decode(t,{stream:!0});if(r.includes("### compiled references:")){let e=function(e,t){let n=e.split("### compiled references:")[1],i=e.split("### compiled references:")[0],a={};a.response=t+i;let r=JSON.parse(n);return r instanceof Array?a.context=r:"object"==typeof r&&null!==r&&(a.online=r),a}(r,l);e.response&&(l=e.response,i(e.response),a(e))}else l+=r,i(l)}}catch(e){console.error("Error verifying statement: ",e)}finally{n(!1)}}async function S(e){let t=await fetch("/api/chat/sessions?client=web",{method:"POST"});e((await t.json()).conversation_id)}function T(e){let[t,n]=(0,o.useState)(""),[a,r]=(0,o.useState)(!0),s="".concat(e.message,". Use this link for reference: ").concat(e.additionalLink),c=(0,C.IC)();return(0,o.useEffect)(()=>{e.prefilledResponse?(n(e.prefilledResponse),r(!1)):N(s,e.conversationId,r,n,()=>{})},[s,e.conversationId,e.prefilledResponse]),(0,o.useEffect)(()=>{""!==t&&(e.prefilledResponse||a||e.setChildReferencesCallback(e.additionalLink,t,e.linkTitle))},[t,a,e]),(0,i.jsxs)("div",{children:[a&&(0,i.jsx)(w,{}),(0,i.jsx)(l.Z,{chatMessage:{automationId:"",by:"AI",message:t,context:[],created:new Date().toISOString(),onlineContext:{}},isMobileWidth:c})]})}function I(e){var t,n,a;let s=e.linkTitle||(null===(a=e.onlineData)||void 0===a?void 0:null===(n=a.organic)||void 0===n?void 0:null===(t=n[0])||void 0===t?void 0:t.title)||"Reference",o={link:e.additionalLink};return(0,i.jsxs)(g.Zb,{className:"mt-2 mb-4",children:[(0,i.jsxs)(g.Ol,{children:[(0,i.jsx)("a",{className:r().titleLink,href:e.additionalLink,target:"_blank",rel:"noreferrer",children:s}),(0,i.jsx)(L,{...o})]}),(0,i.jsx)(g.aY,{children:(0,i.jsx)(T,{additionalLink:e.additionalLink,message:e.officialFactToVerify,linkTitle:s,conversationId:e.conversationId,setChildReferencesCallback:e.setChildReferencesCallback,prefilledResponse:e.prefilledResponse})})]})}let L=e=>{let t=new URL(e.link).hostname;return(0,i.jsx)("div",{className:r().subLinks,children:(0,i.jsx)("a",{className:"".concat(r().subLinks," bg-blue-200 px-2"),href:e.link,target:"_blank",rel:"noreferrer",children:t})})};function E(){let[e,t]=(0,o.useState)(""),[n,a]=(0,o.useState)(""),[c,d]=(0,o.useState)(!1),[f,h]=(0,o.useState)(""),[u,m]=(0,o.useState)(!1),[p,x]=(0,o.useState)(),[T,E]=(0,o.useState)(),[R,F]=(0,o.useState)(),O=(0,C.IC)(),[A,P]=(0,o.useState)(""),[V,M]=(0,o.useState)(""),[U,D]=(0,o.useState)(!1),[q,Z]=(0,o.useState)();function B(e,t,n){let i=T||[];i.find(t=>t.additionalLink===e)||(i.push({additionalLink:e,response:t,linkTitle:n}),E(i))}let z=(0,s.GW)();function W(){if(u)return;if(!e){alert("Please enter a fact to verify.");return}if(m(!0),!z){let e=window.location.href;window.location.href="/login?next=".concat(e)}x(void 0),h(""),S(P);let t=[...Array(16)].map(()=>Math.random().toString(36)[2]).join("");M(t),window.history.pushState({},document.title,window.location.pathname+"?runId=".concat(t)),a(e),m(!1)}(0,o.useEffect)(()=>{e?document.title="AI Fact Check: ".concat(e):document.title="AI Fact Checker"},[e]),(0,o.useEffect)(()=>{let e=localStorage.getItem("factToVerify");e&&t(e);let n=new URLSearchParams(window.location.search),i=n.get("factToVerify");i&&t(i);let r=n.get("runId");r&&(M(r),(async()=>{try{let e=await fetch("/api/chat/store/factchecker?runId=".concat(r));if(200!==e.status)throw Error("Failed to fetch stored data");let t=JSON.parse(await e.json());t&&(a(t.factToVerify),h(t.response),x(t.references),E(t.childReferences),Z(t.modelUsed)),D(!0)}catch(e){console.error("Error fetching stored data: ",e)}})())},[]),(0,o.useEffect)(()=>{A&&N(n,A,d,h,x)},[A,n]),(0,o.useEffect)(()=>{localStorage.setItem("factToVerify",e)},[e]),(0,o.useEffect)(()=>{let e=document.querySelector('meta[name="description"]');e&&e.setAttribute("content",f);let t=document.querySelector('meta[property="og:description"]');t||((t=document.createElement("meta")).setAttribute("property","og:description"),document.getElementsByTagName("head")[0].appendChild(t)),t.setAttribute("content",f)},[f]);let J=e=>e.map((e,t)=>(0,i.jsx)(I,{additionalLink:e.additionalLink,officialFactToVerify:n,conversationId:A,linkTitle:e.linkTitle,setChildReferencesCallback:B,prefilledResponse:e.response},t)),Y=e=>e instanceof Array?e.map((e,t)=>L(e)):L(e);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{className:"relative md:fixed h-full",children:(0,i.jsx)(_.ZP,{conversationId:null,uploadedFiles:[],isMobileWidth:O})}),(0,i.jsxs)("div",{className:r().factCheckerContainer,children:[(0,i.jsx)("h1",{className:"".concat(r().response," pt-8 md:pt-4 font-large outline-slate-800 dark:outline-slate-200"),children:"AI Fact Checker"}),(0,i.jsx)("footer",{className:"".concat(r().footer," mt-4"),children:"This is an experimental AI tool. It may make mistakes."}),f&&p&&T?(0,i.jsxs)("div",{className:r().reportActions,children:[(0,i.jsx)(b.z,{asChild:!0,variant:"secondary",children:(0,i.jsx)(y.default,{href:"/factchecker",target:"_blank",rel:"noopener noreferrer",children:"Try Another"})}),(0,i.jsx)(j.Z,{buttonTitle:"Share report",title:"AI Fact Checking Report",description:"Share this fact checking report with others. Anyone who has this link will be able to view the report.",url:function(){let e=new URL(window.location.href);return e.searchParams.set("runId",V),e.href}(),onShare:U?()=>{}:function(){fetch("/api/chat/store/factchecker",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runId:V,storeData:{factToVerify:e,response:f,references:p,childReferences:T,runId:V,modelUsed:R}})})}})]}):(0,i.jsxs)("div",{className:r().newReportActions,children:[(0,i.jsxs)("div",{className:"".concat(r().inputFields," mt-4"),children:[(0,i.jsx)(v.I,{type:"text",maxLength:200,placeholder:"Enter a falsifiable statement to verify",disabled:c,onChange:e=>t(e.target.value),value:e,onKeyDown:e=>{"Enter"===e.key&&W()},onFocus:e=>e.target.placeholder="",onBlur:e=>e.target.placeholder="Enter a falsifiable statement to verify"}),(0,i.jsx)(b.z,{disabled:u,onClick:()=>W(),children:"Verify"})]}),(0,i.jsxs)("h3",{className:"mt-4 mb-4",children:["Try with a particular model. You must be"," ",(0,i.jsx)("a",{href:"/settings",className:"font-medium text-blue-600 dark:text-blue-500 hover:underline",children:"subscribed"})," ","to configure the model."]})]}),(0,i.jsx)(k,{disabled:c||U,setModelUsed:F,initialModel:q}),c&&(0,i.jsx)("div",{className:r().loading,children:(0,i.jsx)(w,{})}),f&&(0,i.jsxs)(g.Zb,{className:"mt-4",children:[(0,i.jsx)(g.Ol,{children:(0,i.jsx)(g.ll,{children:n})}),(0,i.jsx)(g.aY,{children:(0,i.jsx)("div",{className:r().responseText,children:(0,i.jsx)(l.Z,{chatMessage:{automationId:"",by:"AI",message:f,context:[],created:new Date().toISOString(),onlineContext:{}},isMobileWidth:O})})}),(0,i.jsx)(g.eW,{children:p&&p.online&&Object.keys(p.online).length>0&&(0,i.jsx)("div",{className:r().subLinks,children:Object.entries(p.online).map((e,t)=>{let[n,i]=e;return Y((null==i?void 0:i.webpages)||[])})})})]}),p&&(0,i.jsxs)("div",{className:r().referenceContainer,children:[(0,i.jsx)("h2",{className:"mt-4 mb-4",children:"Supplements"}),(0,i.jsx)("div",{className:r().references,children:void 0!==p.online&&((e,t,n,a,r)=>{if(a&&r)return J(r);let s=new Set;return Object.entries(t.online||{}).map((e,t)=>{let[n,i]=e,a=(null==i?void 0:i.webpages)||[];if(a instanceof Array)for(let e=0;e<a.length;e++){let t=a[e].link||"";if(s.has(t))return null;s.add(t)}else{let e=a.link||"";if(s.has(e))return null;s.add(e)}}),Object.entries(t.online||{}).map((t,a)=>{var r,o;let[l,c]=t,d="";for(let e=0;e<(null==c?void 0:null===(r=c.organic)||void 0===r?void 0:r.length)&&(d=(null==c?void 0:null===(o=c.organic)||void 0===o?void 0:o[e]).link||"",s.has(d));e++);return(s.add(d),""===d)?null:(0,i.jsx)(I,{onlineData:c,officialFactToVerify:n,conversationId:e,additionalLink:d,setChildReferencesCallback:B},a)}).filter(Boolean)})(A,p,n,U,T)})]})]})]})}},67135:function(e,t,n){"use strict";n.d(t,{_:function(){return c}});var i=n(57437),a=n(2265),r=n(38364),s=n(12218),o=n(37440);let l=(0,s.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),c=a.forwardRef((e,t)=>{let{className:n,...a}=e;return(0,i.jsx)(r.f,{ref:t,className:(0,o.cn)(l(),n),...a})});c.displayName=r.f.displayName},53907:function(e){e.exports={modelPicker:"modelPicker_modelPicker__chlCh"}},34209:function(e){e.exports={factVerification:"factChecker_factVerification__UCbIf",factCheckerContainer:"factChecker_factCheckerContainer__Brqjv",responseText:"factChecker_responseText__HzSck",response:"factChecker_response__HaFuc",titleLink:"factChecker_titleLink__FA5mt",subLinks:"factChecker_subLinks__iaFHn",reference:"factChecker_reference___6Fwh",footer:"factChecker_footer__Tbj3t",reportActions:"factChecker_reportActions__2_tFq",factCheckButton:"factChecker_factCheckButton__2XPTv",spinner:"factChecker_spinner__T26Jv","sk-rotate":"factChecker_sk-rotate__ogES_",inputFields:"factChecker_inputFields__LU3cQ",dot1:"factChecker_dot1__n9Bu5",dot2:"factChecker_dot2__HDdBs","sk-bounce":"factChecker_sk-bounce__q4XFt"}},38364:function(e,t,n){"use strict";n.d(t,{f:function(){return o}});var i=n(2265),a=n(25171),r=n(57437),s=i.forwardRef((e,t)=>(0,r.jsx)(a.WV.label,{...e,ref:t,onMouseDown:t=>{var n;t.target.closest("button, input, select, textarea")||(null===(n=e.onMouseDown)||void 0===n||n.call(e,t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));s.displayName="Label";var o=s}},function(e){e.O(0,[6129,8918,929,3954,9001,3062,4086,121,4051,1603,9417,9178,2971,7023,1744],function(){return e(e.s=71884)}),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6894],{71884:function(e,t,n){Promise.resolve().then(n.bind(n,69769))},18642:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var i=n(57437),a=n(90837),r=n(50495),s=n(83102),o=n(67135),l=n(34797);function c(e){var t;return(0,i.jsxs)(a.Vq,{children:[(0,i.jsx)(a.hg,{asChild:!0,onClick:e.onShare,children:(0,i.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,i.jsx)(l.m,{className:"w-4 h-4 mr-2"}),e.buttonTitle]})}),(0,i.jsxs)(a.cZ,{children:[(0,i.jsxs)(a.fK,{children:[(0,i.jsx)(a.$N,{children:e.title}),(0,i.jsx)(a.Be,{children:e.description})]}),(0,i.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,i.jsxs)("div",{className:"grid flex-1 gap-2",children:[(0,i.jsx)(o._,{htmlFor:"link",className:"sr-only",children:"Link"}),(0,i.jsx)(s.I,{id:"link",defaultValue:e.url,readOnly:!0})]}),(0,i.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,i.jsx)("span",{children:"Copy"})})]})]})]})}},69769:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return E}});var i=n(57437),a=n(34209),r=n.n(a),s=n(79306),o=n(2265),l=n(53423),c=n(29039),d=n(6780),f=n(53907),h=n.n(f);let u=async e=>(await fetch(e,{method:"GET",headers:{"Content-Type":"application/json"}})).json(),m=e=>{let{data:t,error:n}=(0,c.ZP)(e,u);return{data:t,isLoading:!n&&!t,isError:n}},p=async e=>(await fetch(e,{method:"GET",headers:{"Content-Type":"application/json"}})).json(),x=e=>{let{data:t,error:n}=(0,c.ZP)(e,p);return{data:t,isLoading:!n&&!t,isError:n}},k=e=>{let{data:t}=m("/api/model/chat/options"),{data:n}=x("/api/model/chat"),[a,r]=o.useState(!1),l=(0,s.GW)(),c=e.setModelUsed;return((0,o.useEffect)(()=>{c&&n&&c(n)},[n,c]),t)?(0,i.jsxs)("div",{className:h().modelPicker,children:[(0,i.jsx)("select",{className:h().modelPicker,onChange:n=>{let i=Number(n.target.value),a=t.find(e=>e.id===i);a?function(t){if(!l){r(!0);return}e.setModelUsed&&e.setModelUsed(t),fetch("/api/model/chat?id="+String(t.id),{method:"POST",body:JSON.stringify(t)}).then(e=>{if(!e.ok)throw Error("Failed to select model")}).catch(e=>{console.error("Failed to select model",e)})}(a):console.error("Selected model not found",n.target.value)},disabled:e.disabled,children:null==t?void 0:t.map(t=>(0,i.jsx)("option",{value:t.id,selected:e.initialModel?t.id===e.initialModel.id:(null==n?void 0:n.id)===t.id,children:t.chat_model},t.id))}),(0,i.jsx)(d.aR,{open:a,onOpenChange:r,children:(0,i.jsxs)(d._T,{children:[(0,i.jsxs)(d.fY,{children:[(0,i.jsx)(d.f$,{children:"You must be logged in to configure your model."}),(0,i.jsxs)(d.yT,{children:["Once you create an account with Khoj, you can configure your model and use a whole suite of other features. Check out our"," ",(0,i.jsx)("a",{href:"https://docs.khoj.dev/",children:"documentation"})," to learn more."]})]}),(0,i.jsxs)(d.xo,{children:[(0,i.jsx)(d.le,{children:"Cancel"}),(0,i.jsx)(d.OL,{onClick:()=>{window.location.href=window.location.origin+"/login"},children:"Sign in"})]})]})})]}):(0,i.jsx)("div",{children:"Loading..."})};var j=n(18642),v=n(83102),b=n(50495),g=n(36013),y=n(87138),_=n(48861),C=n(69591);let w=()=>(0,i.jsx)("div",{className:r().loading,children:(0,i.jsxs)("div",{className:r().loadingVerification,children:["Researching...",(0,i.jsxs)("div",{className:r().spinner,children:[(0,i.jsx)("div",{className:"".concat(r().dot1," bg-blue-300")}),(0,i.jsx)("div",{className:"".concat(r().dot2," bg-blue-300")})]})]})});async function N(e,t,n,i,a){n(!0);let r="".concat("Limit your search to reputable sources. Search the internet for relevant supporting or refuting information. Do not reference my notes. Refuse to answer any queries that are not falsifiable by informing me that you will not answer the question. You're not permitted to ask follow-up questions, so do the best with what you have. Respond with **TRUE** or **FALSE** or **INCONCLUSIVE**, then provide your justification. Fact Check:"," ").concat(e);try{var s;let e=await fetch("".concat("/api/chat","?client=web"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({q:r,conversation_id:t,stream:!0})});if(!e.body)throw Error("No response body found");let n=null===(s=e.body)||void 0===s?void 0:s.getReader(),o=new TextDecoder,l="";for(;;){let{done:e,value:t}=await n.read();if(e)break;let r=o.decode(t,{stream:!0});if(r.includes("### compiled references:")){let e=function(e,t){let n=e.split("### compiled references:")[1],i=e.split("### compiled references:")[0],a={};a.response=t+i;let r=JSON.parse(n);return r instanceof Array?a.context=r:"object"==typeof r&&null!==r&&(a.online=r),a}(r,l);e.response&&(l=e.response,i(e.response),a(e))}else l+=r,i(l)}}catch(e){console.error("Error verifying statement: ",e)}finally{n(!1)}}async function S(e){let t=await fetch("/api/chat/sessions?client=web",{method:"POST"});e((await t.json()).conversation_id)}function T(e){let[t,n]=(0,o.useState)(""),[a,r]=(0,o.useState)(!0),s="".concat(e.message,". Use this link for reference: ").concat(e.additionalLink),c=(0,C.IC)();return(0,o.useEffect)(()=>{e.prefilledResponse?(n(e.prefilledResponse),r(!1)):N(s,e.conversationId,r,n,()=>{})},[s,e.conversationId,e.prefilledResponse]),(0,o.useEffect)(()=>{""!==t&&(e.prefilledResponse||a||e.setChildReferencesCallback(e.additionalLink,t,e.linkTitle))},[t,a,e]),(0,i.jsxs)("div",{children:[a&&(0,i.jsx)(w,{}),(0,i.jsx)(l.Z,{chatMessage:{automationId:"",by:"AI",message:t,context:[],created:new Date().toISOString(),onlineContext:{}},isMobileWidth:c})]})}function I(e){var t,n,a;let s=e.linkTitle||(null===(a=e.onlineData)||void 0===a?void 0:null===(n=a.organic)||void 0===n?void 0:null===(t=n[0])||void 0===t?void 0:t.title)||"Reference",o={link:e.additionalLink};return(0,i.jsxs)(g.Zb,{className:"mt-2 mb-4",children:[(0,i.jsxs)(g.Ol,{children:[(0,i.jsx)("a",{className:r().titleLink,href:e.additionalLink,target:"_blank",rel:"noreferrer",children:s}),(0,i.jsx)(L,{...o})]}),(0,i.jsx)(g.aY,{children:(0,i.jsx)(T,{additionalLink:e.additionalLink,message:e.officialFactToVerify,linkTitle:s,conversationId:e.conversationId,setChildReferencesCallback:e.setChildReferencesCallback,prefilledResponse:e.prefilledResponse})})]})}let L=e=>{let t=new URL(e.link).hostname;return(0,i.jsx)("div",{className:r().subLinks,children:(0,i.jsx)("a",{className:"".concat(r().subLinks," bg-blue-200 px-2"),href:e.link,target:"_blank",rel:"noreferrer",children:t})})};function E(){let[e,t]=(0,o.useState)(""),[n,a]=(0,o.useState)(""),[c,d]=(0,o.useState)(!1),[f,h]=(0,o.useState)(""),[u,m]=(0,o.useState)(!1),[p,x]=(0,o.useState)(),[T,E]=(0,o.useState)(),[R,F]=(0,o.useState)(),O=(0,C.IC)(),[A,P]=(0,o.useState)(""),[V,M]=(0,o.useState)(""),[U,D]=(0,o.useState)(!1),[q,Z]=(0,o.useState)();function B(e,t,n){let i=T||[];i.find(t=>t.additionalLink===e)||(i.push({additionalLink:e,response:t,linkTitle:n}),E(i))}let z=(0,s.GW)();function W(){if(u)return;if(!e){alert("Please enter a fact to verify.");return}if(m(!0),!z){let e=window.location.href;window.location.href="/login?next=".concat(e)}x(void 0),h(""),S(P);let t=[...Array(16)].map(()=>Math.random().toString(36)[2]).join("");M(t),window.history.pushState({},document.title,window.location.pathname+"?runId=".concat(t)),a(e),m(!1)}(0,o.useEffect)(()=>{e?document.title="AI Fact Check: ".concat(e):document.title="AI Fact Checker"},[e]),(0,o.useEffect)(()=>{let e=localStorage.getItem("factToVerify");e&&t(e);let n=new URLSearchParams(window.location.search),i=n.get("factToVerify");i&&t(i);let r=n.get("runId");r&&(M(r),(async()=>{try{let e=await fetch("/api/chat/store/factchecker?runId=".concat(r));if(200!==e.status)throw Error("Failed to fetch stored data");let t=JSON.parse(await e.json());t&&(a(t.factToVerify),h(t.response),x(t.references),E(t.childReferences),Z(t.modelUsed)),D(!0)}catch(e){console.error("Error fetching stored data: ",e)}})())},[]),(0,o.useEffect)(()=>{A&&N(n,A,d,h,x)},[A,n]),(0,o.useEffect)(()=>{localStorage.setItem("factToVerify",e)},[e]),(0,o.useEffect)(()=>{let e=document.querySelector('meta[name="description"]');e&&e.setAttribute("content",f);let t=document.querySelector('meta[property="og:description"]');t||((t=document.createElement("meta")).setAttribute("property","og:description"),document.getElementsByTagName("head")[0].appendChild(t)),t.setAttribute("content",f)},[f]);let J=e=>e.map((e,t)=>(0,i.jsx)(I,{additionalLink:e.additionalLink,officialFactToVerify:n,conversationId:A,linkTitle:e.linkTitle,setChildReferencesCallback:B,prefilledResponse:e.response},t)),Y=e=>e instanceof Array?e.map((e,t)=>L(e)):L(e);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{className:"relative md:fixed h-full",children:(0,i.jsx)(_.ZP,{conversationId:null,uploadedFiles:[],isMobileWidth:O})}),(0,i.jsxs)("div",{className:r().factCheckerContainer,children:[(0,i.jsx)("h1",{className:"".concat(r().response," pt-8 md:pt-4 font-large outline-slate-800 dark:outline-slate-200"),children:"AI Fact Checker"}),(0,i.jsx)("footer",{className:"".concat(r().footer," mt-4"),children:"This is an experimental AI tool. It may make mistakes."}),f&&p&&T?(0,i.jsxs)("div",{className:r().reportActions,children:[(0,i.jsx)(b.z,{asChild:!0,variant:"secondary",children:(0,i.jsx)(y.default,{href:"/factchecker",target:"_blank",rel:"noopener noreferrer",children:"Try Another"})}),(0,i.jsx)(j.Z,{buttonTitle:"Share report",title:"AI Fact Checking Report",description:"Share this fact checking report with others. Anyone who has this link will be able to view the report.",url:function(){let e=new URL(window.location.href);return e.searchParams.set("runId",V),e.href}(),onShare:U?()=>{}:function(){fetch("/api/chat/store/factchecker",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runId:V,storeData:{factToVerify:e,response:f,references:p,childReferences:T,runId:V,modelUsed:R}})})}})]}):(0,i.jsxs)("div",{className:r().newReportActions,children:[(0,i.jsxs)("div",{className:"".concat(r().inputFields," mt-4"),children:[(0,i.jsx)(v.I,{type:"text",maxLength:200,placeholder:"Enter a falsifiable statement to verify",disabled:c,onChange:e=>t(e.target.value),value:e,onKeyDown:e=>{"Enter"===e.key&&W()},onFocus:e=>e.target.placeholder="",onBlur:e=>e.target.placeholder="Enter a falsifiable statement to verify"}),(0,i.jsx)(b.z,{disabled:u,onClick:()=>W(),children:"Verify"})]}),(0,i.jsxs)("h3",{className:"mt-4 mb-4",children:["Try with a particular model. You must be"," ",(0,i.jsx)("a",{href:"/settings",className:"font-medium text-blue-600 dark:text-blue-500 hover:underline",children:"subscribed"})," ","to configure the model."]})]}),(0,i.jsx)(k,{disabled:c||U,setModelUsed:F,initialModel:q}),c&&(0,i.jsx)("div",{className:r().loading,children:(0,i.jsx)(w,{})}),f&&(0,i.jsxs)(g.Zb,{className:"mt-4",children:[(0,i.jsx)(g.Ol,{children:(0,i.jsx)(g.ll,{children:n})}),(0,i.jsx)(g.aY,{children:(0,i.jsx)("div",{className:r().responseText,children:(0,i.jsx)(l.Z,{chatMessage:{automationId:"",by:"AI",message:f,context:[],created:new Date().toISOString(),onlineContext:{}},isMobileWidth:O})})}),(0,i.jsx)(g.eW,{children:p&&p.online&&Object.keys(p.online).length>0&&(0,i.jsx)("div",{className:r().subLinks,children:Object.entries(p.online).map((e,t)=>{let[n,i]=e;return Y((null==i?void 0:i.webpages)||[])})})})]}),p&&(0,i.jsxs)("div",{className:r().referenceContainer,children:[(0,i.jsx)("h2",{className:"mt-4 mb-4",children:"Supplements"}),(0,i.jsx)("div",{className:r().references,children:void 0!==p.online&&((e,t,n,a,r)=>{if(a&&r)return J(r);let s=new Set;return Object.entries(t.online||{}).map((e,t)=>{let[n,i]=e,a=(null==i?void 0:i.webpages)||[];if(a instanceof Array)for(let e=0;e<a.length;e++){let t=a[e].link||"";if(s.has(t))return null;s.add(t)}else{let e=a.link||"";if(s.has(e))return null;s.add(e)}}),Object.entries(t.online||{}).map((t,a)=>{var r,o;let[l,c]=t,d="";for(let e=0;e<(null==c?void 0:null===(r=c.organic)||void 0===r?void 0:r.length)&&(d=(null==c?void 0:null===(o=c.organic)||void 0===o?void 0:o[e]).link||"",s.has(d));e++);return(s.add(d),""===d)?null:(0,i.jsx)(I,{onlineData:c,officialFactToVerify:n,conversationId:e,additionalLink:d,setChildReferencesCallback:B},a)}).filter(Boolean)})(A,p,n,U,T)})]})]})]})}},67135:function(e,t,n){"use strict";n.d(t,{_:function(){return c}});var i=n(57437),a=n(2265),r=n(38364),s=n(12218),o=n(37440);let l=(0,s.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),c=a.forwardRef((e,t)=>{let{className:n,...a}=e;return(0,i.jsx)(r.f,{ref:t,className:(0,o.cn)(l(),n),...a})});c.displayName=r.f.displayName},53907:function(e){e.exports={modelPicker:"modelPicker_modelPicker__chlCh"}},34209:function(e){e.exports={factVerification:"factChecker_factVerification__UCbIf",factCheckerContainer:"factChecker_factCheckerContainer__Brqjv",responseText:"factChecker_responseText__HzSck",response:"factChecker_response__HaFuc",titleLink:"factChecker_titleLink__FA5mt",subLinks:"factChecker_subLinks__iaFHn",reference:"factChecker_reference___6Fwh",footer:"factChecker_footer__Tbj3t",reportActions:"factChecker_reportActions__2_tFq",factCheckButton:"factChecker_factCheckButton__2XPTv",spinner:"factChecker_spinner__T26Jv","sk-rotate":"factChecker_sk-rotate__ogES_",inputFields:"factChecker_inputFields__LU3cQ",dot1:"factChecker_dot1__n9Bu5",dot2:"factChecker_dot2__HDdBs","sk-bounce":"factChecker_sk-bounce__q4XFt"}},38364:function(e,t,n){"use strict";n.d(t,{f:function(){return o}});var i=n(2265),a=n(25171),r=n(57437),s=i.forwardRef((e,t)=>(0,r.jsx)(a.WV.label,{...e,ref:t,onMouseDown:t=>{var n;t.target.closest("button, input, select, textarea")||(null===(n=e.onMouseDown)||void 0===n||n.call(e,t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));s.displayName="Label";var o=s}},function(e){e.O(0,[6129,8918,929,3954,9001,3062,8840,121,6327,1603,9417,3423,2971,7023,1744],function(){return e(e.s=71884)}),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1931],{1507:function(e,t,n){Promise.resolve().then(n.bind(n,4515))},4515:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return q}});var i,o,a=n(57437);n(58877);var r=n(68518),s=n.n(r);n(7395);var l=n(2265),c=n(29039),d=n(52195);let p=new Map([["bold",l.createElement(l.Fragment,null,l.createElement("path",{d:"M228,128a100,100,0,0,1-98.66,100H128a99.39,99.39,0,0,1-68.62-27.29,12,12,0,0,1,16.48-17.45,76,76,0,1,0-1.57-109c-.13.13-.25.25-.39.37L54.89,92H72a12,12,0,0,1,0,24H24a12,12,0,0,1-12-12V56a12,12,0,0,1,24,0V76.72L57.48,57.06A100,100,0,0,1,228,128Z"}))],["duotone",l.createElement(l.Fragment,null,l.createElement("path",{d:"M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z",opacity:"0.2"}),l.createElement("path",{d:"M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z"}))],["fill",l.createElement(l.Fragment,null,l.createElement("path",{d:"M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L60.63,81.29l17,17A8,8,0,0,1,72,112H24a8,8,0,0,1-8-8V56A8,8,0,0,1,29.66,50.3L49.31,70,60.25,60A96,96,0,0,1,224,128Z"}))],["light",l.createElement(l.Fragment,null,l.createElement("path",{d:"M222,128a94,94,0,0,1-92.74,94H128a93.43,93.43,0,0,1-64.5-25.65,6,6,0,1,1,8.24-8.72A82,82,0,1,0,70,70l-.19.19L39.44,98H72a6,6,0,0,1,0,12H24a6,6,0,0,1-6-6V56a6,6,0,0,1,12,0V90.34L61.63,61.4A94,94,0,0,1,222,128Z"}))],["regular",l.createElement(l.Fragment,null,l.createElement("path",{d:"M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z"}))],["thin",l.createElement(l.Fragment,null,l.createElement("path",{d:"M220,128a92,92,0,0,1-90.77,92H128a91.47,91.47,0,0,1-63.13-25.1,4,4,0,1,1,5.5-5.82A84,84,0,1,0,68.6,68.57l-.13.12L34.3,100H72a4,4,0,0,1,0,8H24a4,4,0,0,1-4-4V56a4,4,0,0,1,8,0V94.89l35-32A92,92,0,0,1,220,128Z"}))]]);var u=Object.defineProperty,h=Object.defineProperties,m=Object.getOwnPropertyDescriptors,g=Object.getOwnPropertySymbols,y=Object.prototype.hasOwnProperty,f=Object.prototype.propertyIsEnumerable,k=(e,t,n)=>t in e?u(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,b=(e,t)=>{for(var n in t||(t={}))y.call(t,n)&&k(e,n,t[n]);if(g)for(var n of g(t))f.call(t,n)&&k(e,n,t[n]);return e},v=(e,t)=>h(e,m(t));let x=(0,l.forwardRef)((e,t)=>l.createElement(d.Z,v(b({ref:t},e),{weights:p})));x.displayName="ArrowCounterClockwise";var w=n(36013),P=n(31806),j=n.n(P),L=n(58575),C=n(89417);(i=o||(o={})).Automation="Automation",i.Paint="Paint",i.Travel="Travel",i.Health="Health",i.Learning="Learning",i.Language="Language",i.PopCulture="Pop Culture",i.Food="Food",i.Interviewing="Interviewing",i.Home="Home",i.Fun="Fun",i.Code="Code",i.Finance="Finance";let A={};A.Automation="blue",A.Paint="indigo",A.Travel="yellow",A.Health="teal",A.Learning="purple",A.Language="blue",A["Pop Culture"]="red",A.Food="yellow",A.Interviewing="orange",A.Home="green",A.Fun="fuchsia",A.Code="purple",A.Finance="green";let S="orange",H=[{type:"Automation",color:A.Automation||S,description:"Send me a summary of HackerNews every morning.",link:"/automations?subject=Summarizing%20Top%20Headlines%20from%20HackerNews&query=Summarize%20the%20top%20headlines%20on%20HackerNews&crontime=00%207%20*%20*%20*"},{type:"Automation",color:A.Automation||S,description:"Compose a bedtime story that a five-year-old might enjoy.",link:"/automations?subject=Daily%20Bedtime%20Story&query=Compose%20a%20bedtime%20story%20that%20a%20five-year-old%20might%20enjoy.%20It%20should%20not%20exceed%20five%20paragraphs.%20Appeal%20to%20the%20imagination%2C%20but%20weave%20in%20learnings.&crontime=0%2021%20*%20*%20*"},{type:"Paint",color:A.Paint||S,description:"Paint a picture of a sunset but it's made of stained glass tiles",link:""},{type:"Travel",color:A.Travel||S,description:"Search for the best attractions in Austria Hungary",link:""},{type:"Health",color:A.Health||S,description:"Generate a weekly meal plan with recipes.",link:"/automations?subject=Weekly Meal Plan&query=Create a weekly meal plan with 7 dinner recipes, including ingredients and brief instructions. Focus on balanced, healthy meals.&crontime=0 18 * * 0"},{type:"Paint",color:A.Paint||S,description:"Paint a futuristic cityscape with flying cars.",link:""},{type:"Travel",color:A.Travel||S,description:"Find the top-rated coffee shops in Seattle.",link:""},{type:"Automation",color:A.Automation||S,description:"Send daily motivational quotes.",link:"/automations?subject=Daily Motivation&query=Provide an inspiring quote for the day along with a brief explanation of its meaning.&crontime=0 7 * * *"},{type:"Paint",color:A.Paint||S,description:"Create an abstract representation of jazz music.",link:""},{type:"Learning",color:A.Learning||S,description:"Research the history of the Eiffel Tower.",link:""},{type:"Automation",color:A.Automation||S,description:"Compile a weekly news summary.",link:"/automations?subject=Weekly News Digest&query=Summarize the top 5 most important news stories of the week across various categories.&crontime=0 18 * * 5"},{type:"Paint",color:A.Paint||S,description:"Paint a portrait of a cat wearing a Victorian-era costume.",link:""},{type:"Travel",color:A.Travel||S,description:"Find beginner-friendly hiking trails near Los Angeles.",link:""},{type:"Automation",color:A.Automation||S,description:"Generate a daily writing prompt.",link:"/automations?subject=Daily Writing Prompt&query=Create an engaging writing prompt suitable for short story or journal writing.&crontime=0 9 * * *"},{type:"Paint",color:A.Paint||S,description:"Create a surrealist landscape inspired by Salvador Dali.",link:""},{type:"Learning",color:A.Learning||S,description:"Research the benefits and drawbacks of electric vehicles.",link:""},{type:"Automation",color:A.Automation||S,description:"Send weekly language learning tips for Spanish.",link:"/automations?subject=Spanish Learning Tips&query=Provide a useful Spanish language learning tip, including vocabulary, grammar, or cultural insight.&crontime=0 19 * * 2"},{type:"Paint",color:A.Paint||S,description:"Paint a scene from a fairy tale in the style of Studio Ghibli.",link:""},{type:"Pop Culture",color:"yellow",description:"Find the best-rated science fiction books of the last decade.",link:""},{type:"Paint",color:A.Paint||S,description:"Paint a still life of exotic fruits in a neon color palette.",link:""},{type:"Travel",color:A.Travel||S,description:"Research the most eco-friendly cities in Europe.",link:""},{type:"Automation",color:A.Automation||S,description:"Send daily reminders for habit tracking.",link:"/automations?subject=Habit Tracker&query=Generate a daily reminder to track habits, including a motivational message.&crontime=0 20 * * *"},{type:"Paint",color:A.Paint||S,description:"Create a digital painting of a cyberpunk street market.",link:""},{type:"Learning",color:A.Learning||S,description:"Summarize the biography of this figure: https://en.wikipedia.org/wiki/Jean_Baptiste_Point_du_Sable",link:""},{type:"Language",color:"blue",description:"Send daily Spanish phrases used in Latin America.",link:"/automations?subject=Daily Latin American Spanish&query=Provide a common Spanish phrase or slang term used in Latin America, its meaning, and an example of usage. Include which countries it's most common in.&crontime=0 8 * * *"},{type:"Paint",color:A.Paint||S,description:"Create a vibrant painting inspired by Frida Kahlo's style.",link:""},{type:"Food",color:A.Food||S,description:"Find the best empanada recipe from Colombia.",link:""},{type:"Automation",color:A.Automation||S,description:"Weekly update on the Brazilian startup ecosystems.",link:"/automations?subject=LatAm Startup News&query=Provide a summary of the most significant developments in Latin American startup ecosystems this week. Include notable funding rounds, expansions, or policy changes.&crontime=0 18 * * 5"},{type:"Paint",color:A.Paint||S,description:"Paint a colorful scene of a traditional Day of the Dead celebration in Mexico.",link:""},{type:"Language",color:A.Language||S,description:"Daily Swahili phrase with English translation.",link:"/automations?subject=Daily Swahili Lesson&query=Provide a common Swahili phrase or proverb, its English translation, and a brief explanation of its cultural significance in East Africa.&crontime=0 7 * * *"},{type:"Paint",color:A.Paint||S,description:"Create a digital painting of the Serengeti during wildebeest migration.",link:""},{type:"Learning",color:A.Learning||S,description:"Research the top M-Pesa alternatives in East Africa.",link:""},{type:"Automation",color:A.Automation||S,description:"Weekly update on East African tech startups and innovations.",link:"/automations?subject=East African Tech News&query=Summarize the most significant developments in East African tech startups and innovations this week. Include notable funding rounds, new product launches, or policy changes affecting the tech ecosystem.&crontime=0 18 * * 5"},{type:"Paint",color:A.Paint||S,description:"Paint a colorful scene inspired by Maasai traditional clothing and jewelry.",link:""},{type:"Automation",color:A.Automation||S,description:"Weekly summary of EU policy changes and their impact.",link:"/automations?subject=EU Policy Update&query=Summarize the most significant EU policy changes or proposals from this week. Explain their potential impact on European citizens and businesses.&crontime=0 17 * * 5"},{type:"Paint",color:A.Paint||S,description:"Paint a digital landscape of the Northern Lights over the Norwegian fjords.",link:""},{type:"Automation",color:A.Automation||S,description:"Daily East Asian proverb with explanation.",link:"/automations?subject=East Asian Wisdom&query=Provide a proverb from an East Asian language (rotating through Chinese, Japanese, Korean, etc.), its English translation, and a brief explanation of its cultural significance and practical application.&crontime=0 7 * * *"},{type:"Paint",color:A.Paint||S,description:"Create a digital painting in the style of traditional Chinese ink wash landscape.",link:""},{type:"Pop Culture",color:"yellow",description:"Research the latest trends in K-pop and its global influence.",link:""},{type:"Automation",color:A.Automation||S,description:"Weekly summary of technological innovations from East Asian tech giants.",link:"/automations?subject=East Asian Tech Update&query=Summarize the most significant technological innovations or product launches from major East Asian tech companies (e.g., Samsung, Sony, Alibaba, Tencent) this week. Explain their potential impact on global markets.&crontime=0 18 * * 5"},{type:"Paint",color:A.Paint||S,description:"Paint a vibrant scene of a Japanese cherry blossom festival.",link:""},{type:"Automation",color:A.Automation||S,description:"Daily South Asian recipe with cultural significance.",link:"/automations?subject=South Asian Culinary Journey&query=Provide a traditional South Asian recipe (rotating through Indian, Pakistani, Bangladeshi, Sri Lankan, etc. cuisines), including ingredients, brief instructions, and its cultural significance or origin story.&crontime=0 10 * * *"},{type:"Pop Culture",color:A["Pop Culture"]||S,description:"Research the impact of Bollywood on global cinema and fashion.",link:""},{type:"Automation",color:A.Automation||S,description:"Weekly update on South Asian startup ecosystems and innovations.",link:"/automations?subject=South Asian Startup Pulse&query=Summarize the most significant developments in South Asian startup ecosystems this week. Include notable funding rounds, innovative solutions to local challenges, and any policy changes affecting the tech landscape in countries like India, Bangladesh, Pakistan, and Sri Lanka.&crontime=0 18 * * 5"},{type:"Interviewing",color:A.Interviewing||S,description:"Create interview prep questions for a consulting job.",link:""},{type:"Interviewing",color:A.Interviewing||S,description:"What information should I include in a CV for a PhD application?",link:""},{type:"Home",color:A.Home||S,description:"Recommend plants that can grow well indoors.",link:""},{type:"Health",color:A.Health||S,description:"Suggest healthy meal prep ideas for a busy work week.",link:""},{type:"Learning",color:A.Learning||S,description:"List effective time management techniques for students.",link:""},{type:"Learning",color:A.Learning||S,description:"Provide tips for improving public speaking skills.",link:""},{type:"Learning",color:A.Learning||S,description:"Recommend books for learning about personal finance.",link:""},{type:"Home",color:A.Home||S,description:"Suggest ways to reduce plastic waste in daily life.",link:""},{type:"Health",color:A.Health||S,description:"Create a beginner's guide to meditation and mindfulness.",link:""},{type:"Health",color:A.Health||S,description:"Give me some tips for improving my sleep quality.",link:""},{type:"Health",color:A.Health||S,description:"What are weight loss strategies supported by clinical studies?",link:""},{type:"Fun",color:A.Fun||S,description:"List creative date ideas for couples on a budget.",link:""},{type:"Code",color:A.Interviewing||S,description:"Provide tips for writing an effective resume.",link:""},{type:"Code",color:A.Code||S,description:"Explain the concept of recursion with a simple coding example.",link:""},{type:"Code",color:A.Code||S,description:"Provide a coding challenge to reverse a string without using built-in functions.",link:""},{type:"Code",color:A.Code||S,description:"Explain the difference between 'let', 'const', and 'var' in JavaScript.",link:""},{type:"Code",color:A.Code||S,description:"Create a coding exercise to implement a basic sorting algorithm (e.g., bubble sort).",link:""},{type:"Code",color:A.Code||S,description:"Explain object-oriented programming principles with a simple class example.",link:""},{type:"Code",color:A.Code||S,description:"Provide a coding challenge to find the longest palindromic substring in a given string.",link:""},{type:"Code",color:A.Code||S,description:"Explain the concept of asynchronous programming with a JavaScript Promise example.",link:""},{type:"Code",color:A.Code||S,description:"Create a coding exercise to implement a basic data structure (e.g., linked list or stack).",link:""},{type:"Code",color:A.Code||S,description:"Explain the time and space complexity of common algorithms (e.g., binary search).",link:""},{type:"Code",color:A.Code||S,description:"Provide a coding challenge to implement a simple REST API using Node.js and Express.",link:""},{type:"Code",color:A.Code||S,description:"Compare popular web frameworks in Rust and Python",link:""},{type:"Travel",color:A.Travel||S,description:"Craft an off-beat itinerary for a weekend in Lagos, Nigeria.",link:""},{type:"Language",color:A.Language||S,description:"Teach me about declensions in Latin.",link:""},{type:"Learning",color:A.Learning||S,description:"Break down the concept of photosynthesis for a middle school student.",link:""},{type:"Learning",color:A.Learning||S,description:"Use the Socratic method to explore the causes of World War I.",link:""},{type:"Learning",color:A.Learning||S,description:"Explain the water cycle using an analogy suitable for elementary students.",link:""},{type:"Learning",color:A.Learning||S,description:"Guide a high school student through solving a quadratic equation step-by-step.",link:""},{type:"Learning",color:A.Learning||S,description:"Create a series of questions to help a student discover the principles of basic economics.",link:""},{type:"Learning",color:A.Learning||S,description:"Develop a hands-on experiment to demonstrate the concept of density to middle schoolers.",link:""},{type:"Learning",color:A.Learning||S,description:"Use guided discovery to help a student understand the structure of DNA.",link:""},{type:"Learning",color:A.Learning||S,description:"Create a personalized learning plan for a student struggling with grammar concepts.",link:""},{type:"Learning",color:A.Learning||S,description:"Design a series of questions to encourage critical thinking about climate change.",link:""},{type:"Learning",color:A.Learning||S,description:"Develop a step-by-step guide for conducting a basic science experiment on plant growth.",link:""},{type:"Health",color:A.Health||S,description:"Provide a detailed explanation about how to manage type 2 diabetes.",link:""},{type:"Health",color:A.Health||S,description:"Explain the effects a stroke might have on the body.",link:""},{type:"Health",color:A.Health||S,description:"Describe the recommended steps for preventing heart disease.",link:""},{type:"Health",color:A.Health||S,description:"Explain the differences between various types of headaches and their treatments.",link:""},{type:"Health",color:A.Health||S,description:"Provide an overview of the most effective stress management techniques.",link:""},{type:"Health",color:A.Health||S,description:"Explain the importance of vaccination and how vaccines work.",link:""},{type:"Health",color:A.Health||S,description:"Describe the symptoms and treatment options for depression.",link:""},{type:"Health",color:A.Health||S,description:"Explain the process of digestion and common digestive disorders.",link:""},{type:"Health",color:A.Health||S,description:"Provide an overview of the different types of cancer screenings and their importance.",link:""},{type:"Health",color:A.Health||S,description:"Explain the effects of sleep deprivation on physical and mental health.",link:""},{type:"Fun",color:A.Fun||S,description:"Create a list of fun activities for a family game night.",link:""},{type:"Finance",color:A.Finance||S,description:"Explain the concept of compound interest and its importance in long-term savings.",link:""},{type:"Finance",color:A.Finance||S,description:"Provide an overview of different types of retirement accounts (e.g., 401(k), IRA, Roth IRA).",link:""},{type:"Finance",color:A.Finance||S,description:"Describe strategies for creating and sticking to a personal budget.",link:""},{type:"Finance",color:A.Finance||S,description:"Explain the basics of stock market investing for beginners.",link:""},{type:"Finance",color:A.Finance||S,description:"Outline the pros and cons of renting vs. buying a home.",link:""},{type:"Finance",color:A.Finance||S,description:"Describe different methods for paying off debt, such as the snowball and avalanche methods.",link:""},{type:"Finance",color:A.Finance||S,description:"Explain the importance of an emergency fund and how to build one.",link:""},{type:"Finance",color:A.Finance||S,description:"Provide an overview of different types of insurance and their importance in financial planning.",link:""},{type:"Finance",color:A.Finance||S,description:"Explain the concept of diversification in investment portfolios.",link:""},{type:"Finance",color:A.Finance||S,description:"Describe strategies for minimizing tax liability legally.",link:""}];function E(e){var t,n;let i=(0,L.Zc)(e.color),o="".concat(j().card," ").concat(i," md:w-full md:h-fit sm:w-full h-fit md:w-[200px] md:h-[200px] cursor-pointer"),r="".concat(j().title," pt-2 dark:text-white dark:font-bold"),s="".concat(j().text," dark:text-white"),l=(0,a.jsxs)(w.Zb,{className:o,children:[(0,a.jsx)(w.Ol,{className:"m-0 p-2 pb-1 relative",children:(0,a.jsxs)("div",{className:"flex flex-row md:flex-col",children:[(t=e.title,n=e.color.toLowerCase(),"Automation"===t?(0,C.TI)("Robot",n,"w-8","h-8"):"Paint"===t?(0,C.TI)("Palette",n,"w-8","h-8"):"Pop Culture"===t?(0,C.TI)("Confetti",n,"w-8","h-8"):"Travel"===t?(0,C.TI)("Jeep",n,"w-8","h-8"):"Learning"===t?(0,C.TI)("Book",n,"w-8","h-8"):"Health"===t?(0,C.TI)("Asclepius",n,"w-8","h-8"):"Fun"===t?(0,C.TI)("Island",n,"w-8","h-8"):"Home"===t?(0,C.TI)("House",n,"w-8","h-8"):"Language"===t?(0,C.TI)("Translate",n,"w-8","h-8"):"Code"===t?(0,C.TI)("Code",n,"w-8","h-8"):"Food"===t?(0,C.TI)("BowlFood",n,"w-8","h-8"):"Interviewing"===t?(0,C.TI)("Lectern",n,"w-8","h-8"):"Finance"===t?(0,C.TI)("Wallet",n,"w-8","h-8"):(0,C.TI)("Lightbulb",n,"w-8","h-8")),(0,a.jsx)(w.ll,{className:r,children:e.title})]})}),(0,a.jsx)(w.aY,{className:"m-0 p-2 pr-4 pt-1",children:(0,a.jsx)(w.SZ,{className:"".concat(s," sm:line-clamp-2 md:line-clamp-4"),children:e.body})})]});return e.link?(0,a.jsx)("a",{href:e.link,className:"no-underline",children:l}):l}var I=n(48861),F=n(58485),_=n(59479),N=n(66820),T=n(79306),M=n(9557),D=n(69591),W=n(16463);function B(e){let[t,n]=(0,l.useState)(""),[i,o]=(0,l.useState)(null),[r,d]=(0,l.useState)(!1),[p,u]=(0,l.useState)(""),[h,m]=(0,l.useState)([]),[g,y]=(0,l.useState)("khoj"),[f,k]=(0,l.useState)([]),[b,v]=(0,l.useState)([]),[P,j]=(0,l.useState)(!1),A=(0,W.useSearchParams)().get("q");(0,l.useEffect)(()=>{A&&n(decodeURIComponent(A))},[A]);let S=e.onConversationIdChange,{data:I,error:F}=(0,c.ZP)("agents",()=>window.fetch("/api/agents").then(e=>e.json()).catch(e=>console.log(e)),{revalidateOnFocus:!1});function T(){m((function(e){for(let t=e.length-1;t>0;t--){let n=Math.floor(Math.random()*(t+1));[e[t],e[n]]=[e[n],e[t]]}return e})(H).slice(0,3))}return(0,l.useEffect)(()=>{var t,n;if(e.isLoadingUserConfig)return;let i=new Date,o=i.getDay(),a=i.getHours()>=17||4>i.getHours()?"evening":i.getHours()>=12?"afternoon":"morning",r=(null===(t=e.userConfig)||void 0===t?void 0:t.given_name)?", ".concat(null===(n=e.userConfig)||void 0===n?void 0:n.given_name):"",s=["What would you like to get done".concat(r,"?"),"Hey".concat(r,"! How can I help?"),"Good ".concat(a).concat(r,"! What's on your mind?"),"Ready to breeze through your ".concat(["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][o],"?"),"Want help navigating your ".concat(["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][o]," workload?")];u(s[Math.floor(Math.random()*s.length)])},[e.isLoadingUserConfig,e.userConfig]),(0,l.useEffect)(()=>{e.chatOptionsData&&T()},[e.chatOptionsData]),(0,l.useEffect)(()=>{let t=e.isMobileWidth?2:4,n=I?[...I].sort(()=>.5-Math.random()):[],i=I?[I[0]]:[];n.slice(0,t-1).forEach(e=>{i.find(t=>t.slug===e.slug)||i.push(e)}),v(i),k(i.filter(e=>null!=e).map(e=>(0,C.TI)(e.icon,e.color)))},[I,e.isMobileWidth]),(0,l.useEffect)(()=>{(async()=>{if(t&&!r){d(!0);try{let e=await (0,M.A0)(g||"khoj");null==S||S(e),window.location.href="/chat?conversationId=".concat(e),localStorage.setItem("message",t),i&&localStorage.setItem("image",i)}catch(e){console.error("Error creating new conversation:",e),d(!1)}n("")}})(),t&&d(!0)},[g,t,r,S]),(0,a.jsxs)("div",{className:"".concat(s().homeGreetings," w-full md:w-auto"),children:[P&&(0,a.jsx)(N.Z,{onOpenChange:j,loginRedirectMessage:"Login to your second brain"}),(0,a.jsxs)("div",{className:"w-full text-center justify-end content-end",children:[(0,a.jsx)("div",{className:"items-center",children:(0,a.jsx)("h1",{className:"text-2xl md:text-3xl text-center w-fit pb-6 px-4 mx-auto",children:p})}),!e.isMobileWidth&&(0,a.jsxs)("div",{className:"flex pb-6 gap-2 items-center justify-center",children:[f.map((e,t)=>(0,a.jsx)(w.Zb,{className:"".concat(g===b[t].slug?(0,L.Iu)(b[t].color):"border-stone-100 dark:border-neutral-700 text-muted-foreground","\n hover:cursor-pointer rounded-lg px-2 py-2"),children:(0,a.jsxs)(w.ll,{className:"text-center text-md font-medium flex justify-center items-center",onClick:()=>y(b[t].slug),children:[e," ",b[t].name]})},"".concat(t,"-").concat(b[t].slug))),(0,a.jsx)(w.Zb,{className:"border-none shadow-none flex justify-center items-center hover:cursor-pointer",onClick:()=>window.location.href="/agents",children:(0,a.jsx)(w.ll,{className:"text-center text-md font-normal flex justify-center items-center px-1.5 py-2",children:"See All →"})})]})]}),(0,a.jsxs)("div",{className:"mx-auto ".concat(e.isMobileWidth?"w-full":"w-fit"),children:[!e.isMobileWidth&&(0,a.jsx)("div",{className:"w-full ".concat(s().inputBox," shadow-lg bg-background align-middle items-center justify-center px-3 py-1 dark:bg-neutral-700 border-stone-100 dark:border-none dark:shadow-none rounded-2xl"),children:(0,a.jsx)(_.Z,{isLoggedIn:e.isLoggedIn,sendMessage:e=>n(e),sendImage:e=>o(e),sendDisabled:r,chatOptionsData:e.chatOptionsData,conversationId:null,isMobileWidth:e.isMobileWidth,setUploadedFiles:e.setUploadedFiles})}),(0,a.jsx)("div",{className:"".concat(s().suggestions," w-full ").concat(e.isMobileWidth?"grid":"flex flex-row"," justify-center items-center"),children:h.map((t,i)=>(0,a.jsx)("div",{onClick:i=>{e.isLoggedIn?function(e,t,i){if(!e){let e="";i=i.charAt(0).toLowerCase()+i.slice(1),e="Online Search"===t?"/online "+i:"Paint"===t?"/image "+i:i;let o=document.getElementById("message");o&&(o.value=e,n(e))}}(t.link,t.type,t.description):(i.preventDefault(),i.stopPropagation(),j(!0))},children:(0,a.jsx)(E,{title:t.type,body:t.description,link:t.link,color:t.color},t.type+Math.random())},"".concat(t.type," ").concat(t.description)))}),(0,a.jsx)("div",{className:"flex items-center justify-center margin-auto",children:(0,a.jsxs)("button",{onClick:function(){T()},className:"m-2 p-1.5 rounded-lg dark:hover:bg-[var(--background-color)] hover:bg-stone-100 border border-stone-100 text-sm text-stone-500 dark:text-stone-300 dark:border-neutral-700",children:["More Ideas ",(0,a.jsx)(x,{className:"h-4 w-4 inline"})]})})]}),e.isMobileWidth&&(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)("div",{className:"".concat(s().inputBox," pt-1 shadow-[0_-20px_25px_-5px_rgba(0,0,0,0.1)] dark:bg-neutral-700 bg-background align-middle items-center justify-center pb-3 mx-1 rounded-t-2xl rounded-b-none"),children:[(0,a.jsxs)("div",{className:"flex gap-2 items-center justify-left pt-1 pb-2 px-12",children:[f.map((e,t)=>(0,a.jsx)(w.Zb,{className:"".concat(g===b[t].slug?(0,L.Iu)(b[t].color):"border-muted text-muted-foreground"," hover:cursor-pointer"),children:(0,a.jsxs)(w.ll,{className:"text-center text-xs font-medium flex justify-center items-center px-1.5 py-1",onClick:()=>y(b[t].slug),children:[e," ",b[t].name]})},"".concat(t,"-").concat(b[t].slug))),(0,a.jsx)(w.Zb,{className:"border-none shadow-none flex justify-center items-center hover:cursor-pointer",onClick:()=>window.location.href="/agents",children:(0,a.jsx)(w.ll,{className:"text-center ".concat(e.isMobileWidth?"text-xs":"text-md"," font-normal flex justify-center items-center px-1.5 py-2"),children:"See All →"})})]}),(0,a.jsx)(_.Z,{isLoggedIn:e.isLoggedIn,sendMessage:e=>n(e),sendImage:e=>o(e),sendDisabled:r,chatOptionsData:e.chatOptionsData,conversationId:null,isMobileWidth:e.isMobileWidth,setUploadedFiles:e.setUploadedFiles})]})})]})}function q(){let[e,t]=(0,l.useState)(null),[n,i]=(0,l.useState)(!0),[o,r]=(0,l.useState)(null),[c,d]=(0,l.useState)([]),p=(0,D.IC)(),{userConfig:u,isLoadingUserConfig:h}=(0,T.h2)(!0),[m,g]=(0,l.useState)(null),y=(0,T.GW)();return((0,l.useEffect)(()=>{g(u)},[u]),(0,l.useEffect)(()=>{fetch("/api/chat/options").then(e=>e.json()).then(e=>{i(!1),e&&t(e)}).catch(e=>{console.error(e)})},[]),n)?(0,a.jsx)(F.Z,{}):(0,a.jsxs)("div",{className:"".concat(s().main," ").concat(s().chatLayout),children:[(0,a.jsx)("title",{children:"Khoj AI - Your Second Brain"}),(0,a.jsx)("div",{className:"".concat(s().sidePanel),children:(0,a.jsx)(I.ZP,{conversationId:o,uploadedFiles:c,isMobileWidth:p})}),(0,a.jsx)("div",{className:"".concat(s().chatBox),children:(0,a.jsx)("div",{className:"".concat(s().chatBoxBody),children:(0,a.jsx)(B,{isLoggedIn:null!==y,chatOptionsData:e,setUploadedFiles:d,isMobileWidth:p,onConversationIdChange:e=>{r(e)},userConfig:m,isLoadingUserConfig:h})})})]})}},16463:function(e,t,n){"use strict";var i=n(71169);n.o(i,"useSearchParams")&&n.d(t,{useSearchParams:function(){return i.useSearchParams}})},58877:function(){},31806:function(e){e.exports={card:"suggestions_card__fbiZo",title:"suggestions_title__vNozc",text:"suggestions_text__J_IfY"}},68518:function(e){e.exports={main:"page_main__nw1Wk",suggestions:"page_suggestions__Y8EqU",inputBox:"page_inputBox__LrcZ4",chatBodyFull:"page_chatBodyFull__Qu2T2",chatBody:"page_chatBody__IirQQ",chatLayout:"page_chatLayout__bJUjP",chatBox:"page_chatBox__gsR6V",titleBar:"page_titleBar__3btUI",chatBoxBody:"page_chatBoxBody__xORKr",homeGreetings:"page_homeGreetings__VjQhh",sidePanel:"page_sidePanel__mxpxa"}}},function(e){e.O(0,[404,929,8918,9001,3062,4086,121,3110,1603,9417,9479,2971,7023,1744],function(){return e(e.s=1507)}),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1931],{1507:function(e,t,n){Promise.resolve().then(n.bind(n,4515))},4515:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return q}});var i,o,a=n(57437);n(58877);var r=n(68518),s=n.n(r);n(7395);var l=n(2265),c=n(29039),d=n(52195);let p=new Map([["bold",l.createElement(l.Fragment,null,l.createElement("path",{d:"M228,128a100,100,0,0,1-98.66,100H128a99.39,99.39,0,0,1-68.62-27.29,12,12,0,0,1,16.48-17.45,76,76,0,1,0-1.57-109c-.13.13-.25.25-.39.37L54.89,92H72a12,12,0,0,1,0,24H24a12,12,0,0,1-12-12V56a12,12,0,0,1,24,0V76.72L57.48,57.06A100,100,0,0,1,228,128Z"}))],["duotone",l.createElement(l.Fragment,null,l.createElement("path",{d:"M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z",opacity:"0.2"}),l.createElement("path",{d:"M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z"}))],["fill",l.createElement(l.Fragment,null,l.createElement("path",{d:"M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L60.63,81.29l17,17A8,8,0,0,1,72,112H24a8,8,0,0,1-8-8V56A8,8,0,0,1,29.66,50.3L49.31,70,60.25,60A96,96,0,0,1,224,128Z"}))],["light",l.createElement(l.Fragment,null,l.createElement("path",{d:"M222,128a94,94,0,0,1-92.74,94H128a93.43,93.43,0,0,1-64.5-25.65,6,6,0,1,1,8.24-8.72A82,82,0,1,0,70,70l-.19.19L39.44,98H72a6,6,0,0,1,0,12H24a6,6,0,0,1-6-6V56a6,6,0,0,1,12,0V90.34L61.63,61.4A94,94,0,0,1,222,128Z"}))],["regular",l.createElement(l.Fragment,null,l.createElement("path",{d:"M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z"}))],["thin",l.createElement(l.Fragment,null,l.createElement("path",{d:"M220,128a92,92,0,0,1-90.77,92H128a91.47,91.47,0,0,1-63.13-25.1,4,4,0,1,1,5.5-5.82A84,84,0,1,0,68.6,68.57l-.13.12L34.3,100H72a4,4,0,0,1,0,8H24a4,4,0,0,1-4-4V56a4,4,0,0,1,8,0V94.89l35-32A92,92,0,0,1,220,128Z"}))]]);var u=Object.defineProperty,h=Object.defineProperties,m=Object.getOwnPropertyDescriptors,g=Object.getOwnPropertySymbols,y=Object.prototype.hasOwnProperty,f=Object.prototype.propertyIsEnumerable,k=(e,t,n)=>t in e?u(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,b=(e,t)=>{for(var n in t||(t={}))y.call(t,n)&&k(e,n,t[n]);if(g)for(var n of g(t))f.call(t,n)&&k(e,n,t[n]);return e},v=(e,t)=>h(e,m(t));let x=(0,l.forwardRef)((e,t)=>l.createElement(d.Z,v(b({ref:t},e),{weights:p})));x.displayName="ArrowCounterClockwise";var w=n(36013),P=n(31806),j=n.n(P),L=n(58575),C=n(89417);(i=o||(o={})).Automation="Automation",i.Paint="Paint",i.Travel="Travel",i.Health="Health",i.Learning="Learning",i.Language="Language",i.PopCulture="Pop Culture",i.Food="Food",i.Interviewing="Interviewing",i.Home="Home",i.Fun="Fun",i.Code="Code",i.Finance="Finance";let A={};A.Automation="blue",A.Paint="indigo",A.Travel="yellow",A.Health="teal",A.Learning="purple",A.Language="blue",A["Pop Culture"]="red",A.Food="yellow",A.Interviewing="orange",A.Home="green",A.Fun="fuchsia",A.Code="purple",A.Finance="green";let S="orange",H=[{type:"Automation",color:A.Automation||S,description:"Send me a summary of HackerNews every morning.",link:"/automations?subject=Summarizing%20Top%20Headlines%20from%20HackerNews&query=Summarize%20the%20top%20headlines%20on%20HackerNews&crontime=00%207%20*%20*%20*"},{type:"Automation",color:A.Automation||S,description:"Compose a bedtime story that a five-year-old might enjoy.",link:"/automations?subject=Daily%20Bedtime%20Story&query=Compose%20a%20bedtime%20story%20that%20a%20five-year-old%20might%20enjoy.%20It%20should%20not%20exceed%20five%20paragraphs.%20Appeal%20to%20the%20imagination%2C%20but%20weave%20in%20learnings.&crontime=0%2021%20*%20*%20*"},{type:"Paint",color:A.Paint||S,description:"Paint a picture of a sunset but it's made of stained glass tiles",link:""},{type:"Travel",color:A.Travel||S,description:"Search for the best attractions in Austria Hungary",link:""},{type:"Health",color:A.Health||S,description:"Generate a weekly meal plan with recipes.",link:"/automations?subject=Weekly Meal Plan&query=Create a weekly meal plan with 7 dinner recipes, including ingredients and brief instructions. Focus on balanced, healthy meals.&crontime=0 18 * * 0"},{type:"Paint",color:A.Paint||S,description:"Paint a futuristic cityscape with flying cars.",link:""},{type:"Travel",color:A.Travel||S,description:"Find the top-rated coffee shops in Seattle.",link:""},{type:"Automation",color:A.Automation||S,description:"Send daily motivational quotes.",link:"/automations?subject=Daily Motivation&query=Provide an inspiring quote for the day along with a brief explanation of its meaning.&crontime=0 7 * * *"},{type:"Paint",color:A.Paint||S,description:"Create an abstract representation of jazz music.",link:""},{type:"Learning",color:A.Learning||S,description:"Research the history of the Eiffel Tower.",link:""},{type:"Automation",color:A.Automation||S,description:"Compile a weekly news summary.",link:"/automations?subject=Weekly News Digest&query=Summarize the top 5 most important news stories of the week across various categories.&crontime=0 18 * * 5"},{type:"Paint",color:A.Paint||S,description:"Paint a portrait of a cat wearing a Victorian-era costume.",link:""},{type:"Travel",color:A.Travel||S,description:"Find beginner-friendly hiking trails near Los Angeles.",link:""},{type:"Automation",color:A.Automation||S,description:"Generate a daily writing prompt.",link:"/automations?subject=Daily Writing Prompt&query=Create an engaging writing prompt suitable for short story or journal writing.&crontime=0 9 * * *"},{type:"Paint",color:A.Paint||S,description:"Create a surrealist landscape inspired by Salvador Dali.",link:""},{type:"Learning",color:A.Learning||S,description:"Research the benefits and drawbacks of electric vehicles.",link:""},{type:"Automation",color:A.Automation||S,description:"Send weekly language learning tips for Spanish.",link:"/automations?subject=Spanish Learning Tips&query=Provide a useful Spanish language learning tip, including vocabulary, grammar, or cultural insight.&crontime=0 19 * * 2"},{type:"Paint",color:A.Paint||S,description:"Paint a scene from a fairy tale in the style of Studio Ghibli.",link:""},{type:"Pop Culture",color:"yellow",description:"Find the best-rated science fiction books of the last decade.",link:""},{type:"Paint",color:A.Paint||S,description:"Paint a still life of exotic fruits in a neon color palette.",link:""},{type:"Travel",color:A.Travel||S,description:"Research the most eco-friendly cities in Europe.",link:""},{type:"Automation",color:A.Automation||S,description:"Send daily reminders for habit tracking.",link:"/automations?subject=Habit Tracker&query=Generate a daily reminder to track habits, including a motivational message.&crontime=0 20 * * *"},{type:"Paint",color:A.Paint||S,description:"Create a digital painting of a cyberpunk street market.",link:""},{type:"Learning",color:A.Learning||S,description:"Summarize the biography of this figure: https://en.wikipedia.org/wiki/Jean_Baptiste_Point_du_Sable",link:""},{type:"Language",color:"blue",description:"Send daily Spanish phrases used in Latin America.",link:"/automations?subject=Daily Latin American Spanish&query=Provide a common Spanish phrase or slang term used in Latin America, its meaning, and an example of usage. Include which countries it's most common in.&crontime=0 8 * * *"},{type:"Paint",color:A.Paint||S,description:"Create a vibrant painting inspired by Frida Kahlo's style.",link:""},{type:"Food",color:A.Food||S,description:"Find the best empanada recipe from Colombia.",link:""},{type:"Automation",color:A.Automation||S,description:"Weekly update on the Brazilian startup ecosystems.",link:"/automations?subject=LatAm Startup News&query=Provide a summary of the most significant developments in Latin American startup ecosystems this week. Include notable funding rounds, expansions, or policy changes.&crontime=0 18 * * 5"},{type:"Paint",color:A.Paint||S,description:"Paint a colorful scene of a traditional Day of the Dead celebration in Mexico.",link:""},{type:"Language",color:A.Language||S,description:"Daily Swahili phrase with English translation.",link:"/automations?subject=Daily Swahili Lesson&query=Provide a common Swahili phrase or proverb, its English translation, and a brief explanation of its cultural significance in East Africa.&crontime=0 7 * * *"},{type:"Paint",color:A.Paint||S,description:"Create a digital painting of the Serengeti during wildebeest migration.",link:""},{type:"Learning",color:A.Learning||S,description:"Research the top M-Pesa alternatives in East Africa.",link:""},{type:"Automation",color:A.Automation||S,description:"Weekly update on East African tech startups and innovations.",link:"/automations?subject=East African Tech News&query=Summarize the most significant developments in East African tech startups and innovations this week. Include notable funding rounds, new product launches, or policy changes affecting the tech ecosystem.&crontime=0 18 * * 5"},{type:"Paint",color:A.Paint||S,description:"Paint a colorful scene inspired by Maasai traditional clothing and jewelry.",link:""},{type:"Automation",color:A.Automation||S,description:"Weekly summary of EU policy changes and their impact.",link:"/automations?subject=EU Policy Update&query=Summarize the most significant EU policy changes or proposals from this week. Explain their potential impact on European citizens and businesses.&crontime=0 17 * * 5"},{type:"Paint",color:A.Paint||S,description:"Paint a digital landscape of the Northern Lights over the Norwegian fjords.",link:""},{type:"Automation",color:A.Automation||S,description:"Daily East Asian proverb with explanation.",link:"/automations?subject=East Asian Wisdom&query=Provide a proverb from an East Asian language (rotating through Chinese, Japanese, Korean, etc.), its English translation, and a brief explanation of its cultural significance and practical application.&crontime=0 7 * * *"},{type:"Paint",color:A.Paint||S,description:"Create a digital painting in the style of traditional Chinese ink wash landscape.",link:""},{type:"Pop Culture",color:"yellow",description:"Research the latest trends in K-pop and its global influence.",link:""},{type:"Automation",color:A.Automation||S,description:"Weekly summary of technological innovations from East Asian tech giants.",link:"/automations?subject=East Asian Tech Update&query=Summarize the most significant technological innovations or product launches from major East Asian tech companies (e.g., Samsung, Sony, Alibaba, Tencent) this week. Explain their potential impact on global markets.&crontime=0 18 * * 5"},{type:"Paint",color:A.Paint||S,description:"Paint a vibrant scene of a Japanese cherry blossom festival.",link:""},{type:"Automation",color:A.Automation||S,description:"Daily South Asian recipe with cultural significance.",link:"/automations?subject=South Asian Culinary Journey&query=Provide a traditional South Asian recipe (rotating through Indian, Pakistani, Bangladeshi, Sri Lankan, etc. cuisines), including ingredients, brief instructions, and its cultural significance or origin story.&crontime=0 10 * * *"},{type:"Pop Culture",color:A["Pop Culture"]||S,description:"Research the impact of Bollywood on global cinema and fashion.",link:""},{type:"Automation",color:A.Automation||S,description:"Weekly update on South Asian startup ecosystems and innovations.",link:"/automations?subject=South Asian Startup Pulse&query=Summarize the most significant developments in South Asian startup ecosystems this week. Include notable funding rounds, innovative solutions to local challenges, and any policy changes affecting the tech landscape in countries like India, Bangladesh, Pakistan, and Sri Lanka.&crontime=0 18 * * 5"},{type:"Interviewing",color:A.Interviewing||S,description:"Create interview prep questions for a consulting job.",link:""},{type:"Interviewing",color:A.Interviewing||S,description:"What information should I include in a CV for a PhD application?",link:""},{type:"Home",color:A.Home||S,description:"Recommend plants that can grow well indoors.",link:""},{type:"Health",color:A.Health||S,description:"Suggest healthy meal prep ideas for a busy work week.",link:""},{type:"Learning",color:A.Learning||S,description:"List effective time management techniques for students.",link:""},{type:"Learning",color:A.Learning||S,description:"Provide tips for improving public speaking skills.",link:""},{type:"Learning",color:A.Learning||S,description:"Recommend books for learning about personal finance.",link:""},{type:"Home",color:A.Home||S,description:"Suggest ways to reduce plastic waste in daily life.",link:""},{type:"Health",color:A.Health||S,description:"Create a beginner's guide to meditation and mindfulness.",link:""},{type:"Health",color:A.Health||S,description:"Give me some tips for improving my sleep quality.",link:""},{type:"Health",color:A.Health||S,description:"What are weight loss strategies supported by clinical studies?",link:""},{type:"Fun",color:A.Fun||S,description:"List creative date ideas for couples on a budget.",link:""},{type:"Code",color:A.Interviewing||S,description:"Provide tips for writing an effective resume.",link:""},{type:"Code",color:A.Code||S,description:"Explain the concept of recursion with a simple coding example.",link:""},{type:"Code",color:A.Code||S,description:"Provide a coding challenge to reverse a string without using built-in functions.",link:""},{type:"Code",color:A.Code||S,description:"Explain the difference between 'let', 'const', and 'var' in JavaScript.",link:""},{type:"Code",color:A.Code||S,description:"Create a coding exercise to implement a basic sorting algorithm (e.g., bubble sort).",link:""},{type:"Code",color:A.Code||S,description:"Explain object-oriented programming principles with a simple class example.",link:""},{type:"Code",color:A.Code||S,description:"Provide a coding challenge to find the longest palindromic substring in a given string.",link:""},{type:"Code",color:A.Code||S,description:"Explain the concept of asynchronous programming with a JavaScript Promise example.",link:""},{type:"Code",color:A.Code||S,description:"Create a coding exercise to implement a basic data structure (e.g., linked list or stack).",link:""},{type:"Code",color:A.Code||S,description:"Explain the time and space complexity of common algorithms (e.g., binary search).",link:""},{type:"Code",color:A.Code||S,description:"Provide a coding challenge to implement a simple REST API using Node.js and Express.",link:""},{type:"Code",color:A.Code||S,description:"Compare popular web frameworks in Rust and Python",link:""},{type:"Travel",color:A.Travel||S,description:"Craft an off-beat itinerary for a weekend in Lagos, Nigeria.",link:""},{type:"Language",color:A.Language||S,description:"Teach me about declensions in Latin.",link:""},{type:"Learning",color:A.Learning||S,description:"Break down the concept of photosynthesis for a middle school student.",link:""},{type:"Learning",color:A.Learning||S,description:"Use the Socratic method to explore the causes of World War I.",link:""},{type:"Learning",color:A.Learning||S,description:"Explain the water cycle using an analogy suitable for elementary students.",link:""},{type:"Learning",color:A.Learning||S,description:"Guide a high school student through solving a quadratic equation step-by-step.",link:""},{type:"Learning",color:A.Learning||S,description:"Create a series of questions to help a student discover the principles of basic economics.",link:""},{type:"Learning",color:A.Learning||S,description:"Develop a hands-on experiment to demonstrate the concept of density to middle schoolers.",link:""},{type:"Learning",color:A.Learning||S,description:"Use guided discovery to help a student understand the structure of DNA.",link:""},{type:"Learning",color:A.Learning||S,description:"Create a personalized learning plan for a student struggling with grammar concepts.",link:""},{type:"Learning",color:A.Learning||S,description:"Design a series of questions to encourage critical thinking about climate change.",link:""},{type:"Learning",color:A.Learning||S,description:"Develop a step-by-step guide for conducting a basic science experiment on plant growth.",link:""},{type:"Health",color:A.Health||S,description:"Provide a detailed explanation about how to manage type 2 diabetes.",link:""},{type:"Health",color:A.Health||S,description:"Explain the effects a stroke might have on the body.",link:""},{type:"Health",color:A.Health||S,description:"Describe the recommended steps for preventing heart disease.",link:""},{type:"Health",color:A.Health||S,description:"Explain the differences between various types of headaches and their treatments.",link:""},{type:"Health",color:A.Health||S,description:"Provide an overview of the most effective stress management techniques.",link:""},{type:"Health",color:A.Health||S,description:"Explain the importance of vaccination and how vaccines work.",link:""},{type:"Health",color:A.Health||S,description:"Describe the symptoms and treatment options for depression.",link:""},{type:"Health",color:A.Health||S,description:"Explain the process of digestion and common digestive disorders.",link:""},{type:"Health",color:A.Health||S,description:"Provide an overview of the different types of cancer screenings and their importance.",link:""},{type:"Health",color:A.Health||S,description:"Explain the effects of sleep deprivation on physical and mental health.",link:""},{type:"Fun",color:A.Fun||S,description:"Create a list of fun activities for a family game night.",link:""},{type:"Finance",color:A.Finance||S,description:"Explain the concept of compound interest and its importance in long-term savings.",link:""},{type:"Finance",color:A.Finance||S,description:"Provide an overview of different types of retirement accounts (e.g., 401(k), IRA, Roth IRA).",link:""},{type:"Finance",color:A.Finance||S,description:"Describe strategies for creating and sticking to a personal budget.",link:""},{type:"Finance",color:A.Finance||S,description:"Explain the basics of stock market investing for beginners.",link:""},{type:"Finance",color:A.Finance||S,description:"Outline the pros and cons of renting vs. buying a home.",link:""},{type:"Finance",color:A.Finance||S,description:"Describe different methods for paying off debt, such as the snowball and avalanche methods.",link:""},{type:"Finance",color:A.Finance||S,description:"Explain the importance of an emergency fund and how to build one.",link:""},{type:"Finance",color:A.Finance||S,description:"Provide an overview of different types of insurance and their importance in financial planning.",link:""},{type:"Finance",color:A.Finance||S,description:"Explain the concept of diversification in investment portfolios.",link:""},{type:"Finance",color:A.Finance||S,description:"Describe strategies for minimizing tax liability legally.",link:""}];function E(e){var t,n;let i=(0,L.Zc)(e.color),o="".concat(j().card," ").concat(i," md:w-full md:h-fit sm:w-full h-fit md:w-[200px] md:h-[200px] cursor-pointer"),r="".concat(j().title," pt-2 dark:text-white dark:font-bold"),s="".concat(j().text," dark:text-white"),l=(0,a.jsxs)(w.Zb,{className:o,children:[(0,a.jsx)(w.Ol,{className:"m-0 p-2 pb-1 relative",children:(0,a.jsxs)("div",{className:"flex flex-row md:flex-col",children:[(t=e.title,n=e.color.toLowerCase(),"Automation"===t?(0,C.TI)("Robot",n,"w-8","h-8"):"Paint"===t?(0,C.TI)("Palette",n,"w-8","h-8"):"Pop Culture"===t?(0,C.TI)("Confetti",n,"w-8","h-8"):"Travel"===t?(0,C.TI)("Jeep",n,"w-8","h-8"):"Learning"===t?(0,C.TI)("Book",n,"w-8","h-8"):"Health"===t?(0,C.TI)("Asclepius",n,"w-8","h-8"):"Fun"===t?(0,C.TI)("Island",n,"w-8","h-8"):"Home"===t?(0,C.TI)("House",n,"w-8","h-8"):"Language"===t?(0,C.TI)("Translate",n,"w-8","h-8"):"Code"===t?(0,C.TI)("Code",n,"w-8","h-8"):"Food"===t?(0,C.TI)("BowlFood",n,"w-8","h-8"):"Interviewing"===t?(0,C.TI)("Lectern",n,"w-8","h-8"):"Finance"===t?(0,C.TI)("Wallet",n,"w-8","h-8"):(0,C.TI)("Lightbulb",n,"w-8","h-8")),(0,a.jsx)(w.ll,{className:r,children:e.title})]})}),(0,a.jsx)(w.aY,{className:"m-0 p-2 pr-4 pt-1",children:(0,a.jsx)(w.SZ,{className:"".concat(s," sm:line-clamp-2 md:line-clamp-4"),children:e.body})})]});return e.link?(0,a.jsx)("a",{href:e.link,className:"no-underline",children:l}):l}var I=n(48861),F=n(58485),_=n(59479),N=n(66820),T=n(79306),M=n(9557),D=n(69591),W=n(16463);function B(e){let[t,n]=(0,l.useState)(""),[i,o]=(0,l.useState)(null),[r,d]=(0,l.useState)(!1),[p,u]=(0,l.useState)(""),[h,m]=(0,l.useState)([]),[g,y]=(0,l.useState)("khoj"),[f,k]=(0,l.useState)([]),[b,v]=(0,l.useState)([]),[P,j]=(0,l.useState)(!1),A=(0,W.useSearchParams)().get("q");(0,l.useEffect)(()=>{A&&n(decodeURIComponent(A))},[A]);let S=e.onConversationIdChange,{data:I,error:F}=(0,c.ZP)("agents",()=>window.fetch("/api/agents").then(e=>e.json()).catch(e=>console.log(e)),{revalidateOnFocus:!1});function T(){m((function(e){for(let t=e.length-1;t>0;t--){let n=Math.floor(Math.random()*(t+1));[e[t],e[n]]=[e[n],e[t]]}return e})(H).slice(0,3))}return(0,l.useEffect)(()=>{var t,n;if(e.isLoadingUserConfig)return;let i=new Date,o=i.getDay(),a=i.getHours()>=17||4>i.getHours()?"evening":i.getHours()>=12?"afternoon":"morning",r=(null===(t=e.userConfig)||void 0===t?void 0:t.given_name)?", ".concat(null===(n=e.userConfig)||void 0===n?void 0:n.given_name):"",s=["What would you like to get done".concat(r,"?"),"Hey".concat(r,"! How can I help?"),"Good ".concat(a).concat(r,"! What's on your mind?"),"Ready to breeze through your ".concat(["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][o],"?"),"Want help navigating your ".concat(["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][o]," workload?")];u(s[Math.floor(Math.random()*s.length)])},[e.isLoadingUserConfig,e.userConfig]),(0,l.useEffect)(()=>{e.chatOptionsData&&T()},[e.chatOptionsData]),(0,l.useEffect)(()=>{let t=e.isMobileWidth?2:4,n=I?[...I].sort(()=>.5-Math.random()):[],i=I?[I[0]]:[];n.slice(0,t-1).forEach(e=>{i.find(t=>t.slug===e.slug)||i.push(e)}),v(i),k(i.filter(e=>null!=e).map(e=>(0,C.TI)(e.icon,e.color)))},[I,e.isMobileWidth]),(0,l.useEffect)(()=>{(async()=>{if(t&&!r){d(!0);try{let e=await (0,M.A0)(g||"khoj");null==S||S(e),window.location.href="/chat?conversationId=".concat(e),localStorage.setItem("message",t),i&&localStorage.setItem("image",i)}catch(e){console.error("Error creating new conversation:",e),d(!1)}n("")}})(),t&&d(!0)},[g,t,r,S]),(0,a.jsxs)("div",{className:"".concat(s().homeGreetings," w-full md:w-auto"),children:[P&&(0,a.jsx)(N.Z,{onOpenChange:j,loginRedirectMessage:"Login to your second brain"}),(0,a.jsxs)("div",{className:"w-full text-center justify-end content-end",children:[(0,a.jsx)("div",{className:"items-center",children:(0,a.jsx)("h1",{className:"text-2xl md:text-3xl text-center w-fit pb-6 px-4 mx-auto",children:p})}),!e.isMobileWidth&&(0,a.jsxs)("div",{className:"flex pb-6 gap-2 items-center justify-center",children:[f.map((e,t)=>(0,a.jsx)(w.Zb,{className:"".concat(g===b[t].slug?(0,L.Iu)(b[t].color):"border-stone-100 dark:border-neutral-700 text-muted-foreground","\n hover:cursor-pointer rounded-lg px-2 py-2"),children:(0,a.jsxs)(w.ll,{className:"text-center text-md font-medium flex justify-center items-center",onClick:()=>y(b[t].slug),children:[e," ",b[t].name]})},"".concat(t,"-").concat(b[t].slug))),(0,a.jsx)(w.Zb,{className:"border-none shadow-none flex justify-center items-center hover:cursor-pointer",onClick:()=>window.location.href="/agents",children:(0,a.jsx)(w.ll,{className:"text-center text-md font-normal flex justify-center items-center px-1.5 py-2",children:"See All →"})})]})]}),(0,a.jsxs)("div",{className:"mx-auto ".concat(e.isMobileWidth?"w-full":"w-fit"),children:[!e.isMobileWidth&&(0,a.jsx)("div",{className:"w-full ".concat(s().inputBox," shadow-lg bg-background align-middle items-center justify-center px-3 py-1 dark:bg-neutral-700 border-stone-100 dark:border-none dark:shadow-none rounded-2xl"),children:(0,a.jsx)(_.Z,{isLoggedIn:e.isLoggedIn,sendMessage:e=>n(e),sendImage:e=>o(e),sendDisabled:r,chatOptionsData:e.chatOptionsData,conversationId:null,isMobileWidth:e.isMobileWidth,setUploadedFiles:e.setUploadedFiles})}),(0,a.jsx)("div",{className:"".concat(s().suggestions," w-full ").concat(e.isMobileWidth?"grid":"flex flex-row"," justify-center items-center"),children:h.map((t,i)=>(0,a.jsx)("div",{onClick:i=>{e.isLoggedIn?function(e,t,i){if(!e){let e="";i=i.charAt(0).toLowerCase()+i.slice(1),e="Online Search"===t?"/online "+i:"Paint"===t?"/image "+i:i;let o=document.getElementById("message");o&&(o.value=e,n(e))}}(t.link,t.type,t.description):(i.preventDefault(),i.stopPropagation(),j(!0))},children:(0,a.jsx)(E,{title:t.type,body:t.description,link:t.link,color:t.color},t.type+Math.random())},"".concat(t.type," ").concat(t.description)))}),(0,a.jsx)("div",{className:"flex items-center justify-center margin-auto",children:(0,a.jsxs)("button",{onClick:function(){T()},className:"m-2 p-1.5 rounded-lg dark:hover:bg-[var(--background-color)] hover:bg-stone-100 border border-stone-100 text-sm text-stone-500 dark:text-stone-300 dark:border-neutral-700",children:["More Ideas ",(0,a.jsx)(x,{className:"h-4 w-4 inline"})]})})]}),e.isMobileWidth&&(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)("div",{className:"".concat(s().inputBox," pt-1 shadow-[0_-20px_25px_-5px_rgba(0,0,0,0.1)] dark:bg-neutral-700 bg-background align-middle items-center justify-center pb-3 mx-1 rounded-t-2xl rounded-b-none"),children:[(0,a.jsxs)("div",{className:"flex gap-2 items-center justify-left pt-1 pb-2 px-12",children:[f.map((e,t)=>(0,a.jsx)(w.Zb,{className:"".concat(g===b[t].slug?(0,L.Iu)(b[t].color):"border-muted text-muted-foreground"," hover:cursor-pointer"),children:(0,a.jsxs)(w.ll,{className:"text-center text-xs font-medium flex justify-center items-center px-1.5 py-1",onClick:()=>y(b[t].slug),children:[e," ",b[t].name]})},"".concat(t,"-").concat(b[t].slug))),(0,a.jsx)(w.Zb,{className:"border-none shadow-none flex justify-center items-center hover:cursor-pointer",onClick:()=>window.location.href="/agents",children:(0,a.jsx)(w.ll,{className:"text-center ".concat(e.isMobileWidth?"text-xs":"text-md"," font-normal flex justify-center items-center px-1.5 py-2"),children:"See All →"})})]}),(0,a.jsx)(_.Z,{isLoggedIn:e.isLoggedIn,sendMessage:e=>n(e),sendImage:e=>o(e),sendDisabled:r,chatOptionsData:e.chatOptionsData,conversationId:null,isMobileWidth:e.isMobileWidth,setUploadedFiles:e.setUploadedFiles})]})})]})}function q(){let[e,t]=(0,l.useState)(null),[n,i]=(0,l.useState)(!0),[o,r]=(0,l.useState)(null),[c,d]=(0,l.useState)([]),p=(0,D.IC)(),{userConfig:u,isLoadingUserConfig:h}=(0,T.h2)(!0),[m,g]=(0,l.useState)(null),y=(0,T.GW)();return((0,l.useEffect)(()=>{g(u)},[u]),(0,l.useEffect)(()=>{fetch("/api/chat/options").then(e=>e.json()).then(e=>{i(!1),e&&t(e)}).catch(e=>{console.error(e)})},[]),n)?(0,a.jsx)(F.Z,{}):(0,a.jsxs)("div",{className:"".concat(s().main," ").concat(s().chatLayout),children:[(0,a.jsx)("title",{children:"Khoj AI - Your Second Brain"}),(0,a.jsx)("div",{className:"".concat(s().sidePanel),children:(0,a.jsx)(I.ZP,{conversationId:o,uploadedFiles:c,isMobileWidth:p})}),(0,a.jsx)("div",{className:"".concat(s().chatBox),children:(0,a.jsx)("div",{className:"".concat(s().chatBoxBody),children:(0,a.jsx)(B,{isLoggedIn:null!==y,chatOptionsData:e,setUploadedFiles:d,isMobileWidth:p,onConversationIdChange:e=>{r(e)},userConfig:m,isLoadingUserConfig:h})})})]})}},16463:function(e,t,n){"use strict";var i=n(71169);n.o(i,"useSearchParams")&&n.d(t,{useSearchParams:function(){return i.useSearchParams}})},58877:function(){},31806:function(e){e.exports={card:"suggestions_card__fbiZo",title:"suggestions_title__vNozc",text:"suggestions_text__J_IfY"}},68518:function(e){e.exports={main:"page_main__nw1Wk",suggestions:"page_suggestions__Y8EqU",inputBox:"page_inputBox__LrcZ4",chatBodyFull:"page_chatBodyFull__Qu2T2",chatBody:"page_chatBody__IirQQ",chatLayout:"page_chatLayout__bJUjP",chatBox:"page_chatBox__gsR6V",titleBar:"page_titleBar__3btUI",chatBoxBody:"page_chatBoxBody__xORKr",homeGreetings:"page_homeGreetings__VjQhh",sidePanel:"page_sidePanel__mxpxa"}}},function(e){e.O(0,[404,929,8918,9001,3062,8840,121,3110,1603,9417,9479,2971,7023,1744],function(){return e(e.s=1507)}),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2797],{94114:function(e,t,s){Promise.resolve().then(s.bind(s,51956))},51956:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return C}});var n=s(57437),a=s(83102),r=s(2265),l=s(48861),o=s(49315),i=s.n(o),d=s(94880),c=s(36013),u=s(72151),m=s(9476),h=s(22585),x=s(26100),f=s(44686),g=s(35304),j=s(95289),b=s(17541),p=s(16288),N=s(52680),y=s(50495),w=s(87138),v=s(89417),k=s(69591);let _=["What does the paper say about climate change?","Making a cappuccino at home","Benefits of eating mangoes","How to plan a wedding on a budget","Appointment with Dr. Makinde on 12th August","Class notes lecture 3 on quantum mechanics","Painting concepts for acrylics","Abstract from the paper attention is all you need","Climbing Everest without oxygen","Solving a rubik's cube in 30 seconds","Facts about the planet Mars","How to make a website using React","Fish at the bottom of the ocean","Fish farming Kenya 2021","How to make a cake without an oven","Installing a solar panel at home"];function S(e){var t;let s=e.note,a=(s.additional.file||"").startsWith("http"),r=a?s.additional.heading:s.additional.file.split("/").pop(),l=(0,v.Le)(r||".txt","h-4 w-4 inline mr-2");return(0,n.jsxs)(c.Zb,{className:"bg-secondary h-full shadow-sm rounded-lg bg-gradient-to-b from-background to-slate-50 dark:to-gray-950 border border-muted mb-4",children:[(0,n.jsx)(c.Ol,{children:(0,n.jsxs)(c.ll,{className:"inline-flex gap-2",children:["notion"===(t=s.additional.source)?(0,n.jsx)(u.F,{className:"text-muted-foreground"}):"github"===t?(0,n.jsx)(m.b,{className:"text-muted-foreground"}):(0,n.jsx)(h.S,{className:"text-muted-foreground"}),r]})}),(0,n.jsxs)(c.aY,{children:[(0,n.jsx)("div",{className:"line-clamp-4 text-muted-foreground",children:s.entry}),(0,n.jsxs)(y.z,{onClick:()=>e.setFocusSearchResult(s),variant:"ghost",className:"p-0 mt-2 text-orange-400 hover:bg-inherit",children:["See content",(0,n.jsx)(x.o,{className:"inline ml-2"})]})]}),(0,n.jsx)(c.eW,{children:a?(0,n.jsxs)("a",{href:s.additional.file,target:"_blank",className:"underline text-sm bg-muted p-1 rounded-lg text-muted-foreground",children:[(0,n.jsx)(f.a,{className:"inline m-2"}),s.additional.file]}):(0,n.jsxs)("div",{className:"bg-muted p-2 text-sm rounded-lg text-muted-foreground",children:[l,s.additional.file]})})]})}function C(){let[e,t]=(0,r.useState)(""),[s,o]=(0,r.useState)(null),[u,m]=(0,r.useState)(!1),[h,x]=(0,r.useState)(null),[C,E]=(0,r.useState)(""),F=(0,r.useRef)(null),M=(0,k.IC)();function P(){!u&&e.trim()&&fetch("/api/search?q=".concat(encodeURIComponent(e),"&client=web"),{method:"GET",headers:{"Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{o(e),m(!1)}).catch(e=>{console.error("Error:",e)})}return(0,r.useEffect)(()=>{E(_[Math.floor(Math.random()*_.length)])},[]),(0,r.useEffect)(()=>{if(e.trim())return x(null),F.current&&clearTimeout(F.current),e.trim()&&(F.current=setTimeout(()=>{P()},750)),()=>{F.current&&clearTimeout(F.current)}},[e]),(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"h-full ".concat(i().sidePanel),children:(0,n.jsx)(l.ZP,{conversationId:null,uploadedFiles:[],isMobileWidth:M})}),(0,n.jsx)("div",{className:"".concat(i().searchLayout),children:(0,n.jsx)("div",{className:"md:w-3/4 sm:w-full mx-auto pt-6 md:pt-8",children:(0,n.jsxs)("div",{className:"p-4 md:w-3/4 sm:w-full mx-auto",children:[(0,n.jsxs)("div",{className:"flex justify-between items-center border-2 border-muted p-1 gap-1 rounded-lg",children:[(0,n.jsx)(a.I,{autoFocus:!0,className:"border-none pl-4",onChange:e=>t(e.currentTarget.value),onKeyDown:e=>"Enter"===e.key&&P(),type:"search",placeholder:"Search Documents"}),(0,n.jsxs)("button",{className:"px-2 gap-2 inline-flex items-center rounded border-l border-gray-300 hover:text-gray-500",onClick:()=>P(),children:[(0,n.jsx)(g.Y,{className:"h-4 w-4"}),(0,n.jsx)("span",{children:"Find"})]})]}),h&&(0,n.jsxs)("div",{className:"mt-4",children:[(0,n.jsxs)(y.z,{onClick:()=>x(null),className:"mb-4",variant:"outline",children:[(0,n.jsx)(j.X,{className:"inline mr-2"}),"Back"]}),function(e){let t=(e.additional.file||"").startsWith("http"),s=t?e.additional.heading:e.additional.file.split("/").pop(),a=(0,v.Le)(s||".txt","h-4 w-4 inline mr-2");return(0,n.jsxs)(c.Zb,{className:"bg-secondary h-full shadow-sm rounded-lg bg-gradient-to-b from-background to-slate-50 dark:to-gray-950 border border-muted mb-4",children:[(0,n.jsx)(c.Ol,{children:(0,n.jsx)(c.ll,{children:s})}),(0,n.jsx)(c.eW,{children:t?(0,n.jsxs)("a",{href:e.additional.file,target:"_blank",className:"underline text-sm bg-muted p-3 rounded-lg text-muted-foreground flex items-center gap-2",children:[(0,n.jsx)(f.a,{className:"inline"}),e.additional.file]}):(0,n.jsxs)("div",{className:"bg-muted p-3 text-sm rounded-lg text-muted-foreground flex items-center gap-2",children:[a,e.additional.file]})}),(0,n.jsx)(c.aY,{children:(0,n.jsx)("div",{className:"text-m",children:e.entry})})]})}(h)]}),!h&&s&&s.length>0&&(0,n.jsx)("div",{className:"mt-4 max-w-[92vw] break-all",children:(0,n.jsx)(d.x,{className:"h-[80vh]",children:s.map((e,t)=>(0,n.jsx)(S,{note:e,setFocusSearchResult:x},e["corpus-id"]))})}),null==s&&(0,n.jsxs)(c.Zb,{className:"flex flex-col items-center justify-center border-none shadow-none",children:[(0,n.jsxs)(c.Ol,{className:"flex flex-col items-center justify-center",children:[(0,n.jsx)(c.SZ,{className:"border-muted-foreground border w-fit rounded-lg mb-2 text-center text-lg p-4",children:(0,n.jsx)(b.r,{weight:"fill",className:"text-muted-foreground h-10 w-10"})}),(0,n.jsx)(c.ll,{className:"text-center",children:"Search across your documents"})]}),(0,n.jsxs)(c.aY,{className:"text-muted-foreground items-center justify-center text-center flex",children:[(0,n.jsx)(p.v,{className:"inline mr-2"})," ",C]})]}),s&&0===s.length&&(0,n.jsxs)(c.Zb,{className:"flex flex-col items-center justify-center border-none shadow-none",children:[(0,n.jsxs)(c.Ol,{className:"flex flex-col items-center justify-center",children:[(0,n.jsx)(c.SZ,{className:"border-muted-foreground border w-fit rounded-lg mb-2 text-center text-lg p-4",children:(0,n.jsx)(N.D,{weight:"fill",className:"text-muted-foreground h-10 w-10"})}),(0,n.jsx)(c.ll,{className:"text-center",children:"No documents found"})]}),(0,n.jsxs)(c.aY,{children:[(0,n.jsx)("div",{className:"text-muted-foreground items-center justify-center text-center flex",children:"To use search, upload your docs to your account."}),(0,n.jsx)(w.default,{href:"https://docs.khoj.dev/data-sources/share_your_data",className:"no-underline",children:(0,n.jsx)("div",{className:"mt-4 text-center text-secondary-foreground bg-secondary w-fit m-auto p-2 rounded-lg",children:"Learn More"})})]})]})]})})})]})}},49315:function(e){e.exports={searchLayout:"search_searchLayout__fP3m0",sidePanel:"search_sidePanel__myfc9"}}},function(e){e.O(0,[8918,9001,3062,4086,6297,1603,9417,2971,7023,1744],function(){return e(e.s=94114)}),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2797],{94114:function(e,t,s){Promise.resolve().then(s.bind(s,51956))},51956:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return C}});var n=s(57437),a=s(83102),r=s(2265),l=s(48861),o=s(49315),i=s.n(o),d=s(94880),c=s(36013),u=s(72151),m=s(9476),h=s(22585),x=s(26100),f=s(44686),g=s(35304),j=s(95289),b=s(17541),p=s(16288),N=s(52680),y=s(50495),w=s(87138),v=s(89417),k=s(69591);let _=["What does the paper say about climate change?","Making a cappuccino at home","Benefits of eating mangoes","How to plan a wedding on a budget","Appointment with Dr. Makinde on 12th August","Class notes lecture 3 on quantum mechanics","Painting concepts for acrylics","Abstract from the paper attention is all you need","Climbing Everest without oxygen","Solving a rubik's cube in 30 seconds","Facts about the planet Mars","How to make a website using React","Fish at the bottom of the ocean","Fish farming Kenya 2021","How to make a cake without an oven","Installing a solar panel at home"];function S(e){var t;let s=e.note,a=(s.additional.file||"").startsWith("http"),r=a?s.additional.heading:s.additional.file.split("/").pop(),l=(0,v.Le)(r||".txt","h-4 w-4 inline mr-2");return(0,n.jsxs)(c.Zb,{className:"bg-secondary h-full shadow-sm rounded-lg bg-gradient-to-b from-background to-slate-50 dark:to-gray-950 border border-muted mb-4",children:[(0,n.jsx)(c.Ol,{children:(0,n.jsxs)(c.ll,{className:"inline-flex gap-2",children:["notion"===(t=s.additional.source)?(0,n.jsx)(u.F,{className:"text-muted-foreground"}):"github"===t?(0,n.jsx)(m.b,{className:"text-muted-foreground"}):(0,n.jsx)(h.S,{className:"text-muted-foreground"}),r]})}),(0,n.jsxs)(c.aY,{children:[(0,n.jsx)("div",{className:"line-clamp-4 text-muted-foreground",children:s.entry}),(0,n.jsxs)(y.z,{onClick:()=>e.setFocusSearchResult(s),variant:"ghost",className:"p-0 mt-2 text-orange-400 hover:bg-inherit",children:["See content",(0,n.jsx)(x.o,{className:"inline ml-2"})]})]}),(0,n.jsx)(c.eW,{children:a?(0,n.jsxs)("a",{href:s.additional.file,target:"_blank",className:"underline text-sm bg-muted p-1 rounded-lg text-muted-foreground",children:[(0,n.jsx)(f.a,{className:"inline m-2"}),s.additional.file]}):(0,n.jsxs)("div",{className:"bg-muted p-2 text-sm rounded-lg text-muted-foreground",children:[l,s.additional.file]})})]})}function C(){let[e,t]=(0,r.useState)(""),[s,o]=(0,r.useState)(null),[u,m]=(0,r.useState)(!1),[h,x]=(0,r.useState)(null),[C,E]=(0,r.useState)(""),F=(0,r.useRef)(null),M=(0,k.IC)();function P(){!u&&e.trim()&&fetch("/api/search?q=".concat(encodeURIComponent(e),"&client=web"),{method:"GET",headers:{"Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{o(e),m(!1)}).catch(e=>{console.error("Error:",e)})}return(0,r.useEffect)(()=>{E(_[Math.floor(Math.random()*_.length)])},[]),(0,r.useEffect)(()=>{if(e.trim())return x(null),F.current&&clearTimeout(F.current),e.trim()&&(F.current=setTimeout(()=>{P()},750)),()=>{F.current&&clearTimeout(F.current)}},[e]),(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"h-full ".concat(i().sidePanel),children:(0,n.jsx)(l.ZP,{conversationId:null,uploadedFiles:[],isMobileWidth:M})}),(0,n.jsx)("div",{className:"".concat(i().searchLayout),children:(0,n.jsx)("div",{className:"md:w-3/4 sm:w-full mx-auto pt-6 md:pt-8",children:(0,n.jsxs)("div",{className:"p-4 md:w-3/4 sm:w-full mx-auto",children:[(0,n.jsxs)("div",{className:"flex justify-between items-center border-2 border-muted p-1 gap-1 rounded-lg",children:[(0,n.jsx)(a.I,{autoFocus:!0,className:"border-none pl-4",onChange:e=>t(e.currentTarget.value),onKeyDown:e=>"Enter"===e.key&&P(),type:"search",placeholder:"Search Documents"}),(0,n.jsxs)("button",{className:"px-2 gap-2 inline-flex items-center rounded border-l border-gray-300 hover:text-gray-500",onClick:()=>P(),children:[(0,n.jsx)(g.Y,{className:"h-4 w-4"}),(0,n.jsx)("span",{children:"Find"})]})]}),h&&(0,n.jsxs)("div",{className:"mt-4",children:[(0,n.jsxs)(y.z,{onClick:()=>x(null),className:"mb-4",variant:"outline",children:[(0,n.jsx)(j.X,{className:"inline mr-2"}),"Back"]}),function(e){let t=(e.additional.file||"").startsWith("http"),s=t?e.additional.heading:e.additional.file.split("/").pop(),a=(0,v.Le)(s||".txt","h-4 w-4 inline mr-2");return(0,n.jsxs)(c.Zb,{className:"bg-secondary h-full shadow-sm rounded-lg bg-gradient-to-b from-background to-slate-50 dark:to-gray-950 border border-muted mb-4",children:[(0,n.jsx)(c.Ol,{children:(0,n.jsx)(c.ll,{children:s})}),(0,n.jsx)(c.eW,{children:t?(0,n.jsxs)("a",{href:e.additional.file,target:"_blank",className:"underline text-sm bg-muted p-3 rounded-lg text-muted-foreground flex items-center gap-2",children:[(0,n.jsx)(f.a,{className:"inline"}),e.additional.file]}):(0,n.jsxs)("div",{className:"bg-muted p-3 text-sm rounded-lg text-muted-foreground flex items-center gap-2",children:[a,e.additional.file]})}),(0,n.jsx)(c.aY,{children:(0,n.jsx)("div",{className:"text-m",children:e.entry})})]})}(h)]}),!h&&s&&s.length>0&&(0,n.jsx)("div",{className:"mt-4 max-w-[92vw] break-all",children:(0,n.jsx)(d.x,{className:"h-[80vh]",children:s.map((e,t)=>(0,n.jsx)(S,{note:e,setFocusSearchResult:x},e["corpus-id"]))})}),null==s&&(0,n.jsxs)(c.Zb,{className:"flex flex-col items-center justify-center border-none shadow-none",children:[(0,n.jsxs)(c.Ol,{className:"flex flex-col items-center justify-center",children:[(0,n.jsx)(c.SZ,{className:"border-muted-foreground border w-fit rounded-lg mb-2 text-center text-lg p-4",children:(0,n.jsx)(b.r,{weight:"fill",className:"text-muted-foreground h-10 w-10"})}),(0,n.jsx)(c.ll,{className:"text-center",children:"Search across your documents"})]}),(0,n.jsxs)(c.aY,{className:"text-muted-foreground items-center justify-center text-center flex",children:[(0,n.jsx)(p.v,{className:"inline mr-2"})," ",C]})]}),s&&0===s.length&&(0,n.jsxs)(c.Zb,{className:"flex flex-col items-center justify-center border-none shadow-none",children:[(0,n.jsxs)(c.Ol,{className:"flex flex-col items-center justify-center",children:[(0,n.jsx)(c.SZ,{className:"border-muted-foreground border w-fit rounded-lg mb-2 text-center text-lg p-4",children:(0,n.jsx)(N.D,{weight:"fill",className:"text-muted-foreground h-10 w-10"})}),(0,n.jsx)(c.ll,{className:"text-center",children:"No documents found"})]}),(0,n.jsxs)(c.aY,{children:[(0,n.jsx)("div",{className:"text-muted-foreground items-center justify-center text-center flex",children:"To use search, upload your docs to your account."}),(0,n.jsx)(w.default,{href:"https://docs.khoj.dev/data-sources/share_your_data",className:"no-underline",children:(0,n.jsx)("div",{className:"mt-4 text-center text-secondary-foreground bg-secondary w-fit m-auto p-2 rounded-lg",children:"Learn More"})})]})]})]})})})]})}},49315:function(e){e.exports={searchLayout:"search_searchLayout__fP3m0",sidePanel:"search_sidePanel__myfc9"}}},function(e){e.O(0,[8918,9001,3062,8840,6297,1603,9417,2971,7023,1744],function(){return e(e.s=94114)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3111],{91955:function(e,t,s){Promise.resolve().then(s.bind(s,5506))},5506:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return g}});var o=s(57437),a=s(11930),n=s.n(a),i=s(2265),r=s(48861),c=s(82697),l=s(58485);s(7395);var d=s(69591),h=s(79306),u=s(59479),m=s(9557);function p(e){let[t,s]=(0,i.useState)(""),[a,r]=(0,i.useState)(null),[l,d]=(0,i.useState)(!1),[h,m]=(0,i.useState)(null),p=e.setQueryToProcess,g=e.streamedMessages,f=e.isMobileWidth?"w-full":"w-4/6";return((0,i.useEffect)(()=>{a&&e.setImage64(encodeURIComponent(a))},[a,e.setImage64]),(0,i.useEffect)(()=>{t&&(d(!0),p(t))},[t,p]),(0,i.useEffect)(()=>{g&&g.length>0&&g[g.length-1].completed?d(!1):s("")},[g]),e.publicConversationSlug||e.conversationId)?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{className:n().chatBodyFull,children:(0,o.jsx)(c.Z,{publicConversationSlug:e.publicConversationSlug,conversationId:e.conversationId||"",setAgent:m,setTitle:e.setTitle,pendingMessage:l?t:"",incomingMessages:e.streamedMessages,customClassName:f})}),(0,o.jsx)("div",{className:"".concat(n().inputBox," p-1 md:px-2 shadow-md bg-background align-middle items-center justify-center dark:bg-neutral-700 dark:border-0 dark:shadow-sm rounded-t-2xl rounded-b-none md:rounded-xl h-fit ").concat(f," mr-auto ml-auto"),children:(0,o.jsx)(u.Z,{isLoggedIn:e.isLoggedIn,sendMessage:e=>s(e),sendImage:e=>r(e),sendDisabled:l,chatOptionsData:e.chatOptionsData,conversationId:e.conversationId,agentColor:null==h?void 0:h.color,isMobileWidth:e.isMobileWidth,setUploadedFiles:e.setUploadedFiles})})]}):(0,o.jsx)("div",{className:n().suggestions,children:"Whoops, nothing to see here!"})}function g(){let[e,t]=(0,i.useState)(null),[s,a]=(0,i.useState)(!0),[c,u]=(0,i.useState)("Khoj AI - Chat"),[g,f]=(0,i.useState)(void 0),[x,_]=(0,i.useState)([]),[v,y]=(0,i.useState)(""),[b,C]=(0,i.useState)(!1),[j,w]=(0,i.useState)([]),[S,I]=(0,i.useState)(void 0),[B,N]=(0,i.useState)(""),O=(0,d.k6)()||{timezone:Intl.DateTimeFormat().resolvedOptions().timeZone},k=(0,h.GW)(),T=(0,d.IC)();async function D(e){if(!e.ok)throw Error(e.statusText);if(!e.body)throw Error("Response body is null");let t=e.body.getReader(),s=new TextDecoder,o="␃\uD83D\uDD1A␗",a="";for(;;){let e;let{done:n,value:i}=await t.read();if(n){y(""),C(!1),N("");break}for(a+=s.decode(i,{stream:!0});-1!==(e=a.indexOf(o));){let t=a.slice(0,e);if(a=a.slice(e+o.length),t){let e=x.find(e=>!e.completed);if(!e){console.error("No current message found");return}(0,m.VK)(t,e),_([...x])}}}}async function E(){if(!v||!g)return;let e={q:v,conversation_id:g,stream:!0,...O&&{region:O.region,country:O.country,city:O.city,country_code:O.countryCode,timezone:O.timezone},...B&&{image:B}},t=await fetch("/api/chat?client=web",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});try{await D(t)}catch(e){console.error(e)}}return((0,i.useEffect)(()=>{fetch("/api/chat/options").then(e=>e.json()).then(e=>{a(!1),e&&t(e)}).catch(e=>{console.error(e)}),(0,d.EK)(),I(window.location.pathname.split("/").pop()||"")},[]),(0,i.useEffect)(()=>{if(v&&!g){fetch("/api/chat/share/fork?public_conversation_slug=".concat(S),{method:"POST",headers:{"Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{f(e.conversation_id)}).catch(e=>{console.error(e)});return}if(v){let e={rawResponse:"",trainOfThought:[],context:[],onlineContext:{},completed:!1,timestamp:new Date().toISOString(),rawQuery:v||"",uploadedImageData:decodeURIComponent(B)};_(t=>[...t,e]),C(!0)}},[v,g,S]),(0,i.useEffect)(()=>{b&&E()},[b]),s)?(0,o.jsx)(l.Z,{}):S?(0,o.jsxs)("div",{className:"".concat(n().main," ").concat(n().chatLayout),children:[(0,o.jsx)("title",{children:c}),(0,o.jsx)("div",{className:n().sidePanel,children:(0,o.jsx)(r.ZP,{conversationId:null!=g?g:null,uploadedFiles:j,isMobileWidth:T})}),(0,o.jsx)("div",{className:n().chatBox,children:(0,o.jsxs)("div",{className:n().chatBoxBody,children:[!T&&c&&(0,o.jsx)("div",{className:"".concat(n().chatTitleWrapper," text-nowrap text-ellipsis overflow-hidden max-w-screen-md grid items-top font-bold mr-8 pt-6 col-auto h-fit"),children:c&&(0,o.jsx)("h2",{className:"text-lg text-ellipsis whitespace-nowrap overflow-x-hidden",children:c})}),(0,o.jsx)(i.Suspense,{fallback:(0,o.jsx)(l.Z,{}),children:(0,o.jsx)(p,{conversationId:g,streamedMessages:x,setQueryToProcess:y,isLoggedIn:null!==k,publicConversationSlug:S,chatOptionsData:e,setTitle:u,setUploadedFiles:w,isMobileWidth:T,setImage64:N})})]})})]}):(0,o.jsx)("div",{className:n().suggestions,children:"Whoops, nothing to see here!"})}},11930:function(e){e.exports={main:"sharedChat_main__7Nayy",suggestions:"sharedChat_suggestions__V8kr_",inputBox:"sharedChat_inputBox__wRW5A",chatBodyFull:"sharedChat_chatBodyFull__O1MOv",chatBody:"sharedChat_chatBody__OnHDL",chatLayout:"sharedChat_chatLayout__gutlc",chatBox:"sharedChat_chatBox__PmAPg",titleBar:"sharedChat_titleBar__vOHp_",chatBoxBody:"sharedChat_chatBoxBody__ef2Nl",agentIndicator:"sharedChat_agentIndicator__ORCl4"}}},function(e){e.O(0,[7849,8918,929,3954,9001,3062,8840,121,3110,6327,1603,9417,3423,9479,2697,2971,7023,1744],function(){return e(e.s=91955)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ !function(){"use strict";var e,t,n,r,o,u,i,c,f,a={},l={};function d(e){var t=l[e];if(void 0!==t)return t.exports;var n=l[e]={exports:{}},r=!0;try{a[e].call(n.exports,n,n.exports,d),r=!1}finally{r&&delete l[e]}return n.exports}d.m=a,e=[],d.O=function(t,n,r,o){if(n){o=o||0;for(var u=e.length;u>0&&e[u-1][2]>o;u--)e[u]=e[u-1];e[u]=[n,r,o];return}for(var i=1/0,u=0;u<e.length;u++){for(var n=e[u][0],r=e[u][1],o=e[u][2],c=!0,f=0;f<n.length;f++)i>=o&&Object.keys(d.O).every(function(e){return d.O[e](n[f])})?n.splice(f--,1):(c=!1,o<i&&(i=o));if(c){e.splice(u--,1);var a=r();void 0!==a&&(t=a)}}return t},d.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return d.d(t,{a:t}),t},n=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},d.t=function(e,r){if(1&r&&(e=this(e)),8&r||"object"==typeof e&&e&&(4&r&&e.__esModule||16&r&&"function"==typeof e.then))return e;var o=Object.create(null);d.r(o);var u={};t=t||[null,n({}),n([]),n(n)];for(var i=2&r&&e;"object"==typeof i&&!~t.indexOf(i);i=n(i))Object.getOwnPropertyNames(i).forEach(function(t){u[t]=function(){return e[t]}});return u.default=function(){return e},d.d(o,u),o},d.d=function(e,t){for(var n in t)d.o(t,n)&&!d.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},d.f={},d.e=function(e){return Promise.all(Object.keys(d.f).reduce(function(t,n){return d.f[n](e,t),t},[]))},d.u=function(e){return"static/chunks/"+(({6555:"964ecbae",7293:"94ca1967"})[e]||e)+"."+({1210:"132a7e1910006bbb",1459:"690bf20e7d7b7090",6555:"ea4eab2a3a835ffe",7293:"5584df65931cfe83"})[e]+".js"},d.miniCssF=function(e){},d.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),d.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r={},o="_N_E:",d.l=function(e,t,n,u){if(r[e]){r[e].push(t);return}if(void 0!==n)for(var i,c,f=document.getElementsByTagName("script"),a=0;a<f.length;a++){var l=f[a];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")==o+n){i=l;break}}i||(c=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,d.nc&&i.setAttribute("nonce",d.nc),i.setAttribute("data-webpack",o+n),i.src=d.tu(e)),r[e]=[t];var s=function(t,n){i.onerror=i.onload=null,clearTimeout(p);var o=r[e];if(delete r[e],i.parentNode&&i.parentNode.removeChild(i),o&&o.forEach(function(e){return e(n)}),t)return t(n)},p=setTimeout(s.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=s.bind(null,i.onerror),i.onload=s.bind(null,i.onload),c&&document.head.appendChild(i)},d.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.tt=function(){return void 0===u&&(u={createScriptURL:function(e){return e}},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(u=trustedTypes.createPolicy("nextjs#bundler",u))),u},d.tu=function(e){return d.tt().createScriptURL(e)},d.p="/_next/",i={2272:0,8942:0,404:0,929:0,8918:0,4003:0,9460:0,3729:0,2734:0,6129:0,7849:0,492:0,4229:0,9092:0},d.f.j=function(e,t){var n=d.o(i,e)?i[e]:void 0;if(0!==n){if(n)t.push(n[2]);else if(/^(4(003|04|229|92)|89(18|42)|9(092|29|460)|(372|612|784)9|2272|2734)$/.test(e))i[e]=0;else{var r=new Promise(function(t,r){n=i[e]=[t,r]});t.push(n[2]=r);var o=d.p+d.u(e),u=Error();d.l(o,function(t){if(d.o(i,e)&&(0!==(n=i[e])&&(i[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;u.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",u.name="ChunkLoadError",u.type=r,u.request=o,n[1](u)}},"chunk-"+e,e)}}},d.O.j=function(e){return 0===i[e]},c=function(e,t){var n,r,o=t[0],u=t[1],c=t[2],f=0;if(o.some(function(e){return 0!==i[e]})){for(n in u)d.o(u,n)&&(d.m[n]=u[n]);if(c)var a=c(d)}for(e&&e(t);f<o.length;f++)r=o[f],d.o(i,r)&&i[r]&&i[r][0](),i[r]=0;return d.O(a)},(f=self.webpackChunk_N_E=self.webpackChunk_N_E||[]).forEach(c.bind(null,0)),f.push=c.bind(null,f.push.bind(f)),d.nc=void 0}();
@@ -1 +1 @@
1
- div.sharedChat_main__7Nayy{height:100vh;color:hsla(var(--foreground))}.sharedChat_suggestions__V8kr_{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:1rem;justify-content:center}div.sharedChat_inputBox__wRW5A{border:1px solid var(--border-color);margin-bottom:20px;gap:12px;align-content:center}input.sharedChat_inputBox__wRW5A{border:none}input.sharedChat_inputBox__wRW5A:focus{outline:none;background-color:transparent}div.sharedChat_inputBox__wRW5A:focus{box-shadow:0 8px 16px 0 rgba(0,0,0,.2)}div.sharedChat_chatBodyFull__O1MOv{display:grid;grid-template-columns:1fr;height:100%}button.sharedChat_inputBox__wRW5A{border:none;outline:none;background-color:transparent;cursor:pointer;border-radius:.5rem;padding:.5rem;background:linear-gradient(var(--calm-green),var(--calm-blue))}div.sharedChat_chatBody__OnHDL{display:grid;grid-template-columns:1fr 1fr;height:100%}.sharedChat_inputBox__wRW5A{color:hsla(var(--foreground))}div.sharedChat_chatLayout__gutlc{display:grid;grid-template-columns:auto 1fr;gap:1rem}div.sharedChat_chatBox__PmAPg{display:grid;height:100%}div.sharedChat_titleBar__vOHp_{display:grid;grid-template-columns:1fr auto}div.sharedChat_chatBoxBody__ef2Nl{display:grid;height:100%;width:70%;margin:auto}div.sharedChat_agentIndicator__ORCl4 a{display:flex;text-align:center;align-content:center;align-items:center}div.sharedChat_agentIndicator__ORCl4{padding:10px}@media (max-width:768px){div.sharedChat_chatBody__OnHDL{grid-template-columns:0fr 1fr}div.sharedChat_chatBox__PmAPg{padding:0;height:-moz-min-content;height:min-content}}@media screen and (max-width:768px){div.sharedChat_inputBox__wRW5A{margin-bottom:0}div.sharedChat_chatBoxBody__ef2Nl{width:100%}div.sharedChat_chatBox__PmAPg{padding:0;height:-moz-min-content;height:min-content}div.sharedChat_chatLayout__gutlc{gap:0;grid-template-columns:1fr}}
1
+ div.sharedChat_main__7Nayy{height:100vh;color:hsla(var(--foreground))}.sharedChat_suggestions__V8kr_{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:1rem;justify-content:center}div.sharedChat_inputBox__wRW5A{border:1px solid var(--border-color);margin-bottom:20px;gap:12px;align-content:center}input.sharedChat_inputBox__wRW5A{border:none}input.sharedChat_inputBox__wRW5A:focus{outline:none;background-color:transparent}div.sharedChat_inputBox__wRW5A:focus{box-shadow:0 8px 16px 0 rgba(0,0,0,.2)}div.sharedChat_chatBodyFull__O1MOv{display:grid;grid-template-columns:1fr;height:100%}button.sharedChat_inputBox__wRW5A{border:none;outline:none;background-color:transparent;cursor:pointer;border-radius:.5rem;padding:.5rem;background:linear-gradient(var(--calm-green),var(--calm-blue))}div.sharedChat_chatBody__OnHDL{display:grid;grid-template-columns:1fr 1fr;height:100%}.sharedChat_inputBox__wRW5A{color:hsla(var(--foreground))}div.sharedChat_chatLayout__gutlc{display:grid;grid-template-columns:auto 1fr;gap:1rem}div.sharedChat_chatBox__PmAPg{display:grid;height:100%}div.sharedChat_titleBar__vOHp_{display:grid;grid-template-columns:1fr auto}div.sharedChat_chatBoxBody__ef2Nl{display:grid;height:100%;width:95%;margin:auto}div.sharedChat_agentIndicator__ORCl4 a{display:flex;text-align:center;align-content:center;align-items:center}div.sharedChat_agentIndicator__ORCl4{padding:10px}@media (max-width:768px){div.sharedChat_chatBody__OnHDL{grid-template-columns:0fr 1fr}div.sharedChat_chatBox__PmAPg{padding:0;height:-moz-min-content;height:min-content}}@media screen and (max-width:768px){div.sharedChat_inputBox__wRW5A{margin-bottom:0}div.sharedChat_chatBoxBody__ef2Nl{width:100%}div.sharedChat_chatBox__PmAPg{padding:0;height:-moz-min-content;height:min-content}div.sharedChat_chatLayout__gutlc{gap:0;grid-template-columns:1fr}}