khoj 1.25.1.dev19__py3-none-any.whl → 1.25.1.dev33__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. khoj/database/adapters/__init__.py +72 -2
  2. khoj/database/admin.py +16 -0
  3. khoj/database/migrations/0069_webscraper_serverchatsettings_web_scraper.py +89 -0
  4. khoj/database/models/__init__.py +77 -2
  5. khoj/interface/compiled/404/index.html +1 -1
  6. khoj/interface/compiled/_next/static/chunks/app/agents/{page-fa282831808ee536.js → page-b406d166301c4c7d.js} +1 -1
  7. khoj/interface/compiled/_next/static/chunks/app/automations/{page-5480731341f34450.js → page-2edc21f30819def4.js} +1 -1
  8. khoj/interface/compiled/_next/static/chunks/app/chat/{page-702057ccbcf27881.js → page-4309c98e6dc497dd.js} +1 -1
  9. khoj/interface/compiled/_next/static/chunks/app/factchecker/{page-e7b34316ec6f44de.js → page-f2c83e3a87a28657.js} +1 -1
  10. khoj/interface/compiled/_next/static/chunks/app/{page-10a5aad6e04f3cf8.js → page-ab9beb5a26e396f7.js} +1 -1
  11. khoj/interface/compiled/_next/static/chunks/app/search/{page-d56541c746fded7d.js → page-b807caebd7f278c7.js} +1 -1
  12. khoj/interface/compiled/_next/static/chunks/app/settings/{page-e044a999468a7c5d.js → page-2932356ad11c2f7b.js} +1 -1
  13. khoj/interface/compiled/_next/static/chunks/app/share/chat/{page-fbbd66a4d4633438.js → page-a736a0826570af2b.js} +1 -1
  14. khoj/interface/compiled/_next/static/chunks/{webpack-07fad5db87344b82.js → webpack-61a553b6ff44f97c.js} +1 -1
  15. khoj/interface/compiled/_next/static/css/4cae6c0e5c72fb2d.css +1 -0
  16. khoj/interface/compiled/_next/static/css/b1094827d745306b.css +1 -0
  17. khoj/interface/compiled/agents/index.html +1 -1
  18. khoj/interface/compiled/agents/index.txt +2 -2
  19. khoj/interface/compiled/automations/index.html +1 -1
  20. khoj/interface/compiled/automations/index.txt +2 -2
  21. khoj/interface/compiled/chat/index.html +1 -1
  22. khoj/interface/compiled/chat/index.txt +2 -2
  23. khoj/interface/compiled/factchecker/index.html +1 -1
  24. khoj/interface/compiled/factchecker/index.txt +2 -2
  25. khoj/interface/compiled/index.html +1 -1
  26. khoj/interface/compiled/index.txt +2 -2
  27. khoj/interface/compiled/search/index.html +1 -1
  28. khoj/interface/compiled/search/index.txt +2 -2
  29. khoj/interface/compiled/settings/index.html +1 -1
  30. khoj/interface/compiled/settings/index.txt +2 -2
  31. khoj/interface/compiled/share/chat/index.html +1 -1
  32. khoj/interface/compiled/share/chat/index.txt +2 -2
  33. khoj/processor/embeddings.py +1 -0
  34. khoj/processor/tools/online_search.py +135 -40
  35. khoj/routers/api_chat.py +38 -27
  36. khoj/routers/helpers.py +12 -11
  37. khoj/search_type/text_search.py +7 -2
  38. khoj/utils/helpers.py +46 -4
  39. {khoj-1.25.1.dev19.dist-info → khoj-1.25.1.dev33.dist-info}/METADATA +1 -1
  40. {khoj-1.25.1.dev19.dist-info → khoj-1.25.1.dev33.dist-info}/RECORD +48 -47
  41. khoj/interface/compiled/_next/static/css/2de69f0be774c768.css +0 -1
  42. khoj/interface/compiled/_next/static/css/592ca99f5122e75a.css +0 -1
  43. /khoj/interface/compiled/_next/static/{90HwIhHWUtPEP6Aqr1IZw → NaOqImuryddEYz7a7MQ6j}/_buildManifest.js +0 -0
  44. /khoj/interface/compiled/_next/static/{90HwIhHWUtPEP6Aqr1IZw → NaOqImuryddEYz7a7MQ6j}/_ssgManifest.js +0 -0
  45. /khoj/interface/compiled/_next/static/chunks/{9178-899fe9a6b754ecfe.js → 9178-f208a3e6404714a9.js} +0 -0
  46. /khoj/interface/compiled/_next/static/chunks/{9417-29502e39c3e7d60c.js → 9417-1d158bf46d3a0dc9.js} +0 -0
  47. /khoj/interface/compiled/_next/static/chunks/{9479-7eed36fc954ef804.js → 9479-563e4d61f91d5a7c.js} +0 -0
  48. {khoj-1.25.1.dev19.dist-info → khoj-1.25.1.dev33.dist-info}/WHEEL +0 -0
  49. {khoj-1.25.1.dev19.dist-info → khoj-1.25.1.dev33.dist-info}/entry_points.txt +0 -0
  50. {khoj-1.25.1.dev19.dist-info → khoj-1.25.1.dev33.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/0e790e04fd40ad16-s.p.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="stylesheet" href="/_next/static/css/467a524c75e7d7c0.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/b9a6bf04305d98d7.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/c808691c459e3887.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/2de69f0be774c768.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/2272c73fc7a3b571.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-07fad5db87344b82.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><script src="/_next/static/chunks/d3ac728e-a9e3522eef9b6b28.js" async=""></script><script src="/_next/static/chunks/9001-3b27af6d5f21df44.js" async=""></script><script src="/_next/static/chunks/3062-71ed4b46ac2bb87c.js" async=""></script><script src="/_next/static/chunks/4086-2c74808ba38a5a0f.js" async=""></script><script src="/_next/static/chunks/121-7024f479c297aef0.js" async=""></script><script src="/_next/static/chunks/3110-ef2cacd1b8d79ad8.js" async=""></script><script src="/_next/static/chunks/4051-2cf66369d6ca0f1d.js" async=""></script><script src="/_next/static/chunks/1603-fa3ee48860b9dc5c.js" async=""></script><script src="/_next/static/chunks/9417-29502e39c3e7d60c.js" async=""></script><script src="/_next/static/chunks/9178-899fe9a6b754ecfe.js" async=""></script><script src="/_next/static/chunks/9479-7eed36fc954ef804.js" async=""></script><script src="/_next/static/chunks/2697-a38d01981ad3bdf8.js" async=""></script><script src="/_next/static/chunks/app/share/chat/page-fbbd66a4d4633438.js" async=""></script><meta http-equiv="Content-Security-Policy" content="default-src &#x27;self&#x27; https://assets.khoj.dev; media-src * blob:; script-src &#x27;self&#x27; https://assets.khoj.dev &#x27;unsafe-inline&#x27; &#x27;unsafe-eval&#x27;; connect-src &#x27;self&#x27; blob: https://ipapi.co/json ws://localhost:42110; style-src &#x27;self&#x27; https://assets.khoj.dev &#x27;unsafe-inline&#x27; https://fonts.googleapis.com; img-src &#x27;self&#x27; data: blob: https://*.khoj.dev https://*.googleusercontent.com https://*.google.com/ https://*.gstatic.com; font-src &#x27;self&#x27; https://assets.khoj.dev https://fonts.gstatic.com; child-src &#x27;none&#x27;; object-src &#x27;none&#x27;;"/><meta http-equiv="Content-Security-Policy" content="default-src &#x27;self&#x27; https://assets.khoj.dev; script-src &#x27;self&#x27; https://assets.khoj.dev &#x27;unsafe-inline&#x27; &#x27;unsafe-eval&#x27;; connect-src &#x27;self&#x27; blob: https://ipapi.co/json ws://localhost:42110; style-src &#x27;self&#x27; https://assets.khoj.dev &#x27;unsafe-inline&#x27; https://fonts.googleapis.com; img-src &#x27;self&#x27; data: blob: https://*.khoj.dev https://*.googleusercontent.com https://*.google.com/ https://*.gstatic.com; font-src &#x27;self&#x27; https://assets.khoj.dev https://fonts.gstatic.com; child-src &#x27;none&#x27;; object-src &#x27;none&#x27;;"/><title>Khoj AI - Chat</title><meta name="description" content="Use this page to view a chat with Khoj AI."/><link rel="manifest" href="/static/khoj.webmanifest" crossorigin="use-credentials"/><meta property="og:title" content="Khoj AI - Home"/><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 - Home"/><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_e594dd"><html lang="en"><body class="__className_e594dd"><div class="bg-background opacity-50 flex items-center justify-center h-screen"><div>Loading<!-- --> <span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 256 256" class="inline animate-spin h-5 w-5"><path d="M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60.15,61.59,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20.15-66.41-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z"></path></svg></span></div></div><script src="/_next/static/chunks/webpack-07fad5db87344b82.js" async=""></script></body></html><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/0e790e04fd40ad16-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n2:HL[\"/_next/static/css/467a524c75e7d7c0.css\",\"style\"]\n3:HL[\"/_next/static/css/b9a6bf04305d98d7.css\",\"style\"]\n4:HL[\"/_next/static/css/c808691c459e3887.css\",\"style\"]\n5:HL[\"/_next/static/css/2de69f0be774c768.css\",\"style\"]\n6:HL[\"/_next/static/css/2272c73fc7a3b571.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"7:I[95751,[],\"\"]\n9:I[66513,[],\"ClientPageRoot\"]\na:I[5506,[\"3954\",\"static/chunks/d3ac728e-a9e3522eef9b6b28.js\",\"9001\",\"static/chunks/9001-3b27af6d5f21df44.js\",\"3062\",\"static/chunks/3062-71ed4b46ac2bb87c.js\",\"4086\",\"static/chunks/4086-2c74808ba38a5a0f.js\",\"121\",\"static/chunks/121-7024f479c297aef0.js\",\"3110\",\"static/chunks/3110-ef2cacd1b8d79ad8.js\",\"4051\",\"static/chunks/4051-2cf66369d6ca0f1d.js\",\"1603\",\"static/chunks/1603-fa3ee48860b9dc5c.js\",\"9417\",\"static/chunks/9417-29502e39c3e7d60c.js\",\"9178\",\"static/chunks/9178-899fe9a6b754ecfe.js\",\"9479\",\"static/chunks/9479-7eed36fc954ef804.js\",\"2697\",\"static/chunks/2697-a38d01981ad3bdf8.js\",\"3111\",\"static/chunks/app/share/chat/page-fbbd66a4d4633438.js\"],\"default\",1]\nb:I[39275,[],\"\"]\nc:I[61343,[],\"\"]\ne:I[76130,[],\"\"]\nf:[]\n"])</script><script>self.__next_f.push([1,"0:[\"$\",\"$L7\",null,{\"buildId\":\"90HwIhHWUtPEP6Aqr1IZw\",\"assetPrefix\":\"\",\"urlParts\":[\"\",\"share\",\"chat\",\"\"],\"initialTree\":[\"\",{\"children\":[\"share\",{\"children\":[\"chat\",{\"children\":[\"__PAGE__\",{}]}]}]},\"$undefined\",\"$undefined\",true],\"initialSeedData\":[\"\",{\"children\":[\"share\",{\"children\":[\"chat\",{\"children\":[\"__PAGE__\",{},[[\"$L8\",[\"$\",\"$L9\",null,{\"props\":{\"params\":{},\"searchParams\":{}},\"Component\":\"$a\"}],[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/c808691c459e3887.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/2de69f0be774c768.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"2\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/2272c73fc7a3b571.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}]]],null],null]},[[null,[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[[\"$\",\"meta\",null,{\"httpEquiv\":\"Content-Security-Policy\",\"content\":\"default-src 'self' https://assets.khoj.dev; 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_e594dd\",\"children\":[\"$\",\"$Lb\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"share\",\"children\",\"chat\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$Lc\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\"}]}]]}]],null],null]},[null,[\"$\",\"$Lb\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"share\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$Lc\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\"}]],null]},[[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/467a524c75e7d7c0.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/b9a6bf04305d98d7.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_e594dd\",\"children\":[\"$\",\"$Lb\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$Lc\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"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.\"}]}]]}]}]],\"notFoundStyles\":[]}]}]]}]],null],null],\"couldBeIntercepted\":false,\"initialHead\":[null,\"$Ld\"],\"globalErrorComponent\":\"$e\",\"missingSlots\":\"$Wf\"}]\n"])</script><script>self.__next_f.push([1,"d:[[\"$\",\"meta\",\"0\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}],[\"$\",\"meta\",\"1\",{\"charSet\":\"utf-8\"}],[\"$\",\"title\",\"2\",{\"children\":\"Khoj AI - Chat\"}],[\"$\",\"meta\",\"3\",{\"name\":\"description\",\"content\":\"Use this page to view a chat with Khoj AI.\"}],[\"$\",\"link\",\"4\",{\"rel\":\"manifest\",\"href\":\"/static/khoj.webmanifest\",\"crossOrigin\":\"use-credentials\"}],[\"$\",\"meta\",\"5\",{\"property\":\"og:title\",\"content\":\"Khoj AI - Home\"}],[\"$\",\"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 - Home\"}],[\"$\",\"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,"8: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/0e790e04fd40ad16-s.p.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="stylesheet" href="/_next/static/css/467a524c75e7d7c0.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/b9a6bf04305d98d7.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/c808691c459e3887.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/b1094827d745306b.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/2272c73fc7a3b571.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-61a553b6ff44f97c.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><script src="/_next/static/chunks/d3ac728e-a9e3522eef9b6b28.js" async=""></script><script src="/_next/static/chunks/9001-3b27af6d5f21df44.js" async=""></script><script src="/_next/static/chunks/3062-71ed4b46ac2bb87c.js" async=""></script><script src="/_next/static/chunks/4086-2c74808ba38a5a0f.js" async=""></script><script src="/_next/static/chunks/121-7024f479c297aef0.js" async=""></script><script src="/_next/static/chunks/3110-ef2cacd1b8d79ad8.js" async=""></script><script src="/_next/static/chunks/4051-2cf66369d6ca0f1d.js" async=""></script><script src="/_next/static/chunks/1603-fa3ee48860b9dc5c.js" async=""></script><script src="/_next/static/chunks/9417-1d158bf46d3a0dc9.js" async=""></script><script src="/_next/static/chunks/9178-f208a3e6404714a9.js" async=""></script><script src="/_next/static/chunks/9479-563e4d61f91d5a7c.js" async=""></script><script src="/_next/static/chunks/2697-a38d01981ad3bdf8.js" async=""></script><script src="/_next/static/chunks/app/share/chat/page-a736a0826570af2b.js" async=""></script><meta http-equiv="Content-Security-Policy" content="default-src &#x27;self&#x27; https://assets.khoj.dev; media-src * blob:; script-src &#x27;self&#x27; https://assets.khoj.dev &#x27;unsafe-inline&#x27; &#x27;unsafe-eval&#x27;; connect-src &#x27;self&#x27; blob: https://ipapi.co/json ws://localhost:42110; style-src &#x27;self&#x27; https://assets.khoj.dev &#x27;unsafe-inline&#x27; https://fonts.googleapis.com; img-src &#x27;self&#x27; data: blob: https://*.khoj.dev https://*.googleusercontent.com https://*.google.com/ https://*.gstatic.com; font-src &#x27;self&#x27; https://assets.khoj.dev https://fonts.gstatic.com; child-src &#x27;none&#x27;; object-src &#x27;none&#x27;;"/><meta http-equiv="Content-Security-Policy" content="default-src &#x27;self&#x27; https://assets.khoj.dev; script-src &#x27;self&#x27; https://assets.khoj.dev &#x27;unsafe-inline&#x27; &#x27;unsafe-eval&#x27;; connect-src &#x27;self&#x27; blob: https://ipapi.co/json ws://localhost:42110; style-src &#x27;self&#x27; https://assets.khoj.dev &#x27;unsafe-inline&#x27; https://fonts.googleapis.com; img-src &#x27;self&#x27; data: blob: https://*.khoj.dev https://*.googleusercontent.com https://*.google.com/ https://*.gstatic.com; font-src &#x27;self&#x27; https://assets.khoj.dev https://fonts.gstatic.com; child-src &#x27;none&#x27;; object-src &#x27;none&#x27;;"/><title>Khoj AI - Chat</title><meta name="description" content="Use this page to view a chat with Khoj AI."/><link rel="manifest" href="/static/khoj.webmanifest" crossorigin="use-credentials"/><meta property="og:title" content="Khoj AI - Home"/><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 - Home"/><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_e594dd"><html lang="en"><body class="__className_e594dd"><div class="bg-background opacity-50 flex items-center justify-center h-screen"><div>Loading<!-- --> <span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 256 256" class="inline animate-spin h-5 w-5"><path d="M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60.15,61.59,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20.15-66.41-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z"></path></svg></span></div></div><script src="/_next/static/chunks/webpack-61a553b6ff44f97c.js" async=""></script></body></html><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/0e790e04fd40ad16-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n2:HL[\"/_next/static/css/467a524c75e7d7c0.css\",\"style\"]\n3:HL[\"/_next/static/css/b9a6bf04305d98d7.css\",\"style\"]\n4:HL[\"/_next/static/css/c808691c459e3887.css\",\"style\"]\n5:HL[\"/_next/static/css/b1094827d745306b.css\",\"style\"]\n6:HL[\"/_next/static/css/2272c73fc7a3b571.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"7:I[95751,[],\"\"]\n9:I[66513,[],\"ClientPageRoot\"]\na:I[5506,[\"3954\",\"static/chunks/d3ac728e-a9e3522eef9b6b28.js\",\"9001\",\"static/chunks/9001-3b27af6d5f21df44.js\",\"3062\",\"static/chunks/3062-71ed4b46ac2bb87c.js\",\"4086\",\"static/chunks/4086-2c74808ba38a5a0f.js\",\"121\",\"static/chunks/121-7024f479c297aef0.js\",\"3110\",\"static/chunks/3110-ef2cacd1b8d79ad8.js\",\"4051\",\"static/chunks/4051-2cf66369d6ca0f1d.js\",\"1603\",\"static/chunks/1603-fa3ee48860b9dc5c.js\",\"9417\",\"static/chunks/9417-1d158bf46d3a0dc9.js\",\"9178\",\"static/chunks/9178-f208a3e6404714a9.js\",\"9479\",\"static/chunks/9479-563e4d61f91d5a7c.js\",\"2697\",\"static/chunks/2697-a38d01981ad3bdf8.js\",\"3111\",\"static/chunks/app/share/chat/page-a736a0826570af2b.js\"],\"default\",1]\nb:I[39275,[],\"\"]\nc:I[61343,[],\"\"]\ne:I[76130,[],\"\"]\nf:[]\n"])</script><script>self.__next_f.push([1,"0:[\"$\",\"$L7\",null,{\"buildId\":\"NaOqImuryddEYz7a7MQ6j\",\"assetPrefix\":\"\",\"urlParts\":[\"\",\"share\",\"chat\",\"\"],\"initialTree\":[\"\",{\"children\":[\"share\",{\"children\":[\"chat\",{\"children\":[\"__PAGE__\",{}]}]}]},\"$undefined\",\"$undefined\",true],\"initialSeedData\":[\"\",{\"children\":[\"share\",{\"children\":[\"chat\",{\"children\":[\"__PAGE__\",{},[[\"$L8\",[\"$\",\"$L9\",null,{\"props\":{\"params\":{},\"searchParams\":{}},\"Component\":\"$a\"}],[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/c808691c459e3887.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/b1094827d745306b.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"2\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/2272c73fc7a3b571.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}]]],null],null]},[[null,[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[[\"$\",\"meta\",null,{\"httpEquiv\":\"Content-Security-Policy\",\"content\":\"default-src 'self' https://assets.khoj.dev; 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_e594dd\",\"children\":[\"$\",\"$Lb\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"share\",\"children\",\"chat\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$Lc\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\"}]}]]}]],null],null]},[null,[\"$\",\"$Lb\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"share\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$Lc\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\"}]],null]},[[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/467a524c75e7d7c0.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/b9a6bf04305d98d7.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_e594dd\",\"children\":[\"$\",\"$Lb\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$Lc\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"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.\"}]}]]}]}]],\"notFoundStyles\":[]}]}]]}]],null],null],\"couldBeIntercepted\":false,\"initialHead\":[null,\"$Ld\"],\"globalErrorComponent\":\"$e\",\"missingSlots\":\"$Wf\"}]\n"])</script><script>self.__next_f.push([1,"d:[[\"$\",\"meta\",\"0\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}],[\"$\",\"meta\",\"1\",{\"charSet\":\"utf-8\"}],[\"$\",\"title\",\"2\",{\"children\":\"Khoj AI - Chat\"}],[\"$\",\"meta\",\"3\",{\"name\":\"description\",\"content\":\"Use this page to view a chat with Khoj AI.\"}],[\"$\",\"link\",\"4\",{\"rel\":\"manifest\",\"href\":\"/static/khoj.webmanifest\",\"crossOrigin\":\"use-credentials\"}],[\"$\",\"meta\",\"5\",{\"property\":\"og:title\",\"content\":\"Khoj AI - Home\"}],[\"$\",\"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 - Home\"}],[\"$\",\"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,"8:null\n"])</script></body></html>
@@ -1,7 +1,7 @@
1
1
  2:I[66513,[],"ClientPageRoot"]
2
- 3:I[5506,["3954","static/chunks/d3ac728e-a9e3522eef9b6b28.js","9001","static/chunks/9001-3b27af6d5f21df44.js","3062","static/chunks/3062-71ed4b46ac2bb87c.js","4086","static/chunks/4086-2c74808ba38a5a0f.js","121","static/chunks/121-7024f479c297aef0.js","3110","static/chunks/3110-ef2cacd1b8d79ad8.js","4051","static/chunks/4051-2cf66369d6ca0f1d.js","1603","static/chunks/1603-fa3ee48860b9dc5c.js","9417","static/chunks/9417-29502e39c3e7d60c.js","9178","static/chunks/9178-899fe9a6b754ecfe.js","9479","static/chunks/9479-7eed36fc954ef804.js","2697","static/chunks/2697-a38d01981ad3bdf8.js","3111","static/chunks/app/share/chat/page-fbbd66a4d4633438.js"],"default",1]
2
+ 3:I[5506,["3954","static/chunks/d3ac728e-a9e3522eef9b6b28.js","9001","static/chunks/9001-3b27af6d5f21df44.js","3062","static/chunks/3062-71ed4b46ac2bb87c.js","4086","static/chunks/4086-2c74808ba38a5a0f.js","121","static/chunks/121-7024f479c297aef0.js","3110","static/chunks/3110-ef2cacd1b8d79ad8.js","4051","static/chunks/4051-2cf66369d6ca0f1d.js","1603","static/chunks/1603-fa3ee48860b9dc5c.js","9417","static/chunks/9417-1d158bf46d3a0dc9.js","9178","static/chunks/9178-f208a3e6404714a9.js","9479","static/chunks/9479-563e4d61f91d5a7c.js","2697","static/chunks/2697-a38d01981ad3bdf8.js","3111","static/chunks/app/share/chat/page-a736a0826570af2b.js"],"default",1]
3
3
  4:I[39275,[],""]
4
4
  5:I[61343,[],""]
5
- 0:["90HwIhHWUtPEP6Aqr1IZw",[[["",{"children":["share",{"children":["chat",{"children":["__PAGE__",{}]}]}]},"$undefined","$undefined",true],["",{"children":["share",{"children":["chat",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/c808691c459e3887.css","precedence":"next","crossOrigin":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/_next/static/css/2de69f0be774c768.css","precedence":"next","crossOrigin":"$undefined"}],["$","link","2",{"rel":"stylesheet","href":"/_next/static/css/2272c73fc7a3b571.css","precedence":"next","crossOrigin":"$undefined"}]]],null],null]},[[null,["$","html",null,{"lang":"en","children":[["$","meta",null,{"httpEquiv":"Content-Security-Policy","content":"default-src 'self' https://assets.khoj.dev; 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_e594dd","children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","share","children","chat","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]}]]}]],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","share","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/467a524c75e7d7c0.css","precedence":"next","crossOrigin":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/_next/static/css/b9a6bf04305d98d7.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_e594dd","children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","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."}]}]]}]}]],"notFoundStyles":[]}]}]]}]],null],null],["$L6",null]]]]
5
+ 0:["NaOqImuryddEYz7a7MQ6j",[[["",{"children":["share",{"children":["chat",{"children":["__PAGE__",{}]}]}]},"$undefined","$undefined",true],["",{"children":["share",{"children":["chat",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/c808691c459e3887.css","precedence":"next","crossOrigin":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/_next/static/css/b1094827d745306b.css","precedence":"next","crossOrigin":"$undefined"}],["$","link","2",{"rel":"stylesheet","href":"/_next/static/css/2272c73fc7a3b571.css","precedence":"next","crossOrigin":"$undefined"}]]],null],null]},[[null,["$","html",null,{"lang":"en","children":[["$","meta",null,{"httpEquiv":"Content-Security-Policy","content":"default-src 'self' https://assets.khoj.dev; 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_e594dd","children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","share","children","chat","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]}]]}]],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","share","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/467a524c75e7d7c0.css","precedence":"next","crossOrigin":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/_next/static/css/b9a6bf04305d98d7.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_e594dd","children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","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."}]}]]}]}]],"notFoundStyles":[]}]}]]}]],null],null],["$L6",null]]]]
6
6
  6:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"Khoj AI - Chat"}],["$","meta","3",{"name":"description","content":"Use this page to view a chat with Khoj AI."}],["$","link","4",{"rel":"manifest","href":"/static/khoj.webmanifest","crossOrigin":"use-credentials"}],["$","meta","5",{"property":"og:title","content":"Khoj AI - Home"}],["$","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 - Home"}],["$","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"}]]
7
7
  1:null
@@ -114,6 +114,7 @@ class CrossEncoderModel:
114
114
  payload = {"inputs": {"query": query, "passages": [hit.additional[key] for hit in hits]}}
115
115
  headers = {"Authorization": f"Bearer {self.api_key}", "Content-Type": "application/json"}
116
116
  response = requests.post(target_url, json=payload, headers=headers)
117
+ response.raise_for_status()
117
118
  return response.json()["scores"]
118
119
 
119
120
  cross_inp = [[query, hit.additional[key]] for hit in hits]
@@ -10,14 +10,22 @@ import aiohttp
10
10
  from bs4 import BeautifulSoup
11
11
  from markdownify import markdownify
12
12
 
13
- from khoj.database.models import Agent, KhojUser
13
+ from khoj.database.adapters import ConversationAdapters
14
+ from khoj.database.models import Agent, KhojUser, WebScraper
15
+ from khoj.processor.conversation import prompts
14
16
  from khoj.routers.helpers import (
15
17
  ChatEvent,
16
18
  extract_relevant_info,
17
19
  generate_online_subqueries,
18
20
  infer_webpage_urls,
19
21
  )
20
- from khoj.utils.helpers import is_internet_connected, is_none_or_empty, timer
22
+ from khoj.utils.helpers import (
23
+ is_env_var_true,
24
+ is_internal_url,
25
+ is_internet_connected,
26
+ is_none_or_empty,
27
+ timer,
28
+ )
21
29
  from khoj.utils.rawconfig import LocationData
22
30
 
23
31
  logger = logging.getLogger(__name__)
@@ -25,12 +33,11 @@ logger = logging.getLogger(__name__)
25
33
  SERPER_DEV_API_KEY = os.getenv("SERPER_DEV_API_KEY")
26
34
  SERPER_DEV_URL = "https://google.serper.dev/search"
27
35
 
28
- JINA_READER_API_URL = "https://r.jina.ai/"
29
36
  JINA_SEARCH_API_URL = "https://s.jina.ai/"
30
37
  JINA_API_KEY = os.getenv("JINA_API_KEY")
31
38
 
32
- OLOSTEP_API_KEY = os.getenv("OLOSTEP_API_KEY")
33
- OLOSTEP_API_URL = "https://agent.olostep.com/olostep-p2p-incomingAPI"
39
+ FIRECRAWL_USE_LLM_EXTRACT = is_env_var_true("FIRECRAWL_USE_LLM_EXTRACT")
40
+
34
41
  OLOSTEP_QUERY_PARAMS = {
35
42
  "timeout": 35, # seconds
36
43
  "waitBeforeScraping": 1, # seconds
@@ -83,33 +90,36 @@ async def search_online(
83
90
  search_results = await asyncio.gather(*search_tasks)
84
91
  response_dict = {subquery: search_result for subquery, search_result in search_results}
85
92
 
86
- # Gather distinct web page data from organic results of each subquery without an instant answer.
93
+ # Gather distinct web pages from organic results for subqueries without an instant answer.
87
94
  # Content of web pages is directly available when Jina is used for search.
88
- webpages = {
89
- (organic.get("link"), subquery, organic.get("content"))
90
- for subquery in response_dict
91
- for organic in response_dict[subquery].get("organic", [])[:MAX_WEBPAGES_TO_READ]
92
- if "answerBox" not in response_dict[subquery]
93
- }
95
+ webpages: Dict[str, Dict] = {}
96
+ for subquery in response_dict:
97
+ if "answerBox" in response_dict[subquery]:
98
+ continue
99
+ for organic in response_dict[subquery].get("organic", [])[:MAX_WEBPAGES_TO_READ]:
100
+ link = organic.get("link")
101
+ if link in webpages:
102
+ webpages[link]["queries"].add(subquery)
103
+ else:
104
+ webpages[link] = {"queries": {subquery}, "content": organic.get("content")}
94
105
 
95
106
  # Read, extract relevant info from the retrieved web pages
96
107
  if webpages:
97
- webpage_links = set([link for link, _, _ in webpages])
98
- logger.info(f"Reading web pages at: {list(webpage_links)}")
108
+ logger.info(f"Reading web pages at: {webpages.keys()}")
99
109
  if send_status_func:
100
- webpage_links_str = "\n- " + "\n- ".join(list(webpage_links))
110
+ webpage_links_str = "\n- " + "\n- ".join(webpages.keys())
101
111
  async for event in send_status_func(f"**Reading web pages**: {webpage_links_str}"):
102
112
  yield {ChatEvent.STATUS: event}
103
113
  tasks = [
104
- read_webpage_and_extract_content(subquery, link, content, user=user, agent=agent)
105
- for link, subquery, content in webpages
114
+ read_webpage_and_extract_content(data["queries"], link, data["content"], user=user, agent=agent)
115
+ for link, data in webpages.items()
106
116
  ]
107
117
  results = await asyncio.gather(*tasks)
108
118
 
109
119
  # Collect extracted info from the retrieved web pages
110
- for subquery, webpage_extract, url in results:
120
+ for subqueries, url, webpage_extract in results:
111
121
  if webpage_extract is not None:
112
- response_dict[subquery]["webpages"] = {"link": url, "snippet": webpage_extract}
122
+ response_dict[subqueries.pop()]["webpages"] = {"link": url, "snippet": webpage_extract}
113
123
 
114
124
  yield response_dict
115
125
 
@@ -156,29 +166,66 @@ async def read_webpages(
156
166
  webpage_links_str = "\n- " + "\n- ".join(list(urls))
157
167
  async for event in send_status_func(f"**Reading web pages**: {webpage_links_str}"):
158
168
  yield {ChatEvent.STATUS: event}
159
- tasks = [read_webpage_and_extract_content(query, url, user=user, agent=agent) for url in urls]
169
+ tasks = [read_webpage_and_extract_content({query}, url, user=user, agent=agent) for url in urls]
160
170
  results = await asyncio.gather(*tasks)
161
171
 
162
172
  response: Dict[str, Dict] = defaultdict(dict)
163
173
  response[query]["webpages"] = [
164
- {"query": q, "link": url, "snippet": web_extract} for q, web_extract, url in results if web_extract is not None
174
+ {"query": qs.pop(), "link": url, "snippet": extract} for qs, url, extract in results if extract is not None
165
175
  ]
166
176
  yield response
167
177
 
168
178
 
179
+ async def read_webpage(
180
+ url, scraper_type=None, api_key=None, api_url=None, subqueries=None, agent=None
181
+ ) -> Tuple[str | None, str | None]:
182
+ if scraper_type == WebScraper.WebScraperType.FIRECRAWL and FIRECRAWL_USE_LLM_EXTRACT:
183
+ return None, await query_webpage_with_firecrawl(url, subqueries, api_key, api_url, agent)
184
+ elif scraper_type == WebScraper.WebScraperType.FIRECRAWL:
185
+ return await read_webpage_with_firecrawl(url, api_key, api_url), None
186
+ elif scraper_type == WebScraper.WebScraperType.OLOSTEP:
187
+ return await read_webpage_with_olostep(url, api_key, api_url), None
188
+ elif scraper_type == WebScraper.WebScraperType.JINA:
189
+ return await read_webpage_with_jina(url, api_key, api_url), None
190
+ else:
191
+ return await read_webpage_at_url(url), None
192
+
193
+
169
194
  async def read_webpage_and_extract_content(
170
- subquery: str, url: str, content: str = None, user: KhojUser = None, agent: Agent = None
171
- ) -> Tuple[str, Union[None, str], str]:
172
- try:
173
- if is_none_or_empty(content):
174
- with timer(f"Reading web page at '{url}' took", logger):
175
- content = await read_webpage_with_olostep(url) if OLOSTEP_API_KEY else await read_webpage_with_jina(url)
176
- with timer(f"Extracting relevant information from web page at '{url}' took", logger):
177
- extracted_info = await extract_relevant_info(subquery, content, user=user, agent=agent)
178
- return subquery, extracted_info, url
179
- except Exception as e:
180
- logger.error(f"Failed to read web page at '{url}' with {e}")
181
- return subquery, None, url
195
+ subqueries: set[str], url: str, content: str = None, user: KhojUser = None, agent: Agent = None
196
+ ) -> Tuple[set[str], str, Union[None, str]]:
197
+ # Select the web scrapers to use for reading the web page
198
+ web_scrapers = await ConversationAdapters.aget_enabled_webscrapers()
199
+ # Only use the direct web scraper for internal URLs
200
+ if is_internal_url(url):
201
+ web_scrapers = [scraper for scraper in web_scrapers if scraper.type == WebScraper.WebScraperType.DIRECT]
202
+
203
+ # Fallback through enabled web scrapers until we successfully read the web page
204
+ extracted_info = None
205
+ for scraper in web_scrapers:
206
+ try:
207
+ # Read the web page
208
+ if is_none_or_empty(content):
209
+ with timer(f"Reading web page with {scraper.type} at '{url}' took", logger, log_level=logging.INFO):
210
+ content, extracted_info = await read_webpage(
211
+ url, scraper.type, scraper.api_key, scraper.api_url, subqueries, agent
212
+ )
213
+
214
+ # Extract relevant information from the web page
215
+ if is_none_or_empty(extracted_info):
216
+ with timer(f"Extracting relevant information from web page at '{url}' took", logger):
217
+ extracted_info = await extract_relevant_info(subqueries, content, user=user, agent=agent)
218
+
219
+ # If we successfully extracted information, break the loop
220
+ if not is_none_or_empty(extracted_info):
221
+ break
222
+ except Exception as e:
223
+ logger.warning(f"Failed to read web page with {scraper.type} at '{url}' with {e}")
224
+ # If this is the last web scraper in the list, log an error
225
+ if scraper.name == web_scrapers[-1].name:
226
+ logger.error(f"All web scrapers failed for '{url}'")
227
+
228
+ return subqueries, url, extracted_info
182
229
 
183
230
 
184
231
  async def read_webpage_at_url(web_url: str) -> str:
@@ -195,23 +242,23 @@ async def read_webpage_at_url(web_url: str) -> str:
195
242
  return markdownify(body)
196
243
 
197
244
 
198
- async def read_webpage_with_olostep(web_url: str) -> str:
199
- headers = {"Authorization": f"Bearer {OLOSTEP_API_KEY}"}
245
+ async def read_webpage_with_olostep(web_url: str, api_key: str, api_url: str) -> str:
246
+ headers = {"Authorization": f"Bearer {api_key}"}
200
247
  web_scraping_params: Dict[str, Union[str, int, bool]] = OLOSTEP_QUERY_PARAMS.copy() # type: ignore
201
248
  web_scraping_params["url"] = web_url
202
249
 
203
250
  async with aiohttp.ClientSession() as session:
204
- async with session.get(OLOSTEP_API_URL, params=web_scraping_params, headers=headers) as response:
251
+ async with session.get(api_url, params=web_scraping_params, headers=headers) as response:
205
252
  response.raise_for_status()
206
253
  response_json = await response.json()
207
254
  return response_json["markdown_content"]
208
255
 
209
256
 
210
- async def read_webpage_with_jina(web_url: str) -> str:
211
- jina_reader_api_url = f"{JINA_READER_API_URL}/{web_url}"
257
+ async def read_webpage_with_jina(web_url: str, api_key: str, api_url: str) -> str:
258
+ jina_reader_api_url = f"{api_url}/{web_url}"
212
259
  headers = {"Accept": "application/json", "X-Timeout": "30"}
213
- if JINA_API_KEY:
214
- headers["Authorization"] = f"Bearer {JINA_API_KEY}"
260
+ if api_key:
261
+ headers["Authorization"] = f"Bearer {api_key}"
215
262
 
216
263
  async with aiohttp.ClientSession() as session:
217
264
  async with session.get(jina_reader_api_url, headers=headers) as response:
@@ -220,6 +267,54 @@ async def read_webpage_with_jina(web_url: str) -> str:
220
267
  return response_json["data"]["content"]
221
268
 
222
269
 
270
+ async def read_webpage_with_firecrawl(web_url: str, api_key: str, api_url: str) -> str:
271
+ firecrawl_api_url = f"{api_url}/v1/scrape"
272
+ headers = {"Content-Type": "application/json", "Authorization": f"Bearer {api_key}"}
273
+ params = {"url": web_url, "formats": ["markdown"], "excludeTags": ["script", ".ad"]}
274
+
275
+ async with aiohttp.ClientSession() as session:
276
+ async with session.post(firecrawl_api_url, json=params, headers=headers) as response:
277
+ response.raise_for_status()
278
+ response_json = await response.json()
279
+ return response_json["data"]["markdown"]
280
+
281
+
282
+ async def query_webpage_with_firecrawl(
283
+ web_url: str, queries: set[str], api_key: str, api_url: str, agent: Agent = None
284
+ ) -> str:
285
+ firecrawl_api_url = f"{api_url}/v1/scrape"
286
+ headers = {"Content-Type": "application/json", "Authorization": f"Bearer {api_key}"}
287
+ schema = {
288
+ "type": "object",
289
+ "properties": {
290
+ "relevant_extract": {"type": "string"},
291
+ },
292
+ "required": [
293
+ "relevant_extract",
294
+ ],
295
+ }
296
+
297
+ personality_context = (
298
+ prompts.personality_context.format(personality=agent.personality) if agent and agent.personality else ""
299
+ )
300
+ system_prompt = f"""
301
+ {prompts.system_prompt_extract_relevant_information}
302
+
303
+ {personality_context}
304
+ User Query: {", ".join(queries)}
305
+
306
+ Collate only relevant information from the website to answer the target query and in the provided JSON schema.
307
+ """.strip()
308
+
309
+ params = {"url": web_url, "formats": ["extract"], "extract": {"systemPrompt": system_prompt, "schema": schema}}
310
+
311
+ async with aiohttp.ClientSession() as session:
312
+ async with session.post(firecrawl_api_url, json=params, headers=headers) as response:
313
+ response.raise_for_status()
314
+ response_json = await response.json()
315
+ return response_json["data"]["extract"]["relevant_extract"]
316
+
317
+
223
318
  async def search_with_jina(query: str, location: LocationData) -> Tuple[str, Dict[str, List[Dict]]]:
224
319
  encoded_query = urllib.parse.quote(query)
225
320
  jina_search_api_url = f"{JINA_SEARCH_API_URL}/{encoded_query}"
khoj/routers/api_chat.py CHANGED
@@ -3,7 +3,6 @@ import base64
3
3
  import json
4
4
  import logging
5
5
  import time
6
- import warnings
7
6
  from datetime import datetime
8
7
  from functools import partial
9
8
  from typing import Dict, Optional
@@ -574,7 +573,6 @@ async def chat(
574
573
  chat_metadata: dict = {}
575
574
  connection_alive = True
576
575
  user: KhojUser = request.user.object
577
- subscribed: bool = has_required_scope(request, ["premium"])
578
576
  event_delimiter = "␃🔚␗"
579
577
  q = unquote(q)
580
578
  nonlocal conversation_id
@@ -641,7 +639,7 @@ async def chat(
641
639
  request=request,
642
640
  telemetry_type="api",
643
641
  api="chat",
644
- client=request.user.client_app,
642
+ client=common.client,
645
643
  user_agent=request.headers.get("user-agent"),
646
644
  host=request.headers.get("host"),
647
645
  metadata=chat_metadata,
@@ -840,25 +838,33 @@ async def chat(
840
838
  # Gather Context
841
839
  ## Extract Document References
842
840
  compiled_references, inferred_queries, defiltered_query = [], [], None
843
- async for result in extract_references_and_questions(
844
- request,
845
- meta_log,
846
- q,
847
- (n or 7),
848
- d,
849
- conversation_id,
850
- conversation_commands,
851
- location,
852
- partial(send_event, ChatEvent.STATUS),
853
- uploaded_image_url=uploaded_image_url,
854
- agent=agent,
855
- ):
856
- if isinstance(result, dict) and ChatEvent.STATUS in result:
857
- yield result[ChatEvent.STATUS]
858
- else:
859
- compiled_references.extend(result[0])
860
- inferred_queries.extend(result[1])
861
- defiltered_query = result[2]
841
+ try:
842
+ async for result in extract_references_and_questions(
843
+ request,
844
+ meta_log,
845
+ q,
846
+ (n or 7),
847
+ d,
848
+ conversation_id,
849
+ conversation_commands,
850
+ location,
851
+ partial(send_event, ChatEvent.STATUS),
852
+ uploaded_image_url=uploaded_image_url,
853
+ agent=agent,
854
+ ):
855
+ if isinstance(result, dict) and ChatEvent.STATUS in result:
856
+ yield result[ChatEvent.STATUS]
857
+ else:
858
+ compiled_references.extend(result[0])
859
+ inferred_queries.extend(result[1])
860
+ defiltered_query = result[2]
861
+ except Exception as e:
862
+ error_message = f"Error searching knowledge base: {e}. Attempting to respond without document references."
863
+ logger.warning(error_message)
864
+ async for result in send_event(
865
+ ChatEvent.STATUS, "Document search failed. I'll try respond without document references"
866
+ ):
867
+ yield result
862
868
 
863
869
  if not is_none_or_empty(compiled_references):
864
870
  headings = "\n- " + "\n- ".join(set([c.get("compiled", c).split("\n")[0] for c in compiled_references]))
@@ -894,12 +900,13 @@ async def chat(
894
900
  yield result[ChatEvent.STATUS]
895
901
  else:
896
902
  online_results = result
897
- except ValueError as e:
903
+ except Exception as e:
898
904
  error_message = f"Error searching online: {e}. Attempting to respond without online results"
899
905
  logger.warning(error_message)
900
- async for result in send_llm_response(error_message):
906
+ async for result in send_event(
907
+ ChatEvent.STATUS, "Online search failed. I'll try respond without online references"
908
+ ):
901
909
  yield result
902
- return
903
910
 
904
911
  ## Gather Webpage References
905
912
  if ConversationCommand.Webpage in conversation_commands:
@@ -928,11 +935,15 @@ async def chat(
928
935
  webpages.append(webpage["link"])
929
936
  async for result in send_event(ChatEvent.STATUS, f"**Read web pages**: {webpages}"):
930
937
  yield result
931
- except ValueError as e:
938
+ except Exception as e:
932
939
  logger.warning(
933
- f"Error directly reading webpages: {e}. Attempting to respond without online results",
940
+ f"Error reading webpages: {e}. Attempting to respond without webpage results",
934
941
  exc_info=True,
935
942
  )
943
+ async for result in send_event(
944
+ ChatEvent.STATUS, "Webpage read failed. I'll try respond without webpage references"
945
+ ):
946
+ yield result
936
947
 
937
948
  ## Send Gathered References
938
949
  async for result in send_event(
khoj/routers/helpers.py CHANGED
@@ -353,13 +353,13 @@ async def aget_relevant_information_sources(
353
353
  final_response = [ConversationCommand.Default]
354
354
  else:
355
355
  final_response = [ConversationCommand.General]
356
- return final_response
357
- except Exception as e:
356
+ except Exception:
358
357
  logger.error(f"Invalid response for determining relevant tools: {response}")
359
358
  if len(agent_tools) == 0:
360
359
  final_response = [ConversationCommand.Default]
361
360
  else:
362
361
  final_response = agent_tools
362
+ return final_response
363
363
 
364
364
 
365
365
  async def aget_relevant_output_modes(
@@ -551,12 +551,14 @@ async def schedule_query(
551
551
  raise AssertionError(f"Invalid response for scheduling query: {raw_response}")
552
552
 
553
553
 
554
- async def extract_relevant_info(q: str, corpus: str, user: KhojUser = None, agent: Agent = None) -> Union[str, None]:
554
+ async def extract_relevant_info(
555
+ qs: set[str], corpus: str, user: KhojUser = None, agent: Agent = None
556
+ ) -> Union[str, None]:
555
557
  """
556
558
  Extract relevant information for a given query from the target corpus
557
559
  """
558
560
 
559
- if is_none_or_empty(corpus) or is_none_or_empty(q):
561
+ if is_none_or_empty(corpus) or is_none_or_empty(qs):
560
562
  return None
561
563
 
562
564
  personality_context = (
@@ -564,17 +566,16 @@ async def extract_relevant_info(q: str, corpus: str, user: KhojUser = None, agen
564
566
  )
565
567
 
566
568
  extract_relevant_information = prompts.extract_relevant_information.format(
567
- query=q,
569
+ query=", ".join(qs),
568
570
  corpus=corpus.strip(),
569
571
  personality_context=personality_context,
570
572
  )
571
573
 
572
- with timer("Chat actor: Extract relevant information from data", logger):
573
- response = await send_message_to_model_wrapper(
574
- extract_relevant_information,
575
- prompts.system_prompt_extract_relevant_information,
576
- user=user,
577
- )
574
+ response = await send_message_to_model_wrapper(
575
+ extract_relevant_information,
576
+ prompts.system_prompt_extract_relevant_information,
577
+ user=user,
578
+ )
578
579
  return response.strip()
579
580
 
580
581
 
@@ -3,6 +3,7 @@ import math
3
3
  from pathlib import Path
4
4
  from typing import List, Optional, Tuple, Type, Union
5
5
 
6
+ import requests
6
7
  import torch
7
8
  from asgiref.sync import sync_to_async
8
9
  from sentence_transformers import util
@@ -231,8 +232,12 @@ def setup(
231
232
 
232
233
  def cross_encoder_score(query: str, hits: List[SearchResponse], search_model_name: str) -> List[SearchResponse]:
233
234
  """Score all retrieved entries using the cross-encoder"""
234
- with timer("Cross-Encoder Predict Time", logger, state.device):
235
- cross_scores = state.cross_encoder_model[search_model_name].predict(query, hits)
235
+ try:
236
+ with timer("Cross-Encoder Predict Time", logger, state.device):
237
+ cross_scores = state.cross_encoder_model[search_model_name].predict(query, hits)
238
+ except requests.exceptions.HTTPError as e:
239
+ logger.error(f"Failed to rerank documents using the inference endpoint. Error: {e}.", exc_info=True)
240
+ cross_scores = [0.0] * len(hits)
236
241
 
237
242
  # Convert cross-encoder scores to distances and pass in hits for reranking
238
243
  for idx in range(len(cross_scores)):