khoj 1.25.1.dev12__py3-none-any.whl → 1.26.2__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 (58) hide show
  1. khoj/database/adapters/__init__.py +87 -9
  2. khoj/database/admin.py +16 -0
  3. khoj/database/migrations/0068_alter_agent_output_modes.py +24 -0
  4. khoj/database/migrations/0069_webscraper_serverchatsettings_web_scraper.py +89 -0
  5. khoj/database/models/__init__.py +78 -2
  6. khoj/interface/compiled/404/index.html +1 -1
  7. khoj/interface/compiled/_next/static/chunks/1603-fa3ee48860b9dc5c.js +1 -0
  8. khoj/interface/compiled/_next/static/chunks/{9417-1d158bf46d3a0dc9.js → 9417-46ed3aaa639c85ef.js} +1 -1
  9. khoj/interface/compiled/_next/static/chunks/{9479-563e4d61f91d5a7c.js → 9479-ea776e73f549090c.js} +1 -1
  10. khoj/interface/compiled/_next/static/chunks/app/agents/{layout-e71c8e913cccf792.js → layout-75636ab3a413fa8e.js} +1 -1
  11. khoj/interface/compiled/_next/static/chunks/app/agents/{page-f8d03847a0fa2539.js → page-88aa3042711107b7.js} +1 -1
  12. khoj/interface/compiled/_next/static/chunks/app/chat/{layout-8102549127db3067.js → layout-96fcf62857bf8f30.js} +1 -1
  13. khoj/interface/compiled/_next/static/chunks/app/{layout-f3e40d346da53112.js → layout-d0f0a9067427fb20.js} +1 -1
  14. khoj/interface/compiled/_next/static/chunks/app/settings/{layout-6f9314b0d7a26046.js → layout-a8f33dfe92f997fb.js} +1 -1
  15. khoj/interface/compiled/_next/static/chunks/app/share/chat/{layout-39f03f9e32399f0f.js → layout-2df56074e42adaa0.js} +1 -1
  16. khoj/interface/compiled/_next/static/chunks/{webpack-dff708c71e9234cb.js → webpack-64dc39af85cd2625.js} +1 -1
  17. khoj/interface/compiled/_next/static/css/467a524c75e7d7c0.css +1 -0
  18. khoj/interface/compiled/agents/index.html +1 -1
  19. khoj/interface/compiled/agents/index.txt +2 -2
  20. khoj/interface/compiled/automations/index.html +1 -1
  21. khoj/interface/compiled/automations/index.txt +2 -2
  22. khoj/interface/compiled/chat/index.html +1 -1
  23. khoj/interface/compiled/chat/index.txt +2 -2
  24. khoj/interface/compiled/factchecker/index.html +1 -1
  25. khoj/interface/compiled/factchecker/index.txt +2 -2
  26. khoj/interface/compiled/index.html +1 -1
  27. khoj/interface/compiled/index.txt +2 -2
  28. khoj/interface/compiled/search/index.html +1 -1
  29. khoj/interface/compiled/search/index.txt +2 -2
  30. khoj/interface/compiled/settings/index.html +1 -1
  31. khoj/interface/compiled/settings/index.txt +3 -3
  32. khoj/interface/compiled/share/chat/index.html +1 -1
  33. khoj/interface/compiled/share/chat/index.txt +2 -2
  34. khoj/interface/web/assets/icons/agents.svg +1 -0
  35. khoj/interface/web/assets/icons/automation.svg +1 -0
  36. khoj/interface/web/assets/icons/chat.svg +24 -0
  37. khoj/interface/web/login.html +11 -22
  38. khoj/processor/content/images/image_to_entries.py +2 -0
  39. khoj/processor/content/pdf/pdf_to_entries.py +1 -1
  40. khoj/processor/conversation/google/utils.py +4 -0
  41. khoj/processor/conversation/prompts.py +1 -1
  42. khoj/processor/embeddings.py +1 -0
  43. khoj/processor/tools/online_search.py +135 -40
  44. khoj/routers/api_chat.py +41 -31
  45. khoj/routers/helpers.py +13 -11
  46. khoj/search_type/text_search.py +7 -2
  47. khoj/utils/helpers.py +50 -5
  48. {khoj-1.25.1.dev12.dist-info → khoj-1.26.2.dist-info}/METADATA +4 -4
  49. {khoj-1.25.1.dev12.dist-info → khoj-1.26.2.dist-info}/RECORD +56 -53
  50. khoj/interface/compiled/_next/static/chunks/1603-67a89278e2c5dbe6.js +0 -1
  51. khoj/interface/compiled/_next/static/css/1538cedb321e3a97.css +0 -1
  52. /khoj/interface/compiled/_next/static/chunks/{9178-f208a3e6404714a9.js → 9178-899fe9a6b754ecfe.js} +0 -0
  53. /khoj/interface/compiled/_next/static/chunks/app/{page-421d13f70c505dd9.js → page-10a5aad6e04f3cf8.js} +0 -0
  54. /khoj/interface/compiled/_next/static/{CGyts-FEbV6owmPboHtLL → eim4XajTfG4ub4ft5AEkJ}/_buildManifest.js +0 -0
  55. /khoj/interface/compiled/_next/static/{CGyts-FEbV6owmPboHtLL → eim4XajTfG4ub4ft5AEkJ}/_ssgManifest.js +0 -0
  56. {khoj-1.25.1.dev12.dist-info → khoj-1.26.2.dist-info}/WHEEL +0 -0
  57. {khoj-1.25.1.dev12.dist-info → khoj-1.26.2.dist-info}/entry_points.txt +0 -0
  58. {khoj-1.25.1.dev12.dist-info → khoj-1.26.2.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/1538cedb321e3a97.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-dff708c71e9234cb.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-67a89278e2c5dbe6.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-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_90df87"><html lang="en"><body class="__className_90df87"><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-dff708c71e9234cb.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/1538cedb321e3a97.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-67a89278e2c5dbe6.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-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\":\"CGyts-FEbV6owmPboHtLL\",\"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_90df87\",\"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/1538cedb321e3a97.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_90df87\",\"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/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-64dc39af85cd2625.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-46ed3aaa639c85ef.js" async=""></script><script src="/_next/static/chunks/9178-899fe9a6b754ecfe.js" async=""></script><script src="/_next/static/chunks/9479-ea776e73f549090c.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-64dc39af85cd2625.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-46ed3aaa639c85ef.js\",\"9178\",\"static/chunks/9178-899fe9a6b754ecfe.js\",\"9479\",\"static/chunks/9479-ea776e73f549090c.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\":\"eim4XajTfG4ub4ft5AEkJ\",\"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,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-67a89278e2c5dbe6.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-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-46ed3aaa639c85ef.js","9178","static/chunks/9178-899fe9a6b754ecfe.js","9479","static/chunks/9479-ea776e73f549090c.js","2697","static/chunks/2697-a38d01981ad3bdf8.js","3111","static/chunks/app/share/chat/page-fbbd66a4d4633438.js"],"default",1]
3
3
  4:I[39275,[],""]
4
4
  5:I[61343,[],""]
5
- 0:["CGyts-FEbV6owmPboHtLL",[[["",{"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_90df87","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/1538cedb321e3a97.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_90df87","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:["eim4XajTfG4ub4ft5AEkJ",[[["",{"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]]]]
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
@@ -14,5 +14,6 @@
14
14
  clip-rule="evenodd"
15
15
  fill-rule="evenodd"
16
16
  fill="currentColor"
17
+ stroke="currentColor"
17
18
  stroke-width="0.95844" />
18
19
  </svg>
@@ -12,6 +12,7 @@
12
12
  fill-rule="evenodd"
13
13
  clip-rule="evenodd"
14
14
  fill-opacity="1"
15
+ stroke="currentColor"
15
16
  stroke-width="1.16584"
16
17
  stroke-dasharray="none"
17
18
  />
@@ -0,0 +1,24 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg"
2
+ width="800px"
3
+ height="800px"
4
+ viewBox="0 0 24 24"
5
+ fill="none"
6
+ version="1.1">
7
+ <path
8
+ d="m 14.024348,9.8497703 0.04627,1.9750167"
9
+ stroke="currentColor"
10
+ stroke-width="1.77073"
11
+ stroke-linecap="round" />
12
+ <path
13
+ d="m 9.6453624,9.7953624 0.046275,1.9750166"
14
+ stroke="currentColor"
15
+ stroke-width="1.77072"
16
+ stroke-linecap="round" />
17
+ <path
18
+ d="m 11.90538,2.3619994 c -5.4939109,0 -9.6890976,4.0608185 -9.6890976,9.8578926 0,1.477202 0.2658016,2.542848 0.6989332,3.331408 0.433559,0.789293 1.0740097,1.372483 1.9230615,1.798517 1.7362861,0.87132 4.1946007,1.018626 7.0671029,1.018626 0.317997,0 0.593711,0.167879 0.784844,0.458501 0.166463,0.253124 0.238617,0.552748 0.275566,0.787233 0.07263,0.460801 0.05871,1.030165 0.04785,1.474824 v 4.8e-5 l -2.26e-4,0.0091 c -0.0085,0.348246 -0.01538,0.634247 -0.0085,0.861186 0.105589,-0.07971 0.227925,-0.185287 0.36735,-0.31735 0.348613,-0.330307 0.743513,-0.767362 1.176607,-1.246635 l 0.07837,-0.08673 c 0.452675,-0.500762 0.941688,-1.037938 1.41216,-1.473209 0.453774,-0.419787 0.969948,-0.822472 1.476003,-0.953853 1.323661,-0.343655 2.330132,-0.904027 3.005749,-1.76381 0.658957,-0.838568 1.073167,-2.051868 1.073167,-3.898667 0,-5.7970748 -4.195186,-9.8578946 -9.689097,-9.8578946 z M 0.92440678,12.219892 c 0,-7.0067939 5.05909412,-11.47090892 10.98097322,-11.47090892 5.921878,0 10.980972,4.46411502 10.980972,11.47090892 0,2.172259 -0.497596,3.825405 -1.442862,5.028357 -0.928601,1.181693 -2.218843,1.837914 -3.664937,2.213334 -0.211641,0.05502 -0.53529,0.268579 -0.969874,0.670658 -0.417861,0.386604 -0.865628,0.876836 -1.324566,1.384504 l -0.09131,0.101202 c -0.419252,0.464136 -0.849637,0.94059 -1.239338,1.309807 -0.210187,0.199169 -0.425281,0.383422 -0.635348,0.523424 -0.200911,0.133819 -0.449635,0.263369 -0.716376,0.281474 -0.327812,0.02226 -0.61539,-0.149209 -0.804998,-0.457293 -0.157614,-0.255993 -0.217622,-0.557143 -0.246564,-0.778198 -0.0542,-0.414027 -0.04101,-0.933065 -0.03027,-1.355183 l 0.0024,-0.0922 c 0.01099,-0.463865 0.01489,-0.820507 -0.01611,-1.06842 C 8.9434608,19.975238 6.3139711,19.828758 4.356743,18.84659 3.3355029,18.334136 2.4624526,17.578678 1.8500164,16.463713 1.2372016,15.348029 0.92459928,13.943803 0.92459928,12.219967 Z"
19
+ clip-rule="evenodd"
20
+ stroke-width="0.360886"
21
+ fill="currentColor"
22
+ fill-rule="evenodd"
23
+ fill-opacity="1" />
24
+ </svg>
@@ -46,33 +46,16 @@
46
46
  <p>Transform the way you think, create, and remember</p>
47
47
  <div class="features">
48
48
  <div class="feature">
49
- <svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="2"
50
- fill="none">
51
- <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" />
52
- <path d="M14 2v6h6" />
53
- <path d="M16 13H8" />
54
- <path d="M16 17H8" />
55
- <path d="M10 9H8" />
56
- </svg>
49
+ <img src="/static/assets/icons/chat.svg" alt="Chat" width="24" height="24">
57
50
  <span>Get answers across your documents and the internet</span>
58
51
  </div>
59
52
  <div class="feature">
60
- <svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="2"
61
- fill="none">
62
- <path
63
- d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z" />
64
- <path d="M3.3 7l8.7 5 8.7-5" />
65
- </svg>
66
- <span>Go deeper in the topics personal to you</span>
53
+ <img src="/static/assets/icons/agents.svg" alt="Agents" width="24" height="24">
54
+ <span>Create agents with the knowledge and tools to take on any role</span>
67
55
  </div>
68
56
  <div class="feature">
69
- <svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="2"
70
- fill="none">
71
- <path d="M12 2L2 7l10 5 10-5-10-5z" />
72
- <path d="M2 17l10 5 10-5" />
73
- <path d="M2 12l10 5 10-5" />
74
- </svg>
75
- <span>Use specialized agents</span>
57
+ <img src="/static/assets/icons/automation.svg" alt="Automations" width="24" height="24">
58
+ <span>Automate away repetitive research</span>
76
59
  </div>
77
60
  </div>
78
61
  </div>
@@ -160,6 +143,12 @@
160
143
  height: 24px;
161
144
  stroke: white;
162
145
  }
146
+ .feature img {
147
+ width: 24px;
148
+ height: 24px;
149
+ filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(100%) contrast(100%);
150
+ stroke: white;
151
+ }
163
152
 
164
153
  #login-modal {
165
154
  display: grid;
@@ -64,6 +64,8 @@ class ImageToEntries(TextToEntries):
64
64
  tmp_file = f"tmp_image_file_{timestamp_now}.png"
65
65
  elif image_file.endswith(".jpg") or image_file.endswith(".jpeg"):
66
66
  tmp_file = f"tmp_image_file_{timestamp_now}.jpg"
67
+ elif image_file.endswith(".webp"):
68
+ tmp_file = f"tmp_image_file_{timestamp_now}.webp"
67
69
  with open(tmp_file, "wb") as f:
68
70
  bytes = image_files[image_file]
69
71
  f.write(bytes)
@@ -67,7 +67,7 @@ class PdfToEntries(TextToEntries):
67
67
  bytes = pdf_files[pdf_file]
68
68
  f.write(bytes)
69
69
  try:
70
- loader = PyMuPDFLoader(f"{tmp_file}", extract_images=True)
70
+ loader = PyMuPDFLoader(f"{tmp_file}", extract_images=False)
71
71
  pdf_entries_per_file = [page.page_content for page in loader.load()]
72
72
  except ImportError:
73
73
  loader = PyMuPDFLoader(f"{tmp_file}")
@@ -148,6 +148,10 @@ def handle_gemini_response(candidates, prompt_feedback=None):
148
148
  elif candidates[0].finish_reason == FinishReason.SAFETY:
149
149
  message = generate_safety_response(candidates[0].safety_ratings)
150
150
  stopped = True
151
+ # Check if finish reason is empty, therefore generation is in progress
152
+ elif not candidates[0].finish_reason:
153
+ message = None
154
+ stopped = False
151
155
  # Check if the response was stopped due to reaching maximum token limit or other reasons
152
156
  elif candidates[0].finish_reason != FinishReason.STOP:
153
157
  message = f"\nI can't talk further about that because of **{candidates[0].finish_reason.name} issue.**"
@@ -49,7 +49,7 @@ Instructions:\n{bio}
49
49
  # Prompt forked from https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models
50
50
  gemini_verbose_language_personality = """
51
51
  All questions should be answered comprehensively with details, unless the user requests a concise response specifically.
52
- Respond in the same language as the query.
52
+ Respond in the same language as the query. Use markdown to format your responses.
53
53
  """.strip()
54
54
 
55
55
  ## General Conversation
@@ -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}"