khoj 1.29.2.dev5__py3-none-any.whl → 1.29.2.dev35__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 (51) hide show
  1. khoj/database/adapters/__init__.py +2 -0
  2. khoj/database/admin.py +32 -1
  3. khoj/interface/compiled/404/index.html +1 -1
  4. khoj/interface/compiled/_next/static/chunks/5538-b87b60ecc0c27ceb.js +1 -0
  5. khoj/interface/compiled/_next/static/chunks/796-68f9e87f9cdfda1d.js +3 -0
  6. khoj/interface/compiled/_next/static/chunks/8423-c0123d454681e03a.js +1 -0
  7. khoj/interface/compiled/_next/static/chunks/app/chat/{page-e95e87da53d725a7.js → page-e60a55d029b6216a.js} +1 -1
  8. khoj/interface/compiled/_next/static/chunks/app/page-fcf7411ff80b6bf5.js +1 -0
  9. khoj/interface/compiled/_next/static/chunks/app/share/chat/{page-3a752baa5fb62e20.js → page-4a4c0f199b89bd80.js} +1 -1
  10. khoj/interface/compiled/_next/static/chunks/{webpack-d37377886a1b4e56.js → webpack-323bbe2678102a2f.js} +1 -1
  11. khoj/interface/compiled/agents/index.html +1 -1
  12. khoj/interface/compiled/agents/index.txt +1 -1
  13. khoj/interface/compiled/automations/index.html +1 -1
  14. khoj/interface/compiled/automations/index.txt +1 -1
  15. khoj/interface/compiled/chat/index.html +1 -1
  16. khoj/interface/compiled/chat/index.txt +2 -2
  17. khoj/interface/compiled/index.html +1 -1
  18. khoj/interface/compiled/index.txt +2 -2
  19. khoj/interface/compiled/search/index.html +1 -1
  20. khoj/interface/compiled/search/index.txt +1 -1
  21. khoj/interface/compiled/settings/index.html +1 -1
  22. khoj/interface/compiled/settings/index.txt +1 -1
  23. khoj/interface/compiled/share/chat/index.html +1 -1
  24. khoj/interface/compiled/share/chat/index.txt +2 -2
  25. khoj/main.py +7 -3
  26. khoj/processor/content/pdf/pdf_to_entries.py +1 -1
  27. khoj/processor/conversation/anthropic/anthropic_chat.py +2 -3
  28. khoj/processor/conversation/google/gemini_chat.py +2 -3
  29. khoj/processor/conversation/offline/chat_model.py +2 -2
  30. khoj/processor/conversation/openai/gpt.py +2 -2
  31. khoj/processor/conversation/prompts.py +14 -69
  32. khoj/processor/conversation/utils.py +7 -0
  33. khoj/processor/tools/online_search.py +22 -4
  34. khoj/routers/api_chat.py +23 -15
  35. khoj/routers/helpers.py +36 -77
  36. khoj/routers/research.py +33 -30
  37. khoj/utils/constants.py +1 -1
  38. khoj/utils/helpers.py +5 -6
  39. khoj/utils/initialization.py +77 -10
  40. {khoj-1.29.2.dev5.dist-info → khoj-1.29.2.dev35.dist-info}/METADATA +1 -1
  41. {khoj-1.29.2.dev5.dist-info → khoj-1.29.2.dev35.dist-info}/RECORD +46 -47
  42. khoj/interface/compiled/_next/static/chunks/5538-32bd787d106700dc.js +0 -1
  43. khoj/interface/compiled/_next/static/chunks/5961-3c104d9736b7902b.js +0 -3
  44. khoj/interface/compiled/_next/static/chunks/8423-ffdc2b835629c7f8.js +0 -1
  45. khoj/interface/compiled/_next/static/chunks/app/page-774dcd8ca4459c7e.js +0 -1
  46. khoj/interface/web/assets/icons/favicon-128x128.ico +0 -0
  47. /khoj/interface/compiled/_next/static/{bIVLxe5g7EDG455p-cfe7 → bkshWraYdEa_w254xnxBc}/_buildManifest.js +0 -0
  48. /khoj/interface/compiled/_next/static/{bIVLxe5g7EDG455p-cfe7 → bkshWraYdEa_w254xnxBc}/_ssgManifest.js +0 -0
  49. {khoj-1.29.2.dev5.dist-info → khoj-1.29.2.dev35.dist-info}/WHEEL +0 -0
  50. {khoj-1.29.2.dev5.dist-info → khoj-1.29.2.dev35.dist-info}/entry_points.txt +0 -0
  51. {khoj-1.29.2.dev5.dist-info → khoj-1.29.2.dev35.dist-info}/licenses/LICENSE +0 -0
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8423],{38423:function(e,t,a){"use strict";a.d(t,{a:function(){return O}});var n=a(57437),r=a(37649),s=a.n(r),l=a(2265),o=a(11838),i=a.n(o);a(7395);var c=a(86819),d=a(35719),u=a(77689),h=a(86829),f=a(33009),m=a(51091),g=a(82119),x=a(42491),p=a(6780),j=a(50495),b=a(70571),v=a(19573),w=a(61485),y=a(93146),N=a(19666),C=a(58575),k=a(66820),E=a(58485),T=a(89417),z=a(9557),D=a(69591),R=a(90837),S=a(94880);let O=(0,l.forwardRef)((e,t)=>{let[a,r]=(0,l.useState)(""),o=(0,l.useRef)(null),[O,M]=(0,l.useState)(null),[A,_]=(0,l.useState)(null),[I,L]=(0,l.useState)(!1),[P,U]=(0,l.useState)(null),[F,W]=(0,l.useState)(!1),[Y,$]=(0,l.useState)(!1),[B,H]=(0,l.useState)([]),[J,K]=(0,l.useState)([]),[Z,V]=(0,l.useState)(null),[X,q]=(0,l.useState)([]),[G,Q]=(0,l.useState)(!1),[ee,et]=(0,l.useState)(null),[ea,en]=(0,l.useState)(0),[er,es]=(0,l.useState)(!1),[el,eo]=(0,l.useState)(!1),[ei,ec]=(0,l.useState)(e.isResearchModeEnabled||!1);function ed(){if(Y&&($(!1),H([]),J.forEach(t=>e.sendImage(t))),!a.trim())return;if(!e.isLoggedIn){U("Hey there, you need to be signed in to send messages to Khoj AI"),W(!0);return}let t=a.trim();ei&&!t.startsWith("/research")&&(t="/research ".concat(t)),e.sendMessage(t),V(null),q([]),r("")}function eu(a){var n,r;if(!e.isLoggedIn){U("Please login to chat with your files"),W(!0);return}let s=["jpg","jpeg","png","webp"],l=[];for(let e=0;e<a.length;e++){let t=a[e],n=t.name.split(".").pop();s.includes(n||"")&&l.push(i().sanitize(URL.createObjectURL(t)))}l.length>0&&($(!0),H(e=>[...e,...l]),null==t||null===(r=t.current)||void 0===r||r.focus());let o=Array.from(a).filter(e=>!s.includes(e.name.split(".").pop()||"")),c=o?Array.from(o).concat(Array.from(Z||[])):Array.from(Z||[]);if(c.length>0){for(let e=0;e<c.length;e++)if(c[e].size>10485760){M("File ".concat(c[e].name," is too large. Please upload files smaller than 10 MB."));return}let t=new DataTransfer;c.forEach(e=>t.items.add(e)),eh(t.files).then(a=>{e.setUploadedFiles(a),V(t.files),q(a)})}null==t||null===(n=t.current)||void 0===n||n.focus()}async function eh(e){let t=await (0,z.M1)(e);L(!0);try{let e=await fetch("/api/content/convert",{method:"POST",body:t});if(L(!1),!e.ok)throw Error("HTTP error! status: ".concat(e.status));return await e.json()}catch(e){return _("Error converting files. "+e+". Please try again, or contact team@khoj.dev if the issue persists."),console.error("Error converting files:",e),[]}}async function ef(){try{let e=await navigator.mediaDevices.getUserMedia({audio:!0}),t=new MediaRecorder(e,{mimeType:"audio/webm"}),a=[];t.ondataavailable=async e=>{a.push(e.data);let t=new Blob(a,{type:"audio/webm"}),n=new FormData;n.append("file",t);try{let e=await fetch("/api/transcribe",{method:"POST",body:n});if(!e.ok)throw Error("Network response was not ok");let t=await e.json();r(t.text.trim())}catch(e){console.error("Error sending audio to server:",e)}},t.start(1500),t.onstop=async()=>{let e=new Blob(a,{type:"audio/webm"}),n=new FormData;n.append("file",e);try{let e=await fetch("/api/transcribe",{method:"POST",body:n});if(!e.ok)throw Error("Network response was not ok");let a=await e.json();t.stream.getTracks().forEach(e=>e.stop()),et(null),r(a.text.trim())}catch(e){console.error("Error sending audio to server:",e)}},et(t)}catch(e){console.error("Error getting microphone",e)}}return(0,l.useEffect)(()=>{if(I||en(0),I){let e=setInterval(()=>{en(e=>{let t=e+(Math.floor(5*Math.random())+1);return t<100?t:100})},800);return()=>clearInterval(e)}},[I]),(0,l.useEffect)(()=>{async function e(){B.length>0&&K(await Promise.all(B.map(async e=>{let t=await fetch(e),a=await t.blob();return new Promise(e=>{let t=new FileReader;t.onload=()=>e(t.result),t.readAsDataURL(a)})}))),L(!1)}L(!0),e()},[B]),(0,l.useEffect)(()=>{e.isResearchModeEnabled&&ec(e.isResearchModeEnabled)},[e.isResearchModeEnabled]),(0,l.useEffect)(()=>{!G&&ee&&ee.stop(),G&&!ee&&ef()},[G,ee]),(0,l.useEffect)(()=>{(null==t?void 0:t.current)&&(t.current.style.height="auto",t.current.style.height=Math.max(t.current.scrollHeight-24,64)+"px",a.startsWith("/")&&1===a.split(" ").length?eo(!0):eo(!1))},[a]),(0,n.jsxs)(n.Fragment,{children:[F&&P&&(0,n.jsx)(k.Z,{onOpenChange:W,loginRedirectMessage:P}),I&&(0,n.jsx)(p.aR,{open:I,children:(0,n.jsxs)(p._T,{children:[(0,n.jsx)(p.fY,{children:(0,n.jsx)(p.f$,{children:"Uploading data. Please wait."})}),(0,n.jsx)(p.yT,{children:(0,n.jsx)(b.E,{indicatorColor:"bg-slate-500",className:"w-full h-2 rounded-full",value:ea})}),(0,n.jsx)(p.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>L(!1),children:"Dismiss"})]})}),O&&(0,n.jsx)(p.aR,{open:null!==O,children:(0,n.jsxs)(p._T,{children:[(0,n.jsx)(p.fY,{children:(0,n.jsx)(p.f$,{children:"Data Upload Warning"})}),(0,n.jsx)(p.yT,{children:O}),(0,n.jsx)(p.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>M(null),children:"Close"})]})}),A&&(0,n.jsx)(p.aR,{open:null!==A,children:(0,n.jsxs)(p._T,{children:[(0,n.jsxs)(p.fY,{children:[(0,n.jsx)(p.f$,{children:"Oh no!"}),(0,n.jsx)(p.yT,{children:"Something went wrong while uploading your data"})]}),(0,n.jsx)(p.yT,{children:A}),(0,n.jsx)(p.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>_(null),children:"Close"})]})}),el&&(0,n.jsx)("div",{className:"flex justify-center text-center",children:(0,n.jsxs)(v.J2,{open:el,onOpenChange:eo,children:[(0,n.jsx)(w.xo,{className:"flex justify-center text-center"}),(0,n.jsx)(v.yk,{onOpenAutoFocus:e=>e.preventDefault(),className:"".concat(e.isMobileWidth?"w-[100vw]":"w-full"," rounded-md"),side:"bottom",align:"center",sideOffset:e.conversationId?0:80,alignOffset:0,children:(0,n.jsxs)(x.mY,{className:"max-w-full",children:[(0,n.jsx)(x.sZ,{placeholder:"Type a command or search...",value:a,className:"hidden"}),(0,n.jsxs)(x.e8,{children:[(0,n.jsx)(x.rb,{children:"No matching commands."}),(0,n.jsx)(x.fu,{heading:"Agent Tools",children:e.chatOptionsData&&Object.entries(e.chatOptionsData).map(e=>{let[t,a]=e;return(0,n.jsx)(x.di,{className:"text-md",onSelect:()=>{r("/".concat(t," "))},children:(0,n.jsxs)("div",{className:"grid grid-cols-1 gap-1",children:[(0,n.jsxs)("div",{className:"font-bold flex items-center",children:[(0,T.vH)(t,"h-4 w-4 mr-2"),"/",t]}),(0,n.jsx)("div",{children:a})]})},t)})}),(0,n.jsx)(x.zz,{})]})]})})]})}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 overflow-x-auto",children:[Y&&B.map((e,t)=>(0,n.jsxs)("div",{className:"relative flex-shrink-0 pb-3 pt-2 group",children:[(0,n.jsx)("img",{src:e,alt:"img-".concat(t),className:"w-auto h-16 object-cover rounded-xl"}),(0,n.jsx)(j.z,{variant:"ghost",size:"icon",className:"absolute -top-0 -right-2 h-5 w-5 rounded-full bg-neutral-200 dark:bg-neutral-600 hover:bg-neutral-300 dark:hover:bg-neutral-500 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>{H(e=>e.filter((e,a)=>a!==t)),K(e=>e.filter((e,a)=>a!==t)),1===B.length&&$(!1)},children:(0,n.jsx)(c.X,{className:"h-3 w-3"})})]},t)),X&&Array.from(X).map((t,a)=>(0,n.jsxs)(R.Vq,{children:[(0,n.jsx)(R.hg,{asChild:!0,children:(0,n.jsxs)("div",{className:"relative flex-shrink-0 p-2 group",children:[(0,n.jsx)("div",{className:"w-auto h-16 object-cover rounded-xl ".concat(e.agentColor?(0,C.tp)(e.agentColor):"bg-orange-300 hover:bg-orange-500"," bg-opacity-15"),children:(0,n.jsxs)("div",{className:"flex p-2 flex-col justify-start items-start h-full",children:[(0,n.jsx)("span",{className:"text-sm font-bold text-neutral-500 dark:text-neutral-400 text-ellipsis truncate max-w-[200px] break-words",children:t.name}),(0,n.jsxs)("span",{className:"flex items-center gap-1",children:[(0,T.Le)(t.file_type),(0,n.jsx)("span",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:(0,D.xq)(t.size)})]})]})}),(0,n.jsx)(j.z,{variant:"ghost",size:"icon",className:"absolute -top-0 -right-2 h-5 w-5 rounded-full bg-neutral-200 dark:bg-neutral-600 hover:bg-neutral-300 dark:hover:bg-neutral-500 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>{V(a=>{let n=t.name;if(!a)return null;let r=Array.from(a).filter(e=>e.name!==n),s=new DataTransfer;r.forEach(e=>s.items.add(e));let l=X.filter(e=>e.name!==n);return e.setUploadedFiles(l),q(l),s.files})},children:(0,n.jsx)(c.X,{className:"h-3 w-3"})})]},a)}),(0,n.jsxs)(R.cZ,{children:[(0,n.jsx)(R.fK,{children:(0,n.jsx)(R.$N,{children:t.name})}),(0,n.jsx)(R.Be,{children:(0,n.jsx)(S.x,{className:"h-72 w-full rounded-md",children:t.content})})]})]},a))]}),(0,n.jsxs)("div",{className:"".concat(s().actualInputArea," justify-between dark:bg-neutral-700 relative ").concat(er&&"animate-pulse"),onDragOver:function(e){e.preventDefault(),es(!0)},onDragLeave:function(e){e.preventDefault(),es(!1)},onDrop:function(e){e.preventDefault(),es(!1),e.dataTransfer.files&&eu(e.dataTransfer.files)},children:[(0,n.jsx)("input",{type:"file",accept:".pdf,.doc,.docx,.txt,.md,.org,.jpg,.jpeg,.png,.webp",multiple:!0,ref:o,onChange:function(e){e.target.files&&eu(e.target.files)},style:{display:"none"}}),(0,n.jsx)("div",{className:"flex items-center",children:(0,n.jsx)(j.z,{variant:"ghost",className:"!bg-none p-0 m-2 h-auto text-3xl rounded-full text-gray-300 hover:text-gray-500",disabled:e.sendDisabled,onClick:function(){o.current&&o.current.click()},children:(0,n.jsx)(d.p,{className:"w-8 h-8"})})}),(0,n.jsx)("div",{className:"flex-grow flex flex-col w-full gap-1.5 relative",children:(0,n.jsx)(y.g,{ref:t,className:"border-none focus:border-none\n focus:outline-none focus-visible:ring-transparent\n w-full h-16 min-h-16 max-h-[128px] md:py-4 rounded-lg resize-none dark:bg-neutral-700\n ".concat(e.isMobileWidth?"text-md":"text-lg"),placeholder:"Type / to see a list of commands",id:"message",autoFocus:!0,value:a,onKeyDown:t=>{"Enter"!==t.key||t.shiftKey||e.isMobileWidth||($(!1),H([]),t.preventDefault(),ed())},onChange:e=>r(e.target.value),disabled:e.sendDisabled||G})}),(0,n.jsxs)("div",{className:"flex items-end pb-2",children:[G?(0,n.jsx)(N.pn,{children:(0,n.jsxs)(N.u,{children:[(0,n.jsx)(N.aJ,{asChild:!0,children:(0,n.jsx)(j.z,{variant:"default",className:"".concat(!G&&"hidden"," ").concat(e.agentColor?(0,C.tp)(e.agentColor):"bg-orange-300 hover:bg-orange-500"," rounded-full p-1 m-2 h-auto text-3xl transition transform md:hover:-translate-y-1"),onClick:()=>{Q(!G)},disabled:e.sendDisabled,children:(0,n.jsx)(u.d,{weight:"fill",className:"w-6 h-6"})})}),(0,n.jsx)(N._v,{children:"Click to stop recording and transcribe your voice."})]})}):ee?(0,n.jsx)(E.l,{}):(0,n.jsx)(N.pn,{children:(0,n.jsxs)(N.u,{children:[(0,n.jsx)(N.aJ,{asChild:!0,children:e.sendDisabled?(0,n.jsx)(j.z,{variant:"default",className:"".concat(e.agentColor?(0,C.tp)(e.agentColor):"bg-orange-300 hover:bg-orange-500"," rounded-full p-1 m-2 h-auto text-3xl transition transform md:hover:-translate-y-1"),onClick:()=>{e.setTriggeredAbort(!0)},children:(0,n.jsx)(u.d,{weight:"fill",className:"w-6 h-6"})}):(0,n.jsx)(j.z,{variant:"default",className:"".concat(!a||G||"hidden"," ").concat(e.agentColor?(0,C.tp)(e.agentColor):"bg-orange-300 hover:bg-orange-500"," rounded-full p-1 m-2 h-auto text-3xl transition transform md:hover:-translate-y-1"),onClick:()=>{r("Listening..."),Q(!G)},children:(0,n.jsx)(h.P,{weight:"fill",className:"w-6 h-6"})})}),(0,n.jsx)(N._v,{children:e.sendDisabled?"Click here to stop the streaming.":"Click to transcribe your message with voice."})]})}),(0,n.jsx)(j.z,{className:"".concat((!a||G)&&"hidden"," ").concat(e.agentColor?(0,C.tp)(e.agentColor):"bg-orange-300 hover:bg-orange-500"," rounded-full p-1 m-2 h-auto text-3xl transition transform md:hover:-translate-y-1"),onClick:ed,children:(0,n.jsx)(f.a,{className:"w-6 h-6",weight:"bold"})})]})]}),(0,n.jsx)(N.pn,{children:(0,n.jsxs)(N.u,{children:[(0,n.jsx)(N.aJ,{asChild:!0,children:(0,n.jsxs)(j.z,{variant:"ghost",className:"float-right justify-center gap-1 flex items-center p-1.5 mr-2 h-fit",onClick:()=>{var e;ec(!ei),null==t||null===(e=t.current)||void 0===e||e.focus()},children:[(0,n.jsx)("span",{className:"text-muted-foreground text-sm",children:"Research Mode"}),ei?(0,n.jsx)(m.W,{weight:"fill",className:"w-6 h-6 inline-block ".concat(e.agentColor?(0,C.oz)(e.agentColor):(0,C.oz)("orange")," rounded-full")}):(0,n.jsx)(g.$,{weight:"fill",className:"w-6 h-6 inline-block ".concat((0,C.oz)("gray")," rounded-full")})]})}),(0,n.jsx)(N._v,{className:"text-xs",children:"(Experimental) Research Mode allows you to get more deeply researched, detailed responses. Response times may be longer."})]})})]})]})});O.displayName="ChatInputArea"},66820:function(e,t,a){"use strict";a.d(t,{Z:function(){return l}});var n=a(57437),r=a(6780),s=a(87138);function l(e){return(0,n.jsx)(r.aR,{open:!0,onOpenChange:e.onOpenChange,children:(0,n.jsxs)(r._T,{children:[(0,n.jsx)(r.fY,{children:(0,n.jsx)(r.f$,{children:"Sign in to Khoj to continue"})}),(0,n.jsxs)(r.yT,{children:[e.loginRedirectMessage,". By logging in, you agree to our"," ",(0,n.jsx)(s.default,{href:"https://khoj.dev/terms-of-service",children:"Terms of Service."})]}),(0,n.jsxs)(r.xo,{children:[(0,n.jsx)(r.le,{children:"Dismiss"}),(0,n.jsx)(r.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>{window.location.href="/login?next=".concat(encodeURIComponent(window.location.pathname))},children:(0,n.jsxs)(s.default,{href:"/login?next=".concat(encodeURIComponent(window.location.pathname)),children:[" ","Login"]})})]})]})})}},70571:function(e,t,a){"use strict";a.d(t,{E:function(){return o}});var n=a(57437),r=a(2265),s=a(52431),l=a(37440);let o=r.forwardRef((e,t)=>{let{className:a,value:r,indicatorColor:o,...i}=e;return(0,n.jsx)(s.fC,{ref:t,className:(0,l.cn)("relative h-4 w-full overflow-hidden rounded-full bg-secondary",a),...i,children:(0,n.jsx)(s.z$,{className:"h-full w-full flex-1 bg-primary transition-all ".concat(o),style:{transform:"translateX(-".concat(100-(r||0),"%)")}})})});o.displayName=s.fC.displayName},93146:function(e,t,a){"use strict";a.d(t,{g:function(){return l}});var n=a(57437),r=a(2265),s=a(37440);let l=r.forwardRef((e,t)=>{let{className:a,...r}=e;return(0,n.jsx)("textarea",{className:(0,s.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",a),ref:t,...r})});l.displayName="Textarea"},19666:function(e,t,a){"use strict";a.d(t,{_v:function(){return d},aJ:function(){return c},pn:function(){return o},u:function(){return i}});var n=a(57437),r=a(2265),s=a(27071),l=a(37440);let o=s.zt,i=s.fC,c=s.xz,d=r.forwardRef((e,t)=>{let{className:a,sideOffset:r=4,...o}=e;return(0,n.jsx)(s.VY,{ref:t,sideOffset:r,className:(0,l.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",a),...o})});d.displayName=s.VY.displayName},37649:function(e){e.exports={actualInputArea:"chatInputArea_actualInputArea__Ha6cN"}}}]);
@@ -1 +0,0 @@
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 U}});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,g=Object.getOwnPropertyDescriptors,m=Object.getOwnPropertySymbols,f=Object.prototype.hasOwnProperty,y=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={}))f.call(t,n)&&k(e,n,t[n]);if(m)for(var n of m(t))y.call(t,n)&&k(e,n,t[n]);return e},v=(e,t)=>h(e,g(t));let w=(0,l.forwardRef)((e,t)=>l.createElement(d.Z,v(b({ref:t},e),{weights:p})));w.displayName="ArrowCounterClockwise";var x=n(36013),P=n(31806),C=n.n(P),L=n(58575),j=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",E=[{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 H(e){var t,n;let i=(0,L.Zc)(e.color),o="".concat(C().card," ").concat(i," md:w-full md:h-fit sm:w-full h-fit md:w-[200px] md:h-[180px] cursor-pointer md:p-2"),r="".concat(C().text," dark:text-white"),s=(0,a.jsx)(x.Zb,{className:o,children:(0,a.jsx)("div",{className:"flex w-full",children:(0,a.jsxs)(x.aY,{className:"m-0 p-2 w-full",children:[(t=e.title,n=e.color.toLowerCase(),"Automation"===t?(0,j.TI)("Robot",n,"w-6","h-6"):"Paint"===t?(0,j.TI)("Palette",n,"w-6","h-6"):"Pop Culture"===t?(0,j.TI)("Confetti",n,"w-6","h-6"):"Travel"===t?(0,j.TI)("Jeep",n,"w-6","h-6"):"Learning"===t?(0,j.TI)("Book",n,"w-6","h-6"):"Health"===t?(0,j.TI)("Asclepius",n,"w-6","h-6"):"Fun"===t?(0,j.TI)("Island",n,"w-6","h-6"):"Home"===t?(0,j.TI)("House",n,"w-6","h-6"):"Language"===t?(0,j.TI)("Translate",n,"w-6","h-6"):"Code"===t?(0,j.TI)("Code",n,"w-6","h-6"):"Food"===t?(0,j.TI)("BowlFood",n,"w-6","h-6"):"Interviewing"===t?(0,j.TI)("Lectern",n,"w-6","h-6"):"Finance"===t?(0,j.TI)("Wallet",n,"w-6","h-6"):(0,j.TI)("Lightbulb",n,"w-6","h-6")),(0,a.jsx)(x.SZ,{className:"".concat(r," sm:line-clamp-2 md:line-clamp-4 pt-1 break-words whitespace-pre-wrap max-w-full"),children:e.body})]})})});return e.link?(0,a.jsx)("a",{href:e.link,className:"no-underline",children:s}):s}var I=n(48861),F=n(58485),_=n(38423),T=n(66820),N=n(79306),M=n(9557),D=n(69591),W=n(16463),B=n(94880),O=n(81970),q=n(19573);function R(e){var t,n;let[i,o]=(0,l.useState)(""),[r,d]=(0,l.useState)([]),[p,u]=(0,l.useState)(!1),[h,g]=(0,l.useState)(""),[m,f]=(0,l.useState)([]),[y,k]=(0,l.useState)(null),b=(0,D.Nr)(y,500),[v,P]=(0,l.useState)(!1),[C,A]=(0,l.useState)("khoj"),[S,I]=(0,l.useState)([]),[F,R]=(0,l.useState)([]),U=(0,l.useRef)(null),[Z,z]=(0,l.useState)(!1),V=(0,W.useRouter)(),J=(0,W.useSearchParams)().get("q");(0,l.useEffect)(()=>{J&&o(decodeURIComponent(J))},[J]),(0,l.useEffect)(()=>{b&&P(!0)},[b]);let G=e.onConversationIdChange,{data:K,error:Y}=(0,c.ZP)("agents",()=>window.fetch("/api/agents").then(e=>e.json()).catch(e=>console.log(e)),{revalidateOnFocus:!1}),Q=e=>{V.push("/agents?agent=".concat(e))};function X(){f((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})(E).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 ".concat(["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][o],"?"),"Let's navigate your ".concat(["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][o]," workload")];g(s[Math.floor(Math.random()*s.length)])},[e.isLoadingUserConfig,e.userConfig]),(0,l.useEffect)(()=>{e.chatOptionsData&&X()},[e.chatOptionsData]),(0,l.useEffect)(()=>{let e=(K||[]).filter(e=>null!=e);R(e),A(e.length>1?e[0].slug:"khoj"),I(e.map(e=>(0,j.TI)(e.icon,e.color)))},[K,e.isMobileWidth]),(0,l.useEffect)(()=>{(async()=>{if(i&&!p){u(!0);try{let e=await (0,M.A0)(C||"khoj");null==G||G(e),localStorage.setItem("message",i),r.length>0&&localStorage.setItem("images",JSON.stringify(r)),window.location.href="/chat?conversationId=".concat(e)}catch(e){console.error("Error creating new conversation:",e),u(!1)}o(""),d([])}})(),(i||r.length>0)&&u(!0)},[C,i,p,G]),(0,l.useEffect)(()=>{let e=document.querySelector("[data-radix-scroll-area-viewport]"),t=()=>{k(null),P(!1)};return null==e||e.addEventListener("scroll",t),()=>null==e?void 0:e.removeEventListener("scroll",t)},[]),(0,a.jsxs)("div",{className:"".concat(s().homeGreetings," w-full md:w-auto"),children:[Z&&(0,a.jsx)(T.Z,{onOpenChange:z,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:h})}),!e.isMobileWidth&&(0,a.jsxs)(B.x,{className:"w-full max-w-[600px] mx-auto",children:[(0,a.jsx)("div",{className:"flex pb-2 gap-2 items-center justify-center",children:F.map((t,n)=>(0,a.jsxs)(q.J2,{open:v&&b===t.slug,onOpenChange:e=>{e||(k(null),P(!1))},children:[(0,a.jsx)(q.xo,{asChild:!0,children:(0,a.jsx)(x.Zb,{className:"".concat(C===t.slug?(0,L.Iu)(t.color):"border-stone-100 dark:border-neutral-700 text-muted-foreground","\n hover:cursor-pointer rounded-lg px-2 py-2"),onDoubleClick:()=>Q(t.slug),onClick:()=>{var e;A(t.slug),null===(e=U.current)||void 0===e||e.focus(),k(null),P(!1)},onMouseEnter:()=>k(t.slug),onMouseLeave:()=>{k(null),P(!1)},children:(0,a.jsxs)(x.ll,{className:"text-center text-md font-medium flex justify-center items-center whitespace-nowrap",children:[S[n]," ",t.name]})})}),(0,a.jsx)(q.yk,{className:"w-80 p-0 border-none bg-transparent shadow-none",onMouseLeave:()=>{k(null),P(!1)},children:(0,a.jsx)(O.EY,{data:t,userProfile:null,isMobileWidth:e.isMobileWidth||!1,showChatButton:!1,editCard:!1,filesOptions:[],selectedChatModelOption:"",agentSlug:"",isSubscribed:(0,N.T8)(e.userConfig),setAgentChangeTriggered:()=>{},modelOptions:[],inputToolOptions:{},outputModeOptions:{}})})]},"".concat(n,"-").concat(t.slug)))}),(0,a.jsx)(B.B,{orientation:"horizontal"})]})]}),(0,a.jsxs)("div",{className:"mx-auto ".concat(e.isMobileWidth?"w-full":"w-fit max-w-screen-md"),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)(_.a,{isLoggedIn:e.isLoggedIn,sendMessage:e=>o(e),sendImage:e=>d(t=>[...t,e]),sendDisabled:p,chatOptionsData:e.chatOptionsData,conversationId:null,isMobileWidth:e.isMobileWidth,setUploadedFiles:e.setUploadedFiles,agentColor:null===(t=F.find(e=>e.slug===C))||void 0===t?void 0:t.color,ref:U,setTriggeredAbort:()=>{}})}),(0,a.jsx)("div",{className:"".concat(s().suggestions," w-full ").concat(e.isMobileWidth?"grid":"flex flex-row"," justify-center items-center"),children:m.map((t,n)=>(0,a.jsx)("div",{onClick:n=>{e.isLoggedIn?function(e,t,n){if(!e){let e="";n=n.charAt(0).toLowerCase()+n.slice(1),e="Online Search"===t?"/online "+n:"Paint"===t?"/image "+n:n;let i=document.getElementById("message");i&&(i.value=e,o(e))}}(t.link,t.type,t.description):(n.preventDefault(),n.stopPropagation(),z(!0))},children:(0,a.jsx)(H,{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(){X()},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)(w,{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)(B.x,{className:"w-full max-w-[85vw]",children:[(0,a.jsx)("div",{className:"flex gap-2 items-center justify-left pt-1 pb-2 px-12",children:S.map((e,t)=>(0,a.jsx)(x.Zb,{className:"".concat(C===F[t].slug?(0,L.Iu)(F[t].color):"border-muted text-muted-foreground"," hover:cursor-pointer"),children:(0,a.jsxs)(x.ll,{className:"text-center text-xs font-medium flex justify-center items-center whitespace-nowrap px-1.5 py-1",onDoubleClick:()=>Q(F[t].slug),onClick:()=>{var e;A(F[t].slug),null===(e=U.current)||void 0===e||e.focus()},children:[e," ",F[t].name]})},"".concat(t,"-").concat(F[t].slug)))}),(0,a.jsx)(B.B,{orientation:"horizontal"})]}),(0,a.jsx)(_.a,{isLoggedIn:e.isLoggedIn,sendMessage:e=>o(e),sendImage:e=>d(t=>[...t,e]),sendDisabled:p,chatOptionsData:e.chatOptionsData,conversationId:null,isMobileWidth:e.isMobileWidth,setUploadedFiles:e.setUploadedFiles,agentColor:null===(n=F.find(e=>e.slug===C))||void 0===n?void 0:n.color,ref:U,setTriggeredAbort:()=>{}})]})})]})}function U(){let[e,t]=(0,l.useState)(null),[n,i]=(0,l.useState)(!0),[o,r]=(0,l.useState)(null),[c,d]=(0,l.useState)(null),p=(0,D.IC)(),{userConfig:u,isLoadingUserConfig:h}=(0,N.h2)(!0),[g,m]=(0,l.useState)(null),f=(0,N.GW)();return((0,l.useEffect)(()=>{m(u)},[u]),(0,l.useEffect)(()=>{c&&localStorage.setItem("uploadedFiles",JSON.stringify(c))},[c]),(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:[],isMobileWidth:p})}),(0,a.jsx)("div",{className:"".concat(s().chatBox),children:(0,a.jsx)("div",{className:"".concat(s().chatBoxBody),children:(0,a.jsx)(R,{isLoggedIn:null!==f,chatOptionsData:e,setUploadedFiles:d,isMobileWidth:p,onConversationIdChange:e=>{r(e)},userConfig:g,isLoadingUserConfig:h})})})]})}},16463:function(e,t,n){"use strict";var i=n(71169);n.o(i,"useRouter")&&n.d(t,{useRouter:function(){return i.useRouter}}),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,4836,9848,9001,3062,3124,3803,5512,2261,4602,1603,9417,8423,1970,2971,7023,1744],function(){return e(e.s=1507)}),_N_E=e.O()}]);