khoj 1.30.2.dev15__py3-none-any.whl → 1.30.2.dev28__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- khoj/interface/compiled/404/index.html +1 -1
- khoj/interface/compiled/_next/static/chunks/1210.ef7a0f9a7e43da1d.js +1 -0
- khoj/interface/compiled/_next/static/chunks/1970-1b63ac1497b03a10.js +1 -0
- khoj/interface/compiled/_next/static/chunks/app/agents/{page-b086c9b0aa5a3833.js → page-5f6e0dacc34e33ad.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/automations/{page-697a2d415e11a872.js → page-60bc7454bc3ea881.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/chat/{page-461e26fcb7578d39.js → page-ac366c9111374312.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/{page-4a3c49c5e996cc40.js → page-358154a4436ef316.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/search/{page-9013658bebfc3d17.js → page-64ea1717528979af.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/settings/{page-41eb536497bb544a.js → page-17a538580c65e7fe.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/share/chat/{page-6a68ac7e227b34e7.js → page-47641b3691fb0856.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/{webpack-224b38bd040ae7a0.js → webpack-53ab241a813a122a.js} +1 -1
- khoj/interface/compiled/_next/static/css/2ff098d0815fdbc1.css +1 -0
- khoj/interface/compiled/_next/static/css/4cae6c0e5c72fb2d.css +1 -0
- khoj/interface/compiled/agents/index.html +1 -1
- khoj/interface/compiled/agents/index.txt +2 -2
- khoj/interface/compiled/automations/index.html +1 -1
- khoj/interface/compiled/automations/index.txt +2 -2
- khoj/interface/compiled/chat/index.html +1 -1
- khoj/interface/compiled/chat/index.txt +2 -2
- khoj/interface/compiled/index.html +1 -1
- khoj/interface/compiled/index.txt +2 -2
- khoj/interface/compiled/search/index.html +1 -1
- khoj/interface/compiled/search/index.txt +2 -2
- khoj/interface/compiled/settings/index.html +1 -1
- khoj/interface/compiled/settings/index.txt +2 -2
- khoj/interface/compiled/share/chat/index.html +1 -1
- khoj/interface/compiled/share/chat/index.txt +2 -2
- khoj/main.py +4 -0
- khoj/processor/conversation/anthropic/anthropic_chat.py +8 -2
- khoj/processor/conversation/anthropic/utils.py +8 -3
- khoj/processor/conversation/google/gemini_chat.py +8 -2
- khoj/processor/conversation/google/utils.py +8 -3
- khoj/processor/conversation/offline/chat_model.py +12 -4
- khoj/processor/conversation/openai/gpt.py +9 -2
- khoj/processor/conversation/openai/utils.py +7 -3
- khoj/processor/conversation/prompts.py +40 -21
- khoj/processor/conversation/utils.py +7 -4
- khoj/processor/tools/run_code.py +1 -25
- khoj/routers/auth.py +2 -2
- khoj/routers/helpers.py +15 -3
- khoj/routers/research.py +2 -1
- khoj/utils/cli.py +2 -0
- khoj/utils/helpers.py +31 -1
- khoj/utils/state.py +1 -0
- {khoj-1.30.2.dev15.dist-info → khoj-1.30.2.dev28.dist-info}/METADATA +1 -1
- {khoj-1.30.2.dev15.dist-info → khoj-1.30.2.dev28.dist-info}/RECORD +51 -51
- khoj/interface/compiled/_next/static/chunks/1210.132a7e1910006bbb.js +0 -1
- khoj/interface/compiled/_next/static/chunks/1970-e1935a1d0930a7c5.js +0 -1
- khoj/interface/compiled/_next/static/css/23f801d22927d568.css +0 -1
- khoj/interface/compiled/_next/static/css/592ca99f5122e75a.css +0 -1
- /khoj/interface/compiled/_next/static/{j4py4V8sxXHwFlBE4LvN_ → NgH-G9_Vv1P_eRtKrSh9k}/_buildManifest.js +0 -0
- /khoj/interface/compiled/_next/static/{j4py4V8sxXHwFlBE4LvN_ → NgH-G9_Vv1P_eRtKrSh9k}/_ssgManifest.js +0 -0
- {khoj-1.30.2.dev15.dist-info → khoj-1.30.2.dev28.dist-info}/WHEEL +0 -0
- {khoj-1.30.2.dev15.dist-info → khoj-1.30.2.dev28.dist-info}/entry_points.txt +0 -0
- {khoj-1.30.2.dev15.dist-info → khoj-1.30.2.dev28.dist-info}/licenses/LICENSE +0 -0
@@ -1 +1 @@
|
|
1
|
-
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" href="/_next/static/media/5455839c73f146e7-s.p.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="stylesheet" href="/_next/static/css/0e9d53dcd7f11342.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/1a4038cc4acc8ee4.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-224b38bd040ae7a0.js"/><script src="/_next/static/chunks/fd9d1056-2e6c8140e79afc3b.js" async=""></script><script src="/_next/static/chunks/7023-e8de2bded4df6539.js" async=""></script><script src="/_next/static/chunks/main-app-6d6ee3495efe03d4.js" async=""></script><meta name="robots" content="noindex"/><meta http-equiv="Content-Security-Policy" content="default-src 'self' https://assets.khoj.dev; media-src * blob:; script-src 'self' https://assets.khoj.dev 'unsafe-inline' 'unsafe-eval'; connect-src 'self' blob: https://ipapi.co/json ws://localhost:42110; style-src 'self' https://assets.khoj.dev 'unsafe-inline' https://fonts.googleapis.com; img-src 'self' data: blob: https://*.khoj.dev https://*.googleusercontent.com https://*.google.com/ https://*.gstatic.com; font-src 'self' https://assets.khoj.dev https://fonts.gstatic.com; child-src 'none'; object-src 'none';"/><title>404: This page could not be found.</title><title>Khoj AI - Home</title><meta name="description" content="Your Second Brain."/><link rel="manifest" href="/static/khoj.webmanifest" crossorigin="use-credentials"/><meta property="og:title" content="Khoj AI"/><meta property="og:description" content="Your Second Brain."/><meta property="og:url" content="https://app.khoj.dev/"/><meta property="og:site_name" content="Khoj AI"/><meta property="og:image" content="https://assets.khoj.dev/khoj_lantern_256x256.png"/><meta property="og:image:width" content="256"/><meta property="og:image:height" content="256"/><meta property="og:image" content="https://assets.khoj.dev/khoj_lantern_logomarktype_1200x630.png"/><meta property="og:image:width" content="1200"/><meta property="og:image:height" content="630"/><meta property="og:type" content="website"/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:title" content="Khoj AI"/><meta name="twitter:description" content="Your Second Brain."/><meta name="twitter:image" content="https://assets.khoj.dev/khoj_lantern_256x256.png"/><meta name="twitter:image:width" content="256"/><meta name="twitter:image:height" content="256"/><meta name="twitter:image" content="https://assets.khoj.dev/khoj_lantern_logomarktype_1200x630.png"/><meta name="twitter:image:width" content="1200"/><meta name="twitter:image:height" content="630"/><link rel="icon" href="/static/assets/icons/khoj_lantern.ico"/><link rel="apple-touch-icon" href="/static/assets/icons/khoj_lantern_256x256.png"/><meta name="next-size-adjust"/><script src="/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js" noModule=""></script></head><body class="__className_af6c42"><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><script src="/_next/static/chunks/webpack-224b38bd040ae7a0.js" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0]);self.__next_f.push([2,null])</script><script>self.__next_f.push([1,"1:HL[\"/_next/static/media/5455839c73f146e7-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n2:HL[\"/_next/static/css/0e9d53dcd7f11342.css\",\"style\"]\n3:HL[\"/_next/static/css/1a4038cc4acc8ee4.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"4:I[95751,[],\"\"]\n6:I[39275,[],\"\"]\n7:I[61343,[],\"\"]\nd:I[76130,[],\"\"]\n8:{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"}\n9:{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"}\na:{\"display\":\"inline-block\"}\nb:{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0}\ne:[]\n"])</script><script>self.__next_f.push([1,"0:[\"$\",\"$L4\",null,{\"buildId\":\"j4py4V8sxXHwFlBE4LvN_\",\"assetPrefix\":\"\",\"urlParts\":[\"\",\"_not-found\",\"\"],\"initialTree\":[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],\"initialSeedData\":[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{},[[\"$L5\",[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],null],null],null]},[null,[\"$\",\"$L6\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"/_not-found\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L7\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\"}]],null]},[[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/0e9d53dcd7f11342.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/1a4038cc4acc8ee4.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[[\"$\",\"meta\",null,{\"httpEquiv\":\"Content-Security-Policy\",\"content\":\"default-src 'self' https://assets.khoj.dev; media-src * blob:; script-src 'self' https://assets.khoj.dev 'unsafe-inline' 'unsafe-eval'; connect-src 'self' blob: https://ipapi.co/json ws://localhost:42110; style-src 'self' https://assets.khoj.dev 'unsafe-inline' https://fonts.googleapis.com; img-src 'self' data: blob: https://*.khoj.dev https://*.googleusercontent.com https://*.google.com/ https://*.gstatic.com; font-src 'self' https://assets.khoj.dev https://fonts.gstatic.com; child-src 'none'; object-src 'none';\"}],[\"$\",\"body\",null,{\"className\":\"__className_af6c42\",\"children\":[\"$\",\"$L6\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L7\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$8\",\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":\"$9\",\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":\"$a\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$b\",\"children\":\"This page could not be found.\"}]}]]}]}]],\"notFoundStyles\":[]}]}]]}]],null],null],\"couldBeIntercepted\":false,\"initialHead\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],\"$Lc\"],\"globalErrorComponent\":\"$d\",\"missingSlots\":\"$We\"}]\n"])</script><script>self.__next_f.push([1,"c:[[\"$\",\"meta\",\"0\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}],[\"$\",\"meta\",\"1\",{\"charSet\":\"utf-8\"}],[\"$\",\"title\",\"2\",{\"children\":\"Khoj AI - Home\"}],[\"$\",\"meta\",\"3\",{\"name\":\"description\",\"content\":\"Your Second Brain.\"}],[\"$\",\"link\",\"4\",{\"rel\":\"manifest\",\"href\":\"/static/khoj.webmanifest\",\"crossOrigin\":\"use-credentials\"}],[\"$\",\"meta\",\"5\",{\"property\":\"og:title\",\"content\":\"Khoj AI\"}],[\"$\",\"meta\",\"6\",{\"property\":\"og:description\",\"content\":\"Your Second Brain.\"}],[\"$\",\"meta\",\"7\",{\"property\":\"og:url\",\"content\":\"https://app.khoj.dev/\"}],[\"$\",\"meta\",\"8\",{\"property\":\"og:site_name\",\"content\":\"Khoj AI\"}],[\"$\",\"meta\",\"9\",{\"property\":\"og:image\",\"content\":\"https://assets.khoj.dev/khoj_lantern_256x256.png\"}],[\"$\",\"meta\",\"10\",{\"property\":\"og:image:width\",\"content\":\"256\"}],[\"$\",\"meta\",\"11\",{\"property\":\"og:image:height\",\"content\":\"256\"}],[\"$\",\"meta\",\"12\",{\"property\":\"og:image\",\"content\":\"https://assets.khoj.dev/khoj_lantern_logomarktype_1200x630.png\"}],[\"$\",\"meta\",\"13\",{\"property\":\"og:image:width\",\"content\":\"1200\"}],[\"$\",\"meta\",\"14\",{\"property\":\"og:image:height\",\"content\":\"630\"}],[\"$\",\"meta\",\"15\",{\"property\":\"og:type\",\"content\":\"website\"}],[\"$\",\"meta\",\"16\",{\"name\":\"twitter:card\",\"content\":\"summary_large_image\"}],[\"$\",\"meta\",\"17\",{\"name\":\"twitter:title\",\"content\":\"Khoj AI\"}],[\"$\",\"meta\",\"18\",{\"name\":\"twitter:description\",\"content\":\"Your Second Brain.\"}],[\"$\",\"meta\",\"19\",{\"name\":\"twitter:image\",\"content\":\"https://assets.khoj.dev/khoj_lantern_256x256.png\"}],[\"$\",\"meta\",\"20\",{\"name\":\"twitter:image:width\",\"content\":\"256\"}],[\"$\",\"meta\",\"21\",{\"name\":\"twitter:image:height\",\"content\":\"256\"}],[\"$\",\"meta\",\"22\",{\"name\":\"twitter:image\",\"content\":\"https://assets.khoj.dev/khoj_lantern_logomarktype_1200x630.png\"}],[\"$\",\"meta\",\"23\",{\"name\":\"twitter:image:width\",\"content\":\"1200\"}],[\"$\",\"meta\",\"24\",{\"name\":\"twitter:image:height\",\"content\":\"630\"}],[\"$\",\"link\",\"25\",{\"rel\":\"icon\",\"href\":\"/static/assets/icons/khoj_lantern.ico\"}],[\"$\",\"link\",\"26\",{\"rel\":\"apple-touch-icon\",\"href\":\"/static/assets/icons/khoj_lantern_256x256.png\"}],[\"$\",\"meta\",\"27\",{\"name\":\"next-size-adjust\"}]]\n"])</script><script>self.__next_f.push([1,"5:null\n"])</script></body></html>
|
1
|
+
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" href="/_next/static/media/5455839c73f146e7-s.p.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="stylesheet" href="/_next/static/css/0e9d53dcd7f11342.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/1a4038cc4acc8ee4.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-53ab241a813a122a.js"/><script src="/_next/static/chunks/fd9d1056-2e6c8140e79afc3b.js" async=""></script><script src="/_next/static/chunks/7023-e8de2bded4df6539.js" async=""></script><script src="/_next/static/chunks/main-app-6d6ee3495efe03d4.js" async=""></script><meta name="robots" content="noindex"/><meta http-equiv="Content-Security-Policy" content="default-src 'self' https://assets.khoj.dev; media-src * blob:; script-src 'self' https://assets.khoj.dev 'unsafe-inline' 'unsafe-eval'; connect-src 'self' blob: https://ipapi.co/json ws://localhost:42110; style-src 'self' https://assets.khoj.dev 'unsafe-inline' https://fonts.googleapis.com; img-src 'self' data: blob: https://*.khoj.dev https://*.googleusercontent.com https://*.google.com/ https://*.gstatic.com; font-src 'self' https://assets.khoj.dev https://fonts.gstatic.com; child-src 'none'; object-src 'none';"/><title>404: This page could not be found.</title><title>Khoj AI - Home</title><meta name="description" content="Your Second Brain."/><link rel="manifest" href="/static/khoj.webmanifest" crossorigin="use-credentials"/><meta property="og:title" content="Khoj AI"/><meta property="og:description" content="Your Second Brain."/><meta property="og:url" content="https://app.khoj.dev/"/><meta property="og:site_name" content="Khoj AI"/><meta property="og:image" content="https://assets.khoj.dev/khoj_lantern_256x256.png"/><meta property="og:image:width" content="256"/><meta property="og:image:height" content="256"/><meta property="og:image" content="https://assets.khoj.dev/khoj_lantern_logomarktype_1200x630.png"/><meta property="og:image:width" content="1200"/><meta property="og:image:height" content="630"/><meta property="og:type" content="website"/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:title" content="Khoj AI"/><meta name="twitter:description" content="Your Second Brain."/><meta name="twitter:image" content="https://assets.khoj.dev/khoj_lantern_256x256.png"/><meta name="twitter:image:width" content="256"/><meta name="twitter:image:height" content="256"/><meta name="twitter:image" content="https://assets.khoj.dev/khoj_lantern_logomarktype_1200x630.png"/><meta name="twitter:image:width" content="1200"/><meta name="twitter:image:height" content="630"/><link rel="icon" href="/static/assets/icons/khoj_lantern.ico"/><link rel="apple-touch-icon" href="/static/assets/icons/khoj_lantern_256x256.png"/><meta name="next-size-adjust"/><script src="/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js" noModule=""></script></head><body class="__className_af6c42"><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><script src="/_next/static/chunks/webpack-53ab241a813a122a.js" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0]);self.__next_f.push([2,null])</script><script>self.__next_f.push([1,"1:HL[\"/_next/static/media/5455839c73f146e7-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n2:HL[\"/_next/static/css/0e9d53dcd7f11342.css\",\"style\"]\n3:HL[\"/_next/static/css/1a4038cc4acc8ee4.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"4:I[95751,[],\"\"]\n6:I[39275,[],\"\"]\n7:I[61343,[],\"\"]\nd:I[76130,[],\"\"]\n8:{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"}\n9:{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"}\na:{\"display\":\"inline-block\"}\nb:{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0}\ne:[]\n"])</script><script>self.__next_f.push([1,"0:[\"$\",\"$L4\",null,{\"buildId\":\"NgH-G9_Vv1P_eRtKrSh9k\",\"assetPrefix\":\"\",\"urlParts\":[\"\",\"_not-found\",\"\"],\"initialTree\":[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],\"initialSeedData\":[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{},[[\"$L5\",[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],null],null],null]},[null,[\"$\",\"$L6\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"/_not-found\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L7\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\"}]],null]},[[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/0e9d53dcd7f11342.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/1a4038cc4acc8ee4.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[[\"$\",\"meta\",null,{\"httpEquiv\":\"Content-Security-Policy\",\"content\":\"default-src 'self' https://assets.khoj.dev; media-src * blob:; script-src 'self' https://assets.khoj.dev 'unsafe-inline' 'unsafe-eval'; connect-src 'self' blob: https://ipapi.co/json ws://localhost:42110; style-src 'self' https://assets.khoj.dev 'unsafe-inline' https://fonts.googleapis.com; img-src 'self' data: blob: https://*.khoj.dev https://*.googleusercontent.com https://*.google.com/ https://*.gstatic.com; font-src 'self' https://assets.khoj.dev https://fonts.gstatic.com; child-src 'none'; object-src 'none';\"}],[\"$\",\"body\",null,{\"className\":\"__className_af6c42\",\"children\":[\"$\",\"$L6\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L7\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$8\",\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":\"$9\",\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":\"$a\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$b\",\"children\":\"This page could not be found.\"}]}]]}]}]],\"notFoundStyles\":[]}]}]]}]],null],null],\"couldBeIntercepted\":false,\"initialHead\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],\"$Lc\"],\"globalErrorComponent\":\"$d\",\"missingSlots\":\"$We\"}]\n"])</script><script>self.__next_f.push([1,"c:[[\"$\",\"meta\",\"0\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}],[\"$\",\"meta\",\"1\",{\"charSet\":\"utf-8\"}],[\"$\",\"title\",\"2\",{\"children\":\"Khoj AI - Home\"}],[\"$\",\"meta\",\"3\",{\"name\":\"description\",\"content\":\"Your Second Brain.\"}],[\"$\",\"link\",\"4\",{\"rel\":\"manifest\",\"href\":\"/static/khoj.webmanifest\",\"crossOrigin\":\"use-credentials\"}],[\"$\",\"meta\",\"5\",{\"property\":\"og:title\",\"content\":\"Khoj AI\"}],[\"$\",\"meta\",\"6\",{\"property\":\"og:description\",\"content\":\"Your Second Brain.\"}],[\"$\",\"meta\",\"7\",{\"property\":\"og:url\",\"content\":\"https://app.khoj.dev/\"}],[\"$\",\"meta\",\"8\",{\"property\":\"og:site_name\",\"content\":\"Khoj AI\"}],[\"$\",\"meta\",\"9\",{\"property\":\"og:image\",\"content\":\"https://assets.khoj.dev/khoj_lantern_256x256.png\"}],[\"$\",\"meta\",\"10\",{\"property\":\"og:image:width\",\"content\":\"256\"}],[\"$\",\"meta\",\"11\",{\"property\":\"og:image:height\",\"content\":\"256\"}],[\"$\",\"meta\",\"12\",{\"property\":\"og:image\",\"content\":\"https://assets.khoj.dev/khoj_lantern_logomarktype_1200x630.png\"}],[\"$\",\"meta\",\"13\",{\"property\":\"og:image:width\",\"content\":\"1200\"}],[\"$\",\"meta\",\"14\",{\"property\":\"og:image:height\",\"content\":\"630\"}],[\"$\",\"meta\",\"15\",{\"property\":\"og:type\",\"content\":\"website\"}],[\"$\",\"meta\",\"16\",{\"name\":\"twitter:card\",\"content\":\"summary_large_image\"}],[\"$\",\"meta\",\"17\",{\"name\":\"twitter:title\",\"content\":\"Khoj AI\"}],[\"$\",\"meta\",\"18\",{\"name\":\"twitter:description\",\"content\":\"Your Second Brain.\"}],[\"$\",\"meta\",\"19\",{\"name\":\"twitter:image\",\"content\":\"https://assets.khoj.dev/khoj_lantern_256x256.png\"}],[\"$\",\"meta\",\"20\",{\"name\":\"twitter:image:width\",\"content\":\"256\"}],[\"$\",\"meta\",\"21\",{\"name\":\"twitter:image:height\",\"content\":\"256\"}],[\"$\",\"meta\",\"22\",{\"name\":\"twitter:image\",\"content\":\"https://assets.khoj.dev/khoj_lantern_logomarktype_1200x630.png\"}],[\"$\",\"meta\",\"23\",{\"name\":\"twitter:image:width\",\"content\":\"1200\"}],[\"$\",\"meta\",\"24\",{\"name\":\"twitter:image:height\",\"content\":\"630\"}],[\"$\",\"link\",\"25\",{\"rel\":\"icon\",\"href\":\"/static/assets/icons/khoj_lantern.ico\"}],[\"$\",\"link\",\"26\",{\"rel\":\"apple-touch-icon\",\"href\":\"/static/assets/icons/khoj_lantern_256x256.png\"}],[\"$\",\"meta\",\"27\",{\"name\":\"next-size-adjust\"}]]\n"])</script><script>self.__next_f.push([1,"5:null\n"])</script></body></html>
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1210],{51210:function(e,t,i){i.r(t),i.d(t,{default:function(){return f}});var n=i(57437),a=i(2265),l=i(57818),d=i(60266),r=i(50495),s=i(10077),o=i(46613);let c=(0,l.default)(async()=>(await Promise.resolve().then(i.t.bind(i,60266,23))).Excalidraw,{loadableGenerated:{webpack:()=>[60266]},ssr:!1});function f(e){let[t,i]=(0,a.useState)([]),[l,f]=(0,a.useState)(!1),u=e=>void 0!==e.x&&void 0!==e.y&&void 0!==e.id&&void 0!==e.type;return(0,a.useEffect)(()=>{onkeydown=l?e=>{"Escape"===e.key&&(f(!1),window.dispatchEvent(new Event("resize")))}:null},[l]),(0,a.useEffect)(()=>{let t=[];for(let i of e.data)u(i)&&t.push(i);let n=[];for(let e of t)if("frame"!==e.type){if("arrow"===e.type){if(e.start&&!t.find(t=>{var i;return t.id===(null===(i=e.start)||void 0===i?void 0:i.id)})||e.end&&!t.find(t=>{var i;return t.id===(null===(i=e.end)||void 0===i?void 0:i.id)}))continue;n.push(e)}else n.push(e)}for(let e of t)if("frame"===e.type){var a;let t=null===(a=e.children)||void 0===a?void 0:a.map(e=>n.find(t=>t.id===e)),i=null==t?void 0:t.map(e=>null==e?void 0:e.id).filter(e=>void 0!==e);if(void 0===i||0===i.length)continue;n.push({...e,children:i})}i((0,d.convertToExcalidrawElements)(n))},[]),(0,n.jsx)("div",{className:"relative",children:(0,n.jsxs)("div",{className:"".concat(l?"fixed inset-0 bg-black bg-opacity-50 backdrop-blur-sm z-50 flex items-center justify-center":""),children:[(0,n.jsx)(r.z,{onClick:()=>{f(!l),window.dispatchEvent(new Event("resize"))},variant:"outline",className:"".concat(l?"absolute top-2 left-2 z-[60]":""),children:l?(0,n.jsx)(s.f,{className:"h-4 w-4"}):(0,n.jsx)(o.t,{className:"h-4 w-4"})}),(0,n.jsx)("div",{className:"\n ".concat(l?"w-[80vw] h-[80vh]":"w-full h-[500px]","\n bg-white overflow-hidden rounded-lg relative\n "),children:(0,n.jsx)(c,{initialData:{elements:t,appState:{zenModeEnabled:!0},scrollToContent:!0},theme:"dark"===localStorage.getItem("theme")?"dark":"light",validateEmbeddable:!0,renderTopRightUI:(e,t)=>(0,n.jsx)(n.Fragment,{})})})]})})}}}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1970],{81970:function(e,t,s){"use strict";s.d(t,{EY:function(){return es},ks:function(){return ea},bc:function(){return et}});var a=s(57437),r=s(2288),l=s.n(r),n=s(2265),i=s(50495),o=s(58284),c=s(5989),d=s(12275),u=s(18444),h=s(31784),x=s(20319),m=s(98750),f=s(55362),p=s(57691),j=s(68029),g=s(68131),v=s(83632),b=s(9950),N=s(35418),y=s(84120),w=s(95289),_=s(26100),k=s(26058),C=s(15780),z=s(59772),S=s(36013),T=s(90837),I=s(66820),P=s(89417),V=s(58575),O=s(47412),R=s(32653),q=s(39343),A=s(83102),F=s(31014),B=s(93146),E=s(46294),J=s(13304),D=s(40882);let W=D.fC,Z=D.wy,M=D.Fw;var X=s(37440),G=s(42491),Y=s(9557),K=s(6780),L=s(70571),Q=s(19573),U=s(18642),$=s(19666);async function H(e,t){let s="/login?next=/agents?agent=".concat(e);if(!t){window.location.href=s;return}let a=await fetch("/api/chat/sessions?agent_slug=".concat(encodeURIComponent(e)),{method:"POST"}),r=await a.json();200==a.status?window.location.href="/chat?conversationId=".concat(r.conversation_id):403==a.status||401==a.status?window.location.href=s:alert("Failed to start chat session")}function ee(e){var t;let s=(null===(t=e.text)||void 0===t?void 0:t.replace(/^\w/,e=>e.toUpperCase()))||"";return(0,a.jsx)($.pn,{children:(0,a.jsxs)($.u,{children:[(0,a.jsx)($._v,{asChild:!0,children:(0,a.jsx)("div",{className:"text-sm",children:e.hoverText||s})}),(0,a.jsx)($.aJ,{className:"cursor-text",children:(0,a.jsxs)("div",{className:"flex items-center space-x-2 rounded-full border-accent-500 border p-1.5",children:[(0,a.jsx)("div",{className:"text-muted-foreground",children:e.icon}),s&&s.length>0&&(0,a.jsx)("div",{className:"text-muted-foreground text-sm",children:s})]})})]})})}let et=z.z.object({name:z.z.string({required_error:"Name is required"}).min(1,"Name is required"),persona:z.z.string({required_error:"Personality is required"}).min(1,"Personality is required"),color:z.z.string({required_error:"Color is required"}).min(1,"Color is required"),icon:z.z.string({required_error:"Icon is required"}).min(1,"Icon is required"),privacy_level:z.z.string({required_error:"Privacy level is required"}).min(1,"Privacy level is required"),chat_model:z.z.string({required_error:"Chat model is required"}).min(1,"Chat model is required"),files:z.z.array(z.z.string()).default([]).optional(),input_tools:z.z.array(z.z.string()).default([]).optional(),output_modes:z.z.array(z.z.string()).default([]).optional()});function es(e){var t;let[s,r]=(0,n.useState)(e.agentSlug===e.data.slug),[j,g]=(0,n.useState)(!1),[v,b]=(0,n.useState)(null),N=(0,a.jsx)(o.H,{}),y="Private agents are only visible to you.";"public"===e.data.privacy_level?(N=(0,a.jsx)(c.T,{}),y="Public agents are visible to everyone."):"protected"===e.data.privacy_level&&(N=(0,a.jsx)(d.M,{}),y="Protected agents are visible to anyone with a direct link.");let w=e.userProfile,_=(0,q.cI)({resolver:(0,F.F)(et),defaultValues:{name:e.data.name,persona:e.data.persona,color:e.data.color,icon:e.data.icon,privacy_level:e.data.privacy_level,chat_model:e.data.chat_model,files:e.data.files,input_tools:e.data.input_tools,output_modes:e.data.output_modes}});(0,n.useEffect)(()=>{_.reset({name:e.data.name,persona:e.data.persona,color:e.data.color,icon:e.data.icon,privacy_level:e.data.privacy_level,chat_model:e.data.chat_model,files:e.data.files,input_tools:e.data.input_tools,output_modes:e.data.output_modes})},[e.data]),s&&window.history.pushState({},"Khoj AI - Agent ".concat(e.data.slug),"/agents?agent=".concat(e.data.slug));let k=(0,V.oz)(e.data.color);function C(){return(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-1",children:[e.editCard&&(0,a.jsx)(ee,{icon:N,text:e.data.privacy_level,hoverText:y}),e.data.files&&e.data.files.length>0&&(0,a.jsx)(ee,{icon:(0,a.jsx)(u.f,{}),text:"knowledge",hoverText:"The agent has a custom knowledge base with ".concat(e.data.files.length," documents. It can use them to give you answers.")}),(0,a.jsx)(ee,{icon:(0,a.jsx)(h.a,{}),text:e.data.chat_model,hoverText:"The agent uses the ".concat(e.data.chat_model," model to chat with you.")}),e.data.output_modes.map(t=>(0,a.jsx)(ee,{icon:(0,P.vH)(t),hoverText:"".concat(t,": ").concat(e.outputModeOptions[t])},t)),e.data.input_tools.map(t=>(0,a.jsx)(ee,{icon:(0,P.vH)(t),hoverText:"".concat(t,": ").concat(e.inputToolOptions[t])},t))]})}return(0,a.jsxs)(S.Zb,{className:"shadow-sm bg-gradient-to-b from-white 20% to-".concat(e.data.color?e.data.color:"gray","-100/50 dark:from-[hsl(var(--background))] dark:to-").concat(e.data.color?e.data.color:"gray","-950/50 rounded-xl hover:shadow-md"),children:[j&&(0,a.jsx)(I.Z,{loginRedirectMessage:"Sign in to start chatting with ".concat(e.data.name),onOpenChange:g}),(0,a.jsx)(S.Ol,{children:(0,a.jsx)(S.ll,{children:(0,a.jsxs)(T.Vq,{open:s,onOpenChange:()=>{r(!s),window.history.pushState({},"Khoj AI - Agents","/agents")},children:[(0,a.jsx)(T.hg,{className:"focus-visible:outline-none",children:(0,a.jsxs)("div",{className:"flex items-center relative top-2",children:[(0,P.TI)(e.data.icon,e.data.color),e.data.name]})}),(0,a.jsxs)("div",{className:"flex float-right",children:[e.editCard&&(0,a.jsx)("div",{className:"float-right",children:(0,a.jsxs)(Q.J2,{children:[(0,a.jsx)(Q.xo,{children:(0,a.jsx)(i.z,{className:"bg-[hsl(var(--background))] w-10 h-10 p-0 rounded-xl border dark:border-neutral-700 shadow-sm hover:bg-stone-100 dark:hover:bg-neutral-900",children:(0,a.jsx)(x.F,{className:"w-6 h-6 ".concat((0,V.oz)(e.data.color))})})}),(0,a.jsxs)(Q.yk,{className:"w-fit grid p-1",side:"bottom",align:"end",children:[(0,a.jsxs)(i.z,{className:"items-center justify-start",variant:"ghost",onClick:()=>r(!0),children:[(0,a.jsx)(m.z,{className:"w-4 h-4 mr-2"}),"Edit"]}),e.editCard&&"private"!==e.data.privacy_level&&(0,a.jsx)(U.Z,{buttonTitle:"Share",title:"Share Agent",description:"Share a link to this agent with others. They'll be able to chat with it, and ask questions to all of its knowledge base.",buttonVariant:"ghost",includeIcon:!0,url:"".concat(window.location.origin,"/agents?agent=").concat(e.data.slug)}),e.data.creator===(null==w?void 0:w.username)&&(0,a.jsxs)(i.z,{className:"items-center justify-start",variant:"destructive",onClick:()=>{fetch("/api/agents/".concat(e.data.slug),{method:"DELETE"}).then(()=>{e.setAgentChangeTriggered(!0)})},children:[(0,a.jsx)(f.r,{className:"w-4 h-4 mr-2"}),"Delete"]})]})]})}),(null===(t=e.showChatButton)||void 0===t||t)&&(0,a.jsx)("div",{className:"float-right",children:e.userProfile?(0,a.jsx)(i.z,{className:"bg-[hsl(var(--background))] w-10 h-10 p-0 rounded-xl border dark:border-neutral-700 shadow-sm hover:bg-stone-100 dark:hover:bg-neutral-900",onClick:()=>H(e.data.slug,w),children:(0,a.jsx)(p.g,{className:"w-6 h-6 ".concat((0,V.oz)(e.data.color))})}):(0,a.jsx)(i.z,{className:"bg-[hsl(var(--background))] w-14 h-14 rounded-xl border dark:border-neutral-700 shadow-sm hover:bg-stone-100 dark:hover:bg-neutral-900",onClick:()=>g(!0),children:(0,a.jsx)(p.g,{className:"w-6 h-6 ".concat((0,V.oz)(e.data.color))})})})]}),e.editCard?(0,a.jsxs)(T.cZ,{className:"lg:max-w-screen-lg overflow-y-scroll max-h-screen",children:[(0,a.jsxs)(J.$N,{children:["Edit ",(0,a.jsx)("b",{children:e.data.name})]}),(0,a.jsx)(ea,{form:_,onSubmit:t=>{let s=e.editCard?"PATCH":"POST",a=t;e.editCard&&(a={...t,slug:e.data.slug}),fetch("/api/agents",{method:s,headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}).then(t=>{200===t.status?(_.reset(),r(!1),b(null),e.setAgentChangeTriggered(!0)):t.json().then(e=>{console.error(e),_.clearErrors(),e.error&&b(e.error)})}).catch(e=>{console.error("Error:",e),b(e),_.clearErrors()})},create:!1,errors:v,filesOptions:e.filesOptions,modelOptions:e.modelOptions,slug:e.data.slug,inputToolOptions:e.inputToolOptions,isSubscribed:e.isSubscribed,outputModeOptions:e.outputModeOptions})]}):(0,a.jsxs)(T.cZ,{className:"whitespace-pre-line max-h-[80vh] max-w-[90vw] rounded-lg",children:[(0,a.jsx)(T.fK,{children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,P.TI)(e.data.icon,e.data.color),(0,a.jsx)("p",{className:"font-bold text-lg",children:e.data.name})]})}),(0,a.jsx)("div",{className:"max-h-[60vh] overflow-y-scroll text-neutral-500 dark:text-white",children:e.data.persona}),(0,a.jsx)("div",{className:"flex flex-wrap items-center gap-1",children:C()}),(0,a.jsx)(T.cN,{children:(0,a.jsxs)(i.z,{className:"pt-6 pb-6 ".concat(k," bg-white dark:bg-[hsl(var(--background))] text-neutral-500 dark:text-white border-2 border-stone-100 shadow-sm rounded-xl hover:bg-stone-100 dark:hover:bg-neutral-900 dark:border-neutral-700"),onClick:()=>{H(e.data.slug,w),r(!1)},children:[(0,a.jsx)(p.g,{className:"w-6 h-6 m-2 ".concat((0,V.oz)(e.data.color))}),"Start Chatting"]})})]})]})})}),(0,a.jsx)(S.aY,{children:(0,a.jsx)("div",{className:l().agentPersonality,children:(0,a.jsx)("button",{className:"".concat(l().infoButton," text-neutral-500 dark:text-white"),onClick:()=>r(!0),children:(0,a.jsx)("p",{children:e.data.persona})})})}),(0,a.jsx)(S.eW,{children:(0,a.jsx)("div",{className:"flex flex-wrap items-center gap-1",children:C()})})]})}function ea(e){let[t,s]=(0,n.useState)(!1),r=(0,P.BI)(),l=V.xF,o=(0,V.oz)(e.form.getValues("color")),[c,d]=(0,n.useState)(!1),[u,h]=(0,n.useState)(null),[x,m]=(0,n.useState)(null),[f,p]=(0,n.useState)(!1),[z,S]=(0,n.useState)(0),[T,I]=(0,n.useState)([]),[q,F]=(0,n.useState)([]),[J,D]=(0,n.useState)(0),[U,$]=(0,n.useState)(!1),H=["public","private","protected"],ee=[{fields:[{name:"name",label:"Name"},{name:"persona",label:"Personality"}],label:"Basic Settings"},{fields:[{name:"color",label:"Color"},{name:"icon",label:"Icon"},{name:"chat_model",label:"Chat Model"},{name:"privacy_level",label:"Privacy Level"}],label:"Customization & Access"},{fields:[{name:"files",label:"Knowledge Base"},{name:"input_tools",label:"Input Tools"},{name:"output_modes",label:"Output Modes"}],label:"Advanced Settings"}],es=(0,n.useRef)(null);function ea(e){e.preventDefault(),d(!0)}function er(e){e.preventDefault(),d(!1)}function el(e){e.preventDefault(),d(!1),e.dataTransfer.files&&en(e.dataTransfer.files)}function en(e){(0,Y.ko)(e,h,p,m,I)}function ei(){es&&es.current&&es.current.click()}function eo(e){e.target.files&&en(e.target.files)}(0,n.useEffect)(()=>{if(f||S(0),f){let e=setInterval(()=>{S(e=>{let t=e+(Math.floor(5*Math.random())+1);return t<100?t:100})},800);return()=>clearInterval(e)}},[f]),(0,n.useEffect)(()=>{F(Array.from(new Set([...q,...e.form.getValues("files")||[],...e.filesOptions||[]])))},[]),(0,n.useEffect)(()=>{T.length>0&&(ec(T),F(e=>[...e,...T]))},[T]),(0,n.useEffect)(()=>{e.errors&&s(!1)},[e.errors]);let ec=t=>{for(let s of t){let t=e.form.getValues("files")||[],a=t.includes(s)?t.filter(e=>e!==s):[...t,s];e.form.setValue("files",a)}};if(U)return(0,a.jsx)(K.aR,{open:!0,children:(0,a.jsxs)(K._T,{children:[(0,a.jsx)(K.fY,{children:(0,a.jsx)(K.f$,{children:"Upgrade to Futurist"})}),(0,a.jsxs)(K.yT,{children:["You need to be a Futurist subscriber to create more agents."," ",(0,a.jsx)("a",{href:"/settings",children:"Upgrade now"}),"."]}),(0,a.jsxs)(K.xo,{children:[(0,a.jsx)(K.le,{onClick:()=>{$(!1)},children:"Cancel"}),(0,a.jsx)(K.OL,{onClick:()=>{window.location.href="/settings"},children:"Continue"})]})]})});let ed=t=>{switch(t){case"name":return(0,a.jsx)(R.Wi,{control:e.form.control,name:"name",render:e=>{let{field:t}=e;return(0,a.jsxs)(R.xJ,{className:"space-y-0 grid gap-2",children:[(0,a.jsx)(R.lX,{children:"Name"}),(0,a.jsx)(R.pf,{children:"What should this agent be called? Pick something descriptive & memorable."}),(0,a.jsx)(R.NI,{children:(0,a.jsx)(A.I,{placeholder:"Biologist",...t})}),(0,a.jsx)(R.zG,{})]})}},t);case"chat_model":return(0,a.jsx)(R.Wi,{control:e.form.control,name:"chat_model",render:t=>{let{field:s}=t;return(0,a.jsxs)(R.xJ,{className:"space-y-1 grid gap-2",children:[(0,a.jsx)(R.lX,{children:"Chat Model"}),(0,a.jsx)(R.pf,{children:e.isSubscribed?(0,a.jsx)("p",{children:"Which chat model would you like to use?"}):(0,a.jsxs)("p",{className:"text-secondary-foreground",children:["Upgrade to the ",(0,a.jsx)("a",{href:"/settings",children:"Futurist plan"})," to access all models."]})}),(0,a.jsxs)(E.Ph,{onValueChange:s.onChange,defaultValue:s.value,disabled:!e.isSubscribed,children:[(0,a.jsx)(R.NI,{children:(0,a.jsx)(E.i4,{className:"text-left",children:(0,a.jsx)(E.ki,{})})}),(0,a.jsx)(E.Bw,{className:"items-start space-y-1 inline-flex flex-col",children:e.modelOptions.map(e=>(0,a.jsx)(E.Ql,{value:e.name,children:(0,a.jsx)("div",{className:"flex items-center space-x-2",children:e.name})},e.id))})]}),(0,a.jsx)(R.zG,{})]})}},t);case"privacy_level":return(0,a.jsx)(R.Wi,{control:e.form.control,name:"privacy_level",render:e=>{let{field:t}=e;return(0,a.jsxs)(R.xJ,{className:"space-y-1 grid gap-2",children:[(0,a.jsx)(R.lX,{children:(0,a.jsx)("div",{children:"Privacy Level"})}),(0,a.jsx)(R.pf,{children:(0,a.jsxs)(Q.J2,{children:[(0,a.jsx)(Q.xo,{asChild:!0,children:(0,a.jsx)(i.z,{variant:"ghost",className:"p-0 h-fit",children:(0,a.jsxs)("span",{className:"items-center flex gap-1 text-sm",children:[(0,a.jsx)(j.k,{className:"inline"}),(0,a.jsx)("p",{className:"text-sm",children:"Learn more"})]})})}),(0,a.jsxs)(Q.yk,{children:[(0,a.jsx)("b",{children:"Private"}),": only visible to you.",(0,a.jsx)("br",{}),(0,a.jsx)("b",{children:"Protected"}),": visible to anyone with a link.",(0,a.jsx)("br",{}),(0,a.jsx)("b",{children:"Public"}),": visible to everyone.",(0,a.jsx)("br",{}),"All public agents will be reviewed by us before they are launched."]})]})}),(0,a.jsxs)(E.Ph,{onValueChange:t.onChange,defaultValue:t.value,children:[(0,a.jsx)(R.NI,{children:(0,a.jsx)(E.i4,{className:"w-[200px]",children:(0,a.jsx)(E.ki,{placeholder:"private"})})}),(0,a.jsx)(E.Bw,{className:"items-center space-y-1 inline-flex flex-col",children:H.map(e=>(0,a.jsx)(E.Ql,{value:e,children:(0,a.jsx)("div",{className:"flex items-center space-x-2",children:e})},e))})]}),(0,a.jsx)(R.zG,{})]})}},t);case"color":return(0,a.jsx)(R.Wi,{control:e.form.control,name:"color",render:e=>{let{field:t}=e;return(0,a.jsxs)(R.xJ,{className:"space-y-3",children:[(0,a.jsx)(R.lX,{children:"Color"}),(0,a.jsxs)(E.Ph,{onValueChange:t.onChange,defaultValue:t.value,children:[(0,a.jsx)(R.NI,{children:(0,a.jsx)(E.i4,{className:"w-[200px]",children:(0,a.jsx)(E.ki,{placeholder:"Color"})})}),(0,a.jsx)(E.Bw,{className:"items-center space-y-1 inline-flex flex-col",children:l.map(e=>(0,a.jsx)(E.Ql,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(g.C,{className:"w-6 h-6 mr-2 ".concat((0,V.oz)(e)),weight:"fill"}),e]})},e))})]}),(0,a.jsx)(R.zG,{})]})}},t);case"icon":return(0,a.jsx)(R.Wi,{control:e.form.control,name:"icon",render:t=>{let{field:s}=t;return(0,a.jsxs)(R.xJ,{className:"space-y-3",children:[(0,a.jsx)(R.lX,{children:"Icon"}),(0,a.jsxs)(E.Ph,{onValueChange:s.onChange,defaultValue:s.value,children:[(0,a.jsx)(R.NI,{children:(0,a.jsx)(E.i4,{className:"w-[200px]",children:(0,a.jsx)(E.ki,{placeholder:"Icon"})})}),(0,a.jsx)(E.Bw,{className:"items-center space-y-1 inline-flex flex-col",children:r.map(t=>(0,a.jsx)(E.Ql,{value:t,children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,P.TI)(t,e.form.getValues("color"),"w-6","h-6"),t]})},t))})]}),(0,a.jsx)(R.zG,{})]})}},t);case"persona":return(0,a.jsx)(R.Wi,{control:e.form.control,name:"persona",render:e=>{let{field:t}=e;return(0,a.jsxs)(R.xJ,{className:"space-y-1 grid gap-2",children:[(0,a.jsx)(R.lX,{children:"Personality"}),(0,a.jsx)(R.pf,{children:"What is the personality, thought process, or tuning of this agent? Get creative; this is how you can influence the agent constitution."}),(0,a.jsx)(R.NI,{children:(0,a.jsx)(B.g,{placeholder:"You are an excellent biologist, at the top of your field in marine biology.",...t})}),(0,a.jsx)(R.zG,{})]})}},t);case"files":return(0,a.jsx)(R.Wi,{control:e.form.control,name:"files",render:t=>{let{field:s}=t;return(0,a.jsxs)(R.xJ,{className:"flex flex-col gap-2",children:[(0,a.jsx)(R.lX,{children:"Knowledge Base"}),(0,a.jsxs)(R.pf,{children:["Which information should be part of its digital brain?"," ",(0,a.jsx)("a",{href:"/settings",children:"Manage data"}),"."]}),(0,a.jsxs)(W,{children:[(0,a.jsxs)(Z,{className:"flex items-center justify-between text-sm gap-2",children:[(0,a.jsx)(v.K,{}),s.value&&s.value.length>0?"".concat(s.value.length," files selected"):"Select files"]}),(0,a.jsx)(M,{children:(0,a.jsxs)(G.mY,{children:[(0,a.jsx)(K.aR,{open:null!==u||null!=x,children:(0,a.jsxs)(K._T,{children:[(0,a.jsx)(K.fY,{children:(0,a.jsx)(K.f$,{children:"Alert"})}),(0,a.jsx)(K.yT,{children:u||x}),(0,a.jsx)(K.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>{h(null),m(null),p(!1)},children:"Close"})]})}),(0,a.jsxs)("div",{className:"flex flex-col h-full cursor-pointer",onDragOver:ea,onDragLeave:er,onDrop:el,onClick:ei,children:[(0,a.jsx)("input",{type:"file",multiple:!0,ref:es,style:{display:"none"},onChange:eo}),(0,a.jsx)("div",{className:"flex-none p-4",children:f&&(0,a.jsx)(L.E,{indicatorColor:"bg-slate-500",className:"w-full h-2 rounded-full",value:z})}),(0,a.jsx)("div",{className:"flex-none p-4 bg-secondary border-b ".concat(c?"animate-pulse":""," rounded-lg"),children:(0,a.jsx)("div",{className:"flex items-center justify-center w-full h-16 border-2 border-dashed border-gray-300 rounded-lg",children:c?(0,a.jsxs)("div",{className:"flex items-center justify-center w-full h-full",children:[(0,a.jsx)(b.u,{className:"h-6 w-6 mr-2"}),(0,a.jsx)("span",{children:"Drop files to upload"})]}):(0,a.jsxs)("div",{className:"flex items-center justify-center w-full h-full",children:[(0,a.jsx)(N.v,{className:"h-6 w-6 mr-2"}),(0,a.jsx)("span",{children:"Drag and drop files here"})]})})})]}),(0,a.jsx)(G.sZ,{placeholder:"Select files..."}),(0,a.jsxs)(G.e8,{children:[(0,a.jsx)(G.rb,{children:"No files found."}),(0,a.jsx)(G.fu,{children:q.map(t=>(0,a.jsxs)(G.di,{value:t,onSelect:()=>{let s=e.form.getValues("files")||[],a=s.includes(t)?s.filter(e=>e!==t):[...s,t];e.form.setValue("files",a)},children:[(0,a.jsx)(y.J,{className:(0,X.cn)("mr-2 h-4 w-4",s.value&&s.value.includes(t)?"opacity-100":"opacity-0")}),t]},t))})]})]})})]})]})}},t);case"input_tools":return(0,a.jsx)(R.Wi,{control:e.form.control,name:"input_tools",render:t=>{let{field:s}=t;return(0,a.jsxs)(R.xJ,{className:"flex flex-col gap-2",children:[(0,a.jsx)(R.lX,{children:"Restrict Input Tools"}),(0,a.jsxs)(R.pf,{children:["Which knowledge retrieval tools should this agent be limited to?",(0,a.jsx)("br",{}),(0,a.jsx)("b",{children:"Default:"})," No limitations."]}),(0,a.jsxs)(W,{children:[(0,a.jsxs)(Z,{className:"flex items-center justify-between text-sm gap-2",children:[(0,a.jsx)(v.K,{}),s.value&&s.value.length>0?"".concat(s.value.length," tools selected"):"All tools"]}),(0,a.jsx)(M,{children:(0,a.jsx)(G.mY,{children:(0,a.jsx)(G.e8,{children:(0,a.jsx)(G.fu,{children:Object.entries(e.inputToolOptions).map(t=>{let[r,l]=t;return(0,a.jsxs)(G.di,{value:r,onSelect:()=>{let t=e.form.getValues("input_tools")||[],s=t.includes(r)?t.filter(e=>e!==r):[...t,r];e.form.setValue("input_tools",s)},children:[(0,a.jsx)(y.J,{className:(0,X.cn)("mr-2 h-4 w-4",s.value&&s.value.includes(r)?"opacity-100":"opacity-0")}),(0,a.jsxs)("div",{className:(0,X.cn)("flex items-center space-x-2"),children:[(0,a.jsx)("p",{children:(0,a.jsx)("b",{children:r})}),(0,a.jsx)("p",{children:l})]})]},r)})})})})})]})]})}},t);case"output_modes":return(0,a.jsx)(R.Wi,{control:e.form.control,name:"output_modes",render:t=>{let{field:s}=t;return(0,a.jsxs)(R.xJ,{className:"flex flex-col gap-2",children:[(0,a.jsx)(R.lX,{children:"Restrict Output Modes"}),(0,a.jsxs)(R.pf,{children:["Which output modes should this agent be limited to?",(0,a.jsx)("br",{}),(0,a.jsx)("b",{children:"Default:"})," No limitations."]}),(0,a.jsxs)(W,{children:[(0,a.jsxs)(Z,{className:"flex items-center justify-between text-sm gap-2",children:[(0,a.jsx)(v.K,{}),s.value&&s.value.length>0?"".concat(s.value.length," modes selected"):"All modes"]}),(0,a.jsx)(M,{children:(0,a.jsx)(G.mY,{children:(0,a.jsx)(G.e8,{children:(0,a.jsx)(G.fu,{children:Object.entries(e.outputModeOptions).map(t=>{let[r,l]=t;return(0,a.jsxs)(G.di,{value:r,onSelect:()=>{let t=e.form.getValues("output_modes")||[],s=t.includes(r)?t.filter(e=>e!==r):[...t,r];e.form.setValue("output_modes",s)},children:[(0,a.jsx)(y.J,{className:(0,X.cn)("mr-2 h-4 w-4",s.value&&s.value.includes(r)?"opacity-100":"opacity-0")}),(0,a.jsxs)("div",{className:(0,X.cn)("flex items-center space-x-2"),children:[(0,a.jsx)("p",{children:(0,a.jsx)("b",{children:r})}),(0,a.jsx)("p",{children:l})]})]},r)})})})})})]})]})}},t);default:return null}};return(0,a.jsx)(R.l0,{...e.form,children:(0,a.jsxs)("form",{onSubmit:e.form.handleSubmit(t=>{e.onSubmit(t),s(!0)}),className:"space-y-6",children:[(0,a.jsx)("div",{className:"space-y-6",children:ee[J].label}),J<ee.length&&ee[J].fields.map(e=>ed(e.name)),(0,a.jsxs)("div",{className:"flex justify-between mt-4",children:[(0,a.jsxs)(i.z,{type:"button",variant:"outline",onClick:e=>{e.preventDefault(),J>0&&D(J-1)},disabled:0===J,className:"items-center ".concat(t?"bg-stone-100 dark:bg-neutral-900":""," text-white ").concat(o),children:[(0,a.jsx)(w.X,{className:"mr-2 h-4 w-4"}),"Previous"]}),J<ee.length-1?(0,a.jsxs)(i.z,{type:"button",variant:"outline",onClick:e=>{e.preventDefault(),J<ee.length-1&&D(J+1)},disabled:!(t=>{try{return et.parse(e.form.getValues()),!0}catch(s){let e=s.errors.reduce((e,t)=>(e[t.path[0]]=t.message,e),{});for(let s of t.fields)if(e[s.name])return!1;return!0}})(ee[J]),className:"items-center ".concat(t?"bg-stone-100 dark:bg-neutral-900":""," text-white ").concat(o),children:["Next",(0,a.jsx)(_.o,{className:"ml-2 h-4 w-4"})]}):(0,a.jsxs)(i.z,{type:"submit",variant:"outline",disabled:t,className:"items-center ".concat(t?"bg-stone-100 dark:bg-neutral-900":""," text-white ").concat(o),children:[(0,a.jsx)(k.B,{className:"h-4 w-4 mr-2"}),t?"Booting...":"Save"]})]}),e.errors&&(0,a.jsx)(O.bZ,{className:"bg-secondary border-none my-4",children:(0,a.jsxs)(O.X,{className:"flex items-center gap-1",children:[(0,a.jsx)(C.f,{weight:"fill",className:"h-4 w-4 text-yellow-400 inline"}),(0,a.jsx)("span",{children:e.errors})]})})]})})}},18642:function(e,t,s){"use strict";s.d(t,{Z:function(){return c}});var a=s(57437),r=s(90837),l=s(50495),n=s(83102),i=s(67135),o=s(34797);function c(e){var t;return(0,a.jsxs)(r.Vq,{children:[(0,a.jsx)(r.hg,{asChild:!0,onClick:e.onShare,children:(0,a.jsxs)(l.z,{size:"sm",className:"".concat(e.buttonClassName||"px-3"),variant:null!==(t=e.buttonVariant)&&void 0!==t?t:"default",children:[e.includeIcon&&(0,a.jsx)(o.m,{className:"w-4 h-4 mr-2"}),e.buttonTitle]})}),(0,a.jsxs)(r.cZ,{children:[(0,a.jsxs)(r.fK,{children:[(0,a.jsx)(r.$N,{children:e.title}),(0,a.jsx)(r.Be,{children:e.description})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsxs)("div",{className:"grid flex-1 gap-2",children:[(0,a.jsx)(i._,{htmlFor:"link",className:"sr-only",children:"Link"}),(0,a.jsx)(n.I,{id:"link",defaultValue:e.url,readOnly:!0})]}),(0,a.jsx)(l.z,{type:"submit",size:"sm",className:"px-3",onClick:()=>(function(e){let t=navigator.clipboard;t&&t.writeText(e)})(e.url),children:(0,a.jsx)("span",{children:"Copy"})})]})]})]})}},47412:function(e,t,s){"use strict";s.d(t,{X:function(){return c},bZ:function(){return o}});var a=s(57437),r=s(2265),l=s(12218),n=s(37440);let i=(0,l.j)("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),o=r.forwardRef((e,t)=>{let{className:s,variant:r,...l}=e;return(0,a.jsx)("div",{ref:t,role:"alert",className:(0,n.cn)(i({variant:r}),s),...l})});o.displayName="Alert",r.forwardRef((e,t)=>{let{className:s,...r}=e;return(0,a.jsx)("h5",{ref:t,className:(0,n.cn)("mb-1 font-medium leading-none tracking-tight",s),...r})}).displayName="AlertTitle";let c=r.forwardRef((e,t)=>{let{className:s,...r}=e;return(0,a.jsx)("div",{ref:t,className:(0,n.cn)("text-sm [&_p]:leading-relaxed",s),...r})});c.displayName="AlertDescription"},32653:function(e,t,s){"use strict";s.d(t,{NI:function(){return p},Wi:function(){return u},l0:function(){return c},lX:function(){return f},pf:function(){return j},xJ:function(){return m},zG:function(){return g}});var a=s(57437),r=s(2265),l=s(71538),n=s(39343),i=s(37440),o=s(67135);let c=n.RV,d=r.createContext({}),u=e=>{let{...t}=e;return(0,a.jsx)(d.Provider,{value:{name:t.name},children:(0,a.jsx)(n.Qr,{...t})})},h=()=>{let e=r.useContext(d),t=r.useContext(x),{getFieldState:s,formState:a}=(0,n.Gc)(),l=s(e.name,a);if(!e)throw Error("useFormField should be used within <FormField>");let{id:i}=t;return{id:i,name:e.name,formItemId:"".concat(i,"-form-item"),formDescriptionId:"".concat(i,"-form-item-description"),formMessageId:"".concat(i,"-form-item-message"),...l}},x=r.createContext({}),m=r.forwardRef((e,t)=>{let{className:s,...l}=e,n=r.useId();return(0,a.jsx)(x.Provider,{value:{id:n},children:(0,a.jsx)("div",{ref:t,className:(0,i.cn)("space-y-2",s),...l})})});m.displayName="FormItem";let f=r.forwardRef((e,t)=>{let{className:s,...r}=e,{error:l,formItemId:n}=h();return(0,a.jsx)(o._,{ref:t,className:(0,i.cn)(l&&"text-destructive",s),htmlFor:n,...r})});f.displayName="FormLabel";let p=r.forwardRef((e,t)=>{let{...s}=e,{error:r,formItemId:n,formDescriptionId:i,formMessageId:o}=h();return(0,a.jsx)(l.g7,{ref:t,id:n,"aria-describedby":r?"".concat(i," ").concat(o):"".concat(i),"aria-invalid":!!r,...s})});p.displayName="FormControl";let j=r.forwardRef((e,t)=>{let{className:s,...r}=e,{formDescriptionId:l}=h();return(0,a.jsx)("p",{ref:t,id:l,className:(0,i.cn)("text-sm text-muted-foreground",s),...r})});j.displayName="FormDescription";let g=r.forwardRef((e,t)=>{let{className:s,children:r,...l}=e,{error:n,formMessageId:o}=h(),c=n?String(null==n?void 0:n.message):r;return c?(0,a.jsx)("p",{ref:t,id:o,className:(0,i.cn)("text-sm font-medium text-destructive",s),...l,children:c}):null});g.displayName="FormMessage"},67135:function(e,t,s){"use strict";s.d(t,{_:function(){return c}});var a=s(57437),r=s(2265),l=s(38364),n=s(12218),i=s(37440);let o=(0,n.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),c=r.forwardRef((e,t)=>{let{className:s,...r}=e;return(0,a.jsx)(l.f,{ref:t,className:(0,i.cn)(o(),s),...r})});c.displayName=l.f.displayName},46294:function(e,t,s){"use strict";s.d(t,{Bw:function(){return f},Ph:function(){return d},Ql:function(){return p},i4:function(){return h},ki:function(){return u}});var a=s(57437),r=s(2265),l=s(77539),n=s(42421),i=s(14392),o=s(22468),c=s(37440);let d=l.fC;l.ZA;let u=l.B4,h=r.forwardRef((e,t)=>{let{className:s,children:r,...i}=e;return(0,a.jsxs)(l.xz,{ref:t,className:(0,c.cn)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",s),...i,children:[r,(0,a.jsx)(l.JO,{asChild:!0,children:(0,a.jsx)(n.Z,{className:"h-4 w-4 opacity-50"})})]})});h.displayName=l.xz.displayName;let x=r.forwardRef((e,t)=>{let{className:s,...r}=e;return(0,a.jsx)(l.u_,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",s),...r,children:(0,a.jsx)(i.Z,{className:"h-4 w-4"})})});x.displayName=l.u_.displayName;let m=r.forwardRef((e,t)=>{let{className:s,...r}=e;return(0,a.jsx)(l.$G,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",s),...r,children:(0,a.jsx)(n.Z,{className:"h-4 w-4"})})});m.displayName=l.$G.displayName;let f=r.forwardRef((e,t)=>{let{className:s,children:r,position:n="popper",...i}=e;return(0,a.jsx)(l.h_,{children:(0,a.jsxs)(l.VY,{ref:t,className:(0,c.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===n&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",s),position:n,...i,children:[(0,a.jsx)(x,{}),(0,a.jsx)(l.l_,{className:(0,c.cn)("p-1","popper"===n&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r}),(0,a.jsx)(m,{})]})})});f.displayName=l.VY.displayName,r.forwardRef((e,t)=>{let{className:s,...r}=e;return(0,a.jsx)(l.__,{ref:t,className:(0,c.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",s),...r})}).displayName=l.__.displayName;let p=r.forwardRef((e,t)=>{let{className:s,children:r,...n}=e;return(0,a.jsxs)(l.ck,{ref:t,className:(0,c.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),...n,children:[(0,a.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,a.jsx)(l.wU,{children:(0,a.jsx)(o.Z,{className:"h-4 w-4"})})}),(0,a.jsx)(l.eT,{children:r})]})});p.displayName=l.ck.displayName,r.forwardRef((e,t)=>{let{className:s,...r}=e;return(0,a.jsx)(l.Z0,{ref:t,className:(0,c.cn)("-mx-1 my-1 h-px bg-muted",s),...r})}).displayName=l.Z0.displayName},2288:function(e){e.exports={agentPersonality:"agentCard_agentPersonality__MmRlN",infoButton:"agentCard_infoButton__heh_w"}}}]);
|
@@ -1 +1 @@
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9718],{1813:function(e,t,n){Promise.resolve().then(n.bind(n,89915))},89915:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return O}});var a=n(57437),l=n(15283),o=n.n(l),s=n(29039),i=n(2265),r=n(79306),d=n(35418),c=n(64945),u=n(90837),p=n(66820),m=n(58485),f=n(48861),h=n(47412),g=n(69591),x=n(81970),v=n(39343),j=n(31014);let b=()=>window.fetch("/api/agents").then(e=>e.json()).catch(e=>console.log(e)),_=e=>fetch(e).then(e=>e.json());function y(e){let[t,n]=(0,i.useState)(!1),[l,o]=(0,i.useState)(null),[s,r]=(0,i.useState)(!0),c=(0,v.cI)({resolver:(0,j.F)(x.bc),defaultValues:{name:e.data.name,persona:e.data.persona,color:e.data.color,icon:e.data.icon,privacy_level:e.data.privacy_level,chat_model:e.selectedChatModelOption,files:[]}});return(0,i.useEffect)(()=>{c.reset({name:e.data.name,persona:e.data.persona,color:e.data.color,icon:e.data.icon,privacy_level:e.data.privacy_level,chat_model:e.selectedChatModelOption,files:[]})},[e.selectedChatModelOption,e.data]),(0,a.jsxs)(u.Vq,{open:t,onOpenChange:n,children:[(0,a.jsx)(u.hg,{children:(0,a.jsxs)("div",{className:"flex items-center text-md gap-2",children:[(0,a.jsx)(d.v,{}),"Create Agent"]})}),(0,a.jsxs)(u.cZ,{className:"lg:max-w-screen-lg overflow-y-scroll max-h-screen",children:[(0,a.jsx)(u.fK,{children:"Create Agent"}),!e.userProfile&&s&&(0,a.jsx)(p.Z,{loginRedirectMessage:"Sign in to start chatting with a specialized agent",onOpenChange:r}),(0,a.jsx)(x.ks,{form:c,onSubmit:t=>{fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then(t=>{200===t.status?(c.reset(),n(!1),o(null),e.setAgentChangeTriggered(!0)):t.json().then(e=>{console.error(e),e.error&&o(e.error)})}).catch(e=>{console.error("Error:",e),o(e)})},create:!0,errors:l,filesOptions:e.filesOptions,modelOptions:e.modelOptions,inputToolOptions:e.inputToolOptions,outputModeOptions:e.outputModeOptions,isSubscribed:e.isSubscribed})]})]})}function O(){let{data:e,error:t,mutate:n}=(0,s.ZP)("agents",b,{revalidateOnFocus:!1}),l=(0,r.GW)(),{userConfig:d}=(0,r.h2)(!0),[u,v]=(0,i.useState)(!1),j=(0,g.IC)(),[O,w]=(0,i.useState)([]),[N,L]=(0,i.useState)([]),[M,C]=(0,i.useState)(null),{data:E,error:S}=(0,s.ZP)(d?"/api/content/computer":null,_),{data:Z,error:P}=(0,s.ZP)("/api/agents/options",_),[A,T]=(0,i.useState)(!1);if((0,i.useEffect)(()=>{A&&(n(),T(!1))},[A]),(0,i.useEffect)(()=>{if(e){w(e.filter(e=>e.creator===(null==l?void 0:l.username)));let t=e.filter(e=>"private"!==e.privacy_level&&e.creator!==(null==l?void 0:l.username));L(t);{let n=new URLSearchParams(window.location.search).get("agent");if(n){C(n);let a=e.find(e=>e.slug===n);a||(a=t.find(e=>e.slug===n)),a||fetch("/api/agents/".concat(n)).then(e=>{if(404===e.status)throw Error("Agent not found");return e.json()}).then(e=>{"protected"===e.privacy_level&&L(t=>[...t,e])})}}}},[e,l]),t)return(0,a.jsxs)("main",{className:o().main,children:[(0,a.jsx)("div",{className:"".concat(o().titleBar," text-5xl"),children:"Agents"}),(0,a.jsx)("div",{className:o().agentList,children:"Error loading agents"})]});if(!e)return(0,a.jsx)("main",{className:o().main,children:(0,a.jsxs)("div",{className:o().agentList,children:[(0,a.jsx)(m.l,{})," booting up your agents"]})});let R=(null==d?void 0:d.chat_model_options)||[],k=(null==d?void 0:d.selected_chat_model_config)||0,z=(0,r.T8)(d),F=R.find(e=>e.id===k);return(0,a.jsx)("main",{className:"w-full mx-auto",children:(0,a.jsxs)("div",{className:"grid w-full mx-auto",children:[(0,a.jsx)("div",{className:"".concat(o().sidePanel," top-0"),children:(0,a.jsx)(f.ZP,{conversationId:null,uploadedFiles:[],isMobileWidth:j})}),(0,a.jsxs)("div",{className:"".concat(o().pageLayout," w-full"),children:[(0,a.jsxs)("div",{className:"pt-6 md:pt-8 flex justify-between",children:[(0,a.jsx)("h1",{className:"text-3xl flex items-center",children:"Agents"}),(0,a.jsx)("div",{className:"ml-auto float-right border p-2 pt-3 rounded-xl font-bold hover:bg-stone-100 dark:hover:bg-neutral-900",children:(0,a.jsx)(y,{data:{slug:"",name:"",persona:"",color:"",icon:"",privacy_level:"private",managed_by_admin:!1,chat_model:"",input_tools:[],output_modes:[]},userProfile:l,isMobileWidth:j,filesOptions:E||[],modelOptions:(null==d?void 0:d.chat_model_options)||[],selectedChatModelOption:(null==F?void 0:F.name)||"",isSubscribed:z,setAgentChangeTriggered:T,inputToolOptions:(null==Z?void 0:Z.input_tools)||{},outputModeOptions:(null==Z?void 0:Z.output_modes)||{}})})]}),u&&(0,a.jsx)(p.Z,{loginRedirectMessage:"Sign in to start chatting with a specialized agent",onOpenChange:v}),(0,a.jsx)(h.bZ,{className:"bg-secondary border-none my-4",children:(0,a.jsxs)(h.X,{children:[(0,a.jsx)(c.B,{weight:"fill",className:"h-4 w-4 text-purple-400 inline"}),(0,a.jsx)("span",{className:"font-bold",children:"How it works"})," Use any of these specialized personas to tune your conversation to your needs."]})}),(0,a.jsx)("div",{className:"pt-6 md:pt-8",children:(0,a.jsx)("div",{className:"".concat(o().agentList),children:O.map(e=>(0,a.jsx)(x.EY,{data:e,userProfile:l,isMobileWidth:j,filesOptions:null!=E?E:[],selectedChatModelOption:(null==F?void 0:F.name)||"",isSubscribed:z,setAgentChangeTriggered:T,modelOptions:(null==d?void 0:d.chat_model_options)||[],editCard:!0,agentSlug:M||"",inputToolOptions:(null==Z?void 0:Z.input_tools)||{},outputModeOptions:(null==Z?void 0:Z.output_modes)||{}},e.slug))})}),(0,a.jsxs)("div",{className:"pt-6 md:pt-8",children:[(0,a.jsx)("h2",{className:"text-2xl",children:"Explore"}),(0,a.jsx)("div",{className:"".concat(o().agentList),children:N.map(e=>(0,a.jsx)(x.EY,{data:e,userProfile:l,isMobileWidth:j,editCard:!1,filesOptions:null!=E?E:[],selectedChatModelOption:(null==F?void 0:F.name)||"",isSubscribed:z,setAgentChangeTriggered:T,modelOptions:(null==d?void 0:d.chat_model_options)||[],agentSlug:M||"",inputToolOptions:(null==Z?void 0:Z.input_tools)||{},outputModeOptions:(null==Z?void 0:Z.output_modes)||{}},e.slug))})]})]})]})})}},66820:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var a=n(57437),l=n(6780),o=n(87138);function s(e){return(0,a.jsx)(l.aR,{open:!0,onOpenChange:e.onOpenChange,children:(0,a.jsxs)(l._T,{children:[(0,a.jsx)(l.fY,{children:(0,a.jsx)(l.f$,{children:"Sign in to Khoj to continue"})}),(0,a.jsxs)(l.yT,{children:[e.loginRedirectMessage,". By logging in, you agree to our"," ",(0,a.jsx)(o.default,{href:"https://khoj.dev/terms-of-service",children:"Terms of Service."})]}),(0,a.jsxs)(l.xo,{children:[(0,a.jsx)(l.le,{children:"Dismiss"}),(0,a.jsx)(l.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>{window.location.href="/login?next=".concat(encodeURIComponent(window.location.pathname))},children:(0,a.jsxs)(o.default,{href:"/login?next=".concat(encodeURIComponent(window.location.pathname)),children:[" ","Login"]})})]})]})})}},70571:function(e,t,n){"use strict";n.d(t,{E:function(){return i}});var a=n(57437),l=n(2265),o=n(40537),s=n(37440);let i=l.forwardRef((e,t)=>{let{className:n,value:l,indicatorColor:i,...r}=e;return(0,a.jsx)(o.fC,{ref:t,className:(0,s.cn)("relative h-4 w-full overflow-hidden rounded-full bg-secondary",n),...r,children:(0,a.jsx)(o.z$,{className:"h-full w-full flex-1 bg-primary transition-all ".concat(i),style:{transform:"translateX(-".concat(100-(l||0),"%)")}})})});i.displayName=o.fC.displayName},93146:function(e,t,n){"use strict";n.d(t,{g:function(){return s}});var a=n(57437),l=n(2265),o=n(37440);let s=l.forwardRef((e,t)=>{let{className:n,...l}=e;return(0,a.jsx)("textarea",{className:(0,o.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",n),ref:t,...l})});s.displayName="Textarea"},19666:function(e,t,n){"use strict";n.d(t,{_v:function(){return c},aJ:function(){return d},pn:function(){return i},u:function(){return r}});var a=n(57437),l=n(2265),o=n(27071),s=n(37440);let i=o.zt,r=o.fC,d=o.xz,c=l.forwardRef((e,t)=>{let{className:n,sideOffset:l=4,...i}=e;return(0,a.jsx)(o.VY,{ref:t,sideOffset:l,className:(0,s.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",n),...i})});c.displayName=o.VY.displayName},15283:function(e){e.exports={titleBar:"agents_titleBar__FzYbY",agentPersonality:"agents_agentPersonality__o0Ysz",pageLayout:"agents_pageLayout__gR3S3",sidePanel:"agents_sidePanel__wGVGc",infoButton:"agents_infoButton__NqI7E",agentList:"agents_agentList__XVx4A"}},64945:function(e,t,n){"use strict";n.d(t,{B:function(){return h}});var a=n(2265),l=n(52195);let o=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M219.71,117.38a12,12,0,0,0-7.25-8.52L161.28,88.39l10.59-70.61a12,12,0,0,0-20.64-10l-112,120a12,12,0,0,0,4.31,19.33l51.18,20.47L84.13,238.22a12,12,0,0,0,20.64,10l112-120A12,12,0,0,0,219.71,117.38ZM113.6,203.55l6.27-41.77a12,12,0,0,0-7.41-12.92L68.74,131.37,142.4,52.45l-6.27,41.77a12,12,0,0,0,7.41,12.92l43.72,17.49Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M96,240l16-80L48,136,160,16,144,96l64,24Z",opacity:"0.2"}),a.createElement("path",{d:"M215.79,118.17a8,8,0,0,0-5-5.66L153.18,90.9l14.66-73.33a8,8,0,0,0-13.69-7l-112,120a8,8,0,0,0,3,13l57.63,21.61L88.16,238.43a8,8,0,0,0,13.69,7l112-120A8,8,0,0,0,215.79,118.17ZM109.37,214l10.47-52.38a8,8,0,0,0-5-9.06L62,132.71l84.62-90.66L136.16,94.43a8,8,0,0,0,5,9.06l52.8,19.8Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M213.85,125.46l-112,120a8,8,0,0,1-13.69-7l14.66-73.33L45.19,143.49a8,8,0,0,1-3-13l112-120a8,8,0,0,1,13.69,7L153.18,90.9l57.63,21.61a8,8,0,0,1,3,12.95Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M213.84,118.63a6,6,0,0,0-3.73-4.25L150.88,92.17l15-75a6,6,0,0,0-10.27-5.27l-112,120a6,6,0,0,0,2.28,9.71l59.23,22.21-15,75a6,6,0,0,0,3.14,6.52A6.07,6.07,0,0,0,96,246a6,6,0,0,0,4.39-1.91l112-120A6,6,0,0,0,213.84,118.63ZM106,220.46l11.85-59.28a6,6,0,0,0-3.77-6.8l-55.6-20.85,91.46-98L138.12,94.82a6,6,0,0,0,3.77,6.8l55.6,20.85Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M215.79,118.17a8,8,0,0,0-5-5.66L153.18,90.9l14.66-73.33a8,8,0,0,0-13.69-7l-112,120a8,8,0,0,0,3,13l57.63,21.61L88.16,238.43a8,8,0,0,0,13.69,7l112-120A8,8,0,0,0,215.79,118.17ZM109.37,214l10.47-52.38a8,8,0,0,0-5-9.06L62,132.71l84.62-90.66L136.16,94.43a8,8,0,0,0,5,9.06l52.8,19.8Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M211.89,119.09a4,4,0,0,0-2.49-2.84l-60.81-22.8,15.33-76.67a4,4,0,0,0-6.84-3.51l-112,120a4,4,0,0,0-1,3.64,4,4,0,0,0,2.49,2.84l60.81,22.8L92.08,239.22a4,4,0,0,0,6.84,3.51l112-120A4,4,0,0,0,211.89,119.09ZM102.68,227l13.24-66.2a4,4,0,0,0-2.52-4.53L55,134.36,153.32,29l-13.24,66.2a4,4,0,0,0,2.52,4.53L201,121.64Z"}))]]);var s=Object.defineProperty,i=Object.defineProperties,r=Object.getOwnPropertyDescriptors,d=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable,p=(e,t,n)=>t in e?s(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,m=(e,t)=>{for(var n in t||(t={}))c.call(t,n)&&p(e,n,t[n]);if(d)for(var n of d(t))u.call(t,n)&&p(e,n,t[n]);return e},f=(e,t)=>i(e,r(t));let h=(0,a.forwardRef)((e,t)=>a.createElement(l.Z,f(m({ref:t},e),{weights:o})));h.displayName="Lightning"}},function(e){e.O(0,[9460,9448,3072,216,3124,7592,5512,4602,1603,9417,1970,2971,7023,1744],function(){return e(e.s=1813)}),_N_E=e.O()}]);
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9718],{1813:function(e,t,n){Promise.resolve().then(n.bind(n,89915))},89915:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return O}});var a=n(57437),l=n(15283),o=n.n(l),s=n(29039),i=n(2265),r=n(79306),d=n(35418),c=n(64945),u=n(90837),p=n(66820),m=n(58485),f=n(48861),h=n(47412),g=n(69591),x=n(81970),v=n(39343),j=n(31014);let b=()=>window.fetch("/api/agents").then(e=>e.json()).catch(e=>console.log(e)),_=e=>fetch(e).then(e=>e.json());function y(e){let[t,n]=(0,i.useState)(!1),[l,o]=(0,i.useState)(null),[s,r]=(0,i.useState)(!0),c=(0,v.cI)({resolver:(0,j.F)(x.bc),defaultValues:{name:e.data.name,persona:e.data.persona,color:e.data.color,icon:e.data.icon,privacy_level:e.data.privacy_level,chat_model:e.selectedChatModelOption,files:[]}});return(0,i.useEffect)(()=>{c.reset({name:e.data.name,persona:e.data.persona,color:e.data.color,icon:e.data.icon,privacy_level:e.data.privacy_level,chat_model:e.selectedChatModelOption,files:[]})},[e.selectedChatModelOption,e.data]),(0,a.jsxs)(u.Vq,{open:t,onOpenChange:n,children:[(0,a.jsx)(u.hg,{children:(0,a.jsxs)("div",{className:"flex items-center text-md gap-2",children:[(0,a.jsx)(d.v,{}),"Create Agent"]})}),(0,a.jsxs)(u.cZ,{className:"lg:max-w-screen-lg overflow-y-scroll max-h-screen",children:[(0,a.jsx)(u.fK,{children:"Create Agent"}),!e.userProfile&&s&&(0,a.jsx)(p.Z,{loginRedirectMessage:"Sign in to start chatting with a specialized agent",onOpenChange:r}),(0,a.jsx)(x.ks,{form:c,onSubmit:t=>{fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then(t=>{200===t.status?(c.reset(),n(!1),o(null),e.setAgentChangeTriggered(!0)):t.json().then(e=>{console.error(e),e.error&&o(e.error)})}).catch(e=>{console.error("Error:",e),o(e)})},create:!0,errors:l,filesOptions:e.filesOptions,modelOptions:e.modelOptions,inputToolOptions:e.inputToolOptions,outputModeOptions:e.outputModeOptions,isSubscribed:e.isSubscribed})]})]})}function O(){let{data:e,error:t,mutate:n}=(0,s.ZP)("agents",b,{revalidateOnFocus:!1}),l=(0,r.GW)(),{userConfig:d}=(0,r.h2)(!0),[u,v]=(0,i.useState)(!1),j=(0,g.IC)(),[O,w]=(0,i.useState)([]),[N,L]=(0,i.useState)([]),[M,C]=(0,i.useState)(null),{data:E,error:S}=(0,s.ZP)(d?"/api/content/computer":null,_),{data:Z,error:P}=(0,s.ZP)("/api/agents/options",_),[A,T]=(0,i.useState)(!1);if((0,i.useEffect)(()=>{A&&(n(),T(!1))},[A]),(0,i.useEffect)(()=>{if(e){w(e.filter(e=>e.creator===(null==l?void 0:l.username)));let t=e.filter(e=>"private"!==e.privacy_level&&e.creator!==(null==l?void 0:l.username));L(t);{let n=new URLSearchParams(window.location.search).get("agent");if(n){C(n);let a=e.find(e=>e.slug===n);a||(a=t.find(e=>e.slug===n)),a||fetch("/api/agents/".concat(n)).then(e=>{if(404===e.status)throw Error("Agent not found");return e.json()}).then(e=>{"protected"===e.privacy_level&&L(t=>[...t,e])})}}}},[e,l]),t)return(0,a.jsxs)("main",{className:o().main,children:[(0,a.jsx)("div",{className:"".concat(o().titleBar," text-5xl"),children:"Agents"}),(0,a.jsx)("div",{className:o().agentList,children:"Error loading agents"})]});if(!e)return(0,a.jsx)("main",{className:o().main,children:(0,a.jsxs)("div",{className:o().agentList,children:[(0,a.jsx)(m.l,{})," booting up your agents"]})});let R=(null==d?void 0:d.chat_model_options)||[],k=(null==d?void 0:d.selected_chat_model_config)||0,z=(0,r.T8)(d),F=R.find(e=>e.id===k);return(0,a.jsx)("main",{className:"w-full mx-auto",children:(0,a.jsxs)("div",{className:"grid w-full mx-auto",children:[(0,a.jsx)("div",{className:"".concat(o().sidePanel," top-0"),children:(0,a.jsx)(f.ZP,{conversationId:null,uploadedFiles:[],isMobileWidth:j})}),(0,a.jsxs)("div",{className:"".concat(o().pageLayout," w-full"),children:[(0,a.jsxs)("div",{className:"pt-6 md:pt-8 flex justify-between",children:[(0,a.jsx)("h1",{className:"text-3xl flex items-center",children:"Agents"}),(0,a.jsx)("div",{className:"ml-auto float-right border p-2 pt-3 rounded-xl font-bold hover:bg-stone-100 dark:hover:bg-neutral-900",children:(0,a.jsx)(y,{data:{slug:"",name:"",persona:"",color:"",icon:"",privacy_level:"private",managed_by_admin:!1,chat_model:"",input_tools:[],output_modes:[]},userProfile:l,isMobileWidth:j,filesOptions:E||[],modelOptions:(null==d?void 0:d.chat_model_options)||[],selectedChatModelOption:(null==F?void 0:F.name)||"",isSubscribed:z,setAgentChangeTriggered:T,inputToolOptions:(null==Z?void 0:Z.input_tools)||{},outputModeOptions:(null==Z?void 0:Z.output_modes)||{}})})]}),u&&(0,a.jsx)(p.Z,{loginRedirectMessage:"Sign in to start chatting with a specialized agent",onOpenChange:v}),(0,a.jsx)(h.bZ,{className:"bg-secondary border-none my-4",children:(0,a.jsxs)(h.X,{children:[(0,a.jsx)(c.B,{weight:"fill",className:"h-4 w-4 text-purple-400 inline"}),(0,a.jsx)("span",{className:"font-bold",children:"How it works"})," Use any of these specialized personas to tune your conversation to your needs."]})}),(0,a.jsx)("div",{className:"pt-6 md:pt-8",children:(0,a.jsx)("div",{className:"".concat(o().agentList),children:O.map(e=>(0,a.jsx)(x.EY,{data:e,userProfile:l,isMobileWidth:j,filesOptions:null!=E?E:[],selectedChatModelOption:(null==F?void 0:F.name)||"",isSubscribed:z,setAgentChangeTriggered:T,modelOptions:(null==d?void 0:d.chat_model_options)||[],editCard:!0,agentSlug:M||"",inputToolOptions:(null==Z?void 0:Z.input_tools)||{},outputModeOptions:(null==Z?void 0:Z.output_modes)||{}},e.slug))})}),(0,a.jsxs)("div",{className:"pt-6 md:pt-8",children:[(0,a.jsx)("h2",{className:"text-2xl",children:"Explore"}),(0,a.jsx)("div",{className:"".concat(o().agentList),children:N.map(e=>(0,a.jsx)(x.EY,{data:e,userProfile:l,isMobileWidth:j,editCard:!1,filesOptions:null!=E?E:[],selectedChatModelOption:(null==F?void 0:F.name)||"",isSubscribed:z,setAgentChangeTriggered:T,modelOptions:(null==d?void 0:d.chat_model_options)||[],agentSlug:M||"",inputToolOptions:(null==Z?void 0:Z.input_tools)||{},outputModeOptions:(null==Z?void 0:Z.output_modes)||{}},e.slug))})]})]})]})})}},66820:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var a=n(57437),l=n(6780),o=n(87138);function s(e){return(0,a.jsx)(l.aR,{open:!0,onOpenChange:e.onOpenChange,children:(0,a.jsxs)(l._T,{children:[(0,a.jsx)(l.fY,{children:(0,a.jsx)(l.f$,{children:"Sign in to Khoj to continue"})}),(0,a.jsxs)(l.yT,{children:[e.loginRedirectMessage,". By logging in, you agree to our"," ",(0,a.jsx)(o.default,{href:"https://khoj.dev/terms-of-service",children:"Terms of Service."})]}),(0,a.jsxs)(l.xo,{children:[(0,a.jsx)(l.le,{children:"Dismiss"}),(0,a.jsx)(l.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>{window.location.href="/login?next=".concat(encodeURIComponent(window.location.pathname))},children:(0,a.jsxs)(o.default,{href:"/login?next=".concat(encodeURIComponent(window.location.pathname)),children:[" ","Login"]})})]})]})})}},70571:function(e,t,n){"use strict";n.d(t,{E:function(){return i}});var a=n(57437),l=n(2265),o=n(40537),s=n(37440);let i=l.forwardRef((e,t)=>{let{className:n,value:l,indicatorColor:i,...r}=e;return(0,a.jsx)(o.fC,{ref:t,className:(0,s.cn)("relative h-4 w-full overflow-hidden rounded-full bg-secondary",n),...r,children:(0,a.jsx)(o.z$,{className:"h-full w-full flex-1 bg-primary transition-all ".concat(i),style:{transform:"translateX(-".concat(100-(l||0),"%)")}})})});i.displayName=o.fC.displayName},93146:function(e,t,n){"use strict";n.d(t,{g:function(){return s}});var a=n(57437),l=n(2265),o=n(37440);let s=l.forwardRef((e,t)=>{let{className:n,...l}=e;return(0,a.jsx)("textarea",{className:(0,o.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",n),ref:t,...l})});s.displayName="Textarea"},19666:function(e,t,n){"use strict";n.d(t,{_v:function(){return c},aJ:function(){return d},pn:function(){return i},u:function(){return r}});var a=n(57437),l=n(2265),o=n(27071),s=n(37440);let i=o.zt,r=o.fC,d=o.xz,c=l.forwardRef((e,t)=>{let{className:n,sideOffset:l=4,...i}=e;return(0,a.jsx)(o.VY,{ref:t,sideOffset:l,className:(0,s.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",n),...i})});c.displayName=o.VY.displayName},15283:function(e){e.exports={titleBar:"agents_titleBar__FzYbY",agentPersonality:"agents_agentPersonality__o0Ysz",pageLayout:"agents_pageLayout__gR3S3",sidePanel:"agents_sidePanel__wGVGc",infoButton:"agents_infoButton__NqI7E",agentList:"agents_agentList__XVx4A"}},64945:function(e,t,n){"use strict";n.d(t,{B:function(){return h}});var a=n(2265),l=n(52195);let o=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M219.71,117.38a12,12,0,0,0-7.25-8.52L161.28,88.39l10.59-70.61a12,12,0,0,0-20.64-10l-112,120a12,12,0,0,0,4.31,19.33l51.18,20.47L84.13,238.22a12,12,0,0,0,20.64,10l112-120A12,12,0,0,0,219.71,117.38ZM113.6,203.55l6.27-41.77a12,12,0,0,0-7.41-12.92L68.74,131.37,142.4,52.45l-6.27,41.77a12,12,0,0,0,7.41,12.92l43.72,17.49Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M96,240l16-80L48,136,160,16,144,96l64,24Z",opacity:"0.2"}),a.createElement("path",{d:"M215.79,118.17a8,8,0,0,0-5-5.66L153.18,90.9l14.66-73.33a8,8,0,0,0-13.69-7l-112,120a8,8,0,0,0,3,13l57.63,21.61L88.16,238.43a8,8,0,0,0,13.69,7l112-120A8,8,0,0,0,215.79,118.17ZM109.37,214l10.47-52.38a8,8,0,0,0-5-9.06L62,132.71l84.62-90.66L136.16,94.43a8,8,0,0,0,5,9.06l52.8,19.8Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M213.85,125.46l-112,120a8,8,0,0,1-13.69-7l14.66-73.33L45.19,143.49a8,8,0,0,1-3-13l112-120a8,8,0,0,1,13.69,7L153.18,90.9l57.63,21.61a8,8,0,0,1,3,12.95Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M213.84,118.63a6,6,0,0,0-3.73-4.25L150.88,92.17l15-75a6,6,0,0,0-10.27-5.27l-112,120a6,6,0,0,0,2.28,9.71l59.23,22.21-15,75a6,6,0,0,0,3.14,6.52A6.07,6.07,0,0,0,96,246a6,6,0,0,0,4.39-1.91l112-120A6,6,0,0,0,213.84,118.63ZM106,220.46l11.85-59.28a6,6,0,0,0-3.77-6.8l-55.6-20.85,91.46-98L138.12,94.82a6,6,0,0,0,3.77,6.8l55.6,20.85Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M215.79,118.17a8,8,0,0,0-5-5.66L153.18,90.9l14.66-73.33a8,8,0,0,0-13.69-7l-112,120a8,8,0,0,0,3,13l57.63,21.61L88.16,238.43a8,8,0,0,0,13.69,7l112-120A8,8,0,0,0,215.79,118.17ZM109.37,214l10.47-52.38a8,8,0,0,0-5-9.06L62,132.71l84.62-90.66L136.16,94.43a8,8,0,0,0,5,9.06l52.8,19.8Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M211.89,119.09a4,4,0,0,0-2.49-2.84l-60.81-22.8,15.33-76.67a4,4,0,0,0-6.84-3.51l-112,120a4,4,0,0,0-1,3.64,4,4,0,0,0,2.49,2.84l60.81,22.8L92.08,239.22a4,4,0,0,0,6.84,3.51l112-120A4,4,0,0,0,211.89,119.09ZM102.68,227l13.24-66.2a4,4,0,0,0-2.52-4.53L55,134.36,153.32,29l-13.24,66.2a4,4,0,0,0,2.52,4.53L201,121.64Z"}))]]);var s=Object.defineProperty,i=Object.defineProperties,r=Object.getOwnPropertyDescriptors,d=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable,p=(e,t,n)=>t in e?s(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,m=(e,t)=>{for(var n in t||(t={}))c.call(t,n)&&p(e,n,t[n]);if(d)for(var n of d(t))u.call(t,n)&&p(e,n,t[n]);return e},f=(e,t)=>i(e,r(t));let h=(0,a.forwardRef)((e,t)=>a.createElement(l.Z,f(m({ref:t},e),{weights:o})));h.displayName="Lightning"}},function(e){e.O(0,[9848,3072,216,3124,7592,5512,4602,1603,9417,1970,2971,7023,1744],function(){return e(e.s=1813)}),_N_E=e.O()}]);
|
@@ -1 +1 @@
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4371],{2743:function(e,t,a){Promise.resolve().then(a.bind(a,19648))},19648:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return ex}});var n=a(57437),s=a(29039),r=a(58485),o=a(36013),i=a(50495),l=a(46294),c=a(18760),d=a.n(c),u=a(31014),m=a(39343),h=a(59772),x=a(2265),f=a(32653),p=a(83102),g=a(90837),j=a(13304),y=a(93146),w=a(69591),v=a(23611),N=a.n(v),b=a(18642),D=a(16463),C=a(19573),k=a(20319),S=a(22049),_=a(55362),I=a(13537),A=a(76082),M=a(52674),R=a(23751),T=a(83522),z=a(8837),P=a(21819),L=a(35418),O=a(64945),W=a(79306),q=a(66820),E=a(35657),U=a(50151),F=a(47412),B=a(48861),V=a(7951);let G=()=>window.fetch("/api/automations").then(e=>e.json()).catch(e=>console.log(e));function Z(e){let t=e.split(" "),a=t[2],n=t[4];return"*"===a&&"*"===n?"Day":"*"!==n?"Week":"*"!==a?"Month":"Day"}function J(e){let t=e.split(" ");if("*"===t[3]&&"*"!==t[4])return Number(t[4])}function Q(e){let t=e.split(" "),a=t[1],n=t[0],s=Number(a)>=12?"PM":"AM",r=Number(a)>12?Number(a)-12:a;"00"===r&&(r="12");let o=n;return 10>Number(o)&&"00"!==o&&(o="0".concat(o)),"".concat(r,":").concat(o," ").concat(s)}function X(e){return String(e.split(" ")[2])}function Y(e){return d().toString(e)}let $=["Day","Week","Month"],H=Array.from({length:31},(e,t)=>String(t+1)),K=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ee=[],et=["AM","PM"];for(var ea=0;ea<et.length;ea++)for(var en=0;en<12;en++)for(var es=0;es<60;es+=15){let e=String(es).padStart(2,"0"),t=0===en?12:en;ee.push("".concat(t,":").concat(e," ").concat(et[ea]))}let er=Date.now(),eo=[{subject:"Weekly Newsletter",query_to_run:"Compile a message including: 1. A recap of news from last week 2. An at-home workout I can do before work 3. A quote to inspire me for the week ahead",schedule:"9AM every Monday",next:"Next run at 9AM on Monday",crontime:"0 9 * * 1",id:er,scheduling_request:""},{subject:"Daily Bedtime Story",query_to_run:"Compose a bedtime story that a five-year-old might enjoy. It should not exceed five paragraphs. Appeal to the imagination, but weave in learnings.",schedule:"9PM every night",next:"Next run at 9PM today",crontime:"0 21 * * *",id:er+1,scheduling_request:""},{subject:"Front Page of Hacker News",query_to_run:"Summarize the top 5 posts from https://news.ycombinator.com/best and share them with me, including links",schedule:"9PM on every Wednesday",next:"Next run at 9PM on Wednesday",crontime:"0 21 * * 3",id:er+2,scheduling_request:""},{subject:"Market Summary",query_to_run:"Get the market summary for today and share it with me. Focus on tech stocks and the S&P 500.",schedule:"9AM on every weekday",next:"Next run at 9AM on Monday",crontime:"0 9 * * *",id:er+3,scheduling_request:""},{subject:"Market Crash Notification",query_to_run:"Notify me if the stock market fell by more than 5% today.",schedule:"5PM every evening",next:"Next run at 5PM today",crontime:"0 17 * * *",id:er+5,scheduling_request:""},{subject:"Round-up of research papers about AI in healthcare",query_to_run:"Summarize the top 3 research papers about AI in healthcare that were published in the last week. Include links to the full papers.",schedule:"9AM every Friday",next:"Next run at 9AM on Friday",crontime:"0 9 * * 5",id:er+4,scheduling_request:""}];function ei(e){let t=encodeURIComponent(e.subject),a=encodeURIComponent(e.query_to_run),n=encodeURIComponent(e.crontime);return"".concat(window.location.origin,"/automations?subject=").concat(t,"&query=").concat(a,"&crontime=").concat(n)}function el(e){let[t,a]=(0,x.useState)(!1),[s,r]=(0,x.useState)(null),[l,c]=(0,x.useState)(!1),[d,u]=(0,x.useState)(""),{toast:m}=(0,E.pm)(),h=e.automation,[f,p]=(0,x.useState)(""),[g,j]=(0,x.useState)("");return((0,x.useEffect)(()=>{let e=s||h;p(Q(e.crontime));let t=Z(e.crontime);if("Day"===t)j("Daily");else if("Week"===t){let t=J(e.crontime);void 0===t?j("Weekly"):j("".concat(K[t]))}else if("Month"===t){let t=X(e.crontime);j("Monthly on the ".concat(t))}},[s,h]),(0,x.useEffect)(()=>{let e="Automation: ".concat((null==s?void 0:s.subject)||h.subject);d&&(m({title:e,description:d,action:(0,n.jsx)(U.gD,{altText:"Dismiss",children:"Ok"})}),u(""))},[d,s,h,m]),l)?null:(0,n.jsxs)(o.Zb,{className:"bg-secondary h-full shadow-sm rounded-lg bg-gradient-to-b from-background to-slate-50 dark:to-gray-950 border ".concat(N().automationCard),children:[(0,n.jsx)(o.Ol,{children:(0,n.jsxs)(o.ll,{className:"line-clamp-2 leading-normal flex justify-between",children:[(null==s?void 0:s.subject)||h.subject,(0,n.jsxs)(C.J2,{children:[(0,n.jsx)(C.xo,{asChild:!0,children:(0,n.jsx)(i.z,{className:"bg-background",variant:"ghost",children:(0,n.jsx)(k.F,{className:"h-4 w-4"})})}),(0,n.jsxs)(C.yk,{className:"w-auto grid gap-2 text-left bg-secondary",children:[!e.suggestedCard&&e.locationData&&(0,n.jsx)(eh,{isMobileWidth:e.isMobileWidth,callToAction:"Edit",createNew:!1,setIsCreating:a,setShowLoginPrompt:e.setShowLoginPrompt,setNewAutomationData:r,authenticatedData:e.authenticatedData,isCreating:t,automation:s||h,ipLocationData:e.locationData}),(0,n.jsx)(b.Z,{buttonTitle:"Share",includeIcon:!0,buttonClassName:"justify-start px-4 py-2 h-10",buttonVariant:"outline",title:"Share Automation",description:"Copy the link below and share it with your coworkers or friends.",url:ei(h),onShare:()=>{navigator.clipboard.writeText(ei(h))}}),!e.suggestedCard&&(0,n.jsxs)(i.z,{variant:"outline",className:"justify-start",onClick:()=>{!function(e,t){fetch("/api/trigger/automation?automation_id=".concat(e),{method:"POST"}).then(e=>{if(!e.ok)throw Error("Network response was not ok");return e}).then(e=>{t("Automation triggered. Check your inbox in a few minutes!")}).catch(e=>{t("Sorry, something went wrong. Try again later.")})}(h.id.toString(),u)},children:[(0,n.jsx)(S.s,{className:"h-4 w-4 mr-2"}),"Run Now"]}),(0,n.jsxs)(i.z,{variant:"destructive",className:"justify-start",onClick:()=>{if(e.suggestedCard){c(!0);return}!function(e,t){fetch("/api/automation?automation_id=".concat(e),{method:"DELETE"}).then(e=>e.json()).then(e=>{t(!0)})}(h.id.toString(),c)},children:[(0,n.jsx)(_.r,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]})}),(0,n.jsx)(o.aY,{className:"text-secondary-foreground break-all",children:(null==s?void 0:s.query_to_run)||h.query_to_run}),(0,n.jsxs)(o.eW,{className:"flex flex-col items-start md:flex-row md:justify-between md:items-center gap-2",children:[(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsxs)("div",{className:"flex items-center bg-blue-50 rounded-lg p-1.5 border-blue-200 border dark:bg-blue-800 dark:border-blue-500",children:[(0,n.jsx)(I.T,{className:"h-4 w-4 mr-2 text-blue-700 dark:text-blue-300"}),(0,n.jsx)("div",{className:"text-s text-blue-700 dark:text-blue-300",children:f})]}),(0,n.jsxs)("div",{className:"flex items-center bg-purple-50 rounded-lg p-1.5 border-purple-200 border dark:bg-purple-800 dark:border-purple-500",children:[(0,n.jsx)(A.u,{className:"h-4 w-4 mr-2 text-purple-700 dark:text-purple-300"}),(0,n.jsx)("div",{className:"text-s text-purple-700 dark:text-purple-300",children:g})]})]}),e.suggestedCard&&e.setNewAutomationData&&(0,n.jsx)(eh,{isMobileWidth:e.isMobileWidth,callToAction:"Add",createNew:!0,setIsCreating:a,setShowLoginPrompt:e.setShowLoginPrompt,setNewAutomationData:e.setNewAutomationData,authenticatedData:e.authenticatedData,isCreating:t,automation:h,ipLocationData:e.locationData})]})]})}function ec(e){let t=(0,D.useSearchParams)(),[a,s]=(0,x.useState)(!0),r=t.get("subject"),o=t.get("query"),i=t.get("crontime");if(!r||!o||!i)return null;let l={id:0,subject:decodeURIComponent(r),query_to_run:decodeURIComponent(o),scheduling_request:"",schedule:Y(decodeURIComponent(i)),crontime:decodeURIComponent(i),next:""};return a?(0,n.jsx)(eh,{isMobileWidth:e.isMobileWidth,callToAction:"Shared",createNew:!0,setIsCreating:s,setShowLoginPrompt:e.setShowLoginPrompt,setNewAutomationData:e.setNewAutomationData,authenticatedData:e.authenticatedData,isCreating:a,automation:l,ipLocationData:e.locationData}):null}let ed=h.z.object({subject:h.z.optional(h.z.string()),everyBlah:h.z.string({required_error:"Every is required"}),dayOfWeek:h.z.optional(h.z.number()),dayOfMonth:h.z.optional(h.z.string()),timeRecurrence:h.z.string({required_error:"Time Recurrence is required"}),queryToRun:h.z.string({required_error:"Query to Run is required"})});function eu(e){let t=e.automation,a=(0,m.cI)({resolver:(0,u.F)(ed),defaultValues:{subject:null==t?void 0:t.subject,everyBlah:(null==t?void 0:t.crontime)?Z(t.crontime):"Day",dayOfWeek:(null==t?void 0:t.crontime)?J(t.crontime):void 0,timeRecurrence:(null==t?void 0:t.crontime)?Q(t.crontime):"12:00 PM",dayOfMonth:(null==t?void 0:t.crontime)?X(t.crontime):"1",queryToRun:null==t?void 0:t.query_to_run}});return(0,n.jsx)(em,{authenticatedData:e.authenticatedData,locationData:e.locationData||null,form:a,onSubmit:a=>{let n=function(e,t,a,n){let s="",r=t.split(":")[1].split(" ")[0],o=t.split(":")[1].split(" ")[1],i=Number(t.split(":")[0]),l="PM"===o&&i<12?String(i+12):i;switch(e){case"Day":s="".concat(r," ").concat(l," * * *");break;case"Week":s="".concat(r," ").concat(l," * * ").concat(void 0!==a?7===a?0:a:"*");break;case"Month":s="".concat(r," ").concat(l," ").concat(n," * *")}return s}(a.everyBlah,a.timeRecurrence,a.dayOfWeek,a.dayOfMonth),s="/api/automation?";s+="q=".concat(encodeURIComponent(a.queryToRun)),(null==t?void 0:t.id)&&!e.createNew&&(s+="&automation_id=".concat(encodeURIComponent(t.id))),a.subject&&(s+="&subject=".concat(encodeURIComponent(a.subject))),s+="&crontime=".concat(encodeURIComponent(n)),e.locationData&&e.locationData.city&&(s+="&city=".concat(encodeURIComponent(e.locationData.city))),e.locationData&&e.locationData.region&&(s+="®ion=".concat(encodeURIComponent(e.locationData.region))),e.locationData&&e.locationData.country&&(s+="&country=".concat(encodeURIComponent(e.locationData.country))),e.locationData&&e.locationData.timezone&&(s+="&timezone=".concat(encodeURIComponent(e.locationData.timezone))),fetch(s,{method:e.createNew?"POST":"PUT"}).then(e=>e.json()).then(t=>{e.setIsEditing(!1),e.setUpdatedAutomationData({id:t.id,subject:t.subject||"",query_to_run:t.query_to_run,scheduling_request:t.scheduling_request,schedule:Y(t.crontime),crontime:t.crontime,next:t.next})})},create:e.createNew,isLoggedIn:e.isLoggedIn,setShowLoginPrompt:e.setShowLoginPrompt})}function em(e){var t,a;let[s,r]=(0,x.useState)(!1),{errors:o}=e.form.formState,c=["Make a picture of","Generate a summary of","Create a newsletter of","Notify me when"];return(0,n.jsx)(f.l0,{...e.form,children:(0,n.jsxs)("form",{onSubmit:e.form.handleSubmit(t=>{e.onSubmit(t),r(!0)}),className:"space-y-6",children:[(0,n.jsx)(f.xJ,{className:"space-y-1",children:(0,n.jsxs)(f.pf,{children:["Emails will be sent to this address. Timezone and location data will be used to schedule automations.",e.locationData&&(t=e.locationData,a=e.authenticatedData,(0,n.jsxs)("div",{className:"flex flex-wrap gap-2 items-center justify-start",children:[a?(0,n.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm",children:[(0,n.jsx)(T.w,{className:"h-4 w-4 mr-2 inline text-orange-500 shadow-sm"}),a.email]}):null,t&&(0,n.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm",children:[(0,n.jsx)(z.x,{className:"h-4 w-4 mr-2 inline text-purple-500"}),t?"".concat(t.city,", ").concat(t.country):"Unknown"]}),t&&(0,n.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm",children:[(0,n.jsx)(P.S,{className:"h-4 w-4 mr-2 inline text-green-500"}),t?"".concat(t.timezone):"Unknown"]})]}))]})}),!e.create&&(0,n.jsx)(f.Wi,{control:e.form.control,name:"subject",render:e=>{var t;let{field:a}=e;return(0,n.jsxs)(f.xJ,{className:"space-y-1",children:[(0,n.jsx)(f.lX,{children:"Subject"}),(0,n.jsx)(f.pf,{children:"This is the subject of the email you will receive."}),(0,n.jsx)(f.NI,{children:(0,n.jsx)(p.I,{placeholder:"Digest of Healthcare AI trends",...a})}),(0,n.jsx)(f.zG,{}),o.subject&&(0,n.jsx)(f.zG,{children:null===(t=o.subject)||void 0===t?void 0:t.message})]})}}),(0,n.jsx)(f.Wi,{control:e.form.control,name:"everyBlah",render:e=>{var t;let{field:a}=e;return(0,n.jsxs)(f.xJ,{className:"w-full space-y-1",children:[(0,n.jsx)(f.lX,{children:"Frequency"}),(0,n.jsx)(f.pf,{children:"How often should this automation run?"}),(0,n.jsxs)(l.Ph,{onValueChange:a.onChange,defaultValue:a.value,children:[(0,n.jsx)(f.NI,{children:(0,n.jsxs)(l.i4,{className:"w-[200px]",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(M.W,{className:"h-4 w-4 mr-2 inline"}),"Every"]}),(0,n.jsx)(l.ki,{placeholder:""})]})}),(0,n.jsx)(l.Bw,{children:$.map(e=>(0,n.jsx)(l.Ql,{value:e,children:e},e))})]}),(0,n.jsx)(f.zG,{}),o.subject&&(0,n.jsx)(f.zG,{children:null===(t=o.everyBlah)||void 0===t?void 0:t.message})]})}}),"Week"===e.form.watch("everyBlah")&&(0,n.jsx)(f.Wi,{control:e.form.control,name:"dayOfWeek",render:e=>{var t;let{field:a}=e;return(0,n.jsxs)(f.xJ,{className:"w-full space-y-1",children:[(0,n.jsx)(f.pf,{children:"Every week, on which day should this automation run?"}),(0,n.jsxs)(l.Ph,{onValueChange:e=>a.onChange(Number(e)),defaultValue:String(a.value),children:[(0,n.jsx)(f.NI,{children:(0,n.jsxs)(l.i4,{className:"w-[200px]",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(R.n,{className:"h-4 w-4 mr-2 inline"}),"On"]}),(0,n.jsx)(l.ki,{placeholder:""})]})}),(0,n.jsx)(l.Bw,{children:K.map((e,t)=>(0,n.jsx)(l.Ql,{value:String(t),children:e},e))})]}),(0,n.jsx)(f.zG,{}),o.subject&&(0,n.jsx)(f.zG,{children:null===(t=o.dayOfWeek)||void 0===t?void 0:t.message})]})}}),"Month"===e.form.watch("everyBlah")&&(0,n.jsx)(f.Wi,{control:e.form.control,name:"dayOfMonth",render:e=>{var t;let{field:a}=e;return(0,n.jsxs)(f.xJ,{className:"w-full space-y-1",children:[(0,n.jsx)(f.pf,{children:"Every month, on which day should the automation run?"}),(0,n.jsxs)(l.Ph,{onValueChange:a.onChange,defaultValue:a.value,children:[(0,n.jsx)(f.NI,{children:(0,n.jsxs)(l.i4,{className:"w-[200px]",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(R.n,{className:"h-4 w-4 mr-2 inline"}),"On the"]}),(0,n.jsx)(l.ki,{placeholder:""})]})}),(0,n.jsx)(l.Bw,{children:H.map(e=>(0,n.jsx)(l.Ql,{value:e,children:e},e))})]}),(0,n.jsx)(f.zG,{}),o.subject&&(0,n.jsx)(f.zG,{children:null===(t=o.dayOfMonth)||void 0===t?void 0:t.message})]})}}),("Day"===e.form.watch("everyBlah")||"Week"==e.form.watch("everyBlah")||"Month"==e.form.watch("everyBlah"))&&(0,n.jsx)(f.Wi,{control:e.form.control,name:"timeRecurrence",render:e=>{var t;let{field:a}=e;return(0,n.jsxs)(f.xJ,{className:"w-full space-y-1",children:[(0,n.jsx)(f.lX,{children:"Time"}),(0,n.jsx)(f.pf,{children:"On the days this automation runs, at what time should it run?"}),(0,n.jsxs)(l.Ph,{onValueChange:a.onChange,defaultValue:a.value,children:[(0,n.jsx)(f.NI,{children:(0,n.jsxs)(l.i4,{className:"w-[200px]",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(A.u,{className:"h-4 w-4 mr-2 inline"}),"At"]}),(0,n.jsx)(l.ki,{placeholder:""})]})}),(0,n.jsx)(l.Bw,{children:ee.map(e=>(0,n.jsx)(l.Ql,{value:e,children:e},e))})]}),(0,n.jsx)(f.zG,{}),o.subject&&(0,n.jsx)(f.zG,{children:null===(t=o.timeRecurrence)||void 0===t?void 0:t.message})]})}}),(0,n.jsx)(f.Wi,{control:e.form.control,name:"queryToRun",render:t=>{var a;let{field:s}=t;return(0,n.jsxs)(f.xJ,{className:"space-y-1",children:[(0,n.jsx)(f.lX,{children:"Instructions"}),(0,n.jsx)(f.pf,{children:"What do you want Khoj to do?"}),e.create&&(0,n.jsx)("div",{children:c.map(e=>{var t;return t=s.onChange,(0,n.jsxs)(i.z,{className:"text-xs bg-slate-50 dark:bg-slate-950 h-auto p-1.5 m-1 rounded-full",variant:"ghost",onClick:a=>{a.preventDefault(),t({target:{value:e}},a)},children:[e,"..."]},e)})}),(0,n.jsx)(f.NI,{children:(0,n.jsx)(y.g,{placeholder:"Create a summary of the latest news about AI in healthcare.",value:s.value,onChange:s.onChange})}),(0,n.jsx)(f.zG,{}),o.subject&&(0,n.jsx)(f.zG,{children:null===(a=o.queryToRun)||void 0===a?void 0:a.message})]})}}),(0,n.jsx)("fieldset",{disabled:s,children:e.isLoggedIn?s?(0,n.jsx)(i.z,{type:"submit",disabled:!0,children:"Saving..."}):(0,n.jsx)(i.z,{type:"submit",children:"Save"}):(0,n.jsx)(i.z,{onClick:t=>{t.preventDefault(),e.setShowLoginPrompt(!0)},variant:"default",children:"Login to Save"})})]})})}function eh(e){return e.isMobileWidth?(0,n.jsxs)(V.dy,{open:e.isCreating,onOpenChange:t=>{e.setIsCreating(t)},children:[(0,n.jsx)(V.Qz,{asChild:!0,children:(0,n.jsxs)(i.z,{className:"shadow-sm justify-start",variant:"outline",children:[(0,n.jsx)(L.v,{className:"h-4 w-4 mr-2"}),e.callToAction]})}),(0,n.jsxs)(V.sc,{className:"p-2",children:[(0,n.jsx)(V.iI,{children:"Automation"}),(0,n.jsx)(eu,{createNew:e.createNew,automation:e.automation,setIsEditing:e.setIsCreating,isLoggedIn:!!e.authenticatedData,authenticatedData:e.authenticatedData,setShowLoginPrompt:e.setShowLoginPrompt,setUpdatedAutomationData:e.setNewAutomationData,locationData:e.ipLocationData})]})]}):(0,n.jsxs)(g.Vq,{open:e.isCreating,onOpenChange:t=>{e.setIsCreating(t)},children:[(0,n.jsx)(g.hg,{asChild:!0,children:(0,n.jsxs)(i.z,{className:"shadow-sm justify-start",variant:"outline",children:[(0,n.jsx)(L.v,{className:"h-4 w-4 mr-2"}),e.callToAction]})}),(0,n.jsxs)(g.cZ,{className:"max-h-[98vh] overflow-y-auto",children:[(0,n.jsx)(j.$N,{children:"Automation"}),(0,n.jsx)(eu,{automation:e.automation,createNew:e.createNew,setIsEditing:e.setIsCreating,isLoggedIn:!!e.authenticatedData,authenticatedData:e.authenticatedData,setShowLoginPrompt:e.setShowLoginPrompt,setUpdatedAutomationData:e.setNewAutomationData,locationData:e.ipLocationData})]})]})}function ex(){let e=(0,W.GW)(),{data:t,error:a,isLoading:o}=(0,s.ZP)(e?"automations":null,G,{revalidateOnFocus:!1}),[l,c]=(0,x.useState)(!1),[d,u]=(0,x.useState)(null),[m,h]=(0,x.useState)([]),[f,p]=(0,x.useState)([]),[g,j]=(0,x.useState)(!1),y=(0,w.IC)(),v=(0,w.k6)();return((0,x.useEffect)(()=>{d&&(h([...m,d]),u(null))},[d,m]),(0,x.useEffect)(()=>{let e=t?t.concat(m):m;e&&p(eo.filter(t=>void 0===e.find(e=>t.subject===e.subject)))},[t,m]),a)?(0,n.jsx)(r.l,{message:"Oops, something went wrong. Please refresh the page."}):(0,n.jsx)("main",{className:"w-full mx-auto",children:(0,n.jsxs)("div",{className:"grid w-full mx-auto",children:[(0,n.jsx)("div",{className:"".concat(N().sidePanel," top-0"),children:(0,n.jsx)(B.ZP,{conversationId:null,uploadedFiles:[],isMobileWidth:y})}),(0,n.jsxs)("div",{className:"".concat(N().pageLayout," w-full"),children:[(0,n.jsxs)("div",{className:"pt-6 md:pt-8 grid gap-1 md:flex md:justify-between",children:[(0,n.jsx)("h1",{className:"text-3xl flex items-center",children:"Automations"}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2 items-center justify-start",children:[e?(0,n.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm",children:[(0,n.jsx)(T.w,{className:"h-4 w-4 mr-2 inline text-orange-500 shadow-sm"}),e.email]}):null,v&&(0,n.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm",children:[(0,n.jsx)(z.x,{className:"h-4 w-4 mr-2 inline text-purple-500"}),v?"".concat(v.city,", ").concat(v.country):"Unknown"]}),v&&(0,n.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm",children:[(0,n.jsx)(P.S,{className:"h-4 w-4 mr-2 inline text-green-500"}),v?"".concat(v.timezone):"Unknown"]})]})]}),g&&(0,n.jsx)(q.Z,{loginRedirectMessage:"Create an account to make your own automation",onOpenChange:j}),(0,n.jsx)(F.bZ,{className:"bg-secondary border-none my-4",children:(0,n.jsxs)(F.X,{children:[(0,n.jsx)(O.B,{weight:"fill",className:"h-4 w-4 text-purple-400 inline"}),(0,n.jsx)("span",{className:"font-bold",children:"How it works"})," Automations help you structure your time by automating tasks you do regularly. Build your own, or try out our presets. Get results straight to your inbox."]})}),(0,n.jsxs)("div",{className:"flex justify-between items-center py-4",children:[(0,n.jsx)("h3",{className:"text-xl",children:"Your Creations"}),e?(0,n.jsx)(eh,{isMobileWidth:y,callToAction:"Create Automation",createNew:!0,setIsCreating:c,setShowLoginPrompt:j,setNewAutomationData:u,authenticatedData:e,isCreating:l,ipLocationData:v}):(0,n.jsxs)(i.z,{className:"shadow-sm",onClick:()=>j(!0),variant:"outline",children:[(0,n.jsx)(L.v,{className:"h-4 w-4 mr-2"}),"Create Automation"]})]}),(0,n.jsx)(x.Suspense,{children:(0,n.jsx)(ec,{isMobileWidth:y,authenticatedData:e,locationData:v,isLoggedIn:!!e,setShowLoginPrompt:j,setNewAutomationData:u})}),(!t||0===t.length)&&0==m.length&&!o&&(0,n.jsxs)("div",{className:"px-4",children:["So empty! Create your own automation to get started.",(0,n.jsx)("div",{className:"mt-4",children:e?(0,n.jsx)(eh,{isMobileWidth:y,callToAction:"Design Automation",createNew:!0,setIsCreating:c,setShowLoginPrompt:j,setNewAutomationData:u,authenticatedData:e,isCreating:l,ipLocationData:v}):(0,n.jsx)(i.z,{onClick:()=>j(!0),variant:"default",children:"Design"})})]}),o&&(0,n.jsx)(r.l,{message:"booting up your automations"}),(0,n.jsxs)("div",{className:"".concat(N().automationsLayout),children:[t&&t.map(t=>(0,n.jsx)(el,{isMobileWidth:y,authenticatedData:e,automation:t,locationData:v,isLoggedIn:!!e,setShowLoginPrompt:j},t.id)),m.map(t=>(0,n.jsx)(el,{isMobileWidth:y,authenticatedData:e,automation:t,locationData:v,isLoggedIn:!!e,setShowLoginPrompt:j},t.id))]}),(0,n.jsx)("h3",{className:"text-xl py-4",children:"Try these out"}),(0,n.jsx)("div",{className:"".concat(N().automationsLayout),children:f.map(t=>(0,n.jsx)(el,{isMobileWidth:y,setNewAutomationData:u,authenticatedData:e,automation:t,locationData:v,isLoggedIn:!!e,setShowLoginPrompt:j,suggestedCard:!0},t.id))})]})]})})}},66820:function(e,t,a){"use strict";a.d(t,{Z:function(){return o}});var n=a(57437),s=a(6780),r=a(87138);function o(e){return(0,n.jsx)(s.aR,{open:!0,onOpenChange:e.onOpenChange,children:(0,n.jsxs)(s._T,{children:[(0,n.jsx)(s.fY,{children:(0,n.jsx)(s.f$,{children:"Sign in to Khoj to continue"})}),(0,n.jsxs)(s.yT,{children:[e.loginRedirectMessage,". By logging in, you agree to our"," ",(0,n.jsx)(r.default,{href:"https://khoj.dev/terms-of-service",children:"Terms of Service."})]}),(0,n.jsxs)(s.xo,{children:[(0,n.jsx)(s.le,{children:"Dismiss"}),(0,n.jsx)(s.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>{window.location.href="/login?next=".concat(encodeURIComponent(window.location.pathname))},children:(0,n.jsxs)(r.default,{href:"/login?next=".concat(encodeURIComponent(window.location.pathname)),children:[" ","Login"]})})]})]})})}},18642:function(e,t,a){"use strict";a.d(t,{Z:function(){return c}});var n=a(57437),s=a(90837),r=a(50495),o=a(83102),i=a(67135),l=a(34797);function c(e){var t;return(0,n.jsxs)(s.Vq,{children:[(0,n.jsx)(s.hg,{asChild:!0,onClick:e.onShare,children:(0,n.jsxs)(r.z,{size:"sm",className:"".concat(e.buttonClassName||"px-3"),variant:null!==(t=e.buttonVariant)&&void 0!==t?t:"default",children:[e.includeIcon&&(0,n.jsx)(l.m,{className:"w-4 h-4 mr-2"}),e.buttonTitle]})}),(0,n.jsxs)(s.cZ,{children:[(0,n.jsxs)(s.fK,{children:[(0,n.jsx)(s.$N,{children:e.title}),(0,n.jsx)(s.Be,{children:e.description})]}),(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,n.jsxs)("div",{className:"grid flex-1 gap-2",children:[(0,n.jsx)(i._,{htmlFor:"link",className:"sr-only",children:"Link"}),(0,n.jsx)(o.I,{id:"link",defaultValue:e.url,readOnly:!0})]}),(0,n.jsx)(r.z,{type:"submit",size:"sm",className:"px-3",onClick:()=>(function(e){let t=navigator.clipboard;t&&t.writeText(e)})(e.url),children:(0,n.jsx)("span",{children:"Copy"})})]})]})]})}},47412:function(e,t,a){"use strict";a.d(t,{X:function(){return c},bZ:function(){return l}});var n=a(57437),s=a(2265),r=a(12218),o=a(37440);let i=(0,r.j)("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),l=s.forwardRef((e,t)=>{let{className:a,variant:s,...r}=e;return(0,n.jsx)("div",{ref:t,role:"alert",className:(0,o.cn)(i({variant:s}),a),...r})});l.displayName="Alert",s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)("h5",{ref:t,className:(0,o.cn)("mb-1 font-medium leading-none tracking-tight",a),...s})}).displayName="AlertTitle";let c=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)("div",{ref:t,className:(0,o.cn)("text-sm [&_p]:leading-relaxed",a),...s})});c.displayName="AlertDescription"},32653:function(e,t,a){"use strict";a.d(t,{NI:function(){return p},Wi:function(){return u},l0:function(){return c},lX:function(){return f},pf:function(){return g},xJ:function(){return x},zG:function(){return j}});var n=a(57437),s=a(2265),r=a(71538),o=a(39343),i=a(37440),l=a(67135);let c=o.RV,d=s.createContext({}),u=e=>{let{...t}=e;return(0,n.jsx)(d.Provider,{value:{name:t.name},children:(0,n.jsx)(o.Qr,{...t})})},m=()=>{let e=s.useContext(d),t=s.useContext(h),{getFieldState:a,formState:n}=(0,o.Gc)(),r=a(e.name,n);if(!e)throw Error("useFormField should be used within <FormField>");let{id:i}=t;return{id:i,name:e.name,formItemId:"".concat(i,"-form-item"),formDescriptionId:"".concat(i,"-form-item-description"),formMessageId:"".concat(i,"-form-item-message"),...r}},h=s.createContext({}),x=s.forwardRef((e,t)=>{let{className:a,...r}=e,o=s.useId();return(0,n.jsx)(h.Provider,{value:{id:o},children:(0,n.jsx)("div",{ref:t,className:(0,i.cn)("space-y-2",a),...r})})});x.displayName="FormItem";let f=s.forwardRef((e,t)=>{let{className:a,...s}=e,{error:r,formItemId:o}=m();return(0,n.jsx)(l._,{ref:t,className:(0,i.cn)(r&&"text-destructive",a),htmlFor:o,...s})});f.displayName="FormLabel";let p=s.forwardRef((e,t)=>{let{...a}=e,{error:s,formItemId:o,formDescriptionId:i,formMessageId:l}=m();return(0,n.jsx)(r.g7,{ref:t,id:o,"aria-describedby":s?"".concat(i," ").concat(l):"".concat(i),"aria-invalid":!!s,...a})});p.displayName="FormControl";let g=s.forwardRef((e,t)=>{let{className:a,...s}=e,{formDescriptionId:r}=m();return(0,n.jsx)("p",{ref:t,id:r,className:(0,i.cn)("text-sm text-muted-foreground",a),...s})});g.displayName="FormDescription";let j=s.forwardRef((e,t)=>{let{className:a,children:s,...r}=e,{error:o,formMessageId:l}=m(),c=o?String(null==o?void 0:o.message):s;return c?(0,n.jsx)("p",{ref:t,id:l,className:(0,i.cn)("text-sm font-medium text-destructive",a),...r,children:c}):null});j.displayName="FormMessage"},67135:function(e,t,a){"use strict";a.d(t,{_:function(){return c}});var n=a(57437),s=a(2265),r=a(38364),o=a(12218),i=a(37440);let l=(0,o.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),c=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(r.f,{ref:t,className:(0,i.cn)(l(),a),...s})});c.displayName=r.f.displayName},46294:function(e,t,a){"use strict";a.d(t,{Bw:function(){return f},Ph:function(){return d},Ql:function(){return p},i4:function(){return m},ki:function(){return u}});var n=a(57437),s=a(2265),r=a(77539),o=a(42421),i=a(14392),l=a(22468),c=a(37440);let d=r.fC;r.ZA;let u=r.B4,m=s.forwardRef((e,t)=>{let{className:a,children:s,...i}=e;return(0,n.jsxs)(r.xz,{ref:t,className:(0,c.cn)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",a),...i,children:[s,(0,n.jsx)(r.JO,{asChild:!0,children:(0,n.jsx)(o.Z,{className:"h-4 w-4 opacity-50"})})]})});m.displayName=r.xz.displayName;let h=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(r.u_,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",a),...s,children:(0,n.jsx)(i.Z,{className:"h-4 w-4"})})});h.displayName=r.u_.displayName;let x=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(r.$G,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",a),...s,children:(0,n.jsx)(o.Z,{className:"h-4 w-4"})})});x.displayName=r.$G.displayName;let f=s.forwardRef((e,t)=>{let{className:a,children:s,position:o="popper",...i}=e;return(0,n.jsx)(r.h_,{children:(0,n.jsxs)(r.VY,{ref:t,className:(0,c.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===o&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",a),position:o,...i,children:[(0,n.jsx)(h,{}),(0,n.jsx)(r.l_,{className:(0,c.cn)("p-1","popper"===o&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),(0,n.jsx)(x,{})]})})});f.displayName=r.VY.displayName,s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(r.__,{ref:t,className:(0,c.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",a),...s})}).displayName=r.__.displayName;let p=s.forwardRef((e,t)=>{let{className:a,children:s,...o}=e;return(0,n.jsxs)(r.ck,{ref:t,className:(0,c.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),...o,children:[(0,n.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,n.jsx)(r.wU,{children:(0,n.jsx)(l.Z,{className:"h-4 w-4"})})}),(0,n.jsx)(r.eT,{children:s})]})});p.displayName=r.ck.displayName,s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(r.Z0,{ref:t,className:(0,c.cn)("-mx-1 my-1 h-px bg-muted",a),...s})}).displayName=r.Z0.displayName},93146:function(e,t,a){"use strict";a.d(t,{g:function(){return o}});var n=a(57437),s=a(2265),r=a(37440);let o=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)("textarea",{className:(0,r.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,...s})});o.displayName="Textarea"},50151:function(e,t,a){"use strict";a.d(t,{FN:function(){return m},Mi:function(){return f},VW:function(){return c},_i:function(){return d},gD:function(){return h},lj:function(){return p},sA:function(){return x}});var n=a(57437),s=a(2265),r=a(44504),o=a(12218),i=a(74697),l=a(37440);let c=r.zt,d=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(r.l_,{ref:t,className:(0,l.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]",a),...s})});d.displayName=r.l_.displayName;let u=(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"}}),m=s.forwardRef((e,t)=>{let{className:a,variant:s,...o}=e;return(0,n.jsx)(r.fC,{ref:t,className:(0,l.cn)(u({variant:s}),a),...o})});m.displayName=r.fC.displayName;let h=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(r.aU,{ref:t,className:(0,l.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",a),...s})});h.displayName=r.aU.displayName;let x=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(r.x8,{ref:t,className:(0,l.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",a),"toast-close":"",...s,children:(0,n.jsx)(i.Z,{className:"h-4 w-4"})})});x.displayName=r.x8.displayName;let f=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(r.Dx,{ref:t,className:(0,l.cn)("text-sm font-semibold",a),...s})});f.displayName=r.Dx.displayName;let p=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(r.dk,{ref:t,className:(0,l.cn)("text-sm opacity-90",a),...s})});p.displayName=r.dk.displayName},35657:function(e,t,a){"use strict";a.d(t,{pm:function(){return m}});var n=a(2265);let s=0,r=new Map,o=e=>{if(r.has(e))return;let t=setTimeout(()=>{r.delete(e),d({type:"REMOVE_TOAST",toastId:e})},1e6);r.set(e,t)},i=(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:a}=t;return a?o(a):e.toasts.forEach(e=>{o(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===a||void 0===a?{...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)}}},l=[],c={toasts:[]};function d(e){c=i(c,e),l.forEach(e=>{e(c)})}function u(e){let{...t}=e,a=(s=(s+1)%Number.MAX_SAFE_INTEGER).toString(),n=()=>d({type:"DISMISS_TOAST",toastId:a});return d({type:"ADD_TOAST",toast:{...t,id:a,open:!0,onOpenChange:e=>{e||n()}}}),{id:a,dismiss:n,update:e=>d({type:"UPDATE_TOAST",toast:{...e,id:a}})}}function m(){let[e,t]=n.useState(c);return n.useEffect(()=>(l.push(t),()=>{let e=l.indexOf(t);e>-1&&l.splice(e,1)}),[e]),{...e,toast:u,dismiss:e=>d({type:"DISMISS_TOAST",toastId:e})}}},23611:function(e){e.exports={automationsLayout:"automations_automationsLayout__Atoh_",automationCard:"automations_automationCard__BKidA",pageLayout:"automations_pageLayout__OaoYA",sidePanel:"automations_sidePanel__MPciO"}}},function(e){e.O(0,[9448,3072,216,5512,4504,1279,1603,2971,7023,1744],function(){return e(e.s=2743)}),_N_E=e.O()}]);
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4371],{2743:function(e,t,a){Promise.resolve().then(a.bind(a,19648))},19648:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return ex}});var n=a(57437),s=a(29039),r=a(58485),o=a(36013),i=a(50495),l=a(46294),c=a(18760),d=a.n(c),u=a(31014),m=a(39343),h=a(59772),x=a(2265),f=a(32653),p=a(83102),g=a(90837),j=a(13304),y=a(93146),w=a(69591),v=a(23611),N=a.n(v),b=a(18642),D=a(16463),C=a(19573),k=a(20319),S=a(22049),_=a(55362),I=a(13537),A=a(76082),M=a(52674),R=a(23751),T=a(83522),z=a(8837),P=a(21819),L=a(35418),O=a(64945),W=a(79306),q=a(66820),E=a(35657),U=a(50151),F=a(47412),B=a(48861),V=a(7951);let G=()=>window.fetch("/api/automations").then(e=>e.json()).catch(e=>console.log(e));function Z(e){let t=e.split(" "),a=t[2],n=t[4];return"*"===a&&"*"===n?"Day":"*"!==n?"Week":"*"!==a?"Month":"Day"}function J(e){let t=e.split(" ");if("*"===t[3]&&"*"!==t[4])return Number(t[4])}function Q(e){let t=e.split(" "),a=t[1],n=t[0],s=Number(a)>=12?"PM":"AM",r=Number(a)>12?Number(a)-12:a;"00"===r&&(r="12");let o=n;return 10>Number(o)&&"00"!==o&&(o="0".concat(o)),"".concat(r,":").concat(o," ").concat(s)}function X(e){return String(e.split(" ")[2])}function Y(e){return d().toString(e)}let $=["Day","Week","Month"],H=Array.from({length:31},(e,t)=>String(t+1)),K=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ee=[],et=["AM","PM"];for(var ea=0;ea<et.length;ea++)for(var en=0;en<12;en++)for(var es=0;es<60;es+=15){let e=String(es).padStart(2,"0"),t=0===en?12:en;ee.push("".concat(t,":").concat(e," ").concat(et[ea]))}let er=Date.now(),eo=[{subject:"Weekly Newsletter",query_to_run:"Compile a message including: 1. A recap of news from last week 2. An at-home workout I can do before work 3. A quote to inspire me for the week ahead",schedule:"9AM every Monday",next:"Next run at 9AM on Monday",crontime:"0 9 * * 1",id:er,scheduling_request:""},{subject:"Daily Bedtime Story",query_to_run:"Compose a bedtime story that a five-year-old might enjoy. It should not exceed five paragraphs. Appeal to the imagination, but weave in learnings.",schedule:"9PM every night",next:"Next run at 9PM today",crontime:"0 21 * * *",id:er+1,scheduling_request:""},{subject:"Front Page of Hacker News",query_to_run:"Summarize the top 5 posts from https://news.ycombinator.com/best and share them with me, including links",schedule:"9PM on every Wednesday",next:"Next run at 9PM on Wednesday",crontime:"0 21 * * 3",id:er+2,scheduling_request:""},{subject:"Market Summary",query_to_run:"Get the market summary for today and share it with me. Focus on tech stocks and the S&P 500.",schedule:"9AM on every weekday",next:"Next run at 9AM on Monday",crontime:"0 9 * * *",id:er+3,scheduling_request:""},{subject:"Market Crash Notification",query_to_run:"Notify me if the stock market fell by more than 5% today.",schedule:"5PM every evening",next:"Next run at 5PM today",crontime:"0 17 * * *",id:er+5,scheduling_request:""},{subject:"Round-up of research papers about AI in healthcare",query_to_run:"Summarize the top 3 research papers about AI in healthcare that were published in the last week. Include links to the full papers.",schedule:"9AM every Friday",next:"Next run at 9AM on Friday",crontime:"0 9 * * 5",id:er+4,scheduling_request:""}];function ei(e){let t=encodeURIComponent(e.subject),a=encodeURIComponent(e.query_to_run),n=encodeURIComponent(e.crontime);return"".concat(window.location.origin,"/automations?subject=").concat(t,"&query=").concat(a,"&crontime=").concat(n)}function el(e){let[t,a]=(0,x.useState)(!1),[s,r]=(0,x.useState)(null),[l,c]=(0,x.useState)(!1),[d,u]=(0,x.useState)(""),{toast:m}=(0,E.pm)(),h=e.automation,[f,p]=(0,x.useState)(""),[g,j]=(0,x.useState)("");return((0,x.useEffect)(()=>{let e=s||h;p(Q(e.crontime));let t=Z(e.crontime);if("Day"===t)j("Daily");else if("Week"===t){let t=J(e.crontime);void 0===t?j("Weekly"):j("".concat(K[t]))}else if("Month"===t){let t=X(e.crontime);j("Monthly on the ".concat(t))}},[s,h]),(0,x.useEffect)(()=>{let e="Automation: ".concat((null==s?void 0:s.subject)||h.subject);d&&(m({title:e,description:d,action:(0,n.jsx)(U.gD,{altText:"Dismiss",children:"Ok"})}),u(""))},[d,s,h,m]),l)?null:(0,n.jsxs)(o.Zb,{className:"bg-secondary h-full shadow-sm rounded-lg bg-gradient-to-b from-background to-slate-50 dark:to-gray-950 border ".concat(N().automationCard),children:[(0,n.jsx)(o.Ol,{children:(0,n.jsxs)(o.ll,{className:"line-clamp-2 leading-normal flex justify-between",children:[(null==s?void 0:s.subject)||h.subject,(0,n.jsxs)(C.J2,{children:[(0,n.jsx)(C.xo,{asChild:!0,children:(0,n.jsx)(i.z,{className:"bg-background",variant:"ghost",children:(0,n.jsx)(k.F,{className:"h-4 w-4"})})}),(0,n.jsxs)(C.yk,{className:"w-auto grid gap-2 text-left bg-secondary",children:[!e.suggestedCard&&e.locationData&&(0,n.jsx)(eh,{isMobileWidth:e.isMobileWidth,callToAction:"Edit",createNew:!1,setIsCreating:a,setShowLoginPrompt:e.setShowLoginPrompt,setNewAutomationData:r,authenticatedData:e.authenticatedData,isCreating:t,automation:s||h,ipLocationData:e.locationData}),(0,n.jsx)(b.Z,{buttonTitle:"Share",includeIcon:!0,buttonClassName:"justify-start px-4 py-2 h-10",buttonVariant:"outline",title:"Share Automation",description:"Copy the link below and share it with your coworkers or friends.",url:ei(h),onShare:()=>{navigator.clipboard.writeText(ei(h))}}),!e.suggestedCard&&(0,n.jsxs)(i.z,{variant:"outline",className:"justify-start",onClick:()=>{!function(e,t){fetch("/api/trigger/automation?automation_id=".concat(e),{method:"POST"}).then(e=>{if(!e.ok)throw Error("Network response was not ok");return e}).then(e=>{t("Automation triggered. Check your inbox in a few minutes!")}).catch(e=>{t("Sorry, something went wrong. Try again later.")})}(h.id.toString(),u)},children:[(0,n.jsx)(S.s,{className:"h-4 w-4 mr-2"}),"Run Now"]}),(0,n.jsxs)(i.z,{variant:"destructive",className:"justify-start",onClick:()=>{if(e.suggestedCard){c(!0);return}!function(e,t){fetch("/api/automation?automation_id=".concat(e),{method:"DELETE"}).then(e=>e.json()).then(e=>{t(!0)})}(h.id.toString(),c)},children:[(0,n.jsx)(_.r,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]})}),(0,n.jsx)(o.aY,{className:"text-secondary-foreground break-all",children:(null==s?void 0:s.query_to_run)||h.query_to_run}),(0,n.jsxs)(o.eW,{className:"flex flex-col items-start md:flex-row md:justify-between md:items-center gap-2",children:[(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsxs)("div",{className:"flex items-center bg-blue-50 rounded-lg p-1.5 border-blue-200 border dark:bg-blue-800 dark:border-blue-500",children:[(0,n.jsx)(I.T,{className:"h-4 w-4 mr-2 text-blue-700 dark:text-blue-300"}),(0,n.jsx)("div",{className:"text-s text-blue-700 dark:text-blue-300",children:f})]}),(0,n.jsxs)("div",{className:"flex items-center bg-purple-50 rounded-lg p-1.5 border-purple-200 border dark:bg-purple-800 dark:border-purple-500",children:[(0,n.jsx)(A.u,{className:"h-4 w-4 mr-2 text-purple-700 dark:text-purple-300"}),(0,n.jsx)("div",{className:"text-s text-purple-700 dark:text-purple-300",children:g})]})]}),e.suggestedCard&&e.setNewAutomationData&&(0,n.jsx)(eh,{isMobileWidth:e.isMobileWidth,callToAction:"Add",createNew:!0,setIsCreating:a,setShowLoginPrompt:e.setShowLoginPrompt,setNewAutomationData:e.setNewAutomationData,authenticatedData:e.authenticatedData,isCreating:t,automation:h,ipLocationData:e.locationData})]})]})}function ec(e){let t=(0,D.useSearchParams)(),[a,s]=(0,x.useState)(!0),r=t.get("subject"),o=t.get("query"),i=t.get("crontime");if(!r||!o||!i)return null;let l={id:0,subject:decodeURIComponent(r),query_to_run:decodeURIComponent(o),scheduling_request:"",schedule:Y(decodeURIComponent(i)),crontime:decodeURIComponent(i),next:""};return a?(0,n.jsx)(eh,{isMobileWidth:e.isMobileWidth,callToAction:"Shared",createNew:!0,setIsCreating:s,setShowLoginPrompt:e.setShowLoginPrompt,setNewAutomationData:e.setNewAutomationData,authenticatedData:e.authenticatedData,isCreating:a,automation:l,ipLocationData:e.locationData}):null}let ed=h.z.object({subject:h.z.optional(h.z.string()),everyBlah:h.z.string({required_error:"Every is required"}),dayOfWeek:h.z.optional(h.z.number()),dayOfMonth:h.z.optional(h.z.string()),timeRecurrence:h.z.string({required_error:"Time Recurrence is required"}),queryToRun:h.z.string({required_error:"Query to Run is required"})});function eu(e){let t=e.automation,a=(0,m.cI)({resolver:(0,u.F)(ed),defaultValues:{subject:null==t?void 0:t.subject,everyBlah:(null==t?void 0:t.crontime)?Z(t.crontime):"Day",dayOfWeek:(null==t?void 0:t.crontime)?J(t.crontime):void 0,timeRecurrence:(null==t?void 0:t.crontime)?Q(t.crontime):"12:00 PM",dayOfMonth:(null==t?void 0:t.crontime)?X(t.crontime):"1",queryToRun:null==t?void 0:t.query_to_run}});return(0,n.jsx)(em,{authenticatedData:e.authenticatedData,locationData:e.locationData||null,form:a,onSubmit:a=>{let n=function(e,t,a,n){let s="",r=t.split(":")[1].split(" ")[0],o=t.split(":")[1].split(" ")[1],i=Number(t.split(":")[0]),l="PM"===o&&i<12?String(i+12):i;switch(e){case"Day":s="".concat(r," ").concat(l," * * *");break;case"Week":s="".concat(r," ").concat(l," * * ").concat(void 0!==a?7===a?0:a:"*");break;case"Month":s="".concat(r," ").concat(l," ").concat(n," * *")}return s}(a.everyBlah,a.timeRecurrence,a.dayOfWeek,a.dayOfMonth),s="/api/automation?";s+="q=".concat(encodeURIComponent(a.queryToRun)),(null==t?void 0:t.id)&&!e.createNew&&(s+="&automation_id=".concat(encodeURIComponent(t.id))),a.subject&&(s+="&subject=".concat(encodeURIComponent(a.subject))),s+="&crontime=".concat(encodeURIComponent(n)),e.locationData&&e.locationData.city&&(s+="&city=".concat(encodeURIComponent(e.locationData.city))),e.locationData&&e.locationData.region&&(s+="®ion=".concat(encodeURIComponent(e.locationData.region))),e.locationData&&e.locationData.country&&(s+="&country=".concat(encodeURIComponent(e.locationData.country))),e.locationData&&e.locationData.timezone&&(s+="&timezone=".concat(encodeURIComponent(e.locationData.timezone))),fetch(s,{method:e.createNew?"POST":"PUT"}).then(e=>e.json()).then(t=>{e.setIsEditing(!1),e.setUpdatedAutomationData({id:t.id,subject:t.subject||"",query_to_run:t.query_to_run,scheduling_request:t.scheduling_request,schedule:Y(t.crontime),crontime:t.crontime,next:t.next})})},create:e.createNew,isLoggedIn:e.isLoggedIn,setShowLoginPrompt:e.setShowLoginPrompt})}function em(e){var t,a;let[s,r]=(0,x.useState)(!1),{errors:o}=e.form.formState,c=["Make a picture of","Generate a summary of","Create a newsletter of","Notify me when"];return(0,n.jsx)(f.l0,{...e.form,children:(0,n.jsxs)("form",{onSubmit:e.form.handleSubmit(t=>{e.onSubmit(t),r(!0)}),className:"space-y-6",children:[(0,n.jsx)(f.xJ,{className:"space-y-1",children:(0,n.jsxs)(f.pf,{children:["Emails will be sent to this address. Timezone and location data will be used to schedule automations.",e.locationData&&(t=e.locationData,a=e.authenticatedData,(0,n.jsxs)("div",{className:"flex flex-wrap gap-2 items-center justify-start",children:[a?(0,n.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm",children:[(0,n.jsx)(T.w,{className:"h-4 w-4 mr-2 inline text-orange-500 shadow-sm"}),a.email]}):null,t&&(0,n.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm",children:[(0,n.jsx)(z.x,{className:"h-4 w-4 mr-2 inline text-purple-500"}),t?"".concat(t.city,", ").concat(t.country):"Unknown"]}),t&&(0,n.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm",children:[(0,n.jsx)(P.S,{className:"h-4 w-4 mr-2 inline text-green-500"}),t?"".concat(t.timezone):"Unknown"]})]}))]})}),!e.create&&(0,n.jsx)(f.Wi,{control:e.form.control,name:"subject",render:e=>{var t;let{field:a}=e;return(0,n.jsxs)(f.xJ,{className:"space-y-1",children:[(0,n.jsx)(f.lX,{children:"Subject"}),(0,n.jsx)(f.pf,{children:"This is the subject of the email you will receive."}),(0,n.jsx)(f.NI,{children:(0,n.jsx)(p.I,{placeholder:"Digest of Healthcare AI trends",...a})}),(0,n.jsx)(f.zG,{}),o.subject&&(0,n.jsx)(f.zG,{children:null===(t=o.subject)||void 0===t?void 0:t.message})]})}}),(0,n.jsx)(f.Wi,{control:e.form.control,name:"everyBlah",render:e=>{var t;let{field:a}=e;return(0,n.jsxs)(f.xJ,{className:"w-full space-y-1",children:[(0,n.jsx)(f.lX,{children:"Frequency"}),(0,n.jsx)(f.pf,{children:"How often should this automation run?"}),(0,n.jsxs)(l.Ph,{onValueChange:a.onChange,defaultValue:a.value,children:[(0,n.jsx)(f.NI,{children:(0,n.jsxs)(l.i4,{className:"w-[200px]",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(M.W,{className:"h-4 w-4 mr-2 inline"}),"Every"]}),(0,n.jsx)(l.ki,{placeholder:""})]})}),(0,n.jsx)(l.Bw,{children:$.map(e=>(0,n.jsx)(l.Ql,{value:e,children:e},e))})]}),(0,n.jsx)(f.zG,{}),o.subject&&(0,n.jsx)(f.zG,{children:null===(t=o.everyBlah)||void 0===t?void 0:t.message})]})}}),"Week"===e.form.watch("everyBlah")&&(0,n.jsx)(f.Wi,{control:e.form.control,name:"dayOfWeek",render:e=>{var t;let{field:a}=e;return(0,n.jsxs)(f.xJ,{className:"w-full space-y-1",children:[(0,n.jsx)(f.pf,{children:"Every week, on which day should this automation run?"}),(0,n.jsxs)(l.Ph,{onValueChange:e=>a.onChange(Number(e)),defaultValue:String(a.value),children:[(0,n.jsx)(f.NI,{children:(0,n.jsxs)(l.i4,{className:"w-[200px]",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(R.n,{className:"h-4 w-4 mr-2 inline"}),"On"]}),(0,n.jsx)(l.ki,{placeholder:""})]})}),(0,n.jsx)(l.Bw,{children:K.map((e,t)=>(0,n.jsx)(l.Ql,{value:String(t),children:e},e))})]}),(0,n.jsx)(f.zG,{}),o.subject&&(0,n.jsx)(f.zG,{children:null===(t=o.dayOfWeek)||void 0===t?void 0:t.message})]})}}),"Month"===e.form.watch("everyBlah")&&(0,n.jsx)(f.Wi,{control:e.form.control,name:"dayOfMonth",render:e=>{var t;let{field:a}=e;return(0,n.jsxs)(f.xJ,{className:"w-full space-y-1",children:[(0,n.jsx)(f.pf,{children:"Every month, on which day should the automation run?"}),(0,n.jsxs)(l.Ph,{onValueChange:a.onChange,defaultValue:a.value,children:[(0,n.jsx)(f.NI,{children:(0,n.jsxs)(l.i4,{className:"w-[200px]",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(R.n,{className:"h-4 w-4 mr-2 inline"}),"On the"]}),(0,n.jsx)(l.ki,{placeholder:""})]})}),(0,n.jsx)(l.Bw,{children:H.map(e=>(0,n.jsx)(l.Ql,{value:e,children:e},e))})]}),(0,n.jsx)(f.zG,{}),o.subject&&(0,n.jsx)(f.zG,{children:null===(t=o.dayOfMonth)||void 0===t?void 0:t.message})]})}}),("Day"===e.form.watch("everyBlah")||"Week"==e.form.watch("everyBlah")||"Month"==e.form.watch("everyBlah"))&&(0,n.jsx)(f.Wi,{control:e.form.control,name:"timeRecurrence",render:e=>{var t;let{field:a}=e;return(0,n.jsxs)(f.xJ,{className:"w-full space-y-1",children:[(0,n.jsx)(f.lX,{children:"Time"}),(0,n.jsx)(f.pf,{children:"On the days this automation runs, at what time should it run?"}),(0,n.jsxs)(l.Ph,{onValueChange:a.onChange,defaultValue:a.value,children:[(0,n.jsx)(f.NI,{children:(0,n.jsxs)(l.i4,{className:"w-[200px]",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(A.u,{className:"h-4 w-4 mr-2 inline"}),"At"]}),(0,n.jsx)(l.ki,{placeholder:""})]})}),(0,n.jsx)(l.Bw,{children:ee.map(e=>(0,n.jsx)(l.Ql,{value:e,children:e},e))})]}),(0,n.jsx)(f.zG,{}),o.subject&&(0,n.jsx)(f.zG,{children:null===(t=o.timeRecurrence)||void 0===t?void 0:t.message})]})}}),(0,n.jsx)(f.Wi,{control:e.form.control,name:"queryToRun",render:t=>{var a;let{field:s}=t;return(0,n.jsxs)(f.xJ,{className:"space-y-1",children:[(0,n.jsx)(f.lX,{children:"Instructions"}),(0,n.jsx)(f.pf,{children:"What do you want Khoj to do?"}),e.create&&(0,n.jsx)("div",{children:c.map(e=>{var t;return t=s.onChange,(0,n.jsxs)(i.z,{className:"text-xs bg-slate-50 dark:bg-slate-950 h-auto p-1.5 m-1 rounded-full",variant:"ghost",onClick:a=>{a.preventDefault(),t({target:{value:e}},a)},children:[e,"..."]},e)})}),(0,n.jsx)(f.NI,{children:(0,n.jsx)(y.g,{placeholder:"Create a summary of the latest news about AI in healthcare.",value:s.value,onChange:s.onChange})}),(0,n.jsx)(f.zG,{}),o.subject&&(0,n.jsx)(f.zG,{children:null===(a=o.queryToRun)||void 0===a?void 0:a.message})]})}}),(0,n.jsx)("fieldset",{disabled:s,children:e.isLoggedIn?s?(0,n.jsx)(i.z,{type:"submit",disabled:!0,children:"Saving..."}):(0,n.jsx)(i.z,{type:"submit",children:"Save"}):(0,n.jsx)(i.z,{onClick:t=>{t.preventDefault(),e.setShowLoginPrompt(!0)},variant:"default",children:"Login to Save"})})]})})}function eh(e){return e.isMobileWidth?(0,n.jsxs)(V.dy,{open:e.isCreating,onOpenChange:t=>{e.setIsCreating(t)},children:[(0,n.jsx)(V.Qz,{asChild:!0,children:(0,n.jsxs)(i.z,{className:"shadow-sm justify-start",variant:"outline",children:[(0,n.jsx)(L.v,{className:"h-4 w-4 mr-2"}),e.callToAction]})}),(0,n.jsxs)(V.sc,{className:"p-2",children:[(0,n.jsx)(V.iI,{children:"Automation"}),(0,n.jsx)(eu,{createNew:e.createNew,automation:e.automation,setIsEditing:e.setIsCreating,isLoggedIn:!!e.authenticatedData,authenticatedData:e.authenticatedData,setShowLoginPrompt:e.setShowLoginPrompt,setUpdatedAutomationData:e.setNewAutomationData,locationData:e.ipLocationData})]})]}):(0,n.jsxs)(g.Vq,{open:e.isCreating,onOpenChange:t=>{e.setIsCreating(t)},children:[(0,n.jsx)(g.hg,{asChild:!0,children:(0,n.jsxs)(i.z,{className:"shadow-sm justify-start",variant:"outline",children:[(0,n.jsx)(L.v,{className:"h-4 w-4 mr-2"}),e.callToAction]})}),(0,n.jsxs)(g.cZ,{className:"max-h-[98vh] overflow-y-auto",children:[(0,n.jsx)(j.$N,{children:"Automation"}),(0,n.jsx)(eu,{automation:e.automation,createNew:e.createNew,setIsEditing:e.setIsCreating,isLoggedIn:!!e.authenticatedData,authenticatedData:e.authenticatedData,setShowLoginPrompt:e.setShowLoginPrompt,setUpdatedAutomationData:e.setNewAutomationData,locationData:e.ipLocationData})]})]})}function ex(){let e=(0,W.GW)(),{data:t,error:a,isLoading:o}=(0,s.ZP)(e?"automations":null,G,{revalidateOnFocus:!1}),[l,c]=(0,x.useState)(!1),[d,u]=(0,x.useState)(null),[m,h]=(0,x.useState)([]),[f,p]=(0,x.useState)([]),[g,j]=(0,x.useState)(!1),y=(0,w.IC)(),v=(0,w.k6)();return((0,x.useEffect)(()=>{d&&(h([...m,d]),u(null))},[d,m]),(0,x.useEffect)(()=>{let e=t?t.concat(m):m;e&&p(eo.filter(t=>void 0===e.find(e=>t.subject===e.subject)))},[t,m]),a)?(0,n.jsx)(r.l,{message:"Oops, something went wrong. Please refresh the page."}):(0,n.jsx)("main",{className:"w-full mx-auto",children:(0,n.jsxs)("div",{className:"grid w-full mx-auto",children:[(0,n.jsx)("div",{className:"".concat(N().sidePanel," top-0"),children:(0,n.jsx)(B.ZP,{conversationId:null,uploadedFiles:[],isMobileWidth:y})}),(0,n.jsxs)("div",{className:"".concat(N().pageLayout," w-full"),children:[(0,n.jsxs)("div",{className:"pt-6 md:pt-8 grid gap-1 md:flex md:justify-between",children:[(0,n.jsx)("h1",{className:"text-3xl flex items-center",children:"Automations"}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2 items-center justify-start",children:[e?(0,n.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm",children:[(0,n.jsx)(T.w,{className:"h-4 w-4 mr-2 inline text-orange-500 shadow-sm"}),e.email]}):null,v&&(0,n.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm",children:[(0,n.jsx)(z.x,{className:"h-4 w-4 mr-2 inline text-purple-500"}),v?"".concat(v.city,", ").concat(v.country):"Unknown"]}),v&&(0,n.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm",children:[(0,n.jsx)(P.S,{className:"h-4 w-4 mr-2 inline text-green-500"}),v?"".concat(v.timezone):"Unknown"]})]})]}),g&&(0,n.jsx)(q.Z,{loginRedirectMessage:"Create an account to make your own automation",onOpenChange:j}),(0,n.jsx)(F.bZ,{className:"bg-secondary border-none my-4",children:(0,n.jsxs)(F.X,{children:[(0,n.jsx)(O.B,{weight:"fill",className:"h-4 w-4 text-purple-400 inline"}),(0,n.jsx)("span",{className:"font-bold",children:"How it works"})," Automations help you structure your time by automating tasks you do regularly. Build your own, or try out our presets. Get results straight to your inbox."]})}),(0,n.jsxs)("div",{className:"flex justify-between items-center py-4",children:[(0,n.jsx)("h3",{className:"text-xl",children:"Your Creations"}),e?(0,n.jsx)(eh,{isMobileWidth:y,callToAction:"Create Automation",createNew:!0,setIsCreating:c,setShowLoginPrompt:j,setNewAutomationData:u,authenticatedData:e,isCreating:l,ipLocationData:v}):(0,n.jsxs)(i.z,{className:"shadow-sm",onClick:()=>j(!0),variant:"outline",children:[(0,n.jsx)(L.v,{className:"h-4 w-4 mr-2"}),"Create Automation"]})]}),(0,n.jsx)(x.Suspense,{children:(0,n.jsx)(ec,{isMobileWidth:y,authenticatedData:e,locationData:v,isLoggedIn:!!e,setShowLoginPrompt:j,setNewAutomationData:u})}),(!t||0===t.length)&&0==m.length&&!o&&(0,n.jsxs)("div",{className:"px-4",children:["So empty! Create your own automation to get started.",(0,n.jsx)("div",{className:"mt-4",children:e?(0,n.jsx)(eh,{isMobileWidth:y,callToAction:"Design Automation",createNew:!0,setIsCreating:c,setShowLoginPrompt:j,setNewAutomationData:u,authenticatedData:e,isCreating:l,ipLocationData:v}):(0,n.jsx)(i.z,{onClick:()=>j(!0),variant:"default",children:"Design"})})]}),o&&(0,n.jsx)(r.l,{message:"booting up your automations"}),(0,n.jsxs)("div",{className:"".concat(N().automationsLayout),children:[t&&t.map(t=>(0,n.jsx)(el,{isMobileWidth:y,authenticatedData:e,automation:t,locationData:v,isLoggedIn:!!e,setShowLoginPrompt:j},t.id)),m.map(t=>(0,n.jsx)(el,{isMobileWidth:y,authenticatedData:e,automation:t,locationData:v,isLoggedIn:!!e,setShowLoginPrompt:j},t.id))]}),(0,n.jsx)("h3",{className:"text-xl py-4",children:"Try these out"}),(0,n.jsx)("div",{className:"".concat(N().automationsLayout),children:f.map(t=>(0,n.jsx)(el,{isMobileWidth:y,setNewAutomationData:u,authenticatedData:e,automation:t,locationData:v,isLoggedIn:!!e,setShowLoginPrompt:j,suggestedCard:!0},t.id))})]})]})})}},66820:function(e,t,a){"use strict";a.d(t,{Z:function(){return o}});var n=a(57437),s=a(6780),r=a(87138);function o(e){return(0,n.jsx)(s.aR,{open:!0,onOpenChange:e.onOpenChange,children:(0,n.jsxs)(s._T,{children:[(0,n.jsx)(s.fY,{children:(0,n.jsx)(s.f$,{children:"Sign in to Khoj to continue"})}),(0,n.jsxs)(s.yT,{children:[e.loginRedirectMessage,". By logging in, you agree to our"," ",(0,n.jsx)(r.default,{href:"https://khoj.dev/terms-of-service",children:"Terms of Service."})]}),(0,n.jsxs)(s.xo,{children:[(0,n.jsx)(s.le,{children:"Dismiss"}),(0,n.jsx)(s.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>{window.location.href="/login?next=".concat(encodeURIComponent(window.location.pathname))},children:(0,n.jsxs)(r.default,{href:"/login?next=".concat(encodeURIComponent(window.location.pathname)),children:[" ","Login"]})})]})]})})}},18642:function(e,t,a){"use strict";a.d(t,{Z:function(){return c}});var n=a(57437),s=a(90837),r=a(50495),o=a(83102),i=a(67135),l=a(34797);function c(e){var t;return(0,n.jsxs)(s.Vq,{children:[(0,n.jsx)(s.hg,{asChild:!0,onClick:e.onShare,children:(0,n.jsxs)(r.z,{size:"sm",className:"".concat(e.buttonClassName||"px-3"),variant:null!==(t=e.buttonVariant)&&void 0!==t?t:"default",children:[e.includeIcon&&(0,n.jsx)(l.m,{className:"w-4 h-4 mr-2"}),e.buttonTitle]})}),(0,n.jsxs)(s.cZ,{children:[(0,n.jsxs)(s.fK,{children:[(0,n.jsx)(s.$N,{children:e.title}),(0,n.jsx)(s.Be,{children:e.description})]}),(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,n.jsxs)("div",{className:"grid flex-1 gap-2",children:[(0,n.jsx)(i._,{htmlFor:"link",className:"sr-only",children:"Link"}),(0,n.jsx)(o.I,{id:"link",defaultValue:e.url,readOnly:!0})]}),(0,n.jsx)(r.z,{type:"submit",size:"sm",className:"px-3",onClick:()=>(function(e){let t=navigator.clipboard;t&&t.writeText(e)})(e.url),children:(0,n.jsx)("span",{children:"Copy"})})]})]})]})}},47412:function(e,t,a){"use strict";a.d(t,{X:function(){return c},bZ:function(){return l}});var n=a(57437),s=a(2265),r=a(12218),o=a(37440);let i=(0,r.j)("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),l=s.forwardRef((e,t)=>{let{className:a,variant:s,...r}=e;return(0,n.jsx)("div",{ref:t,role:"alert",className:(0,o.cn)(i({variant:s}),a),...r})});l.displayName="Alert",s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)("h5",{ref:t,className:(0,o.cn)("mb-1 font-medium leading-none tracking-tight",a),...s})}).displayName="AlertTitle";let c=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)("div",{ref:t,className:(0,o.cn)("text-sm [&_p]:leading-relaxed",a),...s})});c.displayName="AlertDescription"},32653:function(e,t,a){"use strict";a.d(t,{NI:function(){return p},Wi:function(){return u},l0:function(){return c},lX:function(){return f},pf:function(){return g},xJ:function(){return x},zG:function(){return j}});var n=a(57437),s=a(2265),r=a(71538),o=a(39343),i=a(37440),l=a(67135);let c=o.RV,d=s.createContext({}),u=e=>{let{...t}=e;return(0,n.jsx)(d.Provider,{value:{name:t.name},children:(0,n.jsx)(o.Qr,{...t})})},m=()=>{let e=s.useContext(d),t=s.useContext(h),{getFieldState:a,formState:n}=(0,o.Gc)(),r=a(e.name,n);if(!e)throw Error("useFormField should be used within <FormField>");let{id:i}=t;return{id:i,name:e.name,formItemId:"".concat(i,"-form-item"),formDescriptionId:"".concat(i,"-form-item-description"),formMessageId:"".concat(i,"-form-item-message"),...r}},h=s.createContext({}),x=s.forwardRef((e,t)=>{let{className:a,...r}=e,o=s.useId();return(0,n.jsx)(h.Provider,{value:{id:o},children:(0,n.jsx)("div",{ref:t,className:(0,i.cn)("space-y-2",a),...r})})});x.displayName="FormItem";let f=s.forwardRef((e,t)=>{let{className:a,...s}=e,{error:r,formItemId:o}=m();return(0,n.jsx)(l._,{ref:t,className:(0,i.cn)(r&&"text-destructive",a),htmlFor:o,...s})});f.displayName="FormLabel";let p=s.forwardRef((e,t)=>{let{...a}=e,{error:s,formItemId:o,formDescriptionId:i,formMessageId:l}=m();return(0,n.jsx)(r.g7,{ref:t,id:o,"aria-describedby":s?"".concat(i," ").concat(l):"".concat(i),"aria-invalid":!!s,...a})});p.displayName="FormControl";let g=s.forwardRef((e,t)=>{let{className:a,...s}=e,{formDescriptionId:r}=m();return(0,n.jsx)("p",{ref:t,id:r,className:(0,i.cn)("text-sm text-muted-foreground",a),...s})});g.displayName="FormDescription";let j=s.forwardRef((e,t)=>{let{className:a,children:s,...r}=e,{error:o,formMessageId:l}=m(),c=o?String(null==o?void 0:o.message):s;return c?(0,n.jsx)("p",{ref:t,id:l,className:(0,i.cn)("text-sm font-medium text-destructive",a),...r,children:c}):null});j.displayName="FormMessage"},67135:function(e,t,a){"use strict";a.d(t,{_:function(){return c}});var n=a(57437),s=a(2265),r=a(38364),o=a(12218),i=a(37440);let l=(0,o.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),c=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(r.f,{ref:t,className:(0,i.cn)(l(),a),...s})});c.displayName=r.f.displayName},46294:function(e,t,a){"use strict";a.d(t,{Bw:function(){return f},Ph:function(){return d},Ql:function(){return p},i4:function(){return m},ki:function(){return u}});var n=a(57437),s=a(2265),r=a(77539),o=a(42421),i=a(14392),l=a(22468),c=a(37440);let d=r.fC;r.ZA;let u=r.B4,m=s.forwardRef((e,t)=>{let{className:a,children:s,...i}=e;return(0,n.jsxs)(r.xz,{ref:t,className:(0,c.cn)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",a),...i,children:[s,(0,n.jsx)(r.JO,{asChild:!0,children:(0,n.jsx)(o.Z,{className:"h-4 w-4 opacity-50"})})]})});m.displayName=r.xz.displayName;let h=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(r.u_,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",a),...s,children:(0,n.jsx)(i.Z,{className:"h-4 w-4"})})});h.displayName=r.u_.displayName;let x=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(r.$G,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",a),...s,children:(0,n.jsx)(o.Z,{className:"h-4 w-4"})})});x.displayName=r.$G.displayName;let f=s.forwardRef((e,t)=>{let{className:a,children:s,position:o="popper",...i}=e;return(0,n.jsx)(r.h_,{children:(0,n.jsxs)(r.VY,{ref:t,className:(0,c.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===o&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",a),position:o,...i,children:[(0,n.jsx)(h,{}),(0,n.jsx)(r.l_,{className:(0,c.cn)("p-1","popper"===o&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),(0,n.jsx)(x,{})]})})});f.displayName=r.VY.displayName,s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(r.__,{ref:t,className:(0,c.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",a),...s})}).displayName=r.__.displayName;let p=s.forwardRef((e,t)=>{let{className:a,children:s,...o}=e;return(0,n.jsxs)(r.ck,{ref:t,className:(0,c.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),...o,children:[(0,n.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,n.jsx)(r.wU,{children:(0,n.jsx)(l.Z,{className:"h-4 w-4"})})}),(0,n.jsx)(r.eT,{children:s})]})});p.displayName=r.ck.displayName,s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(r.Z0,{ref:t,className:(0,c.cn)("-mx-1 my-1 h-px bg-muted",a),...s})}).displayName=r.Z0.displayName},93146:function(e,t,a){"use strict";a.d(t,{g:function(){return o}});var n=a(57437),s=a(2265),r=a(37440);let o=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)("textarea",{className:(0,r.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,...s})});o.displayName="Textarea"},50151:function(e,t,a){"use strict";a.d(t,{FN:function(){return m},Mi:function(){return f},VW:function(){return c},_i:function(){return d},gD:function(){return h},lj:function(){return p},sA:function(){return x}});var n=a(57437),s=a(2265),r=a(44504),o=a(12218),i=a(74697),l=a(37440);let c=r.zt,d=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(r.l_,{ref:t,className:(0,l.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]",a),...s})});d.displayName=r.l_.displayName;let u=(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"}}),m=s.forwardRef((e,t)=>{let{className:a,variant:s,...o}=e;return(0,n.jsx)(r.fC,{ref:t,className:(0,l.cn)(u({variant:s}),a),...o})});m.displayName=r.fC.displayName;let h=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(r.aU,{ref:t,className:(0,l.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",a),...s})});h.displayName=r.aU.displayName;let x=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(r.x8,{ref:t,className:(0,l.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",a),"toast-close":"",...s,children:(0,n.jsx)(i.Z,{className:"h-4 w-4"})})});x.displayName=r.x8.displayName;let f=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(r.Dx,{ref:t,className:(0,l.cn)("text-sm font-semibold",a),...s})});f.displayName=r.Dx.displayName;let p=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(r.dk,{ref:t,className:(0,l.cn)("text-sm opacity-90",a),...s})});p.displayName=r.dk.displayName},35657:function(e,t,a){"use strict";a.d(t,{pm:function(){return m}});var n=a(2265);let s=0,r=new Map,o=e=>{if(r.has(e))return;let t=setTimeout(()=>{r.delete(e),d({type:"REMOVE_TOAST",toastId:e})},1e6);r.set(e,t)},i=(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:a}=t;return a?o(a):e.toasts.forEach(e=>{o(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===a||void 0===a?{...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)}}},l=[],c={toasts:[]};function d(e){c=i(c,e),l.forEach(e=>{e(c)})}function u(e){let{...t}=e,a=(s=(s+1)%Number.MAX_SAFE_INTEGER).toString(),n=()=>d({type:"DISMISS_TOAST",toastId:a});return d({type:"ADD_TOAST",toast:{...t,id:a,open:!0,onOpenChange:e=>{e||n()}}}),{id:a,dismiss:n,update:e=>d({type:"UPDATE_TOAST",toast:{...e,id:a}})}}function m(){let[e,t]=n.useState(c);return n.useEffect(()=>(l.push(t),()=>{let e=l.indexOf(t);e>-1&&l.splice(e,1)}),[e]),{...e,toast:u,dismiss:e=>d({type:"DISMISS_TOAST",toastId:e})}}},23611:function(e){e.exports={automationsLayout:"automations_automationsLayout__Atoh_",automationCard:"automations_automationCard__BKidA",pageLayout:"automations_pageLayout__OaoYA",sidePanel:"automations_sidePanel__MPciO"}}},function(e){e.O(0,[2734,9848,3072,216,5512,4504,1279,1603,2971,7023,1744],function(){return e(e.s=2743)}),_N_E=e.O()}]);
|
@@ -1 +1 @@
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1929],{39929:function(e,t,s){Promise.resolve().then(s.bind(s,38874))},38874:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return p}});var a=s(57437),o=s(65104),n=s.n(o),i=s(2265),r=s(48861),l=s(55538),c=s(16463),d=s(58485),u=s(9557);s(7395);var h=s(69591),m=s(38423),g=s(79306);function f(e){let t=(0,c.useSearchParams)().get("conversationId"),[s,o]=(0,i.useState)(""),[r,d]=(0,i.useState)([]),[u,h]=(0,i.useState)(!1),[g,f]=(0,i.useState)(null),[p,_]=(0,i.useState)(!1),x=(0,i.useRef)(null),y=e.setQueryToProcess,w=e.onConversationIdChange,S=e.isMobileWidth?"w-full":"w-4/6";if((0,i.useEffect)(()=>{if(r.length>0){let t=r.map(e=>encodeURIComponent(e));e.setImages(t)}},[r,e.setImages]),(0,i.useEffect)(()=>{let t=localStorage.getItem("images");if(t){let s=JSON.parse(t);d(s);let a=s.map(e=>encodeURIComponent(e));e.setImages(a),localStorage.removeItem("images")}let s=localStorage.getItem("message");s&&(h(!0),y(s),s.trim().startsWith("/research")&&_(!0));let a=localStorage.getItem("uploadedFiles");if(a){let t=a?JSON.parse(a):[],s=[];for(let e of t)s.push({name:e.name,file_type:e.file_type,content:e.content,size:e.size});localStorage.removeItem("uploadedFiles"),e.setUploadedFiles(s)}},[y,e.setImages,t]),(0,i.useEffect)(()=>{s&&(h(!0),y(s))},[s,y]),(0,i.useEffect)(()=>{t&&(null==w||w(t))},[t,w]),(0,i.useEffect)(()=>{e.streamedMessages&&e.streamedMessages.length>0&&e.streamedMessages[e.streamedMessages.length-1].completed?(h(!1),d([]),e.setUploadedFiles(void 0)):o("")},[e.streamedMessages]),!t){window.location.href="/";return}return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:n().chatBodyFull,children:(0,a.jsx)(l.Z,{conversationId:t,setTitle:e.setTitle,setAgent:f,pendingMessage:u?s:"",incomingMessages:e.streamedMessages,setIncomingMessages:e.setStreamedMessages,customClassName:S})}),(0,a.jsx)("div",{className:"".concat(n().inputBox," p-1 md:px-2 shadow-md bg-background align-middle items-center justify-center dark:bg-neutral-700 dark:border-0 dark:shadow-sm rounded-t-2xl rounded-b-none md:rounded-xl h-fit ").concat(S," mr-auto ml-auto"),children:(0,a.jsx)(m.a,{agentColor:null==g?void 0:g.color,isLoggedIn:e.isLoggedIn,sendMessage:e=>o(e),sendImage:e=>d(t=>[...t,e]),sendDisabled:u,chatOptionsData:e.chatOptionsData,conversationId:t,isMobileWidth:e.isMobileWidth,setUploadedFiles:e.setUploadedFiles,ref:x,isResearchModeEnabled:p,setTriggeredAbort:e.setTriggeredAbort})})]})}function p(){let e="Khoj AI - Chat",[t,s]=(0,i.useState)(null),[o,l]=(0,i.useState)(!0),[c,m]=(0,i.useState)(e),[p,_]=(0,i.useState)(null),[x,y]=(0,i.useState)([]),[w,S]=(0,i.useState)(""),[I,b]=(0,i.useState)(!1),[v,j]=(0,i.useState)(void 0),[C,B]=(0,i.useState)([]),[E,M]=(0,i.useState)(null),[T,k]=(0,i.useState)(!1),F=(0,h.k6)()||{timezone:Intl.DateTimeFormat().resolvedOptions().timeZone},R=(0,g.GW)(),N=(0,h.IC)();async function O(e){if(!e.ok)throw Error(e.statusText);if(!e.body)throw Error("Response body is null");let t=e.body.getReader(),s=new TextDecoder,a="␃\uD83D\uDD1A␗",o="",n=[],i={},r={};for(;;){let e;let{done:l,value:c}=await t.read();if(l){S(""),b(!1),B([]),p&&(0,u.tQ)(p,m);break}for(o+=s.decode(c,{stream:!0});-1!==(e=o.indexOf(a));){let t=o.slice(0,e);if(o=o.slice(e+a.length),t){let e=x.find(e=>!e.completed);if(!e){console.error("No current message found");return}({context:n,onlineContext:i,codeContext:r}=(0,u.VK)(t,e,n,i,r)),y([...x])}}}}async function W(){if(localStorage.removeItem("message"),!w||!p)return;let e={q:w,conversation_id:p,stream:!0,...F&&{city:F.city,region:F.region,country:F.country,country_code:F.countryCode,timezone:F.timezone},...C.length>0&&{images:C},...v&&{files:v}},t=await fetch("/api/chat?client=web",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:null==E?void 0:E.signal});try{await O(t)}catch(n){let e=await t.json();console.error(e);let s=x.find(e=>!e.completed);if(!s)return;let a=n.message,o=n.name;a.includes("Error in input stream")?s.rawResponse="Woops! The connection broke while I was writing my thoughts down. Maybe try again in a bit or dislike this message if the issue persists?":429===t.status?"detail"in e?s.rawResponse="".concat(e.detail):s.rawResponse="I'm a bit overwhelmed at the moment. Could you try again in a bit or dislike this message if the issue persists?":"AbortError"===o?s.rawResponse="I've stopped processing this message. If you'd like to continue, please send the message again.":s.rawResponse="Umm, not sure what just happened. I see this error message: ".concat(a,". Could you try again or dislike this message if the issue persists?"),s.completed=!0,y([...x]),S(""),b(!1)}}return(0,i.useEffect)(()=>{fetch("/api/chat/options").then(e=>e.json()).then(e=>{l(!1),e&&s(e)}).catch(e=>{console.error(e)}),(0,h.EK)()},[]),(0,i.useEffect)(()=>{T&&(null==E||E.abort(),function(){let e=x.find(e=>!e.completed);e&&(e.completed=!0,y([...x]),S(""),b(!1))}(),k(!1))}),(0,i.useEffect)(()=>{if(w){let e={rawResponse:"",trainOfThought:[],context:[],onlineContext:{},codeContext:{},completed:!1,timestamp:new Date().toISOString(),rawQuery:w||"",images:C,queryFiles:v};y(t=>[...t,e]),b(!0),M(new AbortController)}},[w]),(0,i.useEffect)(()=>{I&&W()},[I]),o?(0,a.jsx)(d.Z,{}):(0,a.jsxs)("div",{className:"".concat(n().main," ").concat(n().chatLayout),children:[(0,a.jsx)("title",{children:"".concat(e).concat(c&&c!==e?": ".concat(c):"")}),(0,a.jsx)("div",{children:(0,a.jsx)(r.ZP,{conversationId:p,uploadedFiles:[],isMobileWidth:N})}),(0,a.jsx)("div",{className:n().chatBox,children:(0,a.jsxs)("div",{className:n().chatBoxBody,children:[!N&&p&&(0,a.jsxs)("div",{className:"".concat(n().chatTitleWrapper," text-nowrap text-ellipsis overflow-hidden max-w-screen-md grid items-top font-bold mr-8 pt-6 col-auto h-fit"),children:[c&&(0,a.jsx)("h2",{className:"text-lg text-ellipsis whitespace-nowrap overflow-x-hidden",children:c}),(0,a.jsx)(r.En,{conversationId:p,setTitle:m,sizing:"md"})]}),(0,a.jsx)(i.Suspense,{fallback:(0,a.jsx)(d.Z,{}),children:(0,a.jsx)(f,{isLoggedIn:null!==R,streamedMessages:x,setStreamedMessages:y,chatOptionsData:t,setTitle:m,setQueryToProcess:S,setUploadedFiles:j,isMobileWidth:N,onConversationIdChange:e=>{_(e)},setImages:B,setTriggeredAbort:k})})]})})]})}},16463:function(e,t,s){"use strict";var a=s(71169);s.o(a,"useRouter")&&s.d(t,{useRouter:function(){return a.useRouter}}),s.o(a,"useSearchParams")&&s.d(t,{useSearchParams:function(){return a.useSearchParams}})},65104:function(e){e.exports={main:"chat_main__8xQu5",suggestions:"chat_suggestions__m8n2t",inputBox:"chat_inputBox__LOFws",chatBodyFull:"chat_chatBodyFull__FfKEK",chatBody:"chat_chatBody__sS1LX",chatLayout:"chat_chatLayout__pR203",chatBox:"chat_chatBox__FBct_",titleBar:"chat_titleBar__R5QlK",chatBoxBody:"chat_chatBoxBody__qT_SC",agentIndicator:"chat_agentIndicator__8V55w",chatTitleWrapper:"chat_chatTitleWrapper__6ChWq"}}},function(e){e.O(0,[7812,
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1929],{39929:function(e,t,s){Promise.resolve().then(s.bind(s,38874))},38874:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return p}});var a=s(57437),o=s(65104),n=s.n(o),i=s(2265),r=s(48861),l=s(55538),c=s(16463),d=s(58485),u=s(9557);s(7395);var h=s(69591),m=s(38423),g=s(79306);function f(e){let t=(0,c.useSearchParams)().get("conversationId"),[s,o]=(0,i.useState)(""),[r,d]=(0,i.useState)([]),[u,h]=(0,i.useState)(!1),[g,f]=(0,i.useState)(null),[p,_]=(0,i.useState)(!1),x=(0,i.useRef)(null),y=e.setQueryToProcess,w=e.onConversationIdChange,S=e.isMobileWidth?"w-full":"w-4/6";if((0,i.useEffect)(()=>{if(r.length>0){let t=r.map(e=>encodeURIComponent(e));e.setImages(t)}},[r,e.setImages]),(0,i.useEffect)(()=>{let t=localStorage.getItem("images");if(t){let s=JSON.parse(t);d(s);let a=s.map(e=>encodeURIComponent(e));e.setImages(a),localStorage.removeItem("images")}let s=localStorage.getItem("message");s&&(h(!0),y(s),s.trim().startsWith("/research")&&_(!0));let a=localStorage.getItem("uploadedFiles");if(a){let t=a?JSON.parse(a):[],s=[];for(let e of t)s.push({name:e.name,file_type:e.file_type,content:e.content,size:e.size});localStorage.removeItem("uploadedFiles"),e.setUploadedFiles(s)}},[y,e.setImages,t]),(0,i.useEffect)(()=>{s&&(h(!0),y(s))},[s,y]),(0,i.useEffect)(()=>{t&&(null==w||w(t))},[t,w]),(0,i.useEffect)(()=>{e.streamedMessages&&e.streamedMessages.length>0&&e.streamedMessages[e.streamedMessages.length-1].completed?(h(!1),d([]),e.setUploadedFiles(void 0)):o("")},[e.streamedMessages]),!t){window.location.href="/";return}return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:n().chatBodyFull,children:(0,a.jsx)(l.Z,{conversationId:t,setTitle:e.setTitle,setAgent:f,pendingMessage:u?s:"",incomingMessages:e.streamedMessages,setIncomingMessages:e.setStreamedMessages,customClassName:S})}),(0,a.jsx)("div",{className:"".concat(n().inputBox," p-1 md:px-2 shadow-md bg-background align-middle items-center justify-center dark:bg-neutral-700 dark:border-0 dark:shadow-sm rounded-t-2xl rounded-b-none md:rounded-xl h-fit ").concat(S," mr-auto ml-auto"),children:(0,a.jsx)(m.a,{agentColor:null==g?void 0:g.color,isLoggedIn:e.isLoggedIn,sendMessage:e=>o(e),sendImage:e=>d(t=>[...t,e]),sendDisabled:u,chatOptionsData:e.chatOptionsData,conversationId:t,isMobileWidth:e.isMobileWidth,setUploadedFiles:e.setUploadedFiles,ref:x,isResearchModeEnabled:p,setTriggeredAbort:e.setTriggeredAbort})})]})}function p(){let e="Khoj AI - Chat",[t,s]=(0,i.useState)(null),[o,l]=(0,i.useState)(!0),[c,m]=(0,i.useState)(e),[p,_]=(0,i.useState)(null),[x,y]=(0,i.useState)([]),[w,S]=(0,i.useState)(""),[I,b]=(0,i.useState)(!1),[v,j]=(0,i.useState)(void 0),[C,B]=(0,i.useState)([]),[E,M]=(0,i.useState)(null),[T,k]=(0,i.useState)(!1),F=(0,h.k6)()||{timezone:Intl.DateTimeFormat().resolvedOptions().timeZone},R=(0,g.GW)(),N=(0,h.IC)();async function O(e){if(!e.ok)throw Error(e.statusText);if(!e.body)throw Error("Response body is null");let t=e.body.getReader(),s=new TextDecoder,a="␃\uD83D\uDD1A␗",o="",n=[],i={},r={};for(;;){let e;let{done:l,value:c}=await t.read();if(l){S(""),b(!1),B([]),p&&(0,u.tQ)(p,m);break}for(o+=s.decode(c,{stream:!0});-1!==(e=o.indexOf(a));){let t=o.slice(0,e);if(o=o.slice(e+a.length),t){let e=x.find(e=>!e.completed);if(!e){console.error("No current message found");return}({context:n,onlineContext:i,codeContext:r}=(0,u.VK)(t,e,n,i,r)),y([...x])}}}}async function W(){if(localStorage.removeItem("message"),!w||!p)return;let e={q:w,conversation_id:p,stream:!0,...F&&{city:F.city,region:F.region,country:F.country,country_code:F.countryCode,timezone:F.timezone},...C.length>0&&{images:C},...v&&{files:v}},t=await fetch("/api/chat?client=web",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:null==E?void 0:E.signal});try{await O(t)}catch(n){let e=await t.json();console.error(e);let s=x.find(e=>!e.completed);if(!s)return;let a=n.message,o=n.name;a.includes("Error in input stream")?s.rawResponse="Woops! The connection broke while I was writing my thoughts down. Maybe try again in a bit or dislike this message if the issue persists?":429===t.status?"detail"in e?s.rawResponse="".concat(e.detail):s.rawResponse="I'm a bit overwhelmed at the moment. Could you try again in a bit or dislike this message if the issue persists?":"AbortError"===o?s.rawResponse="I've stopped processing this message. If you'd like to continue, please send the message again.":s.rawResponse="Umm, not sure what just happened. I see this error message: ".concat(a,". Could you try again or dislike this message if the issue persists?"),s.completed=!0,y([...x]),S(""),b(!1)}}return(0,i.useEffect)(()=>{fetch("/api/chat/options").then(e=>e.json()).then(e=>{l(!1),e&&s(e)}).catch(e=>{console.error(e)}),(0,h.EK)()},[]),(0,i.useEffect)(()=>{T&&(null==E||E.abort(),function(){let e=x.find(e=>!e.completed);e&&(e.completed=!0,y([...x]),S(""),b(!1))}(),k(!1))}),(0,i.useEffect)(()=>{if(w){let e={rawResponse:"",trainOfThought:[],context:[],onlineContext:{},codeContext:{},completed:!1,timestamp:new Date().toISOString(),rawQuery:w||"",images:C,queryFiles:v};y(t=>[...t,e]),b(!0),M(new AbortController)}},[w]),(0,i.useEffect)(()=>{I&&W()},[I]),o?(0,a.jsx)(d.Z,{}):(0,a.jsxs)("div",{className:"".concat(n().main," ").concat(n().chatLayout),children:[(0,a.jsx)("title",{children:"".concat(e).concat(c&&c!==e?": ".concat(c):"")}),(0,a.jsx)("div",{children:(0,a.jsx)(r.ZP,{conversationId:p,uploadedFiles:[],isMobileWidth:N})}),(0,a.jsx)("div",{className:n().chatBox,children:(0,a.jsxs)("div",{className:n().chatBoxBody,children:[!N&&p&&(0,a.jsxs)("div",{className:"".concat(n().chatTitleWrapper," text-nowrap text-ellipsis overflow-hidden max-w-screen-md grid items-top font-bold mr-8 pt-6 col-auto h-fit"),children:[c&&(0,a.jsx)("h2",{className:"text-lg text-ellipsis whitespace-nowrap overflow-x-hidden",children:c}),(0,a.jsx)(r.En,{conversationId:p,setTitle:m,sizing:"md"})]}),(0,a.jsx)(i.Suspense,{fallback:(0,a.jsx)(d.Z,{}),children:(0,a.jsx)(f,{isLoggedIn:null!==R,streamedMessages:x,setStreamedMessages:y,chatOptionsData:t,setTitle:m,setQueryToProcess:S,setUploadedFiles:j,isMobileWidth:N,onConversationIdChange:e=>{_(e)},setImages:B,setTriggeredAbort:k})})]})})]})}},16463:function(e,t,s){"use strict";var a=s(71169);s.o(a,"useRouter")&&s.d(t,{useRouter:function(){return a.useRouter}}),s.o(a,"useSearchParams")&&s.d(t,{useSearchParams:function(){return a.useSearchParams}})},65104:function(e){e.exports={main:"chat_main__8xQu5",suggestions:"chat_suggestions__m8n2t",inputBox:"chat_inputBox__LOFws",chatBodyFull:"chat_chatBodyFull__FfKEK",chatBody:"chat_chatBody__sS1LX",chatLayout:"chat_chatLayout__pR203",chatBox:"chat_chatBox__FBct_",titleBar:"chat_titleBar__R5QlK",chatBoxBody:"chat_chatBoxBody__qT_SC",agentIndicator:"chat_agentIndicator__8V55w",chatTitleWrapper:"chat_chatTitleWrapper__6ChWq"}}},function(e){e.O(0,[7812,9848,4836,3954,3072,216,3124,7592,3690,796,1603,9417,8423,5538,2971,7023,1744],function(){return e(e.s=39929)}),_N_E=e.O()}]);
|