khoj 1.28.4.dev7__py3-none-any.whl → 1.28.4.dev22__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 (93) hide show
  1. khoj/configure.py +0 -6
  2. khoj/database/admin.py +6 -1
  3. khoj/interface/compiled/404/index.html +1 -1
  4. khoj/interface/compiled/_next/static/chunks/2261-748f7c327df3c8c1.js +1 -0
  5. khoj/interface/compiled/_next/static/chunks/3803-d74118a2d0182c52.js +1 -0
  6. khoj/interface/compiled/_next/static/chunks/5538-bf582517a8dd3faa.js +1 -0
  7. khoj/interface/compiled/_next/static/chunks/9434-9bbae0af6e92854c.js +3 -0
  8. khoj/interface/compiled/_next/static/chunks/app/agents/layout-e9838b642913a071.js +1 -0
  9. khoj/interface/compiled/_next/static/chunks/app/agents/page-f29d6b3efa6f96c6.js +1 -0
  10. khoj/interface/compiled/_next/static/chunks/app/automations/{page-774ae3e033f938cd.js → page-d3edae545a1b5393.js} +1 -1
  11. khoj/interface/compiled/_next/static/chunks/app/chat/layout-b0e7ff4baa3b5265.js +1 -0
  12. khoj/interface/compiled/_next/static/chunks/app/chat/{page-d8f4c107ad78e9e9.js → page-60bfb0b3b81d3d9d.js} +1 -1
  13. khoj/interface/compiled/_next/static/chunks/app/{layout-d0f0a9067427fb20.js → layout-86561d2fac35a91a.js} +1 -1
  14. khoj/interface/compiled/_next/static/chunks/app/{page-543c1ca0b0449be9.js → page-cbc0e7b837bd35fa.js} +1 -1
  15. khoj/interface/compiled/_next/static/chunks/app/search/layout-ea6b73fdaf9b24ca.js +1 -0
  16. khoj/interface/compiled/_next/static/chunks/app/search/{page-9b64f61caa5bd7f9.js → page-a5c277eff207959e.js} +1 -1
  17. khoj/interface/compiled/_next/static/chunks/app/settings/{layout-a8f33dfe92f997fb.js → layout-254eaaf916449a60.js} +1 -1
  18. khoj/interface/compiled/_next/static/chunks/app/settings/{page-10b288c103f19468.js → page-210bd54db4841333.js} +1 -1
  19. khoj/interface/compiled/_next/static/chunks/app/share/chat/layout-cf7445cf0326bda3.js +1 -0
  20. khoj/interface/compiled/_next/static/chunks/app/share/chat/{page-db775d42e820afb2.js → page-79cf030b31c7e793.js} +1 -1
  21. khoj/interface/compiled/_next/static/chunks/{main-f84cd3c1873cd842.js → main-1ea5c2e0fdef4626.js} +1 -1
  22. khoj/interface/compiled/_next/static/chunks/{webpack-363358fa8ff3d0b2.js → webpack-5018ce30001e8c48.js} +1 -1
  23. khoj/interface/compiled/_next/static/css/{467a524c75e7d7c0.css → 0e9d53dcd7f11342.css} +1 -1
  24. khoj/interface/compiled/_next/static/css/{26c1c33d0423a7d8.css → 1f293605f2871853.css} +1 -1
  25. khoj/interface/compiled/_next/static/css/592ca99f5122e75a.css +1 -0
  26. khoj/interface/compiled/_next/static/css/63e106a52a0ec4ca.css +1 -0
  27. khoj/interface/compiled/_next/static/css/d2bc549245313f26.css +25 -0
  28. khoj/interface/compiled/_next/static/media/5455839c73f146e7-s.p.woff2 +0 -0
  29. khoj/interface/compiled/_next/static/media/5984b96ba4822821-s.woff2 +0 -0
  30. khoj/interface/compiled/_next/static/media/684adc3dde1b03f1-s.woff2 +0 -0
  31. khoj/interface/compiled/_next/static/media/82e3b9a1bdaf0c26-s.woff2 +0 -0
  32. khoj/interface/compiled/_next/static/media/8d1ea331386a0db8-s.woff2 +0 -0
  33. khoj/interface/compiled/_next/static/media/91475f6526542a4f-s.woff2 +0 -0
  34. khoj/interface/compiled/_next/static/media/b98b13dbc1c3b59c-s.woff2 +0 -0
  35. khoj/interface/compiled/_next/static/media/c824d7a20139e39d-s.woff2 +0 -0
  36. khoj/interface/compiled/agents/index.html +1 -1
  37. khoj/interface/compiled/agents/index.txt +2 -2
  38. khoj/interface/compiled/automations/index.html +1 -1
  39. khoj/interface/compiled/automations/index.txt +2 -2
  40. khoj/interface/compiled/chat/index.html +1 -1
  41. khoj/interface/compiled/chat/index.txt +2 -2
  42. khoj/interface/compiled/index.html +1 -1
  43. khoj/interface/compiled/index.txt +2 -2
  44. khoj/interface/compiled/search/index.html +1 -1
  45. khoj/interface/compiled/search/index.txt +2 -2
  46. khoj/interface/compiled/settings/index.html +1 -1
  47. khoj/interface/compiled/settings/index.txt +3 -3
  48. khoj/interface/compiled/share/chat/index.html +1 -1
  49. khoj/interface/compiled/share/chat/index.txt +2 -2
  50. khoj/processor/conversation/utils.py +7 -1
  51. khoj/processor/tools/online_search.py +49 -15
  52. khoj/routers/api.py +3 -1
  53. khoj/routers/api_chat.py +16 -9
  54. khoj/routers/helpers.py +45 -17
  55. khoj/routers/research.py +64 -29
  56. khoj/routers/web_client.py +0 -10
  57. {khoj-1.28.4.dev7.dist-info → khoj-1.28.4.dev22.dist-info}/METADATA +3 -3
  58. {khoj-1.28.4.dev7.dist-info → khoj-1.28.4.dev22.dist-info}/RECORD +66 -73
  59. {khoj-1.28.4.dev7.dist-info → khoj-1.28.4.dev22.dist-info}/WHEEL +1 -1
  60. khoj/interface/compiled/_next/static/chunks/1034-da58b679fcbb79c1.js +0 -1
  61. khoj/interface/compiled/_next/static/chunks/1467-b331e469fe411347.js +0 -1
  62. khoj/interface/compiled/_next/static/chunks/3110-ef2cacd1b8d79ad8.js +0 -1
  63. khoj/interface/compiled/_next/static/chunks/3423-ff7402ae1dd66592.js +0 -1
  64. khoj/interface/compiled/_next/static/chunks/394-6bcb8c429f168f21.js +0 -3
  65. khoj/interface/compiled/_next/static/chunks/7113-f2e114d7034a0835.js +0 -1
  66. khoj/interface/compiled/_next/static/chunks/app/agents/layout-75636ab3a413fa8e.js +0 -1
  67. khoj/interface/compiled/_next/static/chunks/app/agents/page-5ae1e540bb5be8a9.js +0 -1
  68. khoj/interface/compiled/_next/static/chunks/app/chat/layout-96fcf62857bf8f30.js +0 -1
  69. khoj/interface/compiled/_next/static/chunks/app/factchecker/layout-7b30c541c05fb904.js +0 -1
  70. khoj/interface/compiled/_next/static/chunks/app/factchecker/page-1cc42ee55f89fb2e.js +0 -1
  71. khoj/interface/compiled/_next/static/chunks/app/search/layout-3720f1362310bebb.js +0 -1
  72. khoj/interface/compiled/_next/static/chunks/app/share/chat/layout-2df56074e42adaa0.js +0 -1
  73. khoj/interface/compiled/_next/static/css/553f9cdcc7a2bcd6.css +0 -1
  74. khoj/interface/compiled/_next/static/css/798b0de12852bd20.css +0 -1
  75. khoj/interface/compiled/_next/static/css/80bd6301fc657983.css +0 -1
  76. khoj/interface/compiled/_next/static/css/a795ee88875f4853.css +0 -25
  77. khoj/interface/compiled/_next/static/media/0e790e04fd40ad16-s.p.woff2 +0 -0
  78. khoj/interface/compiled/_next/static/media/4221e1667cd19c7d-s.woff2 +0 -0
  79. khoj/interface/compiled/_next/static/media/6c276159aa0eb14b-s.woff2 +0 -0
  80. khoj/interface/compiled/_next/static/media/6cc0b9500e4f9168-s.woff2 +0 -0
  81. khoj/interface/compiled/_next/static/media/9d9319a7a2ac39c6-s.woff2 +0 -0
  82. khoj/interface/compiled/_next/static/media/a75c8ea86756d52d-s.woff2 +0 -0
  83. khoj/interface/compiled/_next/static/media/abce7c400ca31a51-s.woff2 +0 -0
  84. khoj/interface/compiled/_next/static/media/f759c939737fb668-s.woff2 +0 -0
  85. khoj/interface/compiled/factchecker/index.html +0 -1
  86. khoj/interface/compiled/factchecker/index.txt +0 -7
  87. /khoj/interface/compiled/_next/static/chunks/{1970-90dd510762d820ba.js → 1970-d44050bf658ae5cc.js} +0 -0
  88. /khoj/interface/compiled/_next/static/chunks/{8423-f4976d6bda964f96.js → 8423-a1f432e4a8d9a6b0.js} +0 -0
  89. /khoj/interface/compiled/_next/static/chunks/{9417-951f46451a8dd6d7.js → 9417-0d0fc7eb49a86abb.js} +0 -0
  90. /khoj/interface/compiled/_next/static/{JfCnAJYWMXkmMgbWQv1u3 → hIwmaAtdW0-B6vZcnHMX0}/_buildManifest.js +0 -0
  91. /khoj/interface/compiled/_next/static/{JfCnAJYWMXkmMgbWQv1u3 → hIwmaAtdW0-B6vZcnHMX0}/_ssgManifest.js +0 -0
  92. {khoj-1.28.4.dev7.dist-info → khoj-1.28.4.dev22.dist-info}/entry_points.txt +0 -0
  93. {khoj-1.28.4.dev7.dist-info → khoj-1.28.4.dev22.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/a795ee88875f4853.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/3cf13271869a4aeb.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/798b0de12852bd20.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/26c1c33d0423a7d8.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-363358fa8ff3d0b2.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/8840-b8d7b9f0923c6651.js" async=""></script><script src="/_next/static/chunks/7113-f2e114d7034a0835.js" async=""></script><script src="/_next/static/chunks/3110-ef2cacd1b8d79ad8.js" async=""></script><script src="/_next/static/chunks/394-6bcb8c429f168f21.js" async=""></script><script src="/_next/static/chunks/1034-da58b679fcbb79c1.js" async=""></script><script src="/_next/static/chunks/1603-c1568f45947e9f2c.js" async=""></script><script src="/_next/static/chunks/9417-951f46451a8dd6d7.js" async=""></script><script src="/_next/static/chunks/3423-ff7402ae1dd66592.js" async=""></script><script src="/_next/static/chunks/8423-f4976d6bda964f96.js" async=""></script><script src="/_next/static/chunks/1467-b331e469fe411347.js" async=""></script><script src="/_next/static/chunks/app/share/chat/page-db775d42e820afb2.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>window.EXCALIDRAW_ASSET_PATH = 'https://assets.khoj.dev/@excalidraw/excalidraw/dist/';</script><script src="/_next/static/chunks/webpack-363358fa8ff3d0b2.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/a795ee88875f4853.css\",\"style\"]\n4:HL[\"/_next/static/css/3cf13271869a4aeb.css\",\"style\"]\n5:HL[\"/_next/static/css/798b0de12852bd20.css\",\"style\"]\n6:HL[\"/_next/static/css/26c1c33d0423a7d8.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\",\"8840\",\"static/chunks/8840-b8d7b9f0923c6651.js\",\"7113\",\"static/chunks/7113-f2e114d7034a0835.js\",\"3110\",\"static/chunks/3110-ef2cacd1b8d79ad8.js\",\"394\",\"static/chunks/394-6bcb8c429f168f21.js\",\"1034\",\"static/chunks/1034-da58b679fcbb79c1.js\",\"1603\",\"static/chunks/1603-c1568f45947e9f2c.js\",\"9417\",\"static/chunks/9417-951f46451a8dd6d7.js\",\"3423\",\"static/chunks/3423-ff7402ae1dd66592.js\",\"8423\",\"static/chunks/8423-f4976d6bda964f96.js\",\"1467\",\"static/chunks/1467-b331e469fe411347.js\",\"3111\",\"static/chunks/app/share/chat/page-db775d42e820afb2.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\":\"JfCnAJYWMXkmMgbWQv1u3\",\"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/3cf13271869a4aeb.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/798b0de12852bd20.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"2\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/26c1c33d0423a7d8.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\"}],[\"$\",\"script\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"window.EXCALIDRAW_ASSET_PATH = 'https://assets.khoj.dev/@excalidraw/excalidraw/dist/';\"}}]]}]]}]],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/a795ee88875f4853.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/5455839c73f146e7-s.p.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="stylesheet" href="/_next/static/css/0e9d53dcd7f11342.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/d2bc549245313f26.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/3cf13271869a4aeb.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/63e106a52a0ec4ca.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/1f293605f2871853.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-5018ce30001e8c48.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/8840-b8d7b9f0923c6651.js" async=""></script><script src="/_next/static/chunks/3803-d74118a2d0182c52.js" async=""></script><script src="/_next/static/chunks/2261-748f7c327df3c8c1.js" async=""></script><script src="/_next/static/chunks/9434-9bbae0af6e92854c.js" async=""></script><script src="/_next/static/chunks/1603-c1568f45947e9f2c.js" async=""></script><script src="/_next/static/chunks/9417-0d0fc7eb49a86abb.js" async=""></script><script src="/_next/static/chunks/8423-a1f432e4a8d9a6b0.js" async=""></script><script src="/_next/static/chunks/5538-bf582517a8dd3faa.js" async=""></script><script src="/_next/static/chunks/app/share/chat/page-79cf030b31c7e793.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_af6c42"><html lang="en"><body class="__className_af6c42"><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>window.EXCALIDRAW_ASSET_PATH = 'https://assets.khoj.dev/@excalidraw/excalidraw/dist/';</script><script src="/_next/static/chunks/webpack-5018ce30001e8c48.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/5455839c73f146e7-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n2:HL[\"/_next/static/css/0e9d53dcd7f11342.css\",\"style\"]\n3:HL[\"/_next/static/css/d2bc549245313f26.css\",\"style\"]\n4:HL[\"/_next/static/css/3cf13271869a4aeb.css\",\"style\"]\n5:HL[\"/_next/static/css/63e106a52a0ec4ca.css\",\"style\"]\n6:HL[\"/_next/static/css/1f293605f2871853.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\",\"8840\",\"static/chunks/8840-b8d7b9f0923c6651.js\",\"3803\",\"static/chunks/3803-d74118a2d0182c52.js\",\"2261\",\"static/chunks/2261-748f7c327df3c8c1.js\",\"9434\",\"static/chunks/9434-9bbae0af6e92854c.js\",\"1603\",\"static/chunks/1603-c1568f45947e9f2c.js\",\"9417\",\"static/chunks/9417-0d0fc7eb49a86abb.js\",\"8423\",\"static/chunks/8423-a1f432e4a8d9a6b0.js\",\"5538\",\"static/chunks/5538-bf582517a8dd3faa.js\",\"3111\",\"static/chunks/app/share/chat/page-79cf030b31c7e793.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\":\"hIwmaAtdW0-B6vZcnHMX0\",\"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/3cf13271869a4aeb.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/63e106a52a0ec4ca.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"2\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/1f293605f2871853.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_af6c42\",\"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\"}],[\"$\",\"script\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"window.EXCALIDRAW_ASSET_PATH = 'https://assets.khoj.dev/@excalidraw/excalidraw/dist/';\"}}]]}]]}]],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/0e9d53dcd7f11342.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/d2bc549245313f26.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[[\"$\",\"meta\",null,{\"httpEquiv\":\"Content-Security-Policy\",\"content\":\"default-src 'self' https://assets.khoj.dev; media-src * blob:; script-src 'self' https://assets.khoj.dev 'unsafe-inline' 'unsafe-eval'; connect-src 'self' blob: https://ipapi.co/json ws://localhost:42110; style-src 'self' https://assets.khoj.dev 'unsafe-inline' https://fonts.googleapis.com; img-src 'self' data: blob: https://*.khoj.dev https://*.googleusercontent.com https://*.google.com/ https://*.gstatic.com; font-src 'self' https://assets.khoj.dev https://fonts.gstatic.com; child-src 'none'; object-src 'none';\"}],[\"$\",\"body\",null,{\"className\":\"__className_af6c42\",\"children\":[\"$\",\"$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","8840","static/chunks/8840-b8d7b9f0923c6651.js","7113","static/chunks/7113-f2e114d7034a0835.js","3110","static/chunks/3110-ef2cacd1b8d79ad8.js","394","static/chunks/394-6bcb8c429f168f21.js","1034","static/chunks/1034-da58b679fcbb79c1.js","1603","static/chunks/1603-c1568f45947e9f2c.js","9417","static/chunks/9417-951f46451a8dd6d7.js","3423","static/chunks/3423-ff7402ae1dd66592.js","8423","static/chunks/8423-f4976d6bda964f96.js","1467","static/chunks/1467-b331e469fe411347.js","3111","static/chunks/app/share/chat/page-db775d42e820afb2.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","8840","static/chunks/8840-b8d7b9f0923c6651.js","3803","static/chunks/3803-d74118a2d0182c52.js","2261","static/chunks/2261-748f7c327df3c8c1.js","9434","static/chunks/9434-9bbae0af6e92854c.js","1603","static/chunks/1603-c1568f45947e9f2c.js","9417","static/chunks/9417-0d0fc7eb49a86abb.js","8423","static/chunks/8423-a1f432e4a8d9a6b0.js","5538","static/chunks/5538-bf582517a8dd3faa.js","3111","static/chunks/app/share/chat/page-79cf030b31c7e793.js"],"default",1]
3
3
  4:I[39275,[],""]
4
4
  5:I[61343,[],""]
5
- 0:["JfCnAJYWMXkmMgbWQv1u3",[[["",{"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/3cf13271869a4aeb.css","precedence":"next","crossOrigin":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/_next/static/css/798b0de12852bd20.css","precedence":"next","crossOrigin":"$undefined"}],["$","link","2",{"rel":"stylesheet","href":"/_next/static/css/26c1c33d0423a7d8.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"}],["$","script",null,{"dangerouslySetInnerHTML":{"__html":"window.EXCALIDRAW_ASSET_PATH = 'https://assets.khoj.dev/@excalidraw/excalidraw/dist/';"}}]]}]]}]],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/a795ee88875f4853.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:["hIwmaAtdW0-B6vZcnHMX0",[[["",{"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/3cf13271869a4aeb.css","precedence":"next","crossOrigin":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/_next/static/css/63e106a52a0ec4ca.css","precedence":"next","crossOrigin":"$undefined"}],["$","link","2",{"rel":"stylesheet","href":"/_next/static/css/1f293605f2871853.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_af6c42","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"}],["$","script",null,{"dangerouslySetInnerHTML":{"__html":"window.EXCALIDRAW_ASSET_PATH = 'https://assets.khoj.dev/@excalidraw/excalidraw/dist/';"}}]]}]]}]],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/0e9d53dcd7f11342.css","precedence":"next","crossOrigin":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/_next/static/css/d2bc549245313f26.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":[["$","meta",null,{"httpEquiv":"Content-Security-Policy","content":"default-src 'self' https://assets.khoj.dev; media-src * blob:; script-src 'self' https://assets.khoj.dev 'unsafe-inline' 'unsafe-eval'; connect-src 'self' blob: https://ipapi.co/json ws://localhost:42110; style-src 'self' https://assets.khoj.dev 'unsafe-inline' https://fonts.googleapis.com; img-src 'self' data: blob: https://*.khoj.dev https://*.googleusercontent.com https://*.google.com/ https://*.gstatic.com; font-src 'self' https://assets.khoj.dev https://fonts.gstatic.com; child-src 'none'; object-src 'none';"}],["$","body",null,{"className":"__className_af6c42","children":["$","$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
@@ -112,6 +112,7 @@ class InformationCollectionIteration:
112
112
  onlineContext: dict = None,
113
113
  codeContext: dict = None,
114
114
  summarizedResult: str = None,
115
+ warning: str = None,
115
116
  ):
116
117
  self.tool = tool
117
118
  self.query = query
@@ -119,6 +120,7 @@ class InformationCollectionIteration:
119
120
  self.onlineContext = onlineContext
120
121
  self.codeContext = codeContext
121
122
  self.summarizedResult = summarizedResult
123
+ self.warning = warning
122
124
 
123
125
 
124
126
  def construct_iteration_history(
@@ -338,7 +340,11 @@ def generate_chatml_messages_with_context(
338
340
  message_context += chat.get("intent").get("inferred-queries")[0]
339
341
  if not is_none_or_empty(chat.get("context")):
340
342
  references = "\n\n".join(
341
- {f"# File: {item['file']}\n## {item['compiled']}\n" for item in chat.get("context") or []}
343
+ {
344
+ f"# File: {item['file']}\n## {item['compiled']}\n"
345
+ for item in chat.get("context") or []
346
+ if isinstance(item, dict)
347
+ }
342
348
  )
343
349
  message_context += f"{prompts.notes_conversation.format(references=references)}\n\n"
344
350
  if not is_none_or_empty(chat.get("onlineContext")):
@@ -4,7 +4,7 @@ import logging
4
4
  import os
5
5
  import urllib.parse
6
6
  from collections import defaultdict
7
- from typing import Any, Callable, Dict, List, Optional, Tuple, Union
7
+ from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
8
8
 
9
9
  import aiohttp
10
10
  from bs4 import BeautifulSoup
@@ -66,6 +66,7 @@ async def search_online(
66
66
  custom_filters: List[str] = [],
67
67
  max_webpages_to_read: int = DEFAULT_MAX_WEBPAGES_TO_READ,
68
68
  query_images: List[str] = None,
69
+ previous_subqueries: Set = set(),
69
70
  agent: Agent = None,
70
71
  tracer: dict = {},
71
72
  ):
@@ -76,36 +77,45 @@ async def search_online(
76
77
  return
77
78
 
78
79
  # Breakdown the query into subqueries to get the correct answer
79
- subqueries = await generate_online_subqueries(
80
+ new_subqueries = await generate_online_subqueries(
80
81
  query, conversation_history, location, user, query_images=query_images, agent=agent, tracer=tracer
81
82
  )
82
- response_dict = {}
83
+ subqueries = list(new_subqueries - previous_subqueries)
84
+ response_dict: Dict[str, Dict[str, List[Dict] | Dict]] = {}
83
85
 
84
- if subqueries:
85
- logger.info(f"🌐 Searching the Internet for {list(subqueries)}")
86
- if send_status_func:
87
- subqueries_str = "\n- " + "\n- ".join(list(subqueries))
88
- async for event in send_status_func(f"**Searching the Internet for**: {subqueries_str}"):
89
- yield {ChatEvent.STATUS: event}
86
+ if is_none_or_empty(subqueries):
87
+ logger.info("No new subqueries to search online")
88
+ yield response_dict
89
+ return
90
+
91
+ logger.info(f"🌐 Searching the Internet for {subqueries}")
92
+ if send_status_func:
93
+ subqueries_str = "\n- " + "\n- ".join(subqueries)
94
+ async for event in send_status_func(f"**Searching the Internet for**: {subqueries_str}"):
95
+ yield {ChatEvent.STATUS: event}
90
96
 
91
- with timer(f"Internet searches for {list(subqueries)} took", logger):
97
+ with timer(f"Internet searches for {subqueries} took", logger):
92
98
  search_func = search_with_google if SERPER_DEV_API_KEY else search_with_jina
93
99
  search_tasks = [search_func(subquery, location) for subquery in subqueries]
94
100
  search_results = await asyncio.gather(*search_tasks)
95
101
  response_dict = {subquery: search_result for subquery, search_result in search_results}
96
102
 
97
103
  # Gather distinct web pages from organic results for subqueries without an instant answer.
98
- # Content of web pages is directly available when Jina is used for search.
99
104
  webpages: Dict[str, Dict] = {}
100
105
  for subquery in response_dict:
101
106
  if "answerBox" in response_dict[subquery]:
102
107
  continue
103
- for organic in response_dict[subquery].get("organic", [])[:max_webpages_to_read]:
108
+ for idx, organic in enumerate(response_dict[subquery].get("organic", [])):
104
109
  link = organic.get("link")
105
- if link in webpages:
110
+ if link in webpages and idx < max_webpages_to_read:
106
111
  webpages[link]["queries"].add(subquery)
107
- else:
112
+ # Content of web pages is directly available when Jina is used for search.
113
+ elif idx < max_webpages_to_read:
108
114
  webpages[link] = {"queries": {subquery}, "content": organic.get("content")}
115
+ # Only keep webpage content for up to max_webpages_to_read organic results.
116
+ if idx >= max_webpages_to_read and not is_none_or_empty(organic.get("content")):
117
+ organic["content"] = None
118
+ response_dict[subquery]["organic"][idx] = organic
109
119
 
110
120
  # Read, extract relevant info from the retrieved web pages
111
121
  if webpages:
@@ -115,7 +125,9 @@ async def search_online(
115
125
  async for event in send_status_func(f"**Reading web pages**: {webpage_links_str}"):
116
126
  yield {ChatEvent.STATUS: event}
117
127
  tasks = [
118
- read_webpage_and_extract_content(data["queries"], link, data["content"], user=user, agent=agent, tracer=tracer)
128
+ read_webpage_and_extract_content(
129
+ data["queries"], link, data.get("content"), user=user, agent=agent, tracer=tracer
130
+ )
119
131
  for link, data in webpages.items()
120
132
  ]
121
133
  results = await asyncio.gather(*tasks)
@@ -355,3 +367,25 @@ async def search_with_jina(query: str, location: LocationData) -> Tuple[str, Dic
355
367
  for item in response_json["data"]
356
368
  ]
357
369
  return query, {"organic": parsed_response}
370
+
371
+
372
+ def deduplicate_organic_results(online_results: dict) -> dict:
373
+ """Deduplicate organic search results based on links across all queries."""
374
+ # Keep track of seen links to filter out duplicates across queries
375
+ seen_links = set()
376
+ deduplicated_results = {}
377
+
378
+ # Process each query's results
379
+ for query, results in online_results.items():
380
+ # Filter organic results keeping only first occurrence of each link
381
+ filtered_organic = []
382
+ for result in results.get("organic", []):
383
+ link = result.get("link")
384
+ if link and link not in seen_links:
385
+ seen_links.add(link)
386
+ filtered_organic.append(result)
387
+
388
+ # Update results with deduplicated organic entries
389
+ deduplicated_results[query] = {**results, "organic": filtered_organic}
390
+
391
+ return deduplicated_results
khoj/routers/api.py CHANGED
@@ -6,7 +6,7 @@ import os
6
6
  import threading
7
7
  import time
8
8
  import uuid
9
- from typing import Any, Callable, List, Optional, Union
9
+ from typing import Any, Callable, List, Optional, Set, Union
10
10
 
11
11
  import cron_descriptor
12
12
  import pytz
@@ -349,6 +349,7 @@ async def extract_references_and_questions(
349
349
  location_data: LocationData = None,
350
350
  send_status_func: Optional[Callable] = None,
351
351
  query_images: Optional[List[str]] = None,
352
+ previous_inferred_queries: Set = set(),
352
353
  agent: Agent = None,
353
354
  tracer: dict = {},
354
355
  ):
@@ -477,6 +478,7 @@ async def extract_references_and_questions(
477
478
  )
478
479
 
479
480
  # Collate search results as context for GPT
481
+ inferred_queries = list(set(inferred_queries) - previous_inferred_queries)
480
482
  with timer("Searching knowledge base took", logger):
481
483
  search_results = []
482
484
  logger.info(f"🔍 Searching knowledge base with queries: {inferred_queries}")
khoj/routers/api_chat.py CHANGED
@@ -28,7 +28,11 @@ from khoj.processor.conversation.prompts import help_message, no_entries_found
28
28
  from khoj.processor.conversation.utils import defilter_query, save_to_conversation_log
29
29
  from khoj.processor.image.generate import text_to_image
30
30
  from khoj.processor.speech.text_to_speech import generate_text_to_speech
31
- from khoj.processor.tools.online_search import read_webpages, search_online
31
+ from khoj.processor.tools.online_search import (
32
+ deduplicate_organic_results,
33
+ read_webpages,
34
+ search_online,
35
+ )
32
36
  from khoj.processor.tools.run_code import run_code
33
37
  from khoj.routers.api import extract_references_and_questions
34
38
  from khoj.routers.email import send_query_feedback
@@ -738,8 +742,13 @@ async def chat(
738
742
  conversation_commands.append(mode)
739
743
 
740
744
  for cmd in conversation_commands:
741
- await conversation_command_rate_limiter.update_and_check_if_valid(request, cmd)
742
- q = q.replace(f"/{cmd.value}", "").strip()
745
+ try:
746
+ await conversation_command_rate_limiter.update_and_check_if_valid(request, cmd)
747
+ q = q.replace(f"/{cmd.value}", "").strip()
748
+ except HTTPException as e:
749
+ async for result in send_llm_response(str(e.detail)):
750
+ yield result
751
+ return
743
752
 
744
753
  defiltered_query = defilter_query(q)
745
754
 
@@ -773,11 +782,8 @@ async def chat(
773
782
  yield research_result
774
783
 
775
784
  # researched_results = await extract_relevant_info(q, researched_results, agent)
776
- logger.info(f"Researched Results: {researched_results}")
777
-
778
- for cmd in conversation_commands:
779
- await conversation_command_rate_limiter.update_and_check_if_valid(request, cmd)
780
- q = q.replace(f"/{cmd.value}", "").strip()
785
+ if state.verbose > 1:
786
+ logger.debug(f"Researched Results: {researched_results}")
781
787
 
782
788
  used_slash_summarize = conversation_commands == [ConversationCommand.Summarize]
783
789
  file_filters = conversation.file_filters if conversation else []
@@ -1024,12 +1030,13 @@ async def chat(
1024
1030
  )
1025
1031
 
1026
1032
  ## Send Gathered References
1033
+ unique_online_results = deduplicate_organic_results(online_results)
1027
1034
  async for result in send_event(
1028
1035
  ChatEvent.REFERENCES,
1029
1036
  {
1030
1037
  "inferredQueries": inferred_queries,
1031
1038
  "context": compiled_references,
1032
- "onlineContext": online_results,
1039
+ "onlineContext": unique_online_results,
1033
1040
  "codeContext": code_results,
1034
1041
  },
1035
1042
  ):
khoj/routers/helpers.py CHANGED
@@ -20,6 +20,7 @@ from typing import (
20
20
  Iterator,
21
21
  List,
22
22
  Optional,
23
+ Set,
23
24
  Tuple,
24
25
  Union,
25
26
  )
@@ -494,7 +495,7 @@ async def generate_online_subqueries(
494
495
  query_images: List[str] = None,
495
496
  agent: Agent = None,
496
497
  tracer: dict = {},
497
- ) -> List[str]:
498
+ ) -> Set[str]:
498
499
  """
499
500
  Generate subqueries from the given query
500
501
  """
@@ -529,14 +530,14 @@ async def generate_online_subqueries(
529
530
  try:
530
531
  response = clean_json(response)
531
532
  response = json.loads(response)
532
- response = [q.strip() for q in response["queries"] if q.strip()]
533
- if not isinstance(response, list) or not response or len(response) == 0:
533
+ response = {q.strip() for q in response["queries"] if q.strip()}
534
+ if not isinstance(response, set) or not response or len(response) == 0:
534
535
  logger.error(f"Invalid response for constructing subqueries: {response}. Returning original query: {q}")
535
- return [q]
536
+ return {q}
536
537
  return response
537
538
  except Exception as e:
538
539
  logger.error(f"Invalid response for constructing subqueries: {response}. Returning original query: {q}")
539
- return [q]
540
+ return {q}
540
541
 
541
542
 
542
543
  async def schedule_query(
@@ -1128,9 +1129,6 @@ def generate_chat_response(
1128
1129
 
1129
1130
  metadata = {}
1130
1131
  agent = AgentAdapters.get_conversation_agent_by_id(conversation.agent.id) if conversation.agent else None
1131
- query_to_run = q
1132
- if meta_research:
1133
- query_to_run = f"AI Research: {meta_research} {q}"
1134
1132
  try:
1135
1133
  partial_completion = partial(
1136
1134
  save_to_conversation_log,
@@ -1148,6 +1146,13 @@ def generate_chat_response(
1148
1146
  train_of_thought=train_of_thought,
1149
1147
  )
1150
1148
 
1149
+ query_to_run = q
1150
+ if meta_research:
1151
+ query_to_run = f"<query>{q}</query>\n<collected_research>\n{meta_research}\n</collected_research>"
1152
+ compiled_references = []
1153
+ online_results = {}
1154
+ code_results = {}
1155
+
1151
1156
  conversation_config = ConversationAdapters.get_valid_conversation_config(user, conversation)
1152
1157
  vision_available = conversation_config.vision_enabled
1153
1158
  if not vision_available and query_images:
@@ -1306,25 +1311,28 @@ class ApiUserRateLimiter:
1306
1311
  # Check if the user has exceeded the rate limit
1307
1312
  if subscribed and count_requests >= self.subscribed_requests:
1308
1313
  logger.info(
1309
- f"Rate limit: {count_requests} requests in {self.window} seconds for user: {user}. Limit is {self.subscribed_requests} requests."
1314
+ f"Rate limit: {count_requests}/{self.subscribed_requests} requests not allowed in {self.window} seconds for subscribed user: {user}."
1315
+ )
1316
+ raise HTTPException(
1317
+ status_code=429,
1318
+ detail="I'm glad you're enjoying interacting with me! You've unfortunately exceeded your usage limit for today. But let's chat more tomorrow?",
1310
1319
  )
1311
- raise HTTPException(status_code=429, detail="Slow down! Too Many Requests")
1312
1320
  if not subscribed and count_requests >= self.requests:
1313
1321
  if self.requests >= self.subscribed_requests:
1314
1322
  logger.info(
1315
- f"Rate limit: {count_requests} requests in {self.window} seconds for user: {user}. Limit is {self.subscribed_requests} requests."
1323
+ f"Rate limit: {count_requests}/{self.subscribed_requests} requests not allowed in {self.window} seconds for user: {user}."
1316
1324
  )
1317
1325
  raise HTTPException(
1318
1326
  status_code=429,
1319
- detail="Slow down! Too Many Requests",
1327
+ detail="I'm glad you're enjoying interacting with me! You've unfortunately exceeded your usage limit for today. But let's chat more tomorrow?",
1320
1328
  )
1321
1329
 
1322
1330
  logger.info(
1323
- f"Rate limit: {count_requests} requests in {self.window} seconds for user: {user}. Limit is {self.subscribed_requests} requests."
1331
+ f"Rate limit: {count_requests}/{self.requests} requests not allowed in {self.window} seconds for user: {user}."
1324
1332
  )
1325
1333
  raise HTTPException(
1326
1334
  status_code=429,
1327
- detail="I'm glad you're enjoying interacting with me! But you've exceeded your usage limit for today. Come back tomorrow or subscribe to increase your usage limit via [your settings](https://app.khoj.dev/settings).",
1335
+ detail="I'm glad you're enjoying interacting with me! You've unfortunately exceeded your usage limit for today. You can subscribe to increase your usage limit via [your settings](https://app.khoj.dev/settings) or we can continue our conversation tomorrow?",
1328
1336
  )
1329
1337
 
1330
1338
  # Add the current request to the cache
@@ -1350,6 +1358,7 @@ class ApiImageRateLimiter:
1350
1358
 
1351
1359
  # Check number of images
1352
1360
  if len(body.images) > self.max_images:
1361
+ logger.info(f"Rate limit: {len(body.images)}/{self.max_images} images not allowed per message.")
1353
1362
  raise HTTPException(
1354
1363
  status_code=429,
1355
1364
  detail=f"Those are way too many images for me! I can handle up to {self.max_images} images per message.",
@@ -1370,6 +1379,7 @@ class ApiImageRateLimiter:
1370
1379
  total_size_mb += len(image_bytes) / (1024 * 1024) # Convert bytes to MB
1371
1380
 
1372
1381
  if total_size_mb > self.max_combined_size_mb:
1382
+ logger.info(f"Data limit: {total_size_mb}MB/{self.max_combined_size_mb}MB size not allowed per message.")
1373
1383
  raise HTTPException(
1374
1384
  status_code=429,
1375
1385
  detail=f"Those images are way too large for me! I can handle up to {self.max_combined_size_mb}MB of images per message.",
@@ -1405,13 +1415,19 @@ class ConversationCommandRateLimiter:
1405
1415
 
1406
1416
  if subscribed and count_requests >= self.subscribed_rate_limit:
1407
1417
  logger.info(
1408
- f"Rate limit: {count_requests} requests in 24 hours for user: {user}. Limit is {self.subscribed_rate_limit} requests."
1418
+ f"Rate limit: {count_requests}/{self.subscribed_rate_limit} requests not allowed in 24 hours for subscribed user: {user}."
1419
+ )
1420
+ raise HTTPException(
1421
+ status_code=429,
1422
+ detail=f"I'm glad you're enjoying interacting with me! You've unfortunately exceeded your `/{conversation_command.value}` command usage limit for today. Maybe we can talk about something else for today?",
1409
1423
  )
1410
- raise HTTPException(status_code=429, detail="Slow down! Too Many Requests")
1411
1424
  if not subscribed and count_requests >= self.trial_rate_limit:
1425
+ logger.info(
1426
+ f"Rate limit: {count_requests}/{self.trial_rate_limit} requests not allowed in 24 hours for user: {user}."
1427
+ )
1412
1428
  raise HTTPException(
1413
1429
  status_code=429,
1414
- detail=f"We're glad you're enjoying Khoj! You've exceeded your `/{conversation_command.value}` command usage limit for today. Subscribe to increase your usage limit via [your settings](https://app.khoj.dev/settings).",
1430
+ detail=f"I'm glad you're enjoying interacting with me! You've unfortunately exceeded your `/{conversation_command.value}` command usage limit for today. You can subscribe to increase your usage limit via [your settings](https://app.khoj.dev/settings) or we can talk about something else for today?",
1415
1431
  )
1416
1432
  await UserRequests.objects.acreate(user=user, slug=command_slug)
1417
1433
  return
@@ -1457,16 +1473,28 @@ class ApiIndexedDataLimiter:
1457
1473
  logger.info(f"Deleted {num_deleted_entries} entries for user: {user}.")
1458
1474
 
1459
1475
  if subscribed and incoming_data_size_mb >= self.subscribed_num_entries_size:
1476
+ logger.info(
1477
+ f"Data limit: {incoming_data_size_mb}MB incoming will exceed {self.subscribed_num_entries_size}MB allowed for subscribed user: {user}."
1478
+ )
1460
1479
  raise HTTPException(status_code=429, detail="Too much data indexed.")
1461
1480
  if not subscribed and incoming_data_size_mb >= self.num_entries_size:
1481
+ logger.info(
1482
+ f"Data limit: {incoming_data_size_mb}MB incoming will exceed {self.num_entries_size}MB allowed for user: {user}."
1483
+ )
1462
1484
  raise HTTPException(
1463
1485
  status_code=429, detail="Too much data indexed. Subscribe to increase your data index limit."
1464
1486
  )
1465
1487
 
1466
1488
  user_size_data = EntryAdapters.get_size_of_indexed_data_in_mb(user)
1467
1489
  if subscribed and user_size_data + incoming_data_size_mb >= self.subscribed_total_entries_size:
1490
+ logger.info(
1491
+ f"Data limit: {incoming_data_size_mb}MB incoming + {user_size_data}MB existing will exceed {self.subscribed_total_entries_size}MB allowed for subscribed user: {user}."
1492
+ )
1468
1493
  raise HTTPException(status_code=429, detail="Too much data indexed.")
1469
1494
  if not subscribed and user_size_data + incoming_data_size_mb >= self.total_entries_size_limit:
1495
+ logger.info(
1496
+ f"Data limit: {incoming_data_size_mb}MB incoming + {user_size_data}MB existing will exceed {self.subscribed_total_entries_size}MB allowed for non subscribed user: {user}."
1497
+ )
1470
1498
  raise HTTPException(
1471
1499
  status_code=429, detail="Too much data indexed. Subscribe to increase your data index limit."
1472
1500
  )