khoj 1.28.4.dev77__py3-none-any.whl → 1.28.4.dev79__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/{5538-5c4f2271e9377b74.js → 5538-009e71f261f08be0.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/{8423-db6dad6d44869097.js → 8423-4dd7f4edffb1144b.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/agents/{page-4353b1a532795ad1.js → page-ee4f0da14df15091.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/automations/{page-c9f13c865e739607.js → page-da59a2b9ec07da16.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/chat/{page-97876b3bd3c5e69d.js → page-04313ed6d8f38904.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/{page-c33ebe19a3b7b0b2.js → page-5c06dadacb1b5945.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/search/{page-8e28deacb61f75aa.js → page-4f44549ba3807021.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/settings/{page-2fab613a557d3cc5.js → page-88dbd5c184dcd1e3.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/share/chat/{page-3ee3da7e8dfe3572.js → page-9257e8817dcd6af3.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/{webpack-ff5eae43b8dba1d2.js → webpack-d3a4ebfc304496fb.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/_next/static/css/{af0f36f71f368260.css → 9b731f3dacff43f5.css} +1 -1
- 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-1.28.4.dev77.dist-info → khoj-1.28.4.dev79.dist-info}/METADATA +1 -1
- {khoj-1.28.4.dev77.dist-info → khoj-1.28.4.dev79.dist-info}/RECORD +35 -35
- 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/{sE94pAZEifEKkz4WQtTNW → yC3T_YHF5a4as_8f5pHDx}/_buildManifest.js +0 -0
- /khoj/interface/compiled/_next/static/{sE94pAZEifEKkz4WQtTNW → yC3T_YHF5a4as_8f5pHDx}/_ssgManifest.js +0 -0
- {khoj-1.28.4.dev77.dist-info → khoj-1.28.4.dev79.dist-info}/WHEEL +0 -0
- {khoj-1.28.4.dev77.dist-info → khoj-1.28.4.dev79.dist-info}/entry_points.txt +0 -0
- {khoj-1.28.4.dev77.dist-info → khoj-1.28.4.dev79.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/af0f36f71f368260.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-ff5eae43b8dba1d2.js"/><script src="/_next/static/chunks/fd9d1056-2b978342deb60015.js" async=""></script><script src="/_next/static/chunks/7023-a5bf5744d19b3bd3.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-ff5eae43b8dba1d2.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/af0f36f71f368260.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\":\"sE94pAZEifEKkz4WQtTNW\",\"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/af0f36f71f368260.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/9b731f3dacff43f5.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-d3a4ebfc304496fb.js"/><script src="/_next/static/chunks/fd9d1056-2b978342deb60015.js" async=""></script><script src="/_next/static/chunks/7023-a5bf5744d19b3bd3.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-d3a4ebfc304496fb.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/9b731f3dacff43f5.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\":\"yC3T_YHF5a4as_8f5pHDx\",\"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/9b731f3dacff43f5.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>
|
khoj/interface/compiled/_next/static/chunks/{5538-5c4f2271e9377b74.js → 5538-009e71f261f08be0.js}
RENAMED
@@ -1 +1 @@
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5538],{55538:function(e,t,a){"use strict";a.d(t,{Z:function(){return ew}});var n=a(57437),s=a(15238),o=a.n(s),l=a(2265),r=a(34531),c=a.n(r),i=a(14944),d=a(39952),h=a.n(d),u=a(34040);a(7395);var g=a(26100),m=a(36013),f=a(13304),p=a(12218),x=a(74697),v=a(37440);let j=f.fC,y=f.xz;f.x8;let b=f.h_,w=l.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(f.aV,{className:(0,v.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...s,ref:t})});w.displayName=f.aV.displayName;let C=(0,p.j)("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),M=l.forwardRef((e,t)=>{let{side:a="right",className:s,children:o,...l}=e;return(0,n.jsxs)(b,{children:[(0,n.jsx)(w,{}),(0,n.jsxs)(f.VY,{ref:t,className:(0,v.cn)(C({side:a}),s),...l,children:[o,(0,n.jsxs)(f.x8,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[(0,n.jsx)(x.Z,{className:"h-4 w-4"}),(0,n.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});M.displayName=f.VY.displayName;let N=e=>{let{className:t,...a}=e;return(0,n.jsx)("div",{className:(0,v.cn)("flex flex-col space-y-2 text-center sm:text-left",t),...a})};N.displayName="SheetHeader";let k=l.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(f.Dx,{ref:t,className:(0,v.cn)("text-lg font-semibold text-foreground",a),...s})});k.displayName=f.Dx.displayName;let _=l.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(f.dk,{ref:t,className:(0,v.cn)("text-sm text-muted-foreground",a),...s})});_.displayName=f.dk.displayName;var R=a(19573),I=a(11838),T=a.n(I),E=a(89417);let D=new i.Z({html:!0,linkify:!0,typographer:!0});function S(e){let t=(0,E.Le)(e.title||".txt","w-6 h-6 text-muted-foreground inline-flex mr-2"),a=function(e){let t=["org","md","markdown"].includes(e.title.split(".").pop()||"")?e.content.split("\n").slice(1).join("\n"):e.content;return e.showFullContent?T().sanitize(D.render(t)):T().sanitize(t)}(e),[s,o]=(0,l.useState)(!1);return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(R.J2,{open:s&&!e.showFullContent,onOpenChange:o,children:[(0,n.jsx)(R.xo,{asChild:!0,children:(0,n.jsxs)(m.Zb,{onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),className:"".concat(e.showFullContent?"w-auto":"w-[200px]"," overflow-hidden break-words text-balance rounded-lg p-2 bg-muted border-none"),children:[(0,n.jsxs)("h3",{className:"".concat(e.showFullContent?"block":"line-clamp-1"," text-muted-foreground}"),children:[t,e.title]}),(0,n.jsx)("p",{className:"".concat(e.showFullContent?"block":"overflow-hidden line-clamp-2"),dangerouslySetInnerHTML:{__html:a}})]})}),(0,n.jsx)(R.yk,{className:"w-[400px] mx-2",children:(0,n.jsxs)(m.Zb,{className:"w-auto overflow-hidden break-words text-balance rounded-lg p-2 border-none",children:[(0,n.jsxs)("h3",{className:"line-clamp-2 text-muted-foreground}",children:[t,e.title]}),(0,n.jsx)("p",{className:"overflow-hidden line-clamp-3",dangerouslySetInnerHTML:{__html:a}})]})})]})})}function F(e){let t=(0,E.Le)(".py","w-6 h-6 text-muted-foreground inline-flex mr-2"),a=T().sanitize(e.code),[s,o]=(0,l.useState)(!1);return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(R.J2,{open:s&&!e.showFullContent,onOpenChange:o,children:[(0,n.jsx)(R.xo,{asChild:!0,children:(0,n.jsxs)(m.Zb,{onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),className:"".concat(e.showFullContent?"w-auto":"w-[200px]"," overflow-hidden break-words text-balance rounded-lg p-2 bg-muted border-none"),children:[(0,n.jsxs)("h3",{className:"".concat(e.showFullContent?"block":"line-clamp-1"," text-muted-foreground}"),children:[t,"Code"]}),(0,n.jsx)("p",{className:"".concat(e.showFullContent?"block":"overflow-hidden line-clamp-2"),children:a})]})}),(0,n.jsx)(R.yk,{className:"w-[400px] mx-2",children:(0,n.jsxs)(m.Zb,{className:"w-auto overflow-hidden break-words text-balance rounded-lg p-2 border-none",children:[(0,n.jsxs)("h3",{className:"line-clamp-2 text-muted-foreground}",children:[t,"Code"]}),(0,n.jsx)("p",{className:"overflow-hidden line-clamp-3",children:a})]})})]})})}function L(e){let[t,a]=(0,l.useState)(!1);if(!e.link||e.link.split(" ").length>1)return null;let s="https://www.google.com/s2/favicons?domain=globe",o="unknown";try{o=new URL(e.link).hostname,s="https://www.google.com/s2/favicons?domain=".concat(o)}catch(t){return console.warn("Error parsing domain from link: ".concat(e.link)),null}return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(R.J2,{open:t&&!e.showFullContent,onOpenChange:a,children:[(0,n.jsx)(R.xo,{asChild:!0,children:(0,n.jsx)(m.Zb,{onMouseEnter:()=>{a(!0)},onMouseLeave:()=>{a(!1)},className:"".concat(e.showFullContent?"w-auto":"w-[200px]"," overflow-hidden break-words rounded-lg text-balance p-2 bg-muted border-none"),children:(0,n.jsx)("div",{className:"flex flex-col",children:(0,n.jsxs)("a",{href:e.link,target:"_blank",rel:"noreferrer",className:"!no-underline p-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("img",{src:s,alt:"",className:"!w-4 h-4 mr-2 flex-shrink-0"}),(0,n.jsx)("h3",{className:"overflow-hidden ".concat(e.showFullContent?"block":"line-clamp-1"," text-muted-foreground flex-grow"),children:o})]}),(0,n.jsx)("h3",{className:"overflow-hidden ".concat(e.showFullContent?"block":"line-clamp-1"," font-bold"),children:e.title}),(0,n.jsx)("p",{className:"overflow-hidden ".concat(e.showFullContent?"block":"line-clamp-2"),children:e.description})]})})})}),(0,n.jsx)(R.yk,{className:"w-[400px] mx-2",children:(0,n.jsx)(m.Zb,{className:"w-auto overflow-hidden break-words text-balance rounded-lg border-none",children:(0,n.jsx)("div",{className:"flex flex-col",children:(0,n.jsxs)("a",{href:e.link,target:"_blank",rel:"noreferrer",className:"!no-underline p-2",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)("img",{src:s,alt:"",className:"!w-4 h-4 mr-2"}),(0,n.jsx)("h3",{className:"overflow-hidden ".concat(e.showFullContent?"block":"line-clamp-2"," text-muted-foreground"),children:o})]}),(0,n.jsx)("h3",{className:"overflow-hidden ".concat(e.showFullContent?"block":"line-clamp-2"," font-bold"),children:e.title}),(0,n.jsx)("p",{className:"overflow-hidden ".concat(e.showFullContent?"block":"line-clamp-3"),children:e.description})]})})})})]})})}function O(e){let[t,a]=(0,l.useState)(3);(0,l.useEffect)(()=>{a(e.isMobileWidth?1:3)},[e.isMobileWidth]);let s=e.notesReferenceCardData.slice(0,t),o=e.codeReferenceCardData.slice(0,t-s.length),r=s.length+o.length<t?e.onlineReferenceCardData.slice(0,t-o.length-s.length):[],c=e.notesReferenceCardData.length>0||e.codeReferenceCardData.length>0||e.onlineReferenceCardData.length>0,i=e.notesReferenceCardData.length+e.codeReferenceCardData.length+e.onlineReferenceCardData.length;return 0===i?null:(0,n.jsxs)("div",{className:"pt-0 px-4 pb-4 md:px-6",children:[(0,n.jsxs)("h3",{className:"inline-flex items-center",children:["References",(0,n.jsxs)("p",{className:"text-gray-400 m-2",children:[i," sources"]})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2 w-auto mt-2",children:[s.map((e,t)=>(0,l.createElement)(S,{showFullContent:!1,...e,key:"".concat(e.title,"-").concat(t)})),o.map((e,t)=>(0,l.createElement)(F,{showFullContent:!1,...e,key:"code-".concat(t)})),r.map((e,t)=>(0,l.createElement)(L,{showFullContent:!1,...e,key:"".concat(e.title,"-").concat(t)})),c&&(0,n.jsx)(q,{notesReferenceCardData:e.notesReferenceCardData,onlineReferenceCardData:e.onlineReferenceCardData,codeReferenceCardData:e.codeReferenceCardData})]})]})}function q(e){return e.notesReferenceCardData||e.onlineReferenceCardData?(0,n.jsxs)(j,{children:[(0,n.jsxs)(y,{className:"text-balance w-auto md:w-[200px] justify-start overflow-hidden break-words p-0 bg-transparent border-none text-gray-400 align-middle items-center !m-2 inline-flex",children:["View references",(0,n.jsx)(g.o,{className:"m-1"})]}),(0,n.jsxs)(M,{className:"overflow-y-scroll",children:[(0,n.jsxs)(N,{children:[(0,n.jsx)(k,{children:"References"}),(0,n.jsx)(_,{children:"View all references for this response"})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2 w-auto mt-2",children:[e.notesReferenceCardData.map((e,t)=>(0,l.createElement)(S,{showFullContent:!0,...e,key:"".concat(e.title,"-").concat(t)})),e.onlineReferenceCardData.map((e,t)=>(0,l.createElement)(L,{showFullContent:!0,...e,key:"".concat(e.title,"-").concat(t)})),e.codeReferenceCardData.map((e,t)=>(0,l.createElement)(F,{showFullContent:!0,...e,key:"code-".concat(t)}))]})]})]}):null}var B=a(9557),H=a(34149),W=a(29386),z=a(31784),A=a(60665),Z=a(96006),U=a(18444),V=a(35304),P=a(8589),G=a(13493),J=a(63205),$=a(56698),Q=a(32970),Y=a(84120),K=a(92880),X=a(48408),ee=a(55362),et=a(67722),ea=a(58485),en=a(58575),es=a(25800);let eo=(0,a(57818).default)(()=>Promise.all([a.e(6555),a.e(7293),a.e(1459),a.e(1210)]).then(a.bind(a,51210)).then(e=>e.default),{loadableGenerated:{webpack:()=>[51210]},ssr:!1});function el(e){return(0,n.jsx)(l.Suspense,{fallback:(0,n.jsx)(ea.Z,{}),children:(0,n.jsx)(eo,{data:e.data})})}var er=a(90837),ec=a(69591),ei=a(94880);let ed=new i.Z({html:!0,linkify:!0,typographer:!0});function eh(e,t,a){fetch("/api/chat/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({uquery:e,kquery:t,sentiment:a})})}function eu(e){let{uquery:t,kquery:a}=e,[s,o]=(0,l.useState)(null);return(0,l.useEffect)(()=>{null!==s&&setTimeout(()=>{o(null)},2e3)},[s]),(0,n.jsxs)("div",{className:"".concat(c().feedbackButtons," flex align-middle justify-center items-center"),children:[(0,n.jsx)("button",{title:"Like",className:c().thumbsUpButton,disabled:null!==s,onClick:()=>{eh(t,a,"positive"),o(!0)},children:!0===s?(0,n.jsx)(H.V,{alt:"Liked Message",className:"text-green-500",weight:"fill"}):(0,n.jsx)(H.V,{alt:"Like Message",className:"hsl(var(--muted-foreground)) hover:text-green-500"})}),(0,n.jsx)("button",{title:"Dislike",className:c().thumbsDownButton,disabled:null!==s,onClick:()=>{eh(t,a,"negative"),o(!1)},children:!1===s?(0,n.jsx)(W.L,{alt:"Disliked Message",className:"text-red-500",weight:"fill"}):(0,n.jsx)(W.L,{alt:"Dislike Message",className:"hsl(var(--muted-foreground)) hover:text-red-500"})})]})}function eg(e){let t=e.message.match(/\*\*(.*)\*\*/),a=function(e,t){let a=e.toLowerCase(),s="inline mt-1 mr-2 ".concat(t," h-4 w-4");return a.includes("understanding")?(0,n.jsx)(z.a,{className:"".concat(s)}):a.includes("generating")?(0,n.jsx)(A.Z,{className:"".concat(s)}):a.includes("data sources")||a.includes("notes")?(0,n.jsx)(Z.g,{className:"".concat(s)}):a.includes("read")?(0,n.jsx)(U.f,{className:"".concat(s)}):a.includes("search")?(0,n.jsx)(V.Y,{className:"".concat(s)}):a.includes("summary")||a.includes("summarize")||a.includes("enhanc")?(0,n.jsx)(P.u,{className:"".concat(s)}):a.includes("diagram")?(0,n.jsx)(G.j,{className:"".concat(s)}):a.includes("paint")?(0,n.jsx)(J.Y,{className:"".concat(s)}):a.includes("code")?(0,n.jsx)($.E,{className:"".concat(s)}):(0,n.jsx)(z.a,{className:"".concat(s)})}(t?t[1]:"",e.primary?(0,en.oz)(e.agentColor):"text-gray-500"),s=T().sanitize(ed.render(e.message));return s=s.replace(/<h[1-6].*?<\/h[1-6]>/g,""),(0,n.jsxs)("div",{className:"".concat(c().trainOfThoughtElement," break-words items-center ").concat(e.primary?"text-gray-400":"text-gray-300"," ").concat(c().trainOfThought," ").concat(e.primary?c().primary:""),children:[a,(0,n.jsx)("div",{dangerouslySetInnerHTML:{__html:s},className:"break-words"})]})}ed.use(h(),{inline:!0,code:!0});let em=(0,l.forwardRef)((e,t)=>{var a,s;let o,r,i,d,h;let[g,m]=(0,l.useState)(!1),[p,x]=(0,l.useState)(!1),[v,j]=(0,l.useState)(""),[y,b]=(0,l.useState)(""),[w,C]=(0,l.useState)(!1),[M,N]=(0,l.useState)(!1),[k,_]=(0,l.useState)(""),R=(0,l.useRef)(!1),I=(0,l.useRef)(null);async function D(){let t=e.chatMessage.message.match(/[^.!?]+[.!?]*/g)||[];if(!t||0===t.length||!t[0])return;C(!0);let a=S(t[0]);for(let e=0;e<t.length&&!R.current;e++){let n=a;e<t.length-1&&(a=S(t[e+1]));try{let e=await n,t=URL.createObjectURL(e);await function(e){return new Promise((t,a)=>{let n=new Audio(e);n.onended=t,n.onerror=a,n.play()})}(t)}catch(e){console.error("Error:",e);break}}C(!1),N(!1)}async function S(e){let t=await fetch("/api/chat/speech?text=".concat(encodeURIComponent(e)),{method:"POST",headers:{"Content-Type":"application/json"}});if(!t.ok)throw Error("Network response was not ok");return await t.blob()}(0,l.useEffect)(()=>{R.current=M},[M]),(0,l.useEffect)(()=>{let e=new MutationObserver((e,t)=>{if(I.current)for(let t of e)"childList"===t.type&&t.addedNodes.length>0&&(0,es.Z)(I.current,{delimiters:[{left:"$$",right:"$$",display:!0},{left:"\\[",right:"\\]",display:!0},{left:"\\(",right:"\\)",display:!1}]})});return I.current&&e.observe(I.current,{childList:!0}),()=>e.disconnect()},[I.current]),(0,l.useEffect)(()=>{var t;let a=e.chatMessage.message;e.chatMessage.intent&&"excalidraw"==e.chatMessage.intent.type&&(a=e.chatMessage.intent["inferred-queries"][0],_(e.chatMessage.message)),a=a.replace(/\\\(/g,"LEFTPAREN").replace(/\\\)/g,"RIGHTPAREN").replace(/\\\[/g,"LEFTBRACKET").replace(/\\\]/g,"RIGHTBRACKET");let n={"text-to-image":e=>""),"text-to-image2":e=>""),"text-to-image-v3":e=>""),excalidraw:e=>e};if(e.chatMessage.intent){let{type:t,"inferred-queries":s}=e.chatMessage.intent;t in n&&(a=n[t](a)),t.includes("text-to-image")&&(null==s?void 0:s.length)>0&&(a+="\n\n".concat(s[0]))}let s=a,o=a;if(e.chatMessage.images&&e.chatMessage.images.length>0){let t=e.chatMessage.images.map(e=>{let t=e.startsWith("data%3Aimage")?decodeURIComponent(e):e;return T().sanitize(t)}),a=t.map((e,t)=>".concat(e,")")).join("\n"),n=t.map((e,t)=>'<div class="'.concat(c().imageWrapper,'"><img src="').concat(e,'" alt="uploaded image ').concat(t+1,'" /></div>')).join(""),l='<div class="'.concat(c().imagesContainer,'">').concat(n,"</div>");s="".concat(a,"\n\n").concat(s),o="".concat(l).concat(o)}e.chatMessage.intent&&"text-to-image"==e.chatMessage.intent.type?a=""):e.chatMessage.intent&&"text-to-image2"==e.chatMessage.intent.type?a=""):e.chatMessage.intent&&"text-to-image-v3"==e.chatMessage.intent.type&&(a="")),e.chatMessage.intent&&e.chatMessage.intent.type.includes("text-to-image")&&(null===(t=e.chatMessage.intent["inferred-queries"])||void 0===t?void 0:t.length)>0&&(a+="\n\n".concat(e.chatMessage.intent["inferred-queries"][0])),a=(0,B.AQ)(a,e.chatMessage.codeContext),e.chatMessage.codeContext&&Object.entries(e.chatMessage.codeContext).forEach(e=>{var t;let[n,s]=e;null===(t=s.results.output_files)||void 0===t||t.forEach(e=>{if(e.filename.endsWith(".png")||e.filename.endsWith(".jpg"))a.includes(")||(a+="\n\n.concat(e.b64_data,")"));else if(e.filename.endsWith(".txt")||e.filename.endsWith(".org")||e.filename.endsWith(".md")){let t=atob(e.b64_data);a+="\n\n```\n".concat(t,"\n```")}})}),j(s);let l=ed.render(o);l=l.replace(/LEFTPAREN/g,"\\(").replace(/RIGHTPAREN/g,"\\)").replace(/LEFTBRACKET/g,"\\[").replace(/RIGHTBRACKET/g,"\\]"),b(T().sanitize(l))},[e.chatMessage.message,e.chatMessage.images,e.chatMessage.intent]),(0,l.useEffect)(()=>{g&&setTimeout(()=>{m(!1)},2e3)},[g]),(0,l.useEffect)(()=>{I.current&&(I.current.querySelectorAll("pre > .hljs").forEach(e=>{if(!e.querySelector("".concat(c().codeCopyButton))){let t=document.createElement("button"),a=(0,n.jsx)(Q.w,{size:24});(0,u.createRoot)(t).render(a),t.className="hljs ".concat(c().codeCopyButton),t.addEventListener("click",()=>{let a=e.textContent||"";a=(a=(a=a.replace(/^\$+/,"")).replace(/^Copy/,"")).trim(),navigator.clipboard.writeText(a);let s=(0,n.jsx)(Y.J,{size:24});(0,u.createRoot)(t).render(s)}),e.prepend(t)}}),(0,es.Z)(I.current,{delimiters:[{left:"$$",right:"$$",display:!0},{left:"\\[",right:"\\]",display:!0},{left:"\\(",right:"\\)",display:!1}]}))},[y,p,I]);let F=async t=>{let a=t.turnId||e.turnId;(await fetch("/api/chat/conversation/message",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({conversation_id:e.conversationId,turn_id:a})})).ok?e.onDeleteMessage(a):console.error("Failed to delete message")},L=function(e,t,a){let n=[],s=[],o=[];if(a)for(let[e,t]of Object.entries(a))t.results&&o.push({code:t.code,output:t.results.std_out,error:t.results.std_err});if(t){let e=[];for(let[a,n]of Object.entries(t)){if(n.answerBox&&e.push({title:n.answerBox.title,description:n.answerBox.answer,link:n.answerBox.source}),n.knowledgeGraph&&e.push({title:n.knowledgeGraph.title,description:n.knowledgeGraph.description,link:n.knowledgeGraph.descriptionLink}),n.webpages){if(n.webpages instanceof Array){let t=n.webpages.map(e=>({title:e.query,description:e.snippet,link:e.link}));e.push(...t)}else{let t=n.webpages;e.push({title:t.query,description:t.snippet,link:t.link})}}if(n.organic){let t=n.organic.map(e=>({title:e.title,description:e.snippet,link:e.link}));e.push(...t)}}n.push(...e)}if(e){let t=e.map(e=>e.compiled?{title:e.file,content:e.compiled}:{title:e.split("\n")[0],content:e.split("\n").slice(1).join("\n")});s.push(...t)}return{notesReferenceCardData:s,onlineReferenceCardData:n,codeReferenceCardData:o}}(e.chatMessage.context,e.chatMessage.onlineContext,e.chatMessage.codeContext);return(0,n.jsxs)("div",{ref:t,className:(a=e.chatMessage,(o=[c().chatMessageContainer,"shadow-md"]).push(c()[a.by]),a.message||o.push(c().emptyChatMessage),e.customClassName&&o.push(c()["".concat(a.by).concat(e.customClassName)]),o.join(" ")),onMouseLeave:e=>x(!1),onMouseEnter:e=>x(!0),children:[e.chatMessage.queryFiles&&e.chatMessage.queryFiles.length>0&&(0,n.jsx)("div",{className:"flex flex-wrap flex-col m-2 max-w-full",children:e.chatMessage.queryFiles.map((e,t)=>(0,n.jsxs)(er.Vq,{children:[(0,n.jsx)(er.hg,{asChild:!0,children:(0,n.jsxs)("div",{className:"flex items-center space-x-2 cursor-pointer bg-gray-500 bg-opacity-25 rounded-lg m-1 p-2 w-full ",children:[(0,n.jsx)("div",{className:"flex-shrink-0",children:(0,E.Le)(e.file_type)}),(0,n.jsx)("span",{className:"truncate flex-1 min-w-0",children:e.name}),e.size&&(0,n.jsxs)("span",{className:"text-gray-400 flex-shrink-0",children:["(",(0,ec.xq)(e.size),")"]})]})}),(0,n.jsxs)(er.cZ,{children:[(0,n.jsx)(er.fK,{children:(0,n.jsx)(f.$N,{children:e.name})}),(0,n.jsx)(er.Be,{children:(0,n.jsx)(ei.x,{className:"h-72 w-full rounded-md",children:e.content})})]})]},t))}),(0,n.jsxs)("div",{className:(s=e.chatMessage,(r=[c().chatMessageWrapper]).push(c()[s.by]),"khoj"===s.by&&r.push("border-l-4 border-opacity-50 ".concat("border-l-"+e.borderLeftColor)),r.join(" ")),children:[(0,n.jsx)("div",{ref:I,className:c().chatMessage,dangerouslySetInnerHTML:{__html:y}}),k&&(0,n.jsx)(el,{data:k})]}),(0,n.jsx)("div",{className:c().teaserReferencesContainer,children:(0,n.jsx)(O,{isMobileWidth:e.isMobileWidth,notesReferenceCardData:L.notesReferenceCardData,onlineReferenceCardData:L.onlineReferenceCardData,codeReferenceCardData:L.codeReferenceCardData})}),(0,n.jsx)("div",{className:c().chatFooter,children:(p||e.isMobileWidth||e.isLastMessage||w)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{title:(d=(i=new Date(e.chatMessage.created+"Z")).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0}).toUpperCase(),h=i.toLocaleString("en-US",{year:"numeric",month:"short",day:"2-digit"}).replaceAll("-"," "),"".concat(d," on ").concat(h)),className:"text-gray-400 relative top-0 left-4",children:function(e){e.endsWith("Z")||(e+="Z");let t=new Date(e),a=new Date().getTime()-t.getTime();return a<6e4?"Just now":a<36e5?"".concat(Math.round(a/6e4),"m ago"):a<864e5?"".concat(Math.round(a/36e5),"h ago"):"".concat(Math.round(a/864e5),"d ago")}(e.chatMessage.created)}),(0,n.jsxs)("div",{className:"".concat(c().chatButtons," shadow-sm"),children:["khoj"===e.chatMessage.by&&(w?M?(0,n.jsx)(ea.l,{iconClassName:"p-0",className:"m-0"}):(0,n.jsx)("button",{title:"Pause Speech",onClick:e=>N(!0),children:(0,n.jsx)(K.d,{alt:"Pause Message",className:"hsl(var(--muted-foreground))"})}):(0,n.jsx)("button",{title:"Speak",onClick:e=>D(),children:(0,n.jsx)(X.j,{alt:"Speak Message",className:"hsl(var(--muted-foreground)) hover:text-green-500"})})),e.chatMessage.turnId&&(0,n.jsx)("button",{title:"Delete",className:"".concat(c().deleteButton),onClick:()=>F(e.chatMessage),children:(0,n.jsx)(ee.r,{alt:"Delete Message",className:"hsl(var(--muted-foreground)) hover:text-red-500"})}),(0,n.jsx)("button",{title:"Copy",className:"".concat(c().copyButton),onClick:()=>{navigator.clipboard.writeText(v),m(!0)},children:g?(0,n.jsx)(et.C,{alt:"Copied Message",weight:"fill",className:"text-green-500"}):(0,n.jsx)(et.C,{alt:"Copy Message",className:"hsl(var(--muted-foreground)) hover:text-green-500"})}),"khoj"===e.chatMessage.by&&(e.chatMessage.intent?(0,n.jsx)(eu,{uquery:e.chatMessage.intent.query,kquery:e.chatMessage.message}):(0,n.jsx)(eu,{uquery:e.chatMessage.rawQuery||e.chatMessage.message,kquery:e.chatMessage.message}))]})]})})]})});em.displayName="ChatMessage";var ef=a(84511),ep=a(16288),ex=a(20721),ev=a(19666),ej=a(50495),ey=e=>{let{name:t,avatar:a,link:s,description:o}=e;return(0,n.jsx)("div",{className:"relative group flex",children:(0,n.jsx)(ev.pn,{children:(0,n.jsxs)(ev.u,{delayDuration:0,children:[(0,n.jsx)(ev.aJ,{asChild:!0,children:(0,n.jsxs)(ej.z,{variant:"ghost",className:"flex items-center justify-center",children:[a,(0,n.jsx)("div",{children:t})]})}),(0,n.jsx)(ev._v,{children:(0,n.jsxs)("div",{className:"w-80 h-30",children:[(0,n.jsx)("a",{href:s,target:"_blank",rel:"noreferrer",className:"mt-1 ml-2 block no-underline",children:(0,n.jsxs)("div",{className:"flex items-center justify-start gap-2",children:[a,(0,n.jsxs)("div",{className:"mr-2 mt-1 flex justify-center items-center text-sm font-semibold text-gray-800",children:[t,(0,n.jsx)(g.o,{weight:"bold",className:"ml-1"})]})]})}),o&&(0,n.jsx)("p",{className:"mt-2 ml-6 text-sm text-gray-600 line-clamp-2",children:o||"A Khoj agent"})]})})]})})})};function eb(e){let t=e.trainOfThought.length-1,[a,s]=(0,l.useState)(e.completed);return(0,n.jsxs)("div",{className:"".concat(a?"":o().trainOfThought+" shadow-sm"),children:[!e.completed&&(0,n.jsx)(ea.l,{className:"float-right"}),e.completed&&(a?(0,n.jsx)(ej.z,{className:"w-fit text-left justify-start content-start text-xs",onClick:()=>s(!1),variant:"ghost",size:"sm",children:"What was my train of thought?"}):(0,n.jsxs)(ej.z,{className:"w-fit text-left justify-start content-start text-xs p-0 h-fit",onClick:()=>s(!0),variant:"ghost",size:"sm",children:[(0,n.jsx)(ef.a,{size:16,className:"mr-1"}),"Close"]})),!a&&e.trainOfThought.map((a,s)=>(0,n.jsx)(eg,{message:a,primary:s===t&&e.lastMessage&&!e.completed,agentColor:e.agentColor},"train-".concat(s)))]},e.keyId)}function ew(e){var t,a,s,r,c,i,d,h,u;let[g,m]=(0,l.useState)(null),[f,p]=(0,l.useState)(0),[x,v]=(0,l.useState)(!0),[j,y]=(0,l.useState)(null),b=(0,l.useRef)(null),w=(0,l.useRef)(null),C=(0,l.useRef)(null),M=(0,l.useRef)(null),[N,k]=(0,l.useState)(null),[_,R]=(0,l.useState)(!1),[I,T]=(0,l.useState)(!0),D=(0,ec.IC)(),S="[data-radix-scroll-area-viewport]";(0,l.useEffect)(()=>{var e;let t=null===(e=w.current)||void 0===e?void 0:e.querySelector(S);if(!t)return;let a=()=>{let{scrollTop:e,scrollHeight:a,clientHeight:n}=t;T(a-(e+n)<=50)};return t.addEventListener("scroll",a),()=>t.removeEventListener("scroll",a)},[]),(0,l.useEffect)(()=>{e.incomingMessages&&e.incomingMessages.length>0&&I&&L()},[e.incomingMessages,I]),(0,l.useEffect)(()=>{g&&g.chat&&g.chat.length>0&&f<2&&requestAnimationFrame(()=>{var e;null===(e=C.current)||void 0===e||e.scrollIntoView({behavior:"auto",block:"start"})})},[g,f]),(0,l.useEffect)(()=>{if(!x||_)return;let t=new IntersectionObserver(t=>{t[0].isIntersecting&&x&&(R(!0),function(t){if(!x||_)return;let a=(t+1)*10,n="";if(e.conversationId)n="/api/chat/history?client=web&conversation_id=".concat(encodeURIComponent(e.conversationId),"&n=").concat(a);else{if(!e.publicConversationSlug)return;n="/api/chat/share/history?client=web&public_conversation_slug=".concat(e.publicConversationSlug,"&n=").concat(a)}fetch(n).then(e=>e.json()).then(a=>{if(e.setTitle(a.response.slug),a&&a.response&&a.response.chat&&a.response.chat.length>0){if(p(Math.ceil(a.response.chat.length/10)),a.response.chat.length===(null==g?void 0:g.chat.length)){v(!1),R(!1);return}e.setAgent(a.response.agent),m(a.response),R(!1),0===t?L(!0):F()}else{if(a.response.agent&&a.response.conversation_id){let t={chat:[],agent:a.response.agent,conversation_id:a.response.conversation_id,slug:a.response.slug};e.setAgent(a.response.agent),m(t)}v(!1),R(!1)}}).catch(e=>{console.error(e),window.location.href="/"})}(f))},{threshold:1});return b.current&&t.observe(b.current),()=>t.disconnect()},[x,f,_]),(0,l.useEffect)(()=>{v(!0),R(!1),p(0),m(null)},[e.conversationId]),(0,l.useEffect)(()=>{if(e.incomingMessages){let t=e.incomingMessages[e.incomingMessages.length-1];t&&!t.completed&&(k(e.incomingMessages.length-1),e.setTitle(t.rawQuery),t.turnId&&y(t.turnId))}},[e.incomingMessages]);let F=()=>{var e;let t=null===(e=w.current)||void 0===e?void 0:e.querySelector(S);requestAnimationFrame(()=>{var e;null===(e=M.current)||void 0===e||e.scrollIntoView({behavior:"auto",block:"start"}),null==t||t.scrollBy({behavior:"smooth",top:-150})})},L=function(){var e;let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=null===(e=w.current)||void 0===e?void 0:e.querySelector(S);requestAnimationFrame(()=>{null==a||a.scrollTo({top:a.scrollHeight,behavior:t?"auto":"smooth"})}),T(!0)},O=t=>{t&&(m(e=>e&&t?{...e,chat:e.chat.filter(e=>e.turnId!==t)}:e),e.incomingMessages&&e.setIncomingMessages&&e.setIncomingMessages(e.incomingMessages.filter(e=>e.turnId!==t)))};return e.conversationId||e.publicConversationSlug?(0,n.jsx)(ei.x,{className:"h-[73vh] relative",ref:w,children:(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"".concat(o().chatHistory," ").concat(e.customClassName),children:[(0,n.jsx)("div",{ref:b,style:{height:"1px"},children:_&&(0,n.jsx)(ea.l,{className:"opacity-50"})}),g&&g.chat&&g.chat.map((t,a)=>{var s,o,l;return(0,n.jsxs)(n.Fragment,{children:[t.trainOfThought&&"khoj"===t.by&&(0,n.jsx)(eb,{trainOfThought:null===(s=t.trainOfThought)||void 0===s?void 0:s.map(e=>e.data),lastMessage:!1,agentColor:(null==g?void 0:null===(o=g.agent)||void 0===o?void 0:o.color)||"orange",keyId:"".concat(a,"trainOfThought"),completed:!0},"".concat(a,"trainOfThought")),(0,n.jsx)(em,{ref:a===g.chat.length-2?C:a===g.chat.length-(f-1)*10?M:null,isMobileWidth:D,chatMessage:t,customClassName:"fullHistory",borderLeftColor:"".concat(null==g?void 0:null===(l=g.agent)||void 0===l?void 0:l.color,"-500"),isLastMessage:a===g.chat.length-1,onDeleteMessage:O,conversationId:e.conversationId},"".concat(a,"fullHistory"))]})}),e.incomingMessages&&e.incomingMessages.map((t,a)=>{var s,o,r,c,i;let d=null!==(i=null!==(c=t.turnId)&&void 0!==c?c:j)&&void 0!==i?i:void 0;return(0,n.jsxs)(l.Fragment,{children:[(0,n.jsx)(em,{isMobileWidth:D,chatMessage:{message:t.rawQuery,context:[],onlineContext:{},codeContext:{},created:t.timestamp,by:"you",automationId:"",images:t.images,conversationId:e.conversationId,turnId:d,queryFiles:t.queryFiles},customClassName:"fullHistory",borderLeftColor:"".concat(null==g?void 0:null===(s=g.agent)||void 0===s?void 0:s.color,"-500"),onDeleteMessage:O,conversationId:e.conversationId,turnId:d},"".concat(a,"outgoing")),t.trainOfThought&&(0,n.jsx)(eb,{trainOfThought:t.trainOfThought,lastMessage:a===N,agentColor:(null==g?void 0:null===(o=g.agent)||void 0===o?void 0:o.color)||"orange",keyId:"".concat(a,"trainOfThought"),completed:t.completed},"".concat(a,"trainOfThought")),(0,n.jsx)(em,{isMobileWidth:D,chatMessage:{message:t.rawResponse,context:t.context,onlineContext:t.onlineContext,codeContext:t.codeContext,created:t.timestamp,by:"khoj",automationId:"",rawQuery:t.rawQuery,intent:{type:t.intentType||"",query:t.rawQuery,"memory-type":"","inferred-queries":t.inferredQueries||[]},conversationId:e.conversationId,turnId:d},conversationId:e.conversationId,turnId:d,onDeleteMessage:O,customClassName:"fullHistory",borderLeftColor:"".concat(null==g?void 0:null===(r=g.agent)||void 0===r?void 0:r.color,"-500"),isLastMessage:!0},"".concat(a,"incoming"))]},"incomingMessage".concat(a))}),e.pendingMessage&&(0,n.jsx)(em,{isMobileWidth:D,chatMessage:{message:e.pendingMessage,context:[],onlineContext:{},codeContext:{},created:new Date().getTime().toString(),by:"you",automationId:"",conversationId:e.conversationId,turnId:void 0},conversationId:e.conversationId,onDeleteMessage:O,customClassName:"fullHistory",borderLeftColor:"".concat(null==g?void 0:null===(t=g.agent)||void 0===t?void 0:t.color,"-500"),isLastMessage:!0},"pendingMessage-".concat(e.pendingMessage.length)),g&&(0,n.jsx)("div",{className:"".concat(o().agentIndicator," pb-4"),children:(0,n.jsx)("div",{className:"relative group mx-2 cursor-pointer",children:(0,n.jsx)(ey,{name:g&&g.agent&&(null===(r=g.agent)||void 0===r?void 0:r.name)?null===(c=g.agent)||void 0===c?void 0:c.name:"Agent",link:g&&g.agent&&(null===(i=g.agent)||void 0===i?void 0:i.slug)?"/agents?agent=".concat(null===(d=g.agent)||void 0===d?void 0:d.slug):"/agents",avatar:(0,E.TI)(null===(a=g.agent)||void 0===a?void 0:a.icon,null===(s=g.agent)||void 0===s?void 0:s.color)||(0,n.jsx)(ep.v,{}),description:g&&g.agent&&(null===(h=g.agent)||void 0===h?void 0:h.persona)?null===(u=g.agent)||void 0===u?void 0:u.persona:"Your agent is no longer available. You will be reset to the default agent."})})})]}),(0,n.jsx)("div",{className:"".concat(e.customClassName," fixed bottom-[20%] z-10"),children:!I&&(0,n.jsx)("button",{title:"Scroll to bottom",className:"absolute bottom-0 right-0 bg-white dark:bg-[hsl(var(--background))] text-neutral-500 dark:text-white p-2 rounded-full shadow-xl",onClick:()=>{L(),T(!0)},children:(0,n.jsx)(ex.K,{size:24})})})]})}):null}},15238:function(e){e.exports={chatHistory:"chatHistory_chatHistory__CoaVT",agentIndicator:"chatHistory_agentIndicator__wOU1f",trainOfThought:"chatHistory_trainOfThought__mMWSR"}},34531:function(e){e.exports={chatMessageContainer:"chatMessage_chatMessageContainer__sAivf",chatMessageWrapper:"chatMessage_chatMessageWrapper__u5m8A",khojfullHistory:"chatMessage_khojfullHistory__NPu2l",youfullHistory:"chatMessage_youfullHistory__ioyfH",you:"chatMessage_you__6GUC4",khoj:"chatMessage_khoj__cjWON",khojChatMessage:"chatMessage_khojChatMessage__BabQz",emptyChatMessage:"chatMessage_emptyChatMessage__J9JRn",imagesContainer:"chatMessage_imagesContainer__HTRjT",imageWrapper:"chatMessage_imageWrapper__DF92M",author:"chatMessage_author__muRtC",chatFooter:"chatMessage_chatFooter__0vR8s",chatButtons:"chatMessage_chatButtons__Lbk8T",codeCopyButton:"chatMessage_codeCopyButton__Y_Ujv",feedbackButtons:"chatMessage_feedbackButtons___Brdy",copyButton:"chatMessage_copyButton__jd7q7",trainOfThought:"chatMessage_trainOfThought__mR2Gg",primary:"chatMessage_primary__WYPEb",trainOfThoughtElement:"chatMessage_trainOfThoughtElement__le_bC"}}}]);
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5538],{55538:function(e,t,a){"use strict";a.d(t,{Z:function(){return ey}});var n=a(57437),s=a(15238),o=a.n(s),l=a(2265),r=a(34531),c=a.n(r),i=a(14944),d=a(39952),h=a.n(d),u=a(34040);a(7395);var g=a(26100),m=a(36013),f=a(13304),p=a(12218),x=a(74697),v=a(37440);let j=f.fC,w=f.xz;f.x8;let b=f.h_,y=l.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(f.aV,{className:(0,v.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...s,ref:t})});y.displayName=f.aV.displayName;let C=(0,p.j)("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),M=l.forwardRef((e,t)=>{let{side:a="right",className:s,children:o,...l}=e;return(0,n.jsxs)(b,{children:[(0,n.jsx)(y,{}),(0,n.jsxs)(f.VY,{ref:t,className:(0,v.cn)(C({side:a}),s),...l,children:[o,(0,n.jsxs)(f.x8,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[(0,n.jsx)(x.Z,{className:"h-4 w-4"}),(0,n.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});M.displayName=f.VY.displayName;let N=e=>{let{className:t,...a}=e;return(0,n.jsx)("div",{className:(0,v.cn)("flex flex-col space-y-2 text-center sm:text-left",t),...a})};N.displayName="SheetHeader";let k=l.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(f.Dx,{ref:t,className:(0,v.cn)("text-lg font-semibold text-foreground",a),...s})});k.displayName=f.Dx.displayName;let _=l.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(f.dk,{ref:t,className:(0,v.cn)("text-sm text-muted-foreground",a),...s})});_.displayName=f.dk.displayName;var R=a(19573),I=a(11838),T=a.n(I),E=a(89417);let D=new i.Z({html:!0,linkify:!0,typographer:!0});function S(e){let t=(0,E.Le)(e.title||".txt","w-6 h-6 text-muted-foreground inline-flex mr-2"),a=function(e){let t=["org","md","markdown"].includes(e.title.split(".").pop()||"")?e.content.split("\n").slice(1).join("\n"):e.content;return e.showFullContent?T().sanitize(D.render(t)):T().sanitize(t)}(e),[s,o]=(0,l.useState)(!1);return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(R.J2,{open:s&&!e.showFullContent,onOpenChange:o,children:[(0,n.jsx)(R.xo,{asChild:!0,children:(0,n.jsxs)(m.Zb,{onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),className:"".concat(e.showFullContent?"w-auto":"w-[200px]"," overflow-hidden break-words text-balance rounded-lg p-2 bg-muted border-none"),children:[(0,n.jsxs)("h3",{className:"".concat(e.showFullContent?"block":"line-clamp-1"," text-muted-foreground}"),children:[t,e.title]}),(0,n.jsx)("p",{className:"".concat(e.showFullContent?"block":"overflow-hidden line-clamp-2"),dangerouslySetInnerHTML:{__html:a}})]})}),(0,n.jsx)(R.yk,{className:"w-[400px] mx-2",children:(0,n.jsxs)(m.Zb,{className:"w-auto overflow-hidden break-words text-balance rounded-lg p-2 border-none",children:[(0,n.jsxs)("h3",{className:"line-clamp-2 text-muted-foreground}",children:[t,e.title]}),(0,n.jsx)("p",{className:"overflow-hidden line-clamp-3",dangerouslySetInnerHTML:{__html:a}})]})})]})})}function F(e){let t=(0,E.Le)(".py","w-6 h-6 text-muted-foreground inline-flex mr-2"),a=T().sanitize(e.code),[s,o]=(0,l.useState)(!1);return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(R.J2,{open:s&&!e.showFullContent,onOpenChange:o,children:[(0,n.jsx)(R.xo,{asChild:!0,children:(0,n.jsxs)(m.Zb,{onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),className:"".concat(e.showFullContent?"w-auto":"w-[200px]"," overflow-hidden break-words text-balance rounded-lg p-2 bg-muted border-none"),children:[(0,n.jsxs)("h3",{className:"".concat(e.showFullContent?"block":"line-clamp-1"," text-muted-foreground}"),children:[t,"Code"]}),(0,n.jsx)("p",{className:"".concat(e.showFullContent?"block":"overflow-hidden line-clamp-2"),children:a})]})}),(0,n.jsx)(R.yk,{className:"w-[400px] mx-2",children:(0,n.jsxs)(m.Zb,{className:"w-auto overflow-hidden break-words text-balance rounded-lg p-2 border-none",children:[(0,n.jsxs)("h3",{className:"line-clamp-2 text-muted-foreground}",children:[t,"Code"]}),(0,n.jsx)("p",{className:"overflow-hidden line-clamp-3",children:a})]})})]})})}function L(e){let[t,a]=(0,l.useState)(!1);if(!e.link||e.link.split(" ").length>1)return null;let s="https://www.google.com/s2/favicons?domain=globe",o="unknown";try{o=new URL(e.link).hostname,s="https://www.google.com/s2/favicons?domain=".concat(o)}catch(t){return console.warn("Error parsing domain from link: ".concat(e.link)),null}return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(R.J2,{open:t&&!e.showFullContent,onOpenChange:a,children:[(0,n.jsx)(R.xo,{asChild:!0,children:(0,n.jsx)(m.Zb,{onMouseEnter:()=>{a(!0)},onMouseLeave:()=>{a(!1)},className:"".concat(e.showFullContent?"w-auto":"w-[200px]"," overflow-hidden break-words rounded-lg text-balance p-2 bg-muted border-none"),children:(0,n.jsx)("div",{className:"flex flex-col",children:(0,n.jsxs)("a",{href:e.link,target:"_blank",rel:"noreferrer",className:"!no-underline p-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("img",{src:s,alt:"",className:"!w-4 h-4 mr-2 flex-shrink-0"}),(0,n.jsx)("h3",{className:"overflow-hidden ".concat(e.showFullContent?"block":"line-clamp-1"," text-muted-foreground flex-grow"),children:o})]}),(0,n.jsx)("h3",{className:"overflow-hidden ".concat(e.showFullContent?"block":"line-clamp-1"," font-bold"),children:e.title}),(0,n.jsx)("p",{className:"overflow-hidden ".concat(e.showFullContent?"block":"line-clamp-2"),children:e.description})]})})})}),(0,n.jsx)(R.yk,{className:"w-[400px] mx-2",children:(0,n.jsx)(m.Zb,{className:"w-auto overflow-hidden break-words text-balance rounded-lg border-none",children:(0,n.jsx)("div",{className:"flex flex-col",children:(0,n.jsxs)("a",{href:e.link,target:"_blank",rel:"noreferrer",className:"!no-underline p-2",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)("img",{src:s,alt:"",className:"!w-4 h-4 mr-2"}),(0,n.jsx)("h3",{className:"overflow-hidden ".concat(e.showFullContent?"block":"line-clamp-2"," text-muted-foreground"),children:o})]}),(0,n.jsx)("h3",{className:"overflow-hidden ".concat(e.showFullContent?"block":"line-clamp-2"," font-bold"),children:e.title}),(0,n.jsx)("p",{className:"overflow-hidden ".concat(e.showFullContent?"block":"line-clamp-3"),children:e.description})]})})})})]})})}function O(e){let[t,a]=(0,l.useState)(3);(0,l.useEffect)(()=>{a(e.isMobileWidth?1:3)},[e.isMobileWidth]);let s=e.notesReferenceCardData.slice(0,t),o=e.codeReferenceCardData.slice(0,t-s.length),r=s.length+o.length<t?e.onlineReferenceCardData.slice(0,t-o.length-s.length):[],c=e.notesReferenceCardData.length>0||e.codeReferenceCardData.length>0||e.onlineReferenceCardData.length>0,i=e.notesReferenceCardData.length+e.codeReferenceCardData.length+e.onlineReferenceCardData.length;return 0===i?null:(0,n.jsxs)("div",{className:"pt-0 px-4 pb-4 md:px-6",children:[(0,n.jsxs)("h3",{className:"inline-flex items-center",children:["References",(0,n.jsxs)("p",{className:"text-gray-400 m-2",children:[i," sources"]})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2 w-auto mt-2",children:[s.map((e,t)=>(0,l.createElement)(S,{showFullContent:!1,...e,key:"".concat(e.title,"-").concat(t)})),o.map((e,t)=>(0,l.createElement)(F,{showFullContent:!1,...e,key:"code-".concat(t)})),r.map((e,t)=>(0,l.createElement)(L,{showFullContent:!1,...e,key:"".concat(e.title,"-").concat(t)})),c&&(0,n.jsx)(q,{notesReferenceCardData:e.notesReferenceCardData,onlineReferenceCardData:e.onlineReferenceCardData,codeReferenceCardData:e.codeReferenceCardData})]})]})}function q(e){return e.notesReferenceCardData||e.onlineReferenceCardData?(0,n.jsxs)(j,{children:[(0,n.jsxs)(w,{className:"text-balance w-auto md:w-[200px] justify-start overflow-hidden break-words p-0 bg-transparent border-none text-gray-400 align-middle items-center !m-2 inline-flex",children:["View references",(0,n.jsx)(g.o,{className:"m-1"})]}),(0,n.jsxs)(M,{className:"overflow-y-scroll",children:[(0,n.jsxs)(N,{children:[(0,n.jsx)(k,{children:"References"}),(0,n.jsx)(_,{children:"View all references for this response"})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2 w-auto mt-2",children:[e.notesReferenceCardData.map((e,t)=>(0,l.createElement)(S,{showFullContent:!0,...e,key:"".concat(e.title,"-").concat(t)})),e.onlineReferenceCardData.map((e,t)=>(0,l.createElement)(L,{showFullContent:!0,...e,key:"".concat(e.title,"-").concat(t)})),e.codeReferenceCardData.map((e,t)=>(0,l.createElement)(F,{showFullContent:!0,...e,key:"code-".concat(t)}))]})]})]}):null}var B=a(9557),H=a(34149),W=a(29386),z=a(31784),A=a(60665),Z=a(96006),U=a(18444),V=a(35304),P=a(8589),G=a(13493),J=a(63205),$=a(56698),Q=a(32970),Y=a(84120),K=a(92880),X=a(48408),ee=a(55362),et=a(67722),ea=a(58485),en=a(58575),es=a(25800);let eo=(0,a(57818).default)(()=>Promise.all([a.e(6555),a.e(7293),a.e(1459),a.e(1210)]).then(a.bind(a,51210)).then(e=>e.default),{loadableGenerated:{webpack:()=>[51210]},ssr:!1});function el(e){return(0,n.jsx)(l.Suspense,{fallback:(0,n.jsx)(ea.Z,{}),children:(0,n.jsx)(eo,{data:e.data})})}var er=a(90837),ec=a(69591),ei=a(94880);let ed=new i.Z({html:!0,linkify:!0,typographer:!0});function eh(e,t,a){fetch("/api/chat/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({uquery:e,kquery:t,sentiment:a})})}function eu(e){let{uquery:t,kquery:a}=e,[s,o]=(0,l.useState)(null);return(0,l.useEffect)(()=>{null!==s&&setTimeout(()=>{o(null)},2e3)},[s]),(0,n.jsxs)("div",{className:"".concat(c().feedbackButtons," flex align-middle justify-center items-center"),children:[(0,n.jsx)("button",{title:"Like",className:c().thumbsUpButton,disabled:null!==s,onClick:()=>{eh(t,a,"positive"),o(!0)},children:!0===s?(0,n.jsx)(H.V,{alt:"Liked Message",className:"text-green-500",weight:"fill"}):(0,n.jsx)(H.V,{alt:"Like Message",className:"hsl(var(--muted-foreground)) hover:text-green-500"})}),(0,n.jsx)("button",{title:"Dislike",className:c().thumbsDownButton,disabled:null!==s,onClick:()=>{eh(t,a,"negative"),o(!1)},children:!1===s?(0,n.jsx)(W.L,{alt:"Disliked Message",className:"text-red-500",weight:"fill"}):(0,n.jsx)(W.L,{alt:"Dislike Message",className:"hsl(var(--muted-foreground)) hover:text-red-500"})})]})}function eg(e){let t=e.message.match(/\*\*(.*)\*\*/),a=function(e,t){let a=e.toLowerCase(),s="inline mt-1 mr-2 ".concat(t," h-4 w-4");return a.includes("understanding")?(0,n.jsx)(z.a,{className:"".concat(s)}):a.includes("generating")?(0,n.jsx)(A.Z,{className:"".concat(s)}):a.includes("data sources")||a.includes("notes")?(0,n.jsx)(Z.g,{className:"".concat(s)}):a.includes("read")?(0,n.jsx)(U.f,{className:"".concat(s)}):a.includes("search")?(0,n.jsx)(V.Y,{className:"".concat(s)}):a.includes("summary")||a.includes("summarize")||a.includes("enhanc")?(0,n.jsx)(P.u,{className:"".concat(s)}):a.includes("diagram")?(0,n.jsx)(G.j,{className:"".concat(s)}):a.includes("paint")?(0,n.jsx)(J.Y,{className:"".concat(s)}):a.includes("code")?(0,n.jsx)($.E,{className:"".concat(s)}):(0,n.jsx)(z.a,{className:"".concat(s)})}(t?t[1]:"",e.primary?(0,en.oz)(e.agentColor):"text-gray-500"),s=T().sanitize(ed.render(e.message));return s=s.replace(/<h[1-6].*?<\/h[1-6]>/g,""),(0,n.jsxs)("div",{className:"".concat(c().trainOfThoughtElement," break-words items-center ").concat(e.primary?"text-gray-400":"text-gray-300"," ").concat(c().trainOfThought," ").concat(e.primary?c().primary:""),children:[a,(0,n.jsx)("div",{dangerouslySetInnerHTML:{__html:s},className:"break-words"})]})}ed.use(h(),{inline:!0,code:!0});let em=(0,l.forwardRef)((e,t)=>{var a,s;let o,r,i,d,h;let[g,m]=(0,l.useState)(!1),[p,x]=(0,l.useState)(!1),[v,j]=(0,l.useState)(""),[w,b]=(0,l.useState)(""),[y,C]=(0,l.useState)(!1),[M,N]=(0,l.useState)(!1),[k,_]=(0,l.useState)(""),R=(0,l.useRef)(!1),I=(0,l.useRef)(null);async function D(){let t=e.chatMessage.message.match(/[^.!?]+[.!?]*/g)||[];if(!t||0===t.length||!t[0])return;C(!0);let a=S(t[0]);for(let e=0;e<t.length&&!R.current;e++){let n=a;e<t.length-1&&(a=S(t[e+1]));try{let e=await n,t=URL.createObjectURL(e);await function(e){return new Promise((t,a)=>{let n=new Audio(e);n.onended=t,n.onerror=a,n.play()})}(t)}catch(e){console.error("Error:",e);break}}C(!1),N(!1)}async function S(e){let t=await fetch("/api/chat/speech?text=".concat(encodeURIComponent(e)),{method:"POST",headers:{"Content-Type":"application/json"}});if(!t.ok)throw Error("Network response was not ok");return await t.blob()}(0,l.useEffect)(()=>{R.current=M},[M]),(0,l.useEffect)(()=>{let e=new MutationObserver((e,t)=>{if(I.current)for(let t of e)"childList"===t.type&&t.addedNodes.length>0&&(0,es.Z)(I.current,{delimiters:[{left:"$$",right:"$$",display:!0},{left:"\\[",right:"\\]",display:!0},{left:"\\(",right:"\\)",display:!1}]})});return I.current&&e.observe(I.current,{childList:!0}),()=>e.disconnect()},[I.current]),(0,l.useEffect)(()=>{var t;let a=e.chatMessage.message;e.chatMessage.intent&&"excalidraw"==e.chatMessage.intent.type&&(a=e.chatMessage.intent["inferred-queries"][0],_(e.chatMessage.message)),a=a.replace(/\\\(/g,"LEFTPAREN").replace(/\\\)/g,"RIGHTPAREN").replace(/\\\[/g,"LEFTBRACKET").replace(/\\\]/g,"RIGHTBRACKET");let n={"text-to-image":e=>""),"text-to-image2":e=>""),"text-to-image-v3":e=>""),excalidraw:e=>e};if(e.chatMessage.intent){let{type:t,"inferred-queries":s}=e.chatMessage.intent;t in n&&(a=n[t](a)),t.includes("text-to-image")&&(null==s?void 0:s.length)>0&&(a+="\n\n".concat(s[0]))}let s=a,o=a;if(e.chatMessage.images&&e.chatMessage.images.length>0){let t=e.chatMessage.images.map(e=>{let t=e.startsWith("data%3Aimage")?decodeURIComponent(e):e;return T().sanitize(t)}),a=t.map((e,t)=>".concat(e,")")).join("\n"),n=t.map((e,t)=>'<div class="'.concat(c().imageWrapper,'"><img src="').concat(e,'" alt="uploaded image ').concat(t+1,'" /></div>')).join(""),l='<div class="'.concat(c().imagesContainer,'">').concat(n,"</div>");s="".concat(a,"\n\n").concat(s),o="".concat(l).concat(o)}e.chatMessage.intent&&"text-to-image"==e.chatMessage.intent.type?a=""):e.chatMessage.intent&&"text-to-image2"==e.chatMessage.intent.type?a=""):e.chatMessage.intent&&"text-to-image-v3"==e.chatMessage.intent.type&&(a="")),e.chatMessage.intent&&e.chatMessage.intent.type.includes("text-to-image")&&(null===(t=e.chatMessage.intent["inferred-queries"])||void 0===t?void 0:t.length)>0&&(a+="\n\n".concat(e.chatMessage.intent["inferred-queries"][0])),a=(0,B.AQ)(a,e.chatMessage.codeContext),e.chatMessage.codeContext&&Object.entries(e.chatMessage.codeContext).forEach(e=>{var t;let[n,s]=e;null===(t=s.results.output_files)||void 0===t||t.forEach(e=>{if(e.filename.endsWith(".png")||e.filename.endsWith(".jpg"))a.includes(")||(a+="\n\n.concat(e.b64_data,")"));else if(e.filename.endsWith(".txt")||e.filename.endsWith(".org")||e.filename.endsWith(".md")){let t=atob(e.b64_data);a+="\n\n```\n".concat(t,"\n```")}})}),j(s);let l=ed.render(o);l=l.replace(/LEFTPAREN/g,"\\(").replace(/RIGHTPAREN/g,"\\)").replace(/LEFTBRACKET/g,"\\[").replace(/RIGHTBRACKET/g,"\\]"),b(T().sanitize(l))},[e.chatMessage.message,e.chatMessage.images,e.chatMessage.intent]),(0,l.useEffect)(()=>{g&&setTimeout(()=>{m(!1)},2e3)},[g]),(0,l.useEffect)(()=>{I.current&&(I.current.querySelectorAll("pre > .hljs").forEach(e=>{if(!e.querySelector("".concat(c().codeCopyButton))){let t=document.createElement("button"),a=(0,n.jsx)(Q.w,{size:24});(0,u.createRoot)(t).render(a),t.className="hljs ".concat(c().codeCopyButton),t.addEventListener("click",()=>{let a=e.textContent||"";a=(a=(a=a.replace(/^\$+/,"")).replace(/^Copy/,"")).trim(),navigator.clipboard.writeText(a);let s=(0,n.jsx)(Y.J,{size:24});(0,u.createRoot)(t).render(s)}),e.prepend(t)}}),(0,es.Z)(I.current,{delimiters:[{left:"$$",right:"$$",display:!0},{left:"\\[",right:"\\]",display:!0},{left:"\\(",right:"\\)",display:!1}]}))},[w,p,I]);let F=async t=>{let a=t.turnId||e.turnId;(await fetch("/api/chat/conversation/message",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({conversation_id:e.conversationId,turn_id:a})})).ok?e.onDeleteMessage(a):console.error("Failed to delete message")},L=function(e,t,a){let n=[],s=[],o=[];if(a)for(let[e,t]of Object.entries(a))t.results&&o.push({code:t.code,output:t.results.std_out,error:t.results.std_err});if(t){let e=[];for(let[a,n]of Object.entries(t)){if(n.answerBox&&e.push({title:n.answerBox.title,description:n.answerBox.answer,link:n.answerBox.source}),n.knowledgeGraph&&e.push({title:n.knowledgeGraph.title,description:n.knowledgeGraph.description,link:n.knowledgeGraph.descriptionLink}),n.webpages){if(n.webpages instanceof Array){let t=n.webpages.map(e=>({title:e.query,description:e.snippet,link:e.link}));e.push(...t)}else{let t=n.webpages;e.push({title:t.query,description:t.snippet,link:t.link})}}if(n.organic){let t=n.organic.map(e=>({title:e.title,description:e.snippet,link:e.link}));e.push(...t)}}n.push(...e)}if(e){let t=e.map(e=>e.compiled?{title:e.file,content:e.compiled}:{title:e.split("\n")[0],content:e.split("\n").slice(1).join("\n")});s.push(...t)}return{notesReferenceCardData:s,onlineReferenceCardData:n,codeReferenceCardData:o}}(e.chatMessage.context,e.chatMessage.onlineContext,e.chatMessage.codeContext);return(0,n.jsxs)("div",{ref:t,className:(a=e.chatMessage,(o=[c().chatMessageContainer,"shadow-md"]).push(c()[a.by]),a.message||o.push(c().emptyChatMessage),e.customClassName&&o.push(c()["".concat(a.by).concat(e.customClassName)]),o.join(" ")),onMouseLeave:e=>x(!1),onMouseEnter:e=>x(!0),children:[(0,n.jsxs)("div",{className:(s=e.chatMessage,(r=[c().chatMessageWrapper]).push(c()[s.by]),"khoj"===s.by&&r.push("border-l-4 border-opacity-50 ".concat("border-l-"+e.borderLeftColor)),r.join(" ")),children:[e.chatMessage.queryFiles&&e.chatMessage.queryFiles.length>0&&(0,n.jsx)("div",{className:"flex flex-wrap flex-col mb-2 max-w-full",children:e.chatMessage.queryFiles.map((e,t)=>(0,n.jsxs)(er.Vq,{children:[(0,n.jsx)(er.hg,{asChild:!0,children:(0,n.jsxs)("div",{className:"flex items-center space-x-2 cursor-pointer bg-gray-500 bg-opacity-25 rounded-lg p-2 w-full ",children:[(0,n.jsx)("div",{className:"flex-shrink-0",children:(0,E.Le)(e.file_type)}),(0,n.jsx)("span",{className:"truncate flex-1 min-w-0 max-w-[200px]",children:e.name}),e.size&&(0,n.jsxs)("span",{className:"text-gray-400 flex-shrink-0",children:["(",(0,ec.xq)(e.size),")"]})]})}),(0,n.jsxs)(er.cZ,{children:[(0,n.jsx)(er.fK,{children:(0,n.jsx)(f.$N,{children:(0,n.jsx)("div",{className:"truncate min-w-0 break-words break-all text-wrap max-w-full whitespace-normal",children:e.name})})}),(0,n.jsx)(er.Be,{children:(0,n.jsx)(ei.x,{className:"h-72 w-full rounded-md break-words break-all text-wrap",children:e.content})})]})]},t))}),(0,n.jsx)("div",{ref:I,className:c().chatMessage,dangerouslySetInnerHTML:{__html:w}}),k&&(0,n.jsx)(el,{data:k})]}),(0,n.jsx)("div",{className:c().teaserReferencesContainer,children:(0,n.jsx)(O,{isMobileWidth:e.isMobileWidth,notesReferenceCardData:L.notesReferenceCardData,onlineReferenceCardData:L.onlineReferenceCardData,codeReferenceCardData:L.codeReferenceCardData})}),(0,n.jsx)("div",{className:c().chatFooter,children:(p||e.isMobileWidth||e.isLastMessage||y)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{title:(d=(i=new Date(e.chatMessage.created+"Z")).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0}).toUpperCase(),h=i.toLocaleString("en-US",{year:"numeric",month:"short",day:"2-digit"}).replaceAll("-"," "),"".concat(d," on ").concat(h)),className:"text-gray-400 relative top-0 left-4",children:function(e){e.endsWith("Z")||(e+="Z");let t=new Date(e),a=new Date().getTime()-t.getTime();return a<6e4?"Just now":a<36e5?"".concat(Math.round(a/6e4),"m ago"):a<864e5?"".concat(Math.round(a/36e5),"h ago"):"".concat(Math.round(a/864e5),"d ago")}(e.chatMessage.created)}),(0,n.jsxs)("div",{className:"".concat(c().chatButtons," shadow-sm"),children:["khoj"===e.chatMessage.by&&(y?M?(0,n.jsx)(ea.l,{iconClassName:"p-0",className:"m-0"}):(0,n.jsx)("button",{title:"Pause Speech",onClick:e=>N(!0),children:(0,n.jsx)(K.d,{alt:"Pause Message",className:"hsl(var(--muted-foreground))"})}):(0,n.jsx)("button",{title:"Speak",onClick:e=>D(),children:(0,n.jsx)(X.j,{alt:"Speak Message",className:"hsl(var(--muted-foreground)) hover:text-green-500"})})),e.chatMessage.turnId&&(0,n.jsx)("button",{title:"Delete",className:"".concat(c().deleteButton),onClick:()=>F(e.chatMessage),children:(0,n.jsx)(ee.r,{alt:"Delete Message",className:"hsl(var(--muted-foreground)) hover:text-red-500"})}),(0,n.jsx)("button",{title:"Copy",className:"".concat(c().copyButton),onClick:()=>{navigator.clipboard.writeText(v),m(!0)},children:g?(0,n.jsx)(et.C,{alt:"Copied Message",weight:"fill",className:"text-green-500"}):(0,n.jsx)(et.C,{alt:"Copy Message",className:"hsl(var(--muted-foreground)) hover:text-green-500"})}),"khoj"===e.chatMessage.by&&(e.chatMessage.intent?(0,n.jsx)(eu,{uquery:e.chatMessage.intent.query,kquery:e.chatMessage.message}):(0,n.jsx)(eu,{uquery:e.chatMessage.rawQuery||e.chatMessage.message,kquery:e.chatMessage.message}))]})]})})]})});em.displayName="ChatMessage";var ef=a(84511),ep=a(16288),ex=a(20721),ev=a(19666),ej=a(50495),ew=e=>{let{name:t,avatar:a,link:s,description:o}=e;return(0,n.jsx)("div",{className:"relative group flex",children:(0,n.jsx)(ev.pn,{children:(0,n.jsxs)(ev.u,{delayDuration:0,children:[(0,n.jsx)(ev.aJ,{asChild:!0,children:(0,n.jsxs)(ej.z,{variant:"ghost",className:"flex items-center justify-center",children:[a,(0,n.jsx)("div",{children:t})]})}),(0,n.jsx)(ev._v,{children:(0,n.jsxs)("div",{className:"w-80 h-30",children:[(0,n.jsx)("a",{href:s,target:"_blank",rel:"noreferrer",className:"mt-1 ml-2 block no-underline",children:(0,n.jsxs)("div",{className:"flex items-center justify-start gap-2",children:[a,(0,n.jsxs)("div",{className:"mr-2 mt-1 flex justify-center items-center text-sm font-semibold text-gray-800",children:[t,(0,n.jsx)(g.o,{weight:"bold",className:"ml-1"})]})]})}),o&&(0,n.jsx)("p",{className:"mt-2 ml-6 text-sm text-gray-600 line-clamp-2",children:o||"A Khoj agent"})]})})]})})})};function eb(e){let t=e.trainOfThought.length-1,[a,s]=(0,l.useState)(e.completed);return(0,n.jsxs)("div",{className:"".concat(a?"":o().trainOfThought+" shadow-sm"),children:[!e.completed&&(0,n.jsx)(ea.l,{className:"float-right"}),e.completed&&(a?(0,n.jsx)(ej.z,{className:"w-fit text-left justify-start content-start text-xs",onClick:()=>s(!1),variant:"ghost",size:"sm",children:"What was my train of thought?"}):(0,n.jsxs)(ej.z,{className:"w-fit text-left justify-start content-start text-xs p-0 h-fit",onClick:()=>s(!0),variant:"ghost",size:"sm",children:[(0,n.jsx)(ef.a,{size:16,className:"mr-1"}),"Close"]})),!a&&e.trainOfThought.map((a,s)=>(0,n.jsx)(eg,{message:a,primary:s===t&&e.lastMessage&&!e.completed,agentColor:e.agentColor},"train-".concat(s)))]},e.keyId)}function ey(e){var t,a,s,r,c,i,d,h,u;let[g,m]=(0,l.useState)(null),[f,p]=(0,l.useState)(0),[x,v]=(0,l.useState)(!0),[j,w]=(0,l.useState)(null),b=(0,l.useRef)(null),y=(0,l.useRef)(null),C=(0,l.useRef)(null),M=(0,l.useRef)(null),[N,k]=(0,l.useState)(null),[_,R]=(0,l.useState)(!1),[I,T]=(0,l.useState)(!0),D=(0,ec.IC)(),S="[data-radix-scroll-area-viewport]";(0,l.useEffect)(()=>{var e;let t=null===(e=y.current)||void 0===e?void 0:e.querySelector(S);if(!t)return;let a=()=>{let{scrollTop:e,scrollHeight:a,clientHeight:n}=t;T(a-(e+n)<=50)};return t.addEventListener("scroll",a),()=>t.removeEventListener("scroll",a)},[]),(0,l.useEffect)(()=>{e.incomingMessages&&e.incomingMessages.length>0&&I&&L()},[e.incomingMessages,I]),(0,l.useEffect)(()=>{g&&g.chat&&g.chat.length>0&&f<2&&requestAnimationFrame(()=>{var e;null===(e=C.current)||void 0===e||e.scrollIntoView({behavior:"auto",block:"start"})})},[g,f]),(0,l.useEffect)(()=>{if(!x||_)return;let t=new IntersectionObserver(t=>{t[0].isIntersecting&&x&&(R(!0),function(t){if(!x||_)return;let a=(t+1)*10,n="";if(e.conversationId)n="/api/chat/history?client=web&conversation_id=".concat(encodeURIComponent(e.conversationId),"&n=").concat(a);else{if(!e.publicConversationSlug)return;n="/api/chat/share/history?client=web&public_conversation_slug=".concat(e.publicConversationSlug,"&n=").concat(a)}fetch(n).then(e=>e.json()).then(a=>{if(e.setTitle(a.response.slug),a&&a.response&&a.response.chat&&a.response.chat.length>0){if(p(Math.ceil(a.response.chat.length/10)),a.response.chat.length===(null==g?void 0:g.chat.length)){v(!1),R(!1);return}e.setAgent(a.response.agent),m(a.response),R(!1),0===t?L(!0):F()}else{if(a.response.agent&&a.response.conversation_id){let t={chat:[],agent:a.response.agent,conversation_id:a.response.conversation_id,slug:a.response.slug};e.setAgent(a.response.agent),m(t)}v(!1),R(!1)}}).catch(e=>{console.error(e),window.location.href="/"})}(f))},{threshold:1});return b.current&&t.observe(b.current),()=>t.disconnect()},[x,f,_]),(0,l.useEffect)(()=>{v(!0),R(!1),p(0),m(null)},[e.conversationId]),(0,l.useEffect)(()=>{if(e.incomingMessages){let t=e.incomingMessages[e.incomingMessages.length-1];t&&!t.completed&&(k(e.incomingMessages.length-1),e.setTitle(t.rawQuery),t.turnId&&w(t.turnId))}},[e.incomingMessages]);let F=()=>{var e;let t=null===(e=y.current)||void 0===e?void 0:e.querySelector(S);requestAnimationFrame(()=>{var e;null===(e=M.current)||void 0===e||e.scrollIntoView({behavior:"auto",block:"start"}),null==t||t.scrollBy({behavior:"smooth",top:-150})})},L=function(){var e;let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=null===(e=y.current)||void 0===e?void 0:e.querySelector(S);requestAnimationFrame(()=>{null==a||a.scrollTo({top:a.scrollHeight,behavior:t?"auto":"smooth"})}),T(!0)},O=t=>{t&&(m(e=>e&&t?{...e,chat:e.chat.filter(e=>e.turnId!==t)}:e),e.incomingMessages&&e.setIncomingMessages&&e.setIncomingMessages(e.incomingMessages.filter(e=>e.turnId!==t)))};return e.conversationId||e.publicConversationSlug?(0,n.jsx)(ei.x,{className:"h-[73vh] relative",ref:y,children:(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"".concat(o().chatHistory," ").concat(e.customClassName),children:[(0,n.jsx)("div",{ref:b,style:{height:"1px"},children:_&&(0,n.jsx)(ea.l,{className:"opacity-50"})}),g&&g.chat&&g.chat.map((t,a)=>{var s,o,l;return(0,n.jsxs)(n.Fragment,{children:[t.trainOfThought&&"khoj"===t.by&&(0,n.jsx)(eb,{trainOfThought:null===(s=t.trainOfThought)||void 0===s?void 0:s.map(e=>e.data),lastMessage:!1,agentColor:(null==g?void 0:null===(o=g.agent)||void 0===o?void 0:o.color)||"orange",keyId:"".concat(a,"trainOfThought"),completed:!0},"".concat(a,"trainOfThought")),(0,n.jsx)(em,{ref:a===g.chat.length-2?C:a===g.chat.length-(f-1)*10?M:null,isMobileWidth:D,chatMessage:t,customClassName:"fullHistory",borderLeftColor:"".concat(null==g?void 0:null===(l=g.agent)||void 0===l?void 0:l.color,"-500"),isLastMessage:a===g.chat.length-1,onDeleteMessage:O,conversationId:e.conversationId},"".concat(a,"fullHistory"))]})}),e.incomingMessages&&e.incomingMessages.map((t,a)=>{var s,o,r,c,i;let d=null!==(i=null!==(c=t.turnId)&&void 0!==c?c:j)&&void 0!==i?i:void 0;return(0,n.jsxs)(l.Fragment,{children:[(0,n.jsx)(em,{isMobileWidth:D,chatMessage:{message:t.rawQuery,context:[],onlineContext:{},codeContext:{},created:t.timestamp,by:"you",automationId:"",images:t.images,conversationId:e.conversationId,turnId:d,queryFiles:t.queryFiles},customClassName:"fullHistory",borderLeftColor:"".concat(null==g?void 0:null===(s=g.agent)||void 0===s?void 0:s.color,"-500"),onDeleteMessage:O,conversationId:e.conversationId,turnId:d},"".concat(a,"outgoing")),t.trainOfThought&&(0,n.jsx)(eb,{trainOfThought:t.trainOfThought,lastMessage:a===N,agentColor:(null==g?void 0:null===(o=g.agent)||void 0===o?void 0:o.color)||"orange",keyId:"".concat(a,"trainOfThought"),completed:t.completed},"".concat(a,"trainOfThought")),(0,n.jsx)(em,{isMobileWidth:D,chatMessage:{message:t.rawResponse,context:t.context,onlineContext:t.onlineContext,codeContext:t.codeContext,created:t.timestamp,by:"khoj",automationId:"",rawQuery:t.rawQuery,intent:{type:t.intentType||"",query:t.rawQuery,"memory-type":"","inferred-queries":t.inferredQueries||[]},conversationId:e.conversationId,turnId:d},conversationId:e.conversationId,turnId:d,onDeleteMessage:O,customClassName:"fullHistory",borderLeftColor:"".concat(null==g?void 0:null===(r=g.agent)||void 0===r?void 0:r.color,"-500"),isLastMessage:!0},"".concat(a,"incoming"))]},"incomingMessage".concat(a))}),e.pendingMessage&&(0,n.jsx)(em,{isMobileWidth:D,chatMessage:{message:e.pendingMessage,context:[],onlineContext:{},codeContext:{},created:new Date().getTime().toString(),by:"you",automationId:"",conversationId:e.conversationId,turnId:void 0},conversationId:e.conversationId,onDeleteMessage:O,customClassName:"fullHistory",borderLeftColor:"".concat(null==g?void 0:null===(t=g.agent)||void 0===t?void 0:t.color,"-500"),isLastMessage:!0},"pendingMessage-".concat(e.pendingMessage.length)),g&&(0,n.jsx)("div",{className:"".concat(o().agentIndicator," pb-4"),children:(0,n.jsx)("div",{className:"relative group mx-2 cursor-pointer",children:(0,n.jsx)(ew,{name:g&&g.agent&&(null===(r=g.agent)||void 0===r?void 0:r.name)?null===(c=g.agent)||void 0===c?void 0:c.name:"Agent",link:g&&g.agent&&(null===(i=g.agent)||void 0===i?void 0:i.slug)?"/agents?agent=".concat(null===(d=g.agent)||void 0===d?void 0:d.slug):"/agents",avatar:(0,E.TI)(null===(a=g.agent)||void 0===a?void 0:a.icon,null===(s=g.agent)||void 0===s?void 0:s.color)||(0,n.jsx)(ep.v,{}),description:g&&g.agent&&(null===(h=g.agent)||void 0===h?void 0:h.persona)?null===(u=g.agent)||void 0===u?void 0:u.persona:"Your agent is no longer available. You will be reset to the default agent."})})})]}),(0,n.jsx)("div",{className:"".concat(e.customClassName," fixed bottom-[20%] z-10"),children:!I&&(0,n.jsx)("button",{title:"Scroll to bottom",className:"absolute bottom-0 right-0 bg-white dark:bg-[hsl(var(--background))] text-neutral-500 dark:text-white p-2 rounded-full shadow-xl",onClick:()=>{L(),T(!0)},children:(0,n.jsx)(ex.K,{size:24})})})]})}):null}},15238:function(e){e.exports={chatHistory:"chatHistory_chatHistory__CoaVT",agentIndicator:"chatHistory_agentIndicator__wOU1f",trainOfThought:"chatHistory_trainOfThought__mMWSR"}},34531:function(e){e.exports={chatMessageContainer:"chatMessage_chatMessageContainer__sAivf",chatMessageWrapper:"chatMessage_chatMessageWrapper__u5m8A",khojfullHistory:"chatMessage_khojfullHistory__NPu2l",youfullHistory:"chatMessage_youfullHistory__ioyfH",you:"chatMessage_you__6GUC4",khoj:"chatMessage_khoj__cjWON",khojChatMessage:"chatMessage_khojChatMessage__BabQz",emptyChatMessage:"chatMessage_emptyChatMessage__J9JRn",imagesContainer:"chatMessage_imagesContainer__HTRjT",imageWrapper:"chatMessage_imageWrapper__DF92M",author:"chatMessage_author__muRtC",chatFooter:"chatMessage_chatFooter__0vR8s",chatButtons:"chatMessage_chatButtons__Lbk8T",codeCopyButton:"chatMessage_codeCopyButton__Y_Ujv",feedbackButtons:"chatMessage_feedbackButtons___Brdy",copyButton:"chatMessage_copyButton__jd7q7",trainOfThought:"chatMessage_trainOfThought__mR2Gg",primary:"chatMessage_primary__WYPEb",trainOfThoughtElement:"chatMessage_trainOfThoughtElement__le_bC"}}}]);
|
khoj/interface/compiled/_next/static/chunks/{8423-db6dad6d44869097.js → 8423-4dd7f4edffb1144b.js}
RENAMED
@@ -1 +1 @@
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8423],{38423:function(e,t,a){"use strict";a.d(t,{a:function(){return O}});var n=a(57437),r=a(37649),s=a.n(r),l=a(2265),o=a(11838),i=a.n(o);a(7395);var c=a(86819),d=a(35719),u=a(77689),h=a(86829),f=a(33009),m=a(51091),x=a(82119),g=a(42491),p=a(6780),j=a(50495),b=a(70571),v=a(19573),w=a(61485),y=a(93146),N=a(19666),C=a(58575),k=a(66820),E=a(58485),z=a(89417),D=a(9557),R=a(69591),T=a(90837),S=a(94880);let O=(0,l.forwardRef)((e,t)=>{let[a,r]=(0,l.useState)(""),o=(0,l.useRef)(null),[O,M]=(0,l.useState)(null),[_,A]=(0,l.useState)(null),[I,L]=(0,l.useState)(!1),[P,U]=(0,l.useState)(null),[F,W]=(0,l.useState)(!1),[Y,$]=(0,l.useState)(!1),[B,H]=(0,l.useState)([]),[J,K]=(0,l.useState)([]),[Z,V]=(0,l.useState)(null),[X,q]=(0,l.useState)([]),[G,Q]=(0,l.useState)(!1),[ee,et]=(0,l.useState)(null),[ea,en]=(0,l.useState)(0),[er,es]=(0,l.useState)(!1),[el,eo]=(0,l.useState)(!1),[ei,ec]=(0,l.useState)(e.isResearchModeEnabled||!1);function ed(){if(Y&&($(!1),H([]),J.forEach(t=>e.sendImage(t))),!a.trim())return;if(!e.isLoggedIn){U("Hey there, you need to be signed in to send messages to Khoj AI"),W(!0);return}let t=a.trim();ei&&!t.startsWith("/research")&&(t="/research ".concat(t)),e.sendMessage(t),V(null),q([]),r("")}function eu(a){var n,r;if(!e.isLoggedIn){U("Please login to chat with your files"),W(!0);return}let s=["jpg","jpeg","png","webp"],l=[];for(let e=0;e<a.length;e++){let t=a[e],n=t.name.split(".").pop();s.includes(n||"")&&l.push(i().sanitize(URL.createObjectURL(t)))}l.length>0&&($(!0),H(e=>[...e,...l]),null==t||null===(r=t.current)||void 0===r||r.focus());let o=Array.from(a).filter(e=>!s.includes(e.name.split(".").pop()||"")),c=o?Array.from(o).concat(Array.from(Z||[])):Array.from(Z||[]);if(c.length>0){for(let e=0;e<c.length;e++)if(c[e].size>10485760){M("File ".concat(c[e].name," is too large. Please upload files smaller than 10 MB."));return}let t=new DataTransfer;c.forEach(e=>t.items.add(e)),eh(t.files).then(a=>{e.setUploadedFiles(a),V(t.files),q(a)})}null==t||null===(n=t.current)||void 0===n||n.focus()}async function eh(e){let t=await (0,D.M1)(e);L(!0);try{let e=await fetch("/api/content/convert",{method:"POST",body:t});if(L(!1),!e.ok)throw Error("HTTP error! status: ".concat(e.status));return await e.json()}catch(e){return A("Error converting files. "+e+". Please try again, or contact team@khoj.dev if the issue persists."),console.error("Error converting files:",e),[]}}async function ef(){try{let e=await navigator.mediaDevices.getUserMedia({audio:!0}),t=new MediaRecorder(e,{mimeType:"audio/webm"}),a=[];t.ondataavailable=async e=>{a.push(e.data);let t=new Blob(a,{type:"audio/webm"}),n=new FormData;n.append("file",t);try{let e=await fetch("/api/transcribe",{method:"POST",body:n});if(!e.ok)throw Error("Network response was not ok");let t=await e.json();r(t.text.trim())}catch(e){console.error("Error sending audio to server:",e)}},t.start(1500),t.onstop=async()=>{let e=new Blob(a,{type:"audio/webm"}),n=new FormData;n.append("file",e);try{let e=await fetch("/api/transcribe",{method:"POST",body:n});if(!e.ok)throw Error("Network response was not ok");let a=await e.json();t.stream.getTracks().forEach(e=>e.stop()),et(null),r(a.text.trim())}catch(e){console.error("Error sending audio to server:",e)}},et(t)}catch(e){console.error("Error getting microphone",e)}}return(0,l.useEffect)(()=>{if(I||en(0),I){let e=setInterval(()=>{en(e=>{let t=e+(Math.floor(5*Math.random())+1);return t<100?t:100})},800);return()=>clearInterval(e)}},[I]),(0,l.useEffect)(()=>{async function e(){B.length>0&&K(await Promise.all(B.map(async e=>{let t=await fetch(e),a=await t.blob();return new Promise(e=>{let t=new FileReader;t.onload=()=>e(t.result),t.readAsDataURL(a)})}))),L(!1)}L(!0),e()},[B]),(0,l.useEffect)(()=>{e.isResearchModeEnabled&&ec(e.isResearchModeEnabled)},[e.isResearchModeEnabled]),(0,l.useEffect)(()=>{!G&&ee&&ee.stop(),G&&!ee&&ef()},[G,ee]),(0,l.useEffect)(()=>{(null==t?void 0:t.current)&&(t.current.style.height="auto",t.current.style.height=Math.max(t.current.scrollHeight-24,64)+"px",a.startsWith("/")&&1===a.split(" ").length?eo(!0):eo(!1))},[a]),(0,n.jsxs)(n.Fragment,{children:[F&&P&&(0,n.jsx)(k.Z,{onOpenChange:W,loginRedirectMessage:P}),I&&(0,n.jsx)(p.aR,{open:I,children:(0,n.jsxs)(p._T,{children:[(0,n.jsx)(p.fY,{children:(0,n.jsx)(p.f$,{children:"Uploading data. Please wait."})}),(0,n.jsx)(p.yT,{children:(0,n.jsx)(b.E,{indicatorColor:"bg-slate-500",className:"w-full h-2 rounded-full",value:ea})}),(0,n.jsx)(p.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>L(!1),children:"Dismiss"})]})}),O&&(0,n.jsx)(p.aR,{open:null!==O,children:(0,n.jsxs)(p._T,{children:[(0,n.jsx)(p.fY,{children:(0,n.jsx)(p.f$,{children:"Data Upload Warning"})}),(0,n.jsx)(p.yT,{children:O}),(0,n.jsx)(p.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>M(null),children:"Close"})]})}),_&&(0,n.jsx)(p.aR,{open:null!==_,children:(0,n.jsxs)(p._T,{children:[(0,n.jsxs)(p.fY,{children:[(0,n.jsx)(p.f$,{children:"Oh no!"}),(0,n.jsx)(p.yT,{children:"Something went wrong while uploading your data"})]}),(0,n.jsx)(p.yT,{children:_}),(0,n.jsx)(p.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>A(null),children:"Close"})]})}),el&&(0,n.jsx)("div",{className:"flex justify-center text-center",children:(0,n.jsxs)(v.J2,{open:el,onOpenChange:eo,children:[(0,n.jsx)(w.xo,{className:"flex justify-center text-center"}),(0,n.jsx)(v.yk,{onOpenAutoFocus:e=>e.preventDefault(),className:"".concat(e.isMobileWidth?"w-[100vw]":"w-full"," rounded-md"),side:"bottom",align:"center",sideOffset:e.conversationId?0:80,alignOffset:0,children:(0,n.jsxs)(g.mY,{className:"max-w-full",children:[(0,n.jsx)(g.sZ,{placeholder:"Type a command or search...",value:a,className:"hidden"}),(0,n.jsxs)(g.e8,{children:[(0,n.jsx)(g.rb,{children:"No matching commands."}),(0,n.jsx)(g.fu,{heading:"Agent Tools",children:e.chatOptionsData&&Object.entries(e.chatOptionsData).map(e=>{let[t,a]=e;return(0,n.jsx)(g.di,{className:"text-md",onSelect:()=>{r("/".concat(t," "))},children:(0,n.jsxs)("div",{className:"grid grid-cols-1 gap-1",children:[(0,n.jsxs)("div",{className:"font-bold flex items-center",children:[(0,z.vH)(t,"h-4 w-4 mr-2"),"/",t]}),(0,n.jsx)("div",{children:a})]})},t)})}),(0,n.jsx)(g.zz,{})]})]})})]})}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 overflow-x-auto",children:[Y&&B.map((e,t)=>(0,n.jsxs)("div",{className:"relative flex-shrink-0 pb-3 pt-2 group",children:[(0,n.jsx)("img",{src:e,alt:"img-".concat(t),className:"w-auto h-16 object-cover rounded-xl"}),(0,n.jsx)(j.z,{variant:"ghost",size:"icon",className:"absolute -top-0 -right-2 h-5 w-5 rounded-full bg-neutral-200 dark:bg-neutral-600 hover:bg-neutral-300 dark:hover:bg-neutral-500 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>{H(e=>e.filter((e,a)=>a!==t)),K(e=>e.filter((e,a)=>a!==t)),1===B.length&&$(!1)},children:(0,n.jsx)(c.X,{className:"h-3 w-3"})})]},t)),X&&Array.from(X).map((t,a)=>(0,n.jsxs)(T.Vq,{children:[(0,n.jsx)(T.hg,{asChild:!0,children:(0,n.jsxs)("div",{className:"relative flex-shrink-0 p-2 group",children:[(0,n.jsx)("div",{className:"w-auto h-16 object-cover rounded-xl ".concat(e.agentColor?(0,C.tp)(e.agentColor):"bg-orange-300 hover:bg-orange-500"," bg-opacity-15"),children:(0,n.jsxs)("div",{className:"flex p-2 flex-col justify-start items-start h-full",children:[(0,n.jsx)("span",{className:"text-sm font-bold text-neutral-500 dark:text-neutral-400 text-ellipsis truncate max-w-[200px] break-words",children:t.name}),(0,n.jsxs)("span",{className:"flex items-center gap-1",children:[(0,z.Le)(t.file_type),(0,n.jsx)("span",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:(0,R.xq)(t.size)})]})]})}),(0,n.jsx)(j.z,{variant:"ghost",size:"icon",className:"absolute -top-0 -right-2 h-5 w-5 rounded-full bg-neutral-200 dark:bg-neutral-600 hover:bg-neutral-300 dark:hover:bg-neutral-500 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>{V(a=>{let n=t.name;if(!a)return null;let r=Array.from(a).filter(e=>e.name!==n),s=new DataTransfer;r.forEach(e=>s.items.add(e));let l=X.filter(e=>e.name!==n);return e.setUploadedFiles(l),q(l),s.files})},children:(0,n.jsx)(c.X,{className:"h-3 w-3"})})]},a)}),(0,n.jsxs)(T.cZ,{children:[(0,n.jsx)(T.fK,{children:(0,n.jsx)(T.$N,{children:t.name})}),(0,n.jsx)(T.Be,{children:(0,n.jsx)(S.x,{className:"h-72 w-full rounded-md",children:t.content})})]})]},a))]}),(0,n.jsxs)("div",{className:"".concat(s().actualInputArea," justify-between dark:bg-neutral-700 relative ").concat(er&&"animate-pulse"),onDragOver:function(e){e.preventDefault(),es(!0)},onDragLeave:function(e){e.preventDefault(),es(!1)},onDrop:function(e){e.preventDefault(),es(!1),e.dataTransfer.files&&eu(e.dataTransfer.files)},children:[(0,n.jsx)("input",{type:"file",accept:".pdf,.doc,.docx,.txt,.md,.org,.jpg,.jpeg,.png,.webp",multiple:!0,ref:o,onChange:function(e){e.target.files&&eu(e.target.files)},style:{display:"none"}}),(0,n.jsx)("div",{className:"flex items-center",children:(0,n.jsx)(j.z,{variant:"ghost",className:"!bg-none p-0 m-2 h-auto text-3xl rounded-full text-gray-300 hover:text-gray-500",disabled:e.sendDisabled,onClick:function(){o.current&&o.current.click()},children:(0,n.jsx)(d.p,{className:"w-8 h-8"})})}),(0,n.jsx)("div",{className:"flex-grow flex flex-col w-full gap-1.5 relative",children:(0,n.jsx)(y.g,{ref:t,className:"border-none focus:border-none\n focus:outline-none focus-visible:ring-transparent\n w-full h-16 min-h-16 max-h-[128px] md:py-4 rounded-lg resize-none dark:bg-neutral-700\n ".concat(e.isMobileWidth?"text-md":"text-lg"),placeholder:"Type / to see a list of commands",id:"message",autoFocus:!0,value:a,onKeyDown:t=>{"Enter"!==t.key||t.shiftKey||e.isMobileWidth||($(!1),H([]),t.preventDefault(),ed())},onChange:e=>r(e.target.value),disabled:e.sendDisabled||G})}),(0,n.jsxs)("div",{className:"flex items-end pb-2",children:[G?(0,n.jsx)(N.pn,{children:(0,n.jsxs)(N.u,{children:[(0,n.jsx)(N.aJ,{asChild:!0,children:(0,n.jsx)(j.z,{variant:"default",className:"".concat(!G&&"hidden"," ").concat(e.agentColor?(0,C.tp)(e.agentColor):"bg-orange-300 hover:bg-orange-500"," rounded-full p-1 m-2 h-auto text-3xl transition transform md:hover:-translate-y-1"),onClick:()=>{Q(!G)},disabled:e.sendDisabled,children:(0,n.jsx)(u.d,{weight:"fill",className:"w-6 h-6"})})}),(0,n.jsx)(N._v,{children:"Click to stop recording and transcribe your voice."})]})}):ee?(0,n.jsx)(E.l,{}):(0,n.jsx)(N.pn,{children:(0,n.jsxs)(N.u,{children:[(0,n.jsx)(N.aJ,{asChild:!0,children:(0,n.jsx)(j.z,{variant:"default",className:"".concat(!a||G||"hidden"," ").concat(e.agentColor?(0,C.tp)(e.agentColor):"bg-orange-300 hover:bg-orange-500"," rounded-full p-1 m-2 h-auto text-3xl transition transform md:hover:-translate-y-1"),onClick:()=>{r("Listening..."),Q(!G)},disabled:e.sendDisabled,children:(0,n.jsx)(h.P,{weight:"fill",className:"w-6 h-6"})})}),(0,n.jsx)(N._v,{children:"Click to transcribe your message with voice."})]})}),(0,n.jsx)(j.z,{className:"".concat((!a||G)&&"hidden"," ").concat(e.agentColor?(0,C.tp)(e.agentColor):"bg-orange-300 hover:bg-orange-500"," rounded-full p-1 m-2 h-auto text-3xl transition transform md:hover:-translate-y-1"),onClick:ed,disabled:e.sendDisabled,children:(0,n.jsx)(f.a,{className:"w-6 h-6",weight:"bold"})})]})]}),(0,n.jsx)(N.pn,{children:(0,n.jsxs)(N.u,{children:[(0,n.jsx)(N.aJ,{asChild:!0,children:(0,n.jsxs)(j.z,{variant:"ghost",className:"float-right justify-center gap-1 flex items-center p-1.5 mr-2 h-fit",onClick:()=>{var e;ec(!ei),null==t||null===(e=t.current)||void 0===e||e.focus()},children:[(0,n.jsx)("span",{className:"text-muted-foreground text-sm",children:"Research Mode"}),ei?(0,n.jsx)(m.W,{weight:"fill",className:"w-6 h-6 inline-block ".concat(e.agentColor?(0,C.oz)(e.agentColor):(0,C.oz)("orange")," rounded-full")}):(0,n.jsx)(x.$,{weight:"fill",className:"w-6 h-6 inline-block ".concat(e.agentColor?(0,C.oz)(e.agentColor):(0,C.oz)("orange")," rounded-full")})]})}),(0,n.jsx)(N._v,{className:"text-xs",children:"(Experimental) Research Mode allows you to get more deeply researched, detailed responses. Response times may be longer."})]})})]})]})});O.displayName="ChatInputArea"},66820:function(e,t,a){"use strict";a.d(t,{Z:function(){return l}});var n=a(57437),r=a(6780),s=a(87138);function l(e){return(0,n.jsx)(r.aR,{open:!0,onOpenChange:e.onOpenChange,children:(0,n.jsxs)(r._T,{children:[(0,n.jsx)(r.fY,{children:(0,n.jsx)(r.f$,{children:"Sign in to Khoj to continue"})}),(0,n.jsxs)(r.yT,{children:[e.loginRedirectMessage,". By logging in, you agree to our"," ",(0,n.jsx)(s.default,{href:"https://khoj.dev/terms-of-service",children:"Terms of Service."})]}),(0,n.jsxs)(r.xo,{children:[(0,n.jsx)(r.le,{children:"Dismiss"}),(0,n.jsx)(r.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>{window.location.href="/login?next=".concat(encodeURIComponent(window.location.pathname))},children:(0,n.jsxs)(s.default,{href:"/login?next=".concat(encodeURIComponent(window.location.pathname)),children:[" ","Login"]})})]})]})})}},70571:function(e,t,a){"use strict";a.d(t,{E:function(){return o}});var n=a(57437),r=a(2265),s=a(52431),l=a(37440);let o=r.forwardRef((e,t)=>{let{className:a,value:r,indicatorColor:o,...i}=e;return(0,n.jsx)(s.fC,{ref:t,className:(0,l.cn)("relative h-4 w-full overflow-hidden rounded-full bg-secondary",a),...i,children:(0,n.jsx)(s.z$,{className:"h-full w-full flex-1 bg-primary transition-all ".concat(o),style:{transform:"translateX(-".concat(100-(r||0),"%)")}})})});o.displayName=s.fC.displayName},93146:function(e,t,a){"use strict";a.d(t,{g:function(){return l}});var n=a(57437),r=a(2265),s=a(37440);let l=r.forwardRef((e,t)=>{let{className:a,...r}=e;return(0,n.jsx)("textarea",{className:(0,s.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",a),ref:t,...r})});l.displayName="Textarea"},19666:function(e,t,a){"use strict";a.d(t,{_v:function(){return d},aJ:function(){return c},pn:function(){return o},u:function(){return i}});var n=a(57437),r=a(2265),s=a(27071),l=a(37440);let o=s.zt,i=s.fC,c=s.xz,d=r.forwardRef((e,t)=>{let{className:a,sideOffset:r=4,...o}=e;return(0,n.jsx)(s.VY,{ref:t,sideOffset:r,className:(0,l.cn)("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a),...o})});d.displayName=s.VY.displayName},37649:function(e){e.exports={actualInputArea:"chatInputArea_actualInputArea__Ha6cN"}}}]);
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8423],{38423:function(e,t,a){"use strict";a.d(t,{a:function(){return O}});var n=a(57437),r=a(37649),s=a.n(r),l=a(2265),o=a(11838),i=a.n(o);a(7395);var c=a(86819),d=a(35719),u=a(77689),h=a(86829),f=a(33009),m=a(51091),x=a(82119),g=a(42491),p=a(6780),j=a(50495),b=a(70571),v=a(19573),w=a(61485),y=a(93146),N=a(19666),k=a(58575),C=a(66820),E=a(58485),D=a(89417),R=a(9557),T=a(69591),S=a(90837),z=a(94880);let O=(0,l.forwardRef)((e,t)=>{let[a,r]=(0,l.useState)(""),o=(0,l.useRef)(null),[O,M]=(0,l.useState)(null),[_,A]=(0,l.useState)(null),[I,L]=(0,l.useState)(!1),[P,U]=(0,l.useState)(null),[F,W]=(0,l.useState)(!1),[Y,$]=(0,l.useState)(!1),[B,H]=(0,l.useState)([]),[J,K]=(0,l.useState)([]),[Z,V]=(0,l.useState)(null),[X,q]=(0,l.useState)([]),[G,Q]=(0,l.useState)(!1),[ee,et]=(0,l.useState)(null),[ea,en]=(0,l.useState)(0),[er,es]=(0,l.useState)(!1),[el,eo]=(0,l.useState)(!1),[ei,ec]=(0,l.useState)(e.isResearchModeEnabled||!1);function ed(){if(Y&&($(!1),H([]),J.forEach(t=>e.sendImage(t))),!a.trim())return;if(!e.isLoggedIn){U("Hey there, you need to be signed in to send messages to Khoj AI"),W(!0);return}let t=a.trim();ei&&!t.startsWith("/research")&&(t="/research ".concat(t)),e.sendMessage(t),V(null),q([]),r("")}function eu(a){var n,r;if(!e.isLoggedIn){U("Please login to chat with your files"),W(!0);return}let s=["jpg","jpeg","png","webp"],l=[];for(let e=0;e<a.length;e++){let t=a[e],n=t.name.split(".").pop();s.includes(n||"")&&l.push(i().sanitize(URL.createObjectURL(t)))}l.length>0&&($(!0),H(e=>[...e,...l]),null==t||null===(r=t.current)||void 0===r||r.focus());let o=Array.from(a).filter(e=>!s.includes(e.name.split(".").pop()||"")),c=o?Array.from(o).concat(Array.from(Z||[])):Array.from(Z||[]);if(c.length>0){for(let e=0;e<c.length;e++)if(c[e].size>10485760){M("File ".concat(c[e].name," is too large. Please upload files smaller than 10 MB."));return}let t=new DataTransfer;c.forEach(e=>t.items.add(e)),eh(t.files).then(a=>{e.setUploadedFiles(a),V(t.files),q(a)})}null==t||null===(n=t.current)||void 0===n||n.focus()}async function eh(e){let t=await (0,R.M1)(e);L(!0);try{let e=await fetch("/api/content/convert",{method:"POST",body:t});if(L(!1),!e.ok)throw Error("HTTP error! status: ".concat(e.status));return await e.json()}catch(e){return A("Error converting files. "+e+". Please try again, or contact team@khoj.dev if the issue persists."),console.error("Error converting files:",e),[]}}async function ef(){try{let e=await navigator.mediaDevices.getUserMedia({audio:!0}),t=new MediaRecorder(e,{mimeType:"audio/webm"}),a=[];t.ondataavailable=async e=>{a.push(e.data);let t=new Blob(a,{type:"audio/webm"}),n=new FormData;n.append("file",t);try{let e=await fetch("/api/transcribe",{method:"POST",body:n});if(!e.ok)throw Error("Network response was not ok");let t=await e.json();r(t.text.trim())}catch(e){console.error("Error sending audio to server:",e)}},t.start(1500),t.onstop=async()=>{let e=new Blob(a,{type:"audio/webm"}),n=new FormData;n.append("file",e);try{let e=await fetch("/api/transcribe",{method:"POST",body:n});if(!e.ok)throw Error("Network response was not ok");let a=await e.json();t.stream.getTracks().forEach(e=>e.stop()),et(null),r(a.text.trim())}catch(e){console.error("Error sending audio to server:",e)}},et(t)}catch(e){console.error("Error getting microphone",e)}}return(0,l.useEffect)(()=>{if(I||en(0),I){let e=setInterval(()=>{en(e=>{let t=e+(Math.floor(5*Math.random())+1);return t<100?t:100})},800);return()=>clearInterval(e)}},[I]),(0,l.useEffect)(()=>{async function e(){B.length>0&&K(await Promise.all(B.map(async e=>{let t=await fetch(e),a=await t.blob();return new Promise(e=>{let t=new FileReader;t.onload=()=>e(t.result),t.readAsDataURL(a)})}))),L(!1)}L(!0),e()},[B]),(0,l.useEffect)(()=>{e.isResearchModeEnabled&&ec(e.isResearchModeEnabled)},[e.isResearchModeEnabled]),(0,l.useEffect)(()=>{!G&&ee&&ee.stop(),G&&!ee&&ef()},[G,ee]),(0,l.useEffect)(()=>{(null==t?void 0:t.current)&&(t.current.style.height="auto",t.current.style.height=Math.max(t.current.scrollHeight-24,64)+"px",a.startsWith("/")&&1===a.split(" ").length?eo(!0):eo(!1))},[a]),(0,n.jsxs)(n.Fragment,{children:[F&&P&&(0,n.jsx)(C.Z,{onOpenChange:W,loginRedirectMessage:P}),I&&(0,n.jsx)(p.aR,{open:I,children:(0,n.jsxs)(p._T,{children:[(0,n.jsx)(p.fY,{children:(0,n.jsx)(p.f$,{children:"Uploading data. Please wait."})}),(0,n.jsx)(p.yT,{children:(0,n.jsx)(b.E,{indicatorColor:"bg-slate-500",className:"w-full h-2 rounded-full",value:ea})}),(0,n.jsx)(p.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>L(!1),children:"Dismiss"})]})}),O&&(0,n.jsx)(p.aR,{open:null!==O,children:(0,n.jsxs)(p._T,{children:[(0,n.jsx)(p.fY,{children:(0,n.jsx)(p.f$,{children:"Data Upload Warning"})}),(0,n.jsx)(p.yT,{children:O}),(0,n.jsx)(p.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>M(null),children:"Close"})]})}),_&&(0,n.jsx)(p.aR,{open:null!==_,children:(0,n.jsxs)(p._T,{children:[(0,n.jsxs)(p.fY,{children:[(0,n.jsx)(p.f$,{children:"Oh no!"}),(0,n.jsx)(p.yT,{children:"Something went wrong while uploading your data"})]}),(0,n.jsx)(p.yT,{children:_}),(0,n.jsx)(p.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>A(null),children:"Close"})]})}),el&&(0,n.jsx)("div",{className:"flex justify-center text-center",children:(0,n.jsxs)(v.J2,{open:el,onOpenChange:eo,children:[(0,n.jsx)(w.xo,{className:"flex justify-center text-center"}),(0,n.jsx)(v.yk,{onOpenAutoFocus:e=>e.preventDefault(),className:"".concat(e.isMobileWidth?"w-[100vw]":"w-full"," rounded-md"),side:"bottom",align:"center",sideOffset:e.conversationId?0:80,alignOffset:0,children:(0,n.jsxs)(g.mY,{className:"max-w-full",children:[(0,n.jsx)(g.sZ,{placeholder:"Type a command or search...",value:a,className:"hidden"}),(0,n.jsxs)(g.e8,{children:[(0,n.jsx)(g.rb,{children:"No matching commands."}),(0,n.jsx)(g.fu,{heading:"Agent Tools",children:e.chatOptionsData&&Object.entries(e.chatOptionsData).map(e=>{let[t,a]=e;return(0,n.jsx)(g.di,{className:"text-md",onSelect:()=>{r("/".concat(t," "))},children:(0,n.jsxs)("div",{className:"grid grid-cols-1 gap-1",children:[(0,n.jsxs)("div",{className:"font-bold flex items-center",children:[(0,D.vH)(t,"h-4 w-4 mr-2"),"/",t]}),(0,n.jsx)("div",{children:a})]})},t)})}),(0,n.jsx)(g.zz,{})]})]})})]})}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 overflow-x-auto",children:[Y&&B.map((e,t)=>(0,n.jsxs)("div",{className:"relative flex-shrink-0 pb-3 pt-2 group",children:[(0,n.jsx)("img",{src:e,alt:"img-".concat(t),className:"w-auto h-16 object-cover rounded-xl"}),(0,n.jsx)(j.z,{variant:"ghost",size:"icon",className:"absolute -top-0 -right-2 h-5 w-5 rounded-full bg-neutral-200 dark:bg-neutral-600 hover:bg-neutral-300 dark:hover:bg-neutral-500 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>{H(e=>e.filter((e,a)=>a!==t)),K(e=>e.filter((e,a)=>a!==t)),1===B.length&&$(!1)},children:(0,n.jsx)(c.X,{className:"h-3 w-3"})})]},t)),X&&Array.from(X).map((t,a)=>(0,n.jsxs)(S.Vq,{children:[(0,n.jsx)(S.hg,{asChild:!0,children:(0,n.jsxs)("div",{className:"relative flex-shrink-0 p-2 group",children:[(0,n.jsx)("div",{className:"w-auto h-16 object-cover rounded-xl ".concat(e.agentColor?(0,k.tp)(e.agentColor):"bg-orange-300 hover:bg-orange-500"," bg-opacity-15"),children:(0,n.jsxs)("div",{className:"flex p-2 flex-col justify-start items-start h-full",children:[(0,n.jsx)("span",{className:"text-sm font-bold text-neutral-500 dark:text-neutral-400 text-ellipsis truncate max-w-[200px] break-words",children:t.name}),(0,n.jsxs)("span",{className:"flex items-center gap-1",children:[(0,D.Le)(t.file_type),(0,n.jsx)("span",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:(0,T.xq)(t.size)})]})]})}),(0,n.jsx)(j.z,{variant:"ghost",size:"icon",className:"absolute -top-0 -right-2 h-5 w-5 rounded-full bg-neutral-200 dark:bg-neutral-600 hover:bg-neutral-300 dark:hover:bg-neutral-500 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>{V(a=>{let n=t.name;if(!a)return null;let r=Array.from(a).filter(e=>e.name!==n),s=new DataTransfer;r.forEach(e=>s.items.add(e));let l=X.filter(e=>e.name!==n);return e.setUploadedFiles(l),q(l),s.files})},children:(0,n.jsx)(c.X,{className:"h-3 w-3"})})]},a)}),(0,n.jsxs)(S.cZ,{children:[(0,n.jsx)(S.fK,{children:(0,n.jsx)(S.$N,{children:t.name})}),(0,n.jsx)(S.Be,{children:(0,n.jsx)(z.x,{className:"h-72 w-full rounded-md",children:t.content})})]})]},a))]}),(0,n.jsxs)("div",{className:"".concat(s().actualInputArea," justify-between dark:bg-neutral-700 relative ").concat(er&&"animate-pulse"),onDragOver:function(e){e.preventDefault(),es(!0)},onDragLeave:function(e){e.preventDefault(),es(!1)},onDrop:function(e){e.preventDefault(),es(!1),e.dataTransfer.files&&eu(e.dataTransfer.files)},children:[(0,n.jsx)("input",{type:"file",accept:".pdf,.doc,.docx,.txt,.md,.org,.jpg,.jpeg,.png,.webp",multiple:!0,ref:o,onChange:function(e){e.target.files&&eu(e.target.files)},style:{display:"none"}}),(0,n.jsx)("div",{className:"flex items-center",children:(0,n.jsx)(j.z,{variant:"ghost",className:"!bg-none p-0 m-2 h-auto text-3xl rounded-full text-gray-300 hover:text-gray-500",disabled:e.sendDisabled,onClick:function(){o.current&&o.current.click()},children:(0,n.jsx)(d.p,{className:"w-8 h-8"})})}),(0,n.jsx)("div",{className:"flex-grow flex flex-col w-full gap-1.5 relative",children:(0,n.jsx)(y.g,{ref:t,className:"border-none focus:border-none\n focus:outline-none focus-visible:ring-transparent\n w-full h-16 min-h-16 max-h-[128px] md:py-4 rounded-lg resize-none dark:bg-neutral-700\n ".concat(e.isMobileWidth?"text-md":"text-lg"),placeholder:"Type / to see a list of commands",id:"message",autoFocus:!0,value:a,onKeyDown:t=>{"Enter"!==t.key||t.shiftKey||e.isMobileWidth||($(!1),H([]),t.preventDefault(),ed())},onChange:e=>r(e.target.value),disabled:e.sendDisabled||G})}),(0,n.jsxs)("div",{className:"flex items-end pb-2",children:[G?(0,n.jsx)(N.pn,{children:(0,n.jsxs)(N.u,{children:[(0,n.jsx)(N.aJ,{asChild:!0,children:(0,n.jsx)(j.z,{variant:"default",className:"".concat(!G&&"hidden"," ").concat(e.agentColor?(0,k.tp)(e.agentColor):"bg-orange-300 hover:bg-orange-500"," rounded-full p-1 m-2 h-auto text-3xl transition transform md:hover:-translate-y-1"),onClick:()=>{Q(!G)},disabled:e.sendDisabled,children:(0,n.jsx)(u.d,{weight:"fill",className:"w-6 h-6"})})}),(0,n.jsx)(N._v,{children:"Click to stop recording and transcribe your voice."})]})}):ee?(0,n.jsx)(E.l,{}):(0,n.jsx)(N.pn,{children:(0,n.jsxs)(N.u,{children:[(0,n.jsx)(N.aJ,{asChild:!0,children:(0,n.jsx)(j.z,{variant:"default",className:"".concat(!a||G||"hidden"," ").concat(e.agentColor?(0,k.tp)(e.agentColor):"bg-orange-300 hover:bg-orange-500"," rounded-full p-1 m-2 h-auto text-3xl transition transform md:hover:-translate-y-1"),onClick:()=>{r("Listening..."),Q(!G)},disabled:e.sendDisabled,children:(0,n.jsx)(h.P,{weight:"fill",className:"w-6 h-6"})})}),(0,n.jsx)(N._v,{children:"Click to transcribe your message with voice."})]})}),(0,n.jsx)(j.z,{className:"".concat((!a||G)&&"hidden"," ").concat(e.agentColor?(0,k.tp)(e.agentColor):"bg-orange-300 hover:bg-orange-500"," rounded-full p-1 m-2 h-auto text-3xl transition transform md:hover:-translate-y-1"),onClick:ed,disabled:e.sendDisabled,children:(0,n.jsx)(f.a,{className:"w-6 h-6",weight:"bold"})})]})]}),(0,n.jsx)(N.pn,{children:(0,n.jsxs)(N.u,{children:[(0,n.jsx)(N.aJ,{asChild:!0,children:(0,n.jsxs)(j.z,{variant:"ghost",className:"float-right justify-center gap-1 flex items-center p-1.5 mr-2 h-fit",onClick:()=>{var e;ec(!ei),null==t||null===(e=t.current)||void 0===e||e.focus()},children:[(0,n.jsx)("span",{className:"text-muted-foreground text-sm",children:"Research Mode"}),ei?(0,n.jsx)(m.W,{weight:"fill",className:"w-6 h-6 inline-block ".concat(e.agentColor?(0,k.oz)(e.agentColor):(0,k.oz)("orange")," rounded-full")}):(0,n.jsx)(x.$,{className:"w-6 h-6 inline-block text-gray-500 rounded-full"})]})}),(0,n.jsx)(N._v,{className:"text-xs",children:"(Experimental) Research Mode allows you to get more deeply researched, detailed responses. Response times may be longer."})]})})]})]})});O.displayName="ChatInputArea"},66820:function(e,t,a){"use strict";a.d(t,{Z:function(){return l}});var n=a(57437),r=a(6780),s=a(87138);function l(e){return(0,n.jsx)(r.aR,{open:!0,onOpenChange:e.onOpenChange,children:(0,n.jsxs)(r._T,{children:[(0,n.jsx)(r.fY,{children:(0,n.jsx)(r.f$,{children:"Sign in to Khoj to continue"})}),(0,n.jsxs)(r.yT,{children:[e.loginRedirectMessage,". By logging in, you agree to our"," ",(0,n.jsx)(s.default,{href:"https://khoj.dev/terms-of-service",children:"Terms of Service."})]}),(0,n.jsxs)(r.xo,{children:[(0,n.jsx)(r.le,{children:"Dismiss"}),(0,n.jsx)(r.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>{window.location.href="/login?next=".concat(encodeURIComponent(window.location.pathname))},children:(0,n.jsxs)(s.default,{href:"/login?next=".concat(encodeURIComponent(window.location.pathname)),children:[" ","Login"]})})]})]})})}},70571:function(e,t,a){"use strict";a.d(t,{E:function(){return o}});var n=a(57437),r=a(2265),s=a(52431),l=a(37440);let o=r.forwardRef((e,t)=>{let{className:a,value:r,indicatorColor:o,...i}=e;return(0,n.jsx)(s.fC,{ref:t,className:(0,l.cn)("relative h-4 w-full overflow-hidden rounded-full bg-secondary",a),...i,children:(0,n.jsx)(s.z$,{className:"h-full w-full flex-1 bg-primary transition-all ".concat(o),style:{transform:"translateX(-".concat(100-(r||0),"%)")}})})});o.displayName=s.fC.displayName},93146:function(e,t,a){"use strict";a.d(t,{g:function(){return l}});var n=a(57437),r=a(2265),s=a(37440);let l=r.forwardRef((e,t)=>{let{className:a,...r}=e;return(0,n.jsx)("textarea",{className:(0,s.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",a),ref:t,...r})});l.displayName="Textarea"},19666:function(e,t,a){"use strict";a.d(t,{_v:function(){return d},aJ:function(){return c},pn:function(){return o},u:function(){return i}});var n=a(57437),r=a(2265),s=a(27071),l=a(37440);let o=s.zt,i=s.fC,c=s.xz,d=r.forwardRef((e,t)=>{let{className:a,sideOffset:r=4,...o}=e;return(0,n.jsx)(s.VY,{ref:t,sideOffset:r,className:(0,l.cn)("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a),...o})});d.displayName=s.VY.displayName},37649:function(e){e.exports={actualInputArea:"chatInputArea_actualInputArea__Ha6cN"}}}]);
|
@@ -1 +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(52431),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,9001,3062,3124,3803,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(52431),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,9001,3062,3124,3803,5512,4602,1603,9417,1970,2971,7023,1744],function(){return e(e.s=1813)}),_N_E=e.O()}]);
|