khoj 1.34.1.dev14__py3-none-any.whl → 1.34.1.dev38__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 (65) hide show
  1. khoj/database/adapters/__init__.py +10 -3
  2. khoj/database/management/commands/delete_orphaned_fileobjects.py +56 -0
  3. khoj/database/migrations/0079_entry_file_object.py +75 -0
  4. khoj/database/migrations/0081_merge_20250120_1633.py +14 -0
  5. khoj/database/models/__init__.py +10 -8
  6. khoj/interface/compiled/404/index.html +1 -1
  7. khoj/interface/compiled/_next/static/chunks/1199-3461ffb259e6d98b.js +1 -0
  8. khoj/interface/compiled/_next/static/chunks/2327-3b7d77ac1d1c86a2.js +1 -0
  9. khoj/interface/compiled/_next/static/chunks/2509-299ad8b73ce407dd.js +1 -0
  10. khoj/interface/compiled/_next/static/chunks/6244-08fb644d7709f449.js +1 -0
  11. khoj/interface/compiled/_next/static/chunks/app/agents/layout-44c4d7d00224870c.js +1 -0
  12. khoj/interface/compiled/_next/static/chunks/app/automations/layout-0adc73dba7a04c11.js +1 -0
  13. khoj/interface/compiled/_next/static/chunks/app/automations/{page-a951c331320b870a.js → page-b5d449fb82335d1e.js} +1 -1
  14. khoj/interface/compiled/_next/static/chunks/app/chat/layout-a87d7b43ad04d584.js +1 -0
  15. khoj/interface/compiled/_next/static/chunks/app/chat/{page-f68d20917788cbbc.js → page-6a8e3720fdfc7a6a.js} +1 -1
  16. khoj/interface/compiled/_next/static/chunks/app/{page-0c6346ba12c1b885.js → page-b8ff5f62db33db37.js} +1 -1
  17. khoj/interface/compiled/_next/static/chunks/app/search/layout-acc9eb43c9962ee1.js +1 -0
  18. khoj/interface/compiled/_next/static/chunks/app/search/page-74bc4c5a0855bef9.js +1 -0
  19. khoj/interface/compiled/_next/static/chunks/app/settings/page-ac472ce74f507896.js +1 -0
  20. khoj/interface/compiled/_next/static/chunks/app/share/chat/layout-6d7831aace573049.js +1 -0
  21. khoj/interface/compiled/_next/static/chunks/app/share/chat/{page-075278404a3f37b8.js → page-6756c9b548ad8f34.js} +1 -1
  22. khoj/interface/compiled/_next/static/chunks/{webpack-c3e8ecbe7f11b749.js → webpack-b19082dc805b1ce6.js} +1 -1
  23. khoj/interface/compiled/_next/static/css/3b65ca1e74e399bd.css +1 -0
  24. khoj/interface/compiled/_next/static/css/4fde4496bbffba77.css +25 -0
  25. khoj/interface/compiled/_next/static/css/fa9a32d3c4cbb5e3.css +1 -0
  26. khoj/interface/compiled/agents/index.html +1 -1
  27. khoj/interface/compiled/agents/index.txt +2 -2
  28. khoj/interface/compiled/automations/index.html +1 -1
  29. khoj/interface/compiled/automations/index.txt +3 -3
  30. khoj/interface/compiled/chat/index.html +1 -1
  31. khoj/interface/compiled/chat/index.txt +2 -2
  32. khoj/interface/compiled/index.html +1 -1
  33. khoj/interface/compiled/index.txt +2 -2
  34. khoj/interface/compiled/search/index.html +1 -1
  35. khoj/interface/compiled/search/index.txt +4 -3
  36. khoj/interface/compiled/settings/index.html +1 -1
  37. khoj/interface/compiled/settings/index.txt +2 -2
  38. khoj/interface/compiled/share/chat/index.html +1 -1
  39. khoj/interface/compiled/share/chat/index.txt +2 -2
  40. khoj/processor/content/text_to_entries.py +16 -13
  41. khoj/routers/api_content.py +76 -0
  42. {khoj-1.34.1.dev14.dist-info → khoj-1.34.1.dev38.dist-info}/METADATA +1 -1
  43. {khoj-1.34.1.dev14.dist-info → khoj-1.34.1.dev38.dist-info}/RECORD +52 -48
  44. khoj/interface/compiled/_next/static/chunks/2327-48acd1e0a80ae920.js +0 -1
  45. khoj/interface/compiled/_next/static/chunks/6065-64db9ad305ba0bcd.js +0 -1
  46. khoj/interface/compiled/_next/static/chunks/688-b5b4391bbc0376f1.js +0 -1
  47. khoj/interface/compiled/_next/static/chunks/app/agents/layout-e00fb81dca656a10.js +0 -1
  48. khoj/interface/compiled/_next/static/chunks/app/automations/layout-1fe1537449f43496.js +0 -1
  49. khoj/interface/compiled/_next/static/chunks/app/chat/layout-33934fc2d6ae6838.js +0 -1
  50. khoj/interface/compiled/_next/static/chunks/app/search/layout-f5881c7ae3ba0795.js +0 -1
  51. khoj/interface/compiled/_next/static/chunks/app/search/page-de5f63bfa393d25d.js +0 -1
  52. khoj/interface/compiled/_next/static/chunks/app/settings/page-c244a441045a593e.js +0 -1
  53. khoj/interface/compiled/_next/static/chunks/app/share/chat/layout-abb6c5f4239ad7be.js +0 -1
  54. khoj/interface/compiled/_next/static/css/70b2e9482d96d4c2.css +0 -25
  55. khoj/interface/compiled/_next/static/css/df4b47a2d0d85eae.css +0 -1
  56. khoj/interface/compiled/_next/static/css/eff89937927ce00a.css +0 -1
  57. /khoj/interface/compiled/_next/static/chunks/{4986-24b37356a9642ebb.js → 4986-8bade861ddaea499.js} +0 -0
  58. /khoj/interface/compiled/_next/static/chunks/{5427-b52d95253e692bfa.js → 5427-0a9a2669cb5cde83.js} +0 -0
  59. /khoj/interface/compiled/_next/static/chunks/{5477-0bbddb79c25a54a7.js → 5477-3a4efd2e062e7102.js} +0 -0
  60. /khoj/interface/compiled/_next/static/chunks/app/agents/{page-05e8780174a478e6.js → page-f03e7c53795ecdd6.js} +0 -0
  61. /khoj/interface/compiled/_next/static/{-2Fo9Y0X4d8d1XG1iTWml → v-6mFTefx_fFXF9y7TzUD}/_buildManifest.js +0 -0
  62. /khoj/interface/compiled/_next/static/{-2Fo9Y0X4d8d1XG1iTWml → v-6mFTefx_fFXF9y7TzUD}/_ssgManifest.js +0 -0
  63. {khoj-1.34.1.dev14.dist-info → khoj-1.34.1.dev38.dist-info}/WHEEL +0 -0
  64. {khoj-1.34.1.dev14.dist-info → khoj-1.34.1.dev38.dist-info}/entry_points.txt +0 -0
  65. {khoj-1.34.1.dev14.dist-info → khoj-1.34.1.dev38.dist-info}/licenses/LICENSE +0 -0
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8459,3317,244,7138],{63521:function(){}},function(n){n.O(0,[2971,2117,1744],function(){return n(n.s=63521)}),_N_E=n.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3179],{90836:function(t,e,r){Promise.resolve().then(r.bind(r,35976))},89534:function(t,e,r){"use strict";r.d(e,{FN:function(){return f},Mi:function(){return v},VW:function(){return d},_i:function(){return c},gD:function(){return p},lj:function(){return x},sA:function(){return m}});var s=r(57437),a=r(2265),n=r(41915),o=r(90535),i=r(32489),u=r(94508);let d=n.zt,c=a.forwardRef((t,e)=>{let{className:r,...a}=t;return(0,s.jsx)(n.l_,{ref:e,className:(0,u.cn)("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",r),...a})});c.displayName=n.l_.displayName;let l=(0,o.j)("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),f=a.forwardRef((t,e)=>{let{className:r,variant:a,...o}=t;return(0,s.jsx)(n.fC,{ref:e,className:(0,u.cn)(l({variant:a}),r),...o})});f.displayName=n.fC.displayName;let p=a.forwardRef((t,e)=>{let{className:r,...a}=t;return(0,s.jsx)(n.aU,{ref:e,className:(0,u.cn)("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",r),...a})});p.displayName=n.aU.displayName;let m=a.forwardRef((t,e)=>{let{className:r,...a}=t;return(0,s.jsx)(n.x8,{ref:e,className:(0,u.cn)("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",r),"toast-close":"",...a,children:(0,s.jsx)(i.Z,{className:"h-4 w-4"})})});m.displayName=n.x8.displayName;let v=a.forwardRef((t,e)=>{let{className:r,...a}=t;return(0,s.jsx)(n.Dx,{ref:e,className:(0,u.cn)("text-sm font-semibold",r),...a})});v.displayName=n.Dx.displayName;let x=a.forwardRef((t,e)=>{let{className:r,...a}=t;return(0,s.jsx)(n.dk,{ref:e,className:(0,u.cn)("text-sm opacity-90",r),...a})});x.displayName=n.dk.displayName},35976:function(t,e,r){"use strict";r.d(e,{Toaster:function(){return o}});var s=r(57437),a=r(89534),n=r(77992);function o(){let{toasts:t}=(0,n.pm)();return(0,s.jsxs)(a.VW,{children:[t.map(function(t){let{id:e,title:r,description:n,action:o,...i}=t;return(0,s.jsxs)(a.FN,{...i,children:[(0,s.jsxs)("div",{className:"grid gap-1",children:[r&&(0,s.jsx)(a.Mi,{children:r}),n&&(0,s.jsx)(a.lj,{children:n})]}),o,(0,s.jsx)(a.sA,{})]},e)}),(0,s.jsx)(a._i,{})]})}},77992:function(t,e,r){"use strict";r.d(e,{pm:function(){return f}});var s=r(2265);let a=0,n=new Map,o=t=>{if(n.has(t))return;let e=setTimeout(()=>{n.delete(t),c({type:"REMOVE_TOAST",toastId:t})},1e6);n.set(t,e)},i=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,1)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(t=>t.id===e.toast.id?{...t,...e.toast}:t)};case"DISMISS_TOAST":{let{toastId:r}=e;return r?o(r):t.toasts.forEach(t=>{o(t.id)}),{...t,toasts:t.toasts.map(t=>t.id===r||void 0===r?{...t,open:!1}:t)}}case"REMOVE_TOAST":if(void 0===e.toastId)return{...t,toasts:[]};return{...t,toasts:t.toasts.filter(t=>t.id!==e.toastId)}}},u=[],d={toasts:[]};function c(t){d=i(d,t),u.forEach(t=>{t(d)})}function l(t){let{...e}=t,r=(a=(a+1)%Number.MAX_SAFE_INTEGER).toString(),s=()=>c({type:"DISMISS_TOAST",toastId:r});return c({type:"ADD_TOAST",toast:{...e,id:r,open:!0,onOpenChange:t=>{t||s()}}}),{id:r,dismiss:s,update:t=>c({type:"UPDATE_TOAST",toast:{...t,id:r}})}}function f(){let[t,e]=s.useState(d);return s.useEffect(()=>(u.push(e),()=>{let t=u.indexOf(e);t>-1&&u.splice(t,1)}),[t]),{...t,toast:l,dismiss:t=>c({type:"DISMISS_TOAST",toastId:t})}}},94508:function(t,e,r){"use strict";r.d(e,{cn:function(){return n}});var s=r(61994),a=r(53335);function n(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];return(0,a.m6)((0,s.W)(e))}}},function(t){t.O(0,[9259,1915,2971,2117,1744],function(){return t(t.s=90836)}),_N_E=t.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3317,8459,244,7138],{63521:function(){}},function(n){n.O(0,[2971,2117,1744],function(){return n(n.s=63521)}),_N_E=n.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[244,3317,8459,7138],{63521:function(){}},function(n){n.O(0,[2971,2117,1744],function(){return n(n.s=63521)}),_N_E=n.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2797],{94114:function(e,t,s){Promise.resolve().then(s.bind(s,96034))},96034:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return L}});var n=s(57437),a=s(95186),r=s(2265),l=s(41816),o=s.n(l),i=s(19378),c=s(66070),d=s(73925),u=s(75216),m=s(91521),h=s(45178),x=s(58619),f=s(35099),g=s(64697),j=s(27556),p=s(77168),b=s(74915),N=s(62869),v=s(27648),w=s(42225),y=s(7436),k=s(85872),S=s(34124),C=s(6512),_=s(37104);let E=["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 F(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,w.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 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)(d.F,{className:"text-muted-foreground"}):"github"===t?(0,n.jsx)(u.b,{className:"text-muted-foreground"}):(0,n.jsx)(m.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)(N.z,{onClick:()=>e.setFocusSearchResult(s),variant:"ghost",className:"p-0 mt-2 text-orange-400 hover:bg-inherit",children:["See content",(0,n.jsx)(h.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)(x.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 L(){let[e,t]=(0,r.useState)(""),[s,l]=(0,r.useState)(null),[d,u]=(0,r.useState)(!1),[m,h]=(0,r.useState)(null),[L,T]=(0,r.useState)(""),[O,Z]=(0,r.useState)([]),[M,I]=(0,r.useState)([]),[R,W]=(0,r.useState)(!1),Y=(0,r.useRef)(null),D=(0,y.IC)();function H(s){t(e.replace(/file:([^"\s]*|"[^"]*")?/,'file:"'.concat(s,'"'))),W(!1),P()}function P(){!d&&e.trim()&&fetch("/api/search?q=".concat(encodeURIComponent(e),"&client=web"),{method:"GET",headers:{"Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{l(e),u(!1)}).catch(e=>{console.error("Error:",e)})}return(0,r.useEffect)(()=>{T(E[Math.floor(Math.random()*E.length)]),fetch("/api/content/computer",{method:"GET",headers:{"Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{I(e)}).catch(e=>{console.error("Error loading files:",e)})},[]),(0,n.jsxs)(k.Hn,{children:[(0,n.jsx)(S.S,{conversationId:""}),(0,n.jsxs)(k.kV,{children:[(0,n.jsxs)("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:[(0,n.jsx)(k.vP,{className:"-ml-1"}),(0,n.jsx)(C.Z,{orientation:"vertical",className:"mr-2 h-4"}),D?(0,n.jsx)("a",{className:"p-0 no-underline",href:"/",children:(0,n.jsx)(_.VO,{className:"h-auto w-16"})}):(0,n.jsx)("h2",{className:"text-lg",children:"Search"})]}),(0,n.jsx)("div",{children:(0,n.jsx)("div",{className:"".concat(o().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.jsxs)("div",{className:"relative flex-1",children:[(0,n.jsx)(a.I,{autoFocus:!0,className:"border-none pl-4",onChange:e=>{var s;t(s=e.currentTarget.value),Y.current&&clearTimeout(Y.current),function(e){var t;let s=e.match(/file:([^"\s]*|"[^"]*")?/);if(!s){Z([]),W(!1);return}let n=(null===(t=s[1])||void 0===t?void 0:t.replace(/^"|"$/g,"").trim())||"";Z(M.filter(e=>e.toLowerCase().includes(n.toLowerCase())).sort().slice(0,10)),W(!0)}(s),s.trim()&&(Y.current=setTimeout(()=>{P()},750))},onKeyDown:e=>{"Enter"===e.key&&(R&&O.length>0?H(O[0]):P())},type:"search",placeholder:"Search Documents (type 'file:' for file suggestions)",value:e}),R&&O.length>0&&(0,n.jsx)("div",{className:"absolute z-10 w-full mt-1 bg-background border rounded-md shadow-lg",children:O.map((e,t)=>(0,n.jsx)("div",{className:"px-4 py-2 hover:bg-muted cursor-pointer",onClick:()=>H(e),children:e},t))})]}),(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)(f.Y,{className:"h-4 w-4"}),(0,n.jsx)("span",{children:"Find"})]})]}),m&&(0,n.jsxs)("div",{className:"mt-4",children:[(0,n.jsxs)(N.z,{onClick:()=>h(null),className:"mb-4",variant:"outline",children:[(0,n.jsx)(g.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,w.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)(x.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})})]})}(m)]}),!m&&s&&s.length>0&&(0,n.jsx)("div",{className:"mt-4 max-w-[92vw] break-all",children:(0,n.jsx)(i.x,{className:"h-[80vh]",children:s.map((e,t)=>(0,n.jsx)(F,{note:e,setFocusSearchResult:h},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)(j.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"})," ",L]})]}),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)(b.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)(v.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"})})]})]})]})})})})]})]})}},41816:function(e){e.exports={searchLayout:"search_searchLayout__fP3m0"}}},function(e){e.O(0,[2026,1607,9259,8667,182,6065,2327,2971,2117,1744],function(){return e(e.s=94114)}),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6938],{62960:function(e,t,s){Promise.resolve().then(s.bind(s,31537))},31537:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return em}});var a,n,r=s(57437),i=s(917),l=s.n(i);s(97510);var o=s(2265),c=s(77992),d=s(56937),h=s(7436),m=s(67341),u=s(62869),x=s(26371),p=s(95186),f=s(66070),j=s(84190),g=s(94508);let b=o.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("div",{className:"relative w-full overflow-auto",children:(0,r.jsx)("table",{ref:t,className:(0,g.cn)("w-full caption-bottom text-sm",s),...a})})});b.displayName="Table",o.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("thead",{ref:t,className:(0,g.cn)("[&_tr]:border-b",s),...a})}).displayName="TableHeader";let w=o.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("tbody",{ref:t,className:(0,g.cn)("[&_tr:last-child]:border-0",s),...a})});w.displayName="TableBody",o.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("tfoot",{ref:t,className:(0,g.cn)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",s),...a})}).displayName="TableFooter";let N=o.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("tr",{ref:t,className:(0,g.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",s),...a})});N.displayName="TableRow",o.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("th",{ref:t,className:(0,g.cn)("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",s),...a})}).displayName="TableHead";let y=o.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("td",{ref:t,className:(0,g.cn)("p-4 align-middle [&:has([role=checkbox])]:pr-0",s),...a})});y.displayName="TableCell",o.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("caption",{ref:t,className:(0,g.cn)("mt-4 text-sm text-muted-foreground",s),...a})}).displayName="TableCaption";var v=s(23518),_=s(87296),k=s(89203),S=s(57466),C=s(38513),T=s(19841),D=s(3894),E=s(81228),F=s(94018),P=s(13272),O=s(88435),A=s(37295),I=s(2049),z=s(50525),Y=s(5147),R=s(80438),K=s(29975),Z=s(47615),W=s(47020),M=s(22345),U=s(75216),L=s(90483),B=s(73925),V=s(54271),H=s(95656),G=s(58717),J=s(56777),$=s(97525),q=s(45178),X=s(14308),Q=s(34688),ee=s(59199),et=s(37099),es=s(32759),ea=s(27648),en=s(85872),er=s(34124),ei=s(6512),el=s(37104);let eo=e=>{let{onClose:t}=e,[s,a]=(0,o.useState)([]),[n,i]=(0,o.useState)([]),[l,c]=(0,o.useState)(""),[d,h]=(0,o.useState)(!1),[m,x]=(0,o.useState)(null),[p,f]=(0,o.useState)(null),[j,g]=(0,o.useState)(!1),[b,w]=(0,o.useState)(0),[N,y]=(0,o.useState)([]),D=(0,o.useRef)(null);(0,o.useEffect)(()=>{if(j||w(0),j){let e=setInterval(()=>{w(e=>{let t=e+(Math.floor(5*Math.random())+1);return t<100?t:100})},800);return()=>clearInterval(e)}},[j]),(0,o.useEffect)(()=>{(async()=>{try{let e=await fetch("/api/content/computer");if(!e.ok)throw Error("Failed to fetch files");let t=await e.json();Array.isArray(t)?a(t.toSorted()):console.error("Unexpected data format from API")}catch(e){console.error("Error fetching files:",e)}})()},[N]);let E=s.filter(e=>e.toLowerCase().includes(l.toLowerCase())),F=async()=>{let e=n.length>0?n:E;if(0!==e.length)try{if(!(await fetch("/api/content/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:e})})).ok)throw Error("Failed to delete files");a(t=>t.filter(t=>!e.includes(t))),i([])}catch(e){console.error("Error deleting files:",e)}},P=async e=>{try{if(!(await fetch("/api/content/file?filename=".concat(encodeURIComponent(e)),{method:"DELETE",headers:{"Content-Type":"application/json"}})).ok)throw Error("Failed to delete file");a(t=>t.filter(t=>t!==e)),i(t=>t.filter(t=>t!==e))}catch(e){console.error("Error deleting file:",e)}};function O(e){(0,ee.ko)(e,x,g,f,y)}return(0,r.jsxs)(v.m5,{open:!0,onOpenChange:t,children:[(0,r.jsx)(et.aR,{open:null!==m||null!=p,children:(0,r.jsxs)(et._T,{children:[(0,r.jsx)(et.fY,{children:(0,r.jsx)(et.f$,{children:"Alert"})}),(0,r.jsx)(et.yT,{children:m||p}),(0,r.jsx)(et.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>{x(null),f(null),g(!1)},children:"Close"})]})}),(0,r.jsxs)("div",{className:"flex flex-col h-full",onDragOver:function(e){e.preventDefault(),h(!0)},onDragLeave:function(e){e.preventDefault(),h(!1)},onDrop:function(e){e.preventDefault(),h(!1),e.dataTransfer.files&&O(e.dataTransfer.files)},onClick:function(){D&&D.current&&D.current.click()},children:[(0,r.jsx)("input",{type:"file",multiple:!0,ref:D,style:{display:"none"},onChange:function(e){e.target.files&&O(e.target.files)}}),(0,r.jsxs)("div",{className:"flex-none p-4",children:["Upload files",j&&(0,r.jsx)(es.E,{indicatorColor:"bg-slate-500",className:"w-full h-2 rounded-full",value:b})]}),(0,r.jsx)("div",{className:"flex-none p-4 bg-secondary border-b ".concat(d?"animate-pulse":""," rounded-lg"),children:(0,r.jsx)("div",{className:"flex items-center justify-center w-full h-32 border-2 border-dashed border-gray-300 rounded-lg",children:d?(0,r.jsxs)("div",{className:"flex items-center justify-center w-full h-full",children:[(0,r.jsx)(_.u,{className:"h-6 w-6 mr-2"}),(0,r.jsx)("span",{children:"Drop files to upload"})]}):(0,r.jsxs)("div",{className:"flex items-center justify-center w-full h-full",children:[(0,r.jsx)(k.v,{className:"h-6 w-6 mr-2"}),(0,r.jsx)("span",{children:"Drag and drop files here"})]})})})]}),(0,r.jsxs)("div",{className:"flex flex-col h-full",children:[(0,r.jsx)("div",{className:"flex-none p-4 bg-background border-b",children:(0,r.jsx)(v.sZ,{placeholder:"Find synced files",value:l,onValueChange:c})}),(0,r.jsx)("div",{className:"flex-grow overflow-auto",children:(0,r.jsxs)(v.e8,{children:[(0,r.jsx)(v.rb,{children:0===s.length?(0,r.jsxs)("div",{className:"flex items-center justify-center",children:[(0,r.jsx)(S.C,{className:"h-4 w-4 mr-2",weight:"bold"}),"No files synced"]}):(0,r.jsxs)("div",{children:["Could not find a good match.",(0,r.jsx)(ea.default,{href:"/search",className:"block",children:"Need advanced search? Click here."})]})}),(0,r.jsx)(v.fu,{heading:"Synced files",children:E.map(e=>(0,r.jsx)(v.di,{value:e,onSelect:e=>{i(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},children:(0,r.jsxs)("div",{className:"flex items-center justify-between w-full",children:[(0,r.jsxs)("div",{className:"flex items-center ".concat(n.includes(e)?"font-semibold":""),children:[n.includes(e)&&(0,r.jsx)(C.J,{className:"h-4 w-4 mr-2"}),(0,r.jsx)("span",{className:"break-all",children:e})]}),(0,r.jsx)(u.z,{variant:"outline",size:"sm",onClick:()=>P(e),className:"ml-auto",children:(0,r.jsx)(T.r,{className:"h-4 w-4"})})]})},e))})]})}),(0,r.jsx)("div",{className:"flex-none p-4 bg-background border-t",children:(0,r.jsx)("div",{className:"flex justify-between",children:(0,r.jsxs)(u.z,{variant:"outline",size:"sm",onClick:F,className:"mr-2",children:[(0,r.jsx)(T.r,{className:"h-4 w-4 mr-2"}),n.length>0?"Delete Selected (".concat(n.length,")"):"Delete All"]})})})]})]})},ec=e=>{var t,s;let{items:a,selected:n,callbackFunc:i}=e,[l,c]=(0,o.useState)(null!==(s=null==n?void 0:n.toString())&&void 0!==s?s:"0");return!!n&&(0,r.jsx)("div",{className:"overflow-hidden shadow-md rounded-lg",children:(0,r.jsxs)(j.h_,{children:[(0,r.jsx)(j.$F,{asChild:!0,className:"w-full rounded-lg",children:(0,r.jsxs)(u.z,{variant:"outline",className:"justify-start py-6 rounded-lg",children:[null===(t=a.find(e=>e.id.toString()===l))||void 0===t?void 0:t.name," ",(0,r.jsx)(D.p,{className:"h-4 w-4 ml-auto text-muted-foreground"})]})}),(0,r.jsx)(j.AW,{style:{maxHeight:"200px",overflowY:"auto",minWidth:"var(--radix-dropdown-menu-trigger-width)"},children:(0,r.jsx)(j._x,{value:l,onValueChange:async e=>{c(e),await i(e)},children:a.map(e=>(0,r.jsx)(j.qB,{value:e.id.toString(),children:e.name},e.id.toString()))})})]})})},ed=()=>{let[e,t]=(0,o.useState)([]),{toast:s}=(0,c.pm)(),a=async()=>{try{let e=await fetch("/auth/token",{method:"POST",headers:{"Content-Type":"application/json"}}),s=await e.json();t(e=>[...e,s])}catch(e){console.error("Error generating API key:",e)}},n=async e=>{try{await navigator.clipboard.writeText(e),s({title:"\uD83D\uDD11 API Key",description:"Copied to clipboard"})}catch(e){console.error("Error copying API key:",e)}},r=async e=>{try{(await fetch("/auth/token?token=".concat(e),{method:"DELETE"})).ok&&t(t=>t.filter(t=>t.token!==e))}catch(e){console.error("Error deleting API key:",e)}},i=async()=>{try{let e=await fetch("/auth/token"),s=await e.json();(null==s?void 0:s.length)>0&&t(s)}catch(e){console.error("Error listing API keys:",e)}};return(0,o.useEffect)(()=>{i()},[]),{apiKeys:e,generateAPIKey:a,copyAPIKey:n,deleteAPIKey:r}};function eh(){let{apiKeys:e,generateAPIKey:t,copyAPIKey:s,deleteAPIKey:a}=ed(),[n,i]=(0,o.useState)(new Set),{toast:l}=(0,c.pm)();return(0,r.jsxs)(f.Zb,{className:"grid grid-flow-column border border-gray-300 shadow-md rounded-lg dark:bg-muted dark:border-none border-opacity-50 lg:w-2/3",children:[(0,r.jsxs)(f.Ol,{className:"text-xl grid grid-flow-col grid-cols-[1fr_auto] pb-0",children:[(0,r.jsxs)("span",{className:"flex flex-wrap",children:[(0,r.jsx)(E.s,{className:"h-7 w-7 mr-2"}),"API Keys"]}),(0,r.jsxs)(u.z,{variant:"secondary",className:"!mt-0",onClick:t,children:[(0,r.jsx)(k.v,{weight:"bold",className:"h-5 w-5 mr-2"}),"Generate Key"]})]}),(0,r.jsxs)(f.aY,{className:"overflow-hidden grid gap-6",children:[(0,r.jsxs)("p",{className:"text-md text-gray-400",children:["Access Khoj from the"," ",(0,r.jsx)("a",{href:"https://docs.khoj.dev/clients/desktop",target:"_blank",children:"Desktop"}),", ",(0,r.jsx)("a",{href:"https://docs.khoj.dev/clients/obsidian",children:"Obsidian"}),","," ",(0,r.jsx)("a",{href:"https://docs.khoj.dev/clients/emacs",children:"Emacs"})," apps and more."]}),(0,r.jsx)(b,{children:(0,r.jsx)(w,{children:e.map(e=>(0,r.jsxs)(N,{children:[(0,r.jsx)(y,{className:"pl-0 py-3",children:e.name}),(0,r.jsxs)(y,{className:"grid grid-flow-col grid-cols-[1fr_auto] bg-secondary dark:bg-background rounded-xl p-3 m-1",children:[(0,r.jsx)("span",{className:"font-mono text-left w-[50px] md:w-[400px]",children:n.has(e.token)?e.token:"".concat(e.token.slice(0,6),"...").concat(e.token.slice(-4))}),(0,r.jsxs)("div",{className:"grid grid-flow-col",children:[n.has(e.token)?(0,r.jsx)(F.N,{weight:"bold",className:"h-4 w-4 mr-2 hover:bg-primary/40",onClick:()=>i(t=>{let s=new Set(t);return s.delete(e.token),s})}):(0,r.jsx)(P.b,{weight:"bold",className:"h-4 w-4 mr-2 hover:bg-primary/40",onClick:()=>i(new Set([...n,e.token]))}),(0,r.jsx)(O.C,{weight:"bold",className:"h-4 w-4 mr-2 hover:bg-primary/40",onClick:()=>{l({title:"\uD83D\uDD11 Copied API Key: ".concat(e.name),description:"Set this API key in the Khoj apps you want to connect to this Khoj account"}),s(e.token)}}),(0,r.jsx)(T.r,{weight:"bold",className:"h-4 w-4 mr-2 md:ml-4 text-red-400 hover:bg-primary/40",onClick:()=>{l({title:"\uD83D\uDD11 Deleted API Key: ".concat(e.name),description:"Apps using this API key will no longer connect to this Khoj account"}),a(e.token)}})]})]})]},e.token))})})]}),(0,r.jsx)(f.eW,{className:"flex flex-wrap gap-4"})]})}function em(){let{userConfig:e}=(0,d.h2)(!0),[t,s]=(0,o.useState)(null),[a,n]=(0,o.useState)(void 0),[i,j]=(0,o.useState)(null),[g,b]=(0,o.useState)(void 0),[w,N]=(0,o.useState)(""),[y,v]=(0,o.useState)("verified"),[k,C]=(0,o.useState)(!1),{toast:T}=(0,c.pm)(),D=(0,h.IC)(),E="w-full lg:w-5/12 grid grid-flow-column border border-gray-300 shadow-md rounded-lg border dark:border-none border-opacity-50 dark:bg-muted";(0,o.useEffect)(()=>{var t;s(e),b(null==e?void 0:e.phone_number),v((null==e?void 0:e.is_phone_number_verified)?"verified":(null==e?void 0:e.phone_number)?"otp":"setup"),n(null==e?void 0:e.given_name),j(null!==(t=null==e?void 0:e.notion_token)&&void 0!==t?t:null)},[e]);let F=async()=>{try{if(!(await fetch("/api/phone?phone_number=".concat(g),{method:"POST",headers:{"Content-Type":"application/json"}})).ok)throw Error("Failed to send OTP");v("verify")}catch(e){console.error("Error sending OTP:",e),T({title:"\uD83D\uDCF1 Phone",description:"Failed to send OTP. Try again or contact us at team@khoj.dev"})}},P=async()=>{try{if(!(await fetch("/api/phone/verify?code=".concat(w),{method:"POST",headers:{"Content-Type":"application/json"}})).ok)throw Error("Failed to verify OTP");v("verified"),T({title:"\uD83D\uDCF1 Phone",description:"Phone number verified"})}catch(e){console.error("Error verifying OTP:",e),T({title:"\uD83D\uDCF1 Phone",description:"Failed to verify OTP. Try again or contact us at team@khoj.dev"})}},O=async()=>{try{if(!(await fetch("/api/phone",{method:"DELETE",headers:{"Content-Type":"application/json"}})).ok)throw Error("Failed to disconnect phone number");b(void 0),v("setup"),T({title:"\uD83D\uDCF1 Phone",description:"Phone number disconnected"})}catch(e){console.error("Error disconnecting phone number:",e),T({title:"\uD83D\uDCF1 Phone",description:"Failed to disconnect phone number. Try again or contact us at team@khoj.dev"})}},ee=async e=>{try{if(!(await fetch("/api/subscription?operation=".concat(e),{method:"PATCH",headers:{"Content-Type":"application/json"}})).ok)throw Error("Failed to change subscription");t&&(t.subscription_state="cancel"===e?d.o9.UNSUBSCRIBED:d.o9.SUBSCRIBED,s(t)),T({title:"\uD83D\uDCB3 Subscription",description:(null==t?void 0:t.subscription_state)==="unsubscribed"?"Your subscription was cancelled":"Your Futurist subscription has been renewed"})}catch(t){console.error("Error changing subscription:",t),T({title:"\uD83D\uDCB3 Subscription",description:"cancel"===e?"Failed to cancel subscription. Try again or contact us at team@khoj.dev":"Failed to renew subscription. Try again or contact us at team@khoj.dev"})}},et=async()=>{try{let e=await fetch("/api/subscription/trial",{method:"POST"});if(!e.ok)throw Error("Failed to enable free trial");if((await e.json()).trial_enabled&&t){t.subscription_state=d.o9.TRIAL;let e=new Date(Date.now()+864e5*t.length_of_free_trial);t.subscription_renewal_date=(e=>{let t=new Date(e);return new Intl.DateTimeFormat("en-US",{day:"2-digit",month:"short",year:"numeric"}).format(t)})(e),t.subscription_enabled_trial_at=new Date().toISOString(),s(t),T({title:"\uD83C\uDF89 Trial Enabled",description:"Your free trial will end on ".concat(t.subscription_renewal_date)})}}catch(e){console.error("Error enabling free trial:",e),T({title:"⚠️ Failed to Enable Free Trial",description:"Failed to enable free trial. Try again or contact us at team@khoj.dev"})}},es=async()=>{if(a)try{if(!(await fetch("/api/user/name?name=".concat(a),{method:"PATCH",headers:{"Content-Type":"application/json"}})).ok)throw Error("Failed to update name");t&&(t.given_name=a,s(t)),T({title:"✅ Updated Profile",description:"You name has been updated to ".concat(a)})}catch(e){console.error("Error updating name:",e),T({title:"⚠️ Failed to Update Profile",description:"Failed to update name. Try again or contact team@khoj.dev"})}},ea=e=>async s=>{if(!(null==t?void 0:t.is_active)){T({title:"Model Update",description:"You need to be subscribed to update ".concat(e," models"),variant:"destructive"});return}try{if(!(await fetch("/api/model/".concat(e,"?id=")+s,{method:"POST",headers:{"Content-Type":"application/json"}})).ok)throw Error("Failed to update model");T({title:"✅ Updated ".concat((0,h.LF)(e)," Model")})}catch(t){console.error("Failed to update ".concat(e," model:"),t),T({description:"❌ Failed to update ".concat((0,h.LF)(e)," model. Try again."),variant:"destructive"})}},ed=async()=>{if(i)try{if(!(await fetch("/api/content/notion",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:i})})).ok)throw Error("Failed to save Notion API key");t&&(t.notion_token=i,s(t)),T({title:"✅ Saved Notion Settings",description:"You Notion API key has been saved."})}catch(e){console.error("Error updating name:",e),T({title:"⚠️ Failed to Save Notion Settings",description:"Failed to save Notion API key. Try again or contact team@khoj.dev"})}},em=async e=>{try{if(!(await fetch("/api/content?t=".concat(e),{method:"PATCH",headers:{"Content-Type":"application/json"}})).ok)throw Error("Failed to sync content from ".concat(e));T({title:"\uD83D\uDD04 Syncing ".concat(e),description:"Your ".concat(e," content is being synced.")})}catch(t){console.error("Error syncing content:",t),T({title:"⚠️ Failed to Sync ".concat(e),description:"Failed to sync ".concat(e," content. Try again or contact team@khoj.dev")})}},eu=async e=>{try{if(!(await fetch("/api/content/".concat(e),{method:"DELETE",headers:{"Content-Type":"application/json"}})).ok)throw Error("Failed to disconnect ".concat(e));t&&("computer"===e?t.enabled_content_source.computer=!1:"notion"===e?(t.enabled_content_source.notion=!1,t.notion_token=null,j(t.notion_token)):"github"===e&&(t.enabled_content_source.github=!1),s(t)),"computer"===e?T({title:"✅ Deleted Synced Files",description:"Your synced documents have been deleted."}):T({title:"✅ Disconnected ".concat(e),description:"Your ".concat(e," integration to Khoj has been disconnected.")})}catch(t){console.error("Error disconnecting ".concat(e,":"),t),T({title:"⚠️ Failed to Disconnect ".concat(e),description:"Failed to disconnect from ".concat(e,". Try again or contact team@khoj.dev")})}};return t?(0,r.jsxs)(en.Hn,{children:[(0,r.jsx)(er.S,{conversationId:""}),(0,r.jsxs)(en.kV,{children:[(0,r.jsxs)("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:[(0,r.jsx)(en.vP,{className:"-ml-1"}),(0,r.jsx)(ei.Z,{orientation:"vertical",className:"mr-2 h-4"}),D?(0,r.jsx)("a",{className:"p-0 no-underline",href:"/",children:(0,r.jsx)(el.VO,{className:"h-auto w-16"})}):(0,r.jsx)("h2",{className:"text-lg",children:"Settings"})]}),(0,r.jsxs)("div",{className:l().page,children:[(0,r.jsx)("title",{children:"Settings"}),(0,r.jsx)("div",{className:l().content,children:(0,r.jsx)("div",{className:"".concat(l().contentBody," mx-10 my-2"),children:(0,r.jsx)(o.Suspense,{fallback:(0,r.jsx)(X.Z,{}),children:(0,r.jsxs)("div",{id:"content",className:"grid grid-flow-column sm:grid-flow-row gap-16 m-8",children:[(0,r.jsxs)("div",{className:"section grid gap-8",children:[(0,r.jsx)("div",{className:"text-2xl",children:"Profile"}),(0,r.jsxs)("div",{className:"cards flex flex-wrap gap-16",children:[(0,r.jsxs)(f.Zb,{className:E,children:[(0,r.jsxs)(f.Ol,{className:"text-xl flex flex-row",children:[(0,r.jsx)(A.Y,{className:"h-7 w-7 mr-2"}),"Name"]}),(0,r.jsxs)(f.aY,{className:"overflow-hidden",children:[(0,r.jsx)("p",{className:"pb-4 text-gray-400",children:"What should Khoj refer to you as?"}),(0,r.jsx)(p.I,{type:"text",onChange:e=>n(e.target.value),value:a,className:"w-full border border-gray-300 rounded-lg p-4 py-6"})]}),(0,r.jsx)(f.eW,{className:"flex flex-wrap gap-4",children:(0,r.jsxs)(u.z,{variant:"outline",size:"sm",onClick:es,disabled:a===t.given_name,children:[(0,r.jsx)(I.B,{className:"h-5 w-5 inline mr-2"}),"Save"]})})]}),(0,r.jsxs)(f.Zb,{id:"subscription",className:E,children:[(0,r.jsxs)(f.Ol,{className:"text-xl flex flex-row",children:[(0,r.jsx)(z.a,{className:"h-7 w-7 mr-2"}),"Subscription"]}),(0,r.jsxs)(f.aY,{className:"grid gap-2 overflow-hidden",children:[(0,r.jsx)("p",{className:"text-gray-400",children:"Current Plan"}),"trial"===t.subscription_state&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"text-xl text-primary/80",children:"Futurist (Trial)"}),(0,r.jsxs)("p",{className:"text-gray-400",children:["You are on a"," ",t.length_of_free_trial," ","day trial of the Khoj Futurist plan. Your trial ends on"," ",t.subscription_renewal_date,". Check"," ",(0,r.jsx)("a",{href:"https://khoj.dev/#pricing",target:"_blank",children:"pricing page"})," ","to compare plans."]})]})||"subscribed"===t.subscription_state&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"text-xl text-primary/80",children:"Futurist"}),(0,r.jsxs)("p",{className:"text-gray-400",children:["Subscription ",(0,r.jsx)("b",{children:"renews"})," on"," ",(0,r.jsx)("b",{children:t.subscription_renewal_date})]})]})||"unsubscribed"===t.subscription_state&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"text-xl",children:"Futurist"}),(0,r.jsxs)("p",{className:"text-gray-400",children:["Subscription ",(0,r.jsx)("b",{children:"ends"})," on"," ",(0,r.jsx)("b",{children:t.subscription_renewal_date})]})]})||"expired"===t.subscription_state&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"text-xl",children:"Humanist"}),t.subscription_renewal_date&&(0,r.jsxs)("p",{className:"text-gray-400",children:["Subscription ",(0,r.jsx)("b",{children:"expired"})," ","on"," ",(0,r.jsx)("b",{children:t.subscription_renewal_date})]})||(0,r.jsxs)("p",{className:"text-gray-400",children:["Check"," ",(0,r.jsx)("a",{href:"https://khoj.dev/#pricing",target:"_blank",children:"pricing page"})," ","to compare plans."]})]})]}),(0,r.jsx)(f.eW,{className:"flex flex-wrap gap-4",children:"subscribed"==t.subscription_state&&(0,r.jsxs)(u.z,{variant:"outline",className:"hover:text-red-400",onClick:()=>ee("cancel"),children:[(0,r.jsx)(Y.b,{className:"h-5 w-5 mr-2"}),"Unsubscribe"]})||"unsubscribed"==t.subscription_state&&(0,r.jsxs)(u.z,{variant:"outline",className:"text-primary/80 hover:text-primary",onClick:()=>ee("resubscribe"),children:[(0,r.jsx)(R.e,{weight:"bold",className:"h-5 w-5 mr-2"}),"Resubscribe"]})||t.subscription_enabled_trial_at&&(0,r.jsxs)(u.z,{variant:"outline",className:"text-primary/80 hover:text-primary",onClick:()=>window.open("".concat(t.khoj_cloud_subscription_url,"?prefilled_email=").concat(t.username),"_blank","noopener,noreferrer"),children:[(0,r.jsx)(R.e,{weight:"bold",className:"h-5 w-5 mr-2"}),"Subscribe"]})||(0,r.jsxs)(u.z,{variant:"outline",className:"text-primary/80 hover:text-primary",onClick:et,children:[(0,r.jsx)(R.e,{weight:"bold",className:"h-5 w-5 mr-2"}),"Enable Trial"]})})]})]})]}),k&&(0,r.jsx)(eo,{onClose:()=>C(!1)}),(0,r.jsxs)("div",{className:"section grid gap-8",children:[(0,r.jsx)("div",{className:"text-2xl",children:"Content"}),(0,r.jsxs)("div",{className:"cards flex flex-wrap gap-16",children:[(0,r.jsxs)(f.Zb,{id:"computer",className:E,children:[(0,r.jsxs)(f.Ol,{className:"flex flex-row text-2xl",children:[(0,r.jsx)(K.I,{className:"h-8 w-8 mr-2"}),"Files",t.enabled_content_source.computer&&(0,r.jsx)(Z.f,{className:"h-6 w-6 ml-auto text-green-500",weight:"fill"})]}),(0,r.jsx)(f.aY,{className:"overflow-hidden pb-12 text-gray-400",children:"Manage your synced files"}),(0,r.jsxs)(f.eW,{className:"flex flex-wrap gap-4",children:[(0,r.jsx)(u.z,{variant:"outline",size:"sm",onClick:()=>C(!0),children:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(W.h,{className:"h-5 w-5 inline mr-1"}),"Manage"]})}),(0,r.jsxs)(u.z,{variant:"outline",size:"sm",className:"".concat(t.enabled_content_source.computer||"hidden"),onClick:()=>eu("computer"),children:[(0,r.jsx)(M.u,{className:"h-5 w-5 inline mr-1"}),"Disable"]})]})]}),(0,r.jsxs)(f.Zb,{id:"github",className:"".concat(E," hidden"),children:[(0,r.jsxs)(f.Ol,{className:"flex flex-row text-2xl",children:[(0,r.jsx)(U.b,{className:"h-8 w-8 mr-2"}),"Github"]}),(0,r.jsx)(f.aY,{className:"overflow-hidden pb-12 text-gray-400",children:"Set Github repositories to index"}),(0,r.jsxs)(f.eW,{className:"flex flex-wrap gap-4",children:[(0,r.jsx)(u.z,{variant:"outline",size:"sm",children:t.enabled_content_source.github&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(W.h,{className:"h-5 w-5 inline mr-1"}),"Manage"]})||(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(L.F,{className:"h-5 w-5 inline mr-1"}),"Connect"]})}),(0,r.jsxs)(u.z,{variant:"outline",size:"sm",className:"".concat(t.enabled_content_source.github||"hidden"),children:[(0,r.jsx)(M.u,{className:"h-5 w-5 inline mr-1"}),"Disable"]})]})]}),(0,r.jsxs)(f.Zb,{id:"notion",className:E,children:[(0,r.jsxs)(f.Ol,{className:"text-xl flex flex-row",children:[(0,r.jsx)(B.F,{className:"h-7 w-7 mr-2"}),"Notion",t.enabled_content_source.notion&&(0,r.jsx)(Z.f,{className:"h-6 w-6 ml-auto text-green-500",weight:"fill"})]}),(0,r.jsxs)(f.aY,{className:"grid gap-4",children:[(0,r.jsx)("p",{className:"text-gray-400",children:"Sync your Notion workspace."}),!t.notion_oauth_url&&(0,r.jsx)(p.I,{onChange:e=>j(e.target.value),value:i||"",placeholder:"Enter API Key of your Khoj integration on Notion",className:"w-full border border-gray-300 rounded-lg px-4 py-6"})]}),(0,r.jsxs)(f.eW,{className:"flex flex-wrap gap-4",children:[t.notion_oauth_url&&!t.enabled_content_source.notion?(0,r.jsxs)(u.z,{variant:"outline",size:"sm",onClick:()=>{window.open(t.notion_oauth_url)},children:[(0,r.jsx)(L.F,{className:"h-5 w-5 inline mr-1"}),"Connect"]}):t.enabled_content_source.notion&&i===t.notion_token?(0,r.jsxs)(u.z,{variant:"outline",size:"sm",onClick:()=>em("notion"),children:[(0,r.jsx)(V.t,{className:"h-5 w-5 inline mr-1"}),"Sync"]}):t.notion_oauth_url?(0,r.jsx)(r.Fragment,{}):(0,r.jsxs)(u.z,{variant:"outline",size:"sm",onClick:ed,disabled:i===t.notion_token,children:[(0,r.jsx)(I.B,{className:"h-5 w-5 inline mr-1"}),t.enabled_content_source.notion&&"Update API Key"||"Set API Key"]}),(0,r.jsxs)(u.z,{variant:"outline",size:"sm",className:"".concat(t.notion_token||"hidden"),onClick:()=>eu("notion"),children:[(0,r.jsx)(M.u,{className:"h-5 w-5 inline mr-1"}),"Disconnect"]})]})]})]})]}),(0,r.jsxs)("div",{className:"section grid gap-8",children:[(0,r.jsx)("div",{className:"text-2xl",children:"Models"}),(0,r.jsxs)("div",{className:"cards flex flex-wrap gap-16",children:[t.chat_model_options.length>0&&(0,r.jsxs)(f.Zb,{className:E,children:[(0,r.jsxs)(f.Ol,{className:"text-xl flex flex-row",children:[(0,r.jsx)(H.G,{className:"h-7 w-7 mr-2"}),"Chat"]}),(0,r.jsxs)(f.aY,{className:"overflow-hidden pb-12 grid gap-8 h-fit",children:[(0,r.jsx)("p",{className:"text-gray-400",children:"Pick the chat model to generate text responses"}),(0,r.jsx)(ec,{items:t.chat_model_options,selected:t.selected_chat_model_config,callbackFunc:ea("chat")})]}),(0,r.jsx)(f.eW,{className:"flex flex-wrap gap-4",children:!t.is_active&&(0,r.jsx)("p",{className:"text-gray-400",children:"Subscribe to switch model"})})]}),t.paint_model_options.length>0&&(0,r.jsxs)(f.Zb,{className:E,children:[(0,r.jsxs)(f.Ol,{className:"text-xl flex flex-row",children:[(0,r.jsx)(G.Y,{className:"h-7 w-7 mr-2"}),"Paint"]}),(0,r.jsxs)(f.aY,{className:"overflow-hidden pb-12 grid gap-8 h-fit",children:[(0,r.jsx)("p",{className:"text-gray-400",children:"Pick the paint model to generate image responses"}),(0,r.jsx)(ec,{items:t.paint_model_options,selected:t.selected_paint_model_config,callbackFunc:ea("paint")})]}),(0,r.jsx)(f.eW,{className:"flex flex-wrap gap-4",children:!t.is_active&&(0,r.jsx)("p",{className:"text-gray-400",children:"Subscribe to switch model"})})]}),t.voice_model_options.length>0&&(0,r.jsxs)(f.Zb,{className:E,children:[(0,r.jsxs)(f.Ol,{className:"text-xl flex flex-row",children:[(0,r.jsx)(_.u,{className:"h-7 w-7 mr-2"}),"Voice"]}),(0,r.jsxs)(f.aY,{className:"overflow-hidden pb-12 grid gap-8 h-fit",children:[(0,r.jsx)("p",{className:"text-gray-400",children:"Pick the voice model to generate speech responses"}),(0,r.jsx)(ec,{items:t.voice_model_options,selected:t.selected_voice_model_config,callbackFunc:ea("voice")})]}),(0,r.jsx)(f.eW,{className:"flex flex-wrap gap-4",children:!t.is_active&&(0,r.jsx)("p",{className:"text-gray-400",children:"Subscribe to switch model"})})]})]})]}),(0,r.jsxs)("div",{className:"section grid gap-8",children:[(0,r.jsx)("div",{id:"clients",className:"text-2xl",children:"Clients"}),(0,r.jsxs)("div",{className:"cards flex flex-col flex-wrap gap-8",children:[!t.anonymous_mode&&(0,r.jsx)(eh,{}),(0,r.jsxs)(f.Zb,{className:"".concat(E," lg:w-2/3"),children:[(0,r.jsxs)(f.Ol,{className:"text-xl flex flex-row",children:[(0,r.jsx)(J.V,{className:"h-7 w-7 mr-2"}),"Chat on Whatsapp","verified"===y&&(0,r.jsx)(Z.f,{weight:"bold",className:"h-4 w-4 ml-1 text-green-400"})||"setup"!==y&&(0,r.jsx)(S.C,{weight:"bold",className:"h-4 w-4 ml-1 text-yellow-400"})]}),(0,r.jsxs)(f.aY,{className:"grid gap-4",children:[(0,r.jsxs)("p",{className:"text-gray-400",children:["Connect your number to chat with Khoj on WhatsApp. Learn more about the integration"," ",(0,r.jsx)("a",{href:"https://docs.khoj.dev/clients/whatsapp",children:"here"}),"."]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(Q.Z,{initialValue:g||"",onChangeNumber:b,disabled:"verify"===y,initOptions:{separateDialCode:!0,initialCountry:"af",utilsScript:"https://assets.khoj.dev/intl-tel-input%4023.8.0_build_js_utils.js",containerClass:"".concat(l().phoneInput)}}),"verify"===y&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{children:"Enter the OTP sent to your number: ".concat(g)}),(0,r.jsx)(x.Zn,{autoFocus:!0,maxLength:6,value:w||"",onChange:N,onComplete:()=>v("verify"),children:(0,r.jsxs)(x.hf,{children:[(0,r.jsx)(x.cY,{index:0}),(0,r.jsx)(x.cY,{index:1}),(0,r.jsx)(x.cY,{index:2}),(0,r.jsx)(x.cY,{index:3}),(0,r.jsx)(x.cY,{index:4}),(0,r.jsx)(x.cY,{index:5})]})})]})]})]}),(0,r.jsxs)(f.eW,{className:"flex flex-wrap gap-4",children:["verify"===y&&(0,r.jsx)(u.z,{variant:"outline",onClick:P,children:"Verify"})||(0,r.jsx)(u.z,{variant:"outline",disabled:!g||g===t.phone_number&&"verified"===y||!(0,m.y)(g),onClick:F,children:t.phone_number?g&&(g!==t.phone_number||"verified"!==y)&&(0,m.y)(g)?(0,r.jsxs)(r.Fragment,{children:["Send OTP"," ",(0,r.jsx)(q.o,{className:"inline ml-2",weight:"bold"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)($.F,{className:"inline mr-2 text-green-400"}),"Switch Number"]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(L.F,{className:"inline mr-2"}),"Setup Whatsapp"]})}),"verified"===y&&(0,r.jsxs)(u.z,{variant:"outline",onClick:()=>O(),children:[(0,r.jsx)(M.u,{className:"h-5 w-5 mr-2"}),"Disconnect"]})]})]})]})]})]})})})})]})]})]}):(0,r.jsx)(X.Z,{})}(a=n||(n={})).Setup="setup",a.SendOTP="otp",a.VerifyOTP="verify",a.Verified="verified"},32759:function(e,t,s){"use strict";s.d(t,{E:function(){return l}});var a=s(57437),n=s(2265),r=s(60610),i=s(94508);let l=n.forwardRef((e,t)=>{let{className:s,value:n,indicatorColor:l,...o}=e;return(0,a.jsx)(r.fC,{ref:t,className:(0,i.cn)("relative h-4 w-full overflow-hidden rounded-full bg-secondary",s),...o,children:(0,a.jsx)(r.z$,{className:"h-full w-full flex-1 bg-primary transition-all ".concat(l),style:{transform:"translateX(-".concat(100-(n||0),"%)")}})})});l.displayName=r.fC.displayName},77992:function(e,t,s){"use strict";s.d(t,{pm:function(){return m}});var a=s(2265);let n=0,r=new Map,i=e=>{if(r.has(e))return;let t=setTimeout(()=>{r.delete(e),d({type:"REMOVE_TOAST",toastId:e})},1e6);r.set(e,t)},l=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case"DISMISS_TOAST":{let{toastId:s}=t;return s?i(s):e.toasts.forEach(e=>{i(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===s||void 0===s?{...e,open:!1}:e)}}case"REMOVE_TOAST":if(void 0===t.toastId)return{...e,toasts:[]};return{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},o=[],c={toasts:[]};function d(e){c=l(c,e),o.forEach(e=>{e(c)})}function h(e){let{...t}=e,s=(n=(n+1)%Number.MAX_SAFE_INTEGER).toString(),a=()=>d({type:"DISMISS_TOAST",toastId:s});return d({type:"ADD_TOAST",toast:{...t,id:s,open:!0,onOpenChange:e=>{e||a()}}}),{id:s,dismiss:a,update:e=>d({type:"UPDATE_TOAST",toast:{...e,id:s}})}}function m(){let[e,t]=a.useState(c);return a.useEffect(()=>(o.push(t),()=>{let e=o.indexOf(t);e>-1&&o.splice(e,1)}),[e]),{...e,toast:h,dismiss:e=>d({type:"DISMISS_TOAST",toastId:e})}}},917:function(e){e.exports={page:"settings_page__mP7qk",contentBody:"settings_contentBody__uZjue",phoneInput:"settings_phoneInput__j6xJN"}}},function(e){e.O(0,[6008,1607,9259,8667,182,688,2327,2971,2117,1744],function(){return e(e.s=62960)}),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7138,3317,8459,244],{63521:function(){}},function(n){n.O(0,[2971,2117,1744],function(){return n(n.s=63521)}),_N_E=n.O()}]);