khoj 1.29.2.dev35__py3-none-any.whl → 1.30.2.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 (80) hide show
  1. khoj/configure.py +25 -0
  2. khoj/interface/compiled/404/index.html +1 -1
  3. khoj/interface/compiled/_next/static/chunks/1210.ef7a0f9a7e43da1d.js +1 -0
  4. khoj/interface/compiled/_next/static/chunks/1279-4cb23143aa2c0228.js +1 -0
  5. khoj/interface/compiled/_next/static/chunks/1603-1407afe510f0145a.js +1 -0
  6. khoj/interface/compiled/_next/static/chunks/1970-1b63ac1497b03a10.js +1 -0
  7. khoj/interface/compiled/_next/static/chunks/216-b2e4344315b88832.js +1 -0
  8. khoj/interface/compiled/_next/static/chunks/3072-be830e4f8412b9d2.js +1 -0
  9. khoj/interface/compiled/_next/static/chunks/3690-51312931ba1eae30.js +1 -0
  10. khoj/interface/compiled/_next/static/chunks/4504-62ac13e7d94c52f9.js +1 -0
  11. khoj/interface/compiled/_next/static/chunks/5512-7cc62049bbe60e11.js +1 -0
  12. khoj/interface/compiled/_next/static/chunks/5538-e5f3c9f4d67a64b9.js +1 -0
  13. khoj/interface/compiled/_next/static/chunks/{7883-b1305ec254213afe.js → 6901-e3dc0d315e3f6033.js} +2 -2
  14. khoj/interface/compiled/_next/static/chunks/7592-a09c39a38e60634b.js +1 -0
  15. khoj/interface/compiled/_next/static/chunks/8423-1dda16bc56236523.js +1 -0
  16. khoj/interface/compiled/_next/static/chunks/app/agents/{page-ee4f0da14df15091.js → page-5f6e0dacc34e33ad.js} +1 -1
  17. khoj/interface/compiled/_next/static/chunks/app/automations/{layout-27c28e923c9b1ff0.js → layout-7f1b79a2c67af0b4.js} +1 -1
  18. khoj/interface/compiled/_next/static/chunks/app/automations/{page-da59a2b9ec07da16.js → page-60bc7454bc3ea881.js} +1 -1
  19. khoj/interface/compiled/_next/static/chunks/app/chat/{page-e60a55d029b6216a.js → page-ac366c9111374312.js} +1 -1
  20. khoj/interface/compiled/_next/static/chunks/app/{page-fcf7411ff80b6bf5.js → page-358154a4436ef316.js} +1 -1
  21. khoj/interface/compiled/_next/static/chunks/app/search/{page-4f44549ba3807021.js → page-64ea1717528979af.js} +1 -1
  22. khoj/interface/compiled/_next/static/chunks/app/settings/{layout-254eaaf916449a60.js → layout-1f4d76a8b09517b1.js} +1 -1
  23. khoj/interface/compiled/_next/static/chunks/app/settings/page-17a538580c65e7fe.js +1 -0
  24. khoj/interface/compiled/_next/static/chunks/app/share/chat/{page-4a4c0f199b89bd80.js → page-47641b3691fb0856.js} +1 -1
  25. khoj/interface/compiled/_next/static/chunks/webpack-2389f756cfc04602.js +1 -0
  26. khoj/interface/compiled/_next/static/css/1a4038cc4acc8ee4.css +25 -0
  27. khoj/interface/compiled/agents/index.html +1 -1
  28. khoj/interface/compiled/agents/index.txt +2 -2
  29. khoj/interface/compiled/automations/index.html +1 -1
  30. khoj/interface/compiled/automations/index.txt +3 -3
  31. khoj/interface/compiled/chat/index.html +1 -1
  32. khoj/interface/compiled/chat/index.txt +2 -2
  33. khoj/interface/compiled/index.html +1 -1
  34. khoj/interface/compiled/index.txt +2 -2
  35. khoj/interface/compiled/search/index.html +1 -1
  36. khoj/interface/compiled/search/index.txt +2 -2
  37. khoj/interface/compiled/settings/index.html +1 -1
  38. khoj/interface/compiled/settings/index.txt +3 -3
  39. khoj/interface/compiled/share/chat/index.html +1 -1
  40. khoj/interface/compiled/share/chat/index.txt +2 -2
  41. khoj/processor/conversation/anthropic/utils.py +15 -1
  42. khoj/processor/conversation/google/utils.py +12 -1
  43. khoj/processor/conversation/openai/utils.py +33 -19
  44. khoj/processor/conversation/prompts.py +61 -41
  45. khoj/processor/conversation/utils.py +32 -14
  46. khoj/routers/api.py +1 -1
  47. khoj/routers/api_chat.py +33 -17
  48. khoj/routers/helpers.py +70 -57
  49. khoj/utils/constants.py +19 -1
  50. khoj/utils/helpers.py +24 -0
  51. {khoj-1.29.2.dev35.dist-info → khoj-1.30.2.dev22.dist-info}/METADATA +1 -1
  52. {khoj-1.29.2.dev35.dist-info → khoj-1.30.2.dev22.dist-info}/RECORD +65 -65
  53. khoj/interface/compiled/_next/static/chunks/1210.132a7e1910006bbb.js +0 -1
  54. khoj/interface/compiled/_next/static/chunks/1279-f37ee4a388ebf544.js +0 -1
  55. khoj/interface/compiled/_next/static/chunks/1603-dc5fd983dbcd070d.js +0 -1
  56. khoj/interface/compiled/_next/static/chunks/1970-c78f6acc8e16e30b.js +0 -1
  57. khoj/interface/compiled/_next/static/chunks/2261-748f7c327df3c8c1.js +0 -1
  58. khoj/interface/compiled/_next/static/chunks/3062-71ed4b46ac2bb87c.js +0 -1
  59. khoj/interface/compiled/_next/static/chunks/3803-d74118a2d0182c52.js +0 -1
  60. khoj/interface/compiled/_next/static/chunks/4504-1629487c8bc82203.js +0 -1
  61. khoj/interface/compiled/_next/static/chunks/5512-94c7c2bbcf58c19d.js +0 -1
  62. khoj/interface/compiled/_next/static/chunks/5538-b87b60ecc0c27ceb.js +0 -1
  63. khoj/interface/compiled/_next/static/chunks/8423-c0123d454681e03a.js +0 -1
  64. khoj/interface/compiled/_next/static/chunks/9001-3b27af6d5f21df44.js +0 -1
  65. khoj/interface/compiled/_next/static/chunks/app/settings/page-5591490850437232.js +0 -1
  66. khoj/interface/compiled/_next/static/chunks/webpack-323bbe2678102a2f.js +0 -1
  67. khoj/interface/compiled/_next/static/css/ed437164d77aa600.css +0 -25
  68. /khoj/interface/compiled/_next/static/{bkshWraYdEa_w254xnxBc → Tua1S1yzYQvGP_toWnaaz}/_buildManifest.js +0 -0
  69. /khoj/interface/compiled/_next/static/{bkshWraYdEa_w254xnxBc → Tua1S1yzYQvGP_toWnaaz}/_ssgManifest.js +0 -0
  70. /khoj/interface/compiled/_next/static/chunks/{3124-a4cea2eda163128d.js → 3124-e8410bbd01f6f188.js} +0 -0
  71. /khoj/interface/compiled/_next/static/chunks/{4602-8eeb4b76385ad159.js → 4602-460621c3241e0d13.js} +0 -0
  72. /khoj/interface/compiled/_next/static/chunks/{6297-d1c842ed3f714ab0.js → 6297-55f82537bb7068dd.js} +0 -0
  73. /khoj/interface/compiled/_next/static/chunks/{7023-a5bf5744d19b3bd3.js → 7023-e8de2bded4df6539.js} +0 -0
  74. /khoj/interface/compiled/_next/static/chunks/{796-68f9e87f9cdfda1d.js → 796-36ee2d6829448c6d.js} +0 -0
  75. /khoj/interface/compiled/_next/static/chunks/{9417-32c4db52ca42e681.js → 9417-06236cd650f1abcd.js} +0 -0
  76. /khoj/interface/compiled/_next/static/chunks/app/_not-found/{page-07ff4ab42b07845e.js → page-cfba071f5a657256.js} +0 -0
  77. /khoj/interface/compiled/_next/static/chunks/{fd9d1056-2b978342deb60015.js → fd9d1056-2e6c8140e79afc3b.js} +0 -0
  78. {khoj-1.29.2.dev35.dist-info → khoj-1.30.2.dev22.dist-info}/WHEEL +0 -0
  79. {khoj-1.29.2.dev35.dist-info → khoj-1.30.2.dev22.dist-info}/entry_points.txt +0 -0
  80. {khoj-1.29.2.dev35.dist-info → khoj-1.30.2.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/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/ed437164d77aa600.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/3cf13271869a4aeb.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/2ff098d0815fdbc1.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-323bbe2678102a2f.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/3124-a4cea2eda163128d.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/796-68f9e87f9cdfda1d.js" async=""></script><script src="/_next/static/chunks/1603-dc5fd983dbcd070d.js" async=""></script><script src="/_next/static/chunks/9417-32c4db52ca42e681.js" async=""></script><script src="/_next/static/chunks/8423-c0123d454681e03a.js" async=""></script><script src="/_next/static/chunks/5538-b87b60ecc0c27ceb.js" async=""></script><script src="/_next/static/chunks/app/share/chat/page-4a4c0f199b89bd80.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"/><meta property="og:description" content="Your Second Brain."/><meta property="og:url" content="https://app.khoj.dev/"/><meta property="og:site_name" content="Khoj AI"/><meta property="og:image" content="https://assets.khoj.dev/khoj_lantern_256x256.png"/><meta property="og:image:width" content="256"/><meta property="og:image:height" content="256"/><meta property="og:image" content="https://assets.khoj.dev/khoj_lantern_logomarktype_1200x630.png"/><meta property="og:image:width" content="1200"/><meta property="og:image:height" content="630"/><meta property="og:type" content="website"/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:title" content="Khoj AI"/><meta name="twitter:description" content="Your Second Brain."/><meta name="twitter:image" content="https://assets.khoj.dev/khoj_lantern_256x256.png"/><meta name="twitter:image:width" content="256"/><meta name="twitter:image:height" content="256"/><meta name="twitter:image" content="https://assets.khoj.dev/khoj_lantern_logomarktype_1200x630.png"/><meta name="twitter:image:width" content="1200"/><meta name="twitter:image:height" content="630"/><link rel="icon" href="/static/assets/icons/khoj_lantern.ico"/><link rel="apple-touch-icon" href="/static/assets/icons/khoj_lantern_256x256.png"/><meta name="next-size-adjust"/><script src="/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js" noModule=""></script></head><body class="__className_af6c42"><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-323bbe2678102a2f.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/ed437164d77aa600.css\",\"style\"]\n4:HL[\"/_next/static/css/3cf13271869a4aeb.css\",\"style\"]\n5:HL[\"/_next/static/css/2ff098d0815fdbc1.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\",\"3124\",\"static/chunks/3124-a4cea2eda163128d.js\",\"3803\",\"static/chunks/3803-d74118a2d0182c52.js\",\"2261\",\"static/chunks/2261-748f7c327df3c8c1.js\",\"796\",\"static/chunks/796-68f9e87f9cdfda1d.js\",\"1603\",\"static/chunks/1603-dc5fd983dbcd070d.js\",\"9417\",\"static/chunks/9417-32c4db52ca42e681.js\",\"8423\",\"static/chunks/8423-c0123d454681e03a.js\",\"5538\",\"static/chunks/5538-b87b60ecc0c27ceb.js\",\"3111\",\"static/chunks/app/share/chat/page-4a4c0f199b89bd80.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\":\"bkshWraYdEa_w254xnxBc\",\"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/2ff098d0815fdbc1.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/ed437164d77aa600.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\"}],[\"$\",\"meta\",\"6\",{\"property\":\"og:description\",\"content\":\"Your Second Brain.\"}],[\"$\",\"meta\",\"7\",{\"property\":\"og:url\",\"content\":\"https://app.khoj.dev/\"}],[\"$\",\"meta\",\"8\",{\"property\":\"og:site_name\",\"content\":\"Khoj AI\"}],[\"$\",\"meta\",\"9\",{\"property\":\"og:image\",\"content\":\"https://assets.khoj.dev/khoj_lantern_256x256.png\"}],[\"$\",\"meta\",\"10\",{\"property\":\"og:image:width\",\"content\":\"256\"}],[\"$\",\"meta\",\"11\",{\"property\":\"og:image:height\",\"content\":\"256\"}],[\"$\",\"meta\",\"12\",{\"property\":\"og:image\",\"content\":\"https://assets.khoj.dev/khoj_lantern_logomarktype_1200x630.png\"}],[\"$\",\"meta\",\"13\",{\"property\":\"og:image:width\",\"content\":\"1200\"}],[\"$\",\"meta\",\"14\",{\"property\":\"og:image:height\",\"content\":\"630\"}],[\"$\",\"meta\",\"15\",{\"property\":\"og:type\",\"content\":\"website\"}],[\"$\",\"meta\",\"16\",{\"name\":\"twitter:card\",\"content\":\"summary_large_image\"}],[\"$\",\"meta\",\"17\",{\"name\":\"twitter:title\",\"content\":\"Khoj AI\"}],[\"$\",\"meta\",\"18\",{\"name\":\"twitter:description\",\"content\":\"Your Second Brain.\"}],[\"$\",\"meta\",\"19\",{\"name\":\"twitter:image\",\"content\":\"https://assets.khoj.dev/khoj_lantern_256x256.png\"}],[\"$\",\"meta\",\"20\",{\"name\":\"twitter:image:width\",\"content\":\"256\"}],[\"$\",\"meta\",\"21\",{\"name\":\"twitter:image:height\",\"content\":\"256\"}],[\"$\",\"meta\",\"22\",{\"name\":\"twitter:image\",\"content\":\"https://assets.khoj.dev/khoj_lantern_logomarktype_1200x630.png\"}],[\"$\",\"meta\",\"23\",{\"name\":\"twitter:image:width\",\"content\":\"1200\"}],[\"$\",\"meta\",\"24\",{\"name\":\"twitter:image:height\",\"content\":\"630\"}],[\"$\",\"link\",\"25\",{\"rel\":\"icon\",\"href\":\"/static/assets/icons/khoj_lantern.ico\"}],[\"$\",\"link\",\"26\",{\"rel\":\"apple-touch-icon\",\"href\":\"/static/assets/icons/khoj_lantern_256x256.png\"}],[\"$\",\"meta\",\"27\",{\"name\":\"next-size-adjust\"}]]\n"])</script><script>self.__next_f.push([1,"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/1a4038cc4acc8ee4.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/3cf13271869a4aeb.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/2ff098d0815fdbc1.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-2389f756cfc04602.js"/><script src="/_next/static/chunks/fd9d1056-2e6c8140e79afc3b.js" async=""></script><script src="/_next/static/chunks/7023-e8de2bded4df6539.js" async=""></script><script src="/_next/static/chunks/main-app-6d6ee3495efe03d4.js" async=""></script><script src="/_next/static/chunks/d3ac728e-a9e3522eef9b6b28.js" async=""></script><script src="/_next/static/chunks/3072-be830e4f8412b9d2.js" async=""></script><script src="/_next/static/chunks/216-b2e4344315b88832.js" async=""></script><script src="/_next/static/chunks/3124-e8410bbd01f6f188.js" async=""></script><script src="/_next/static/chunks/7592-a09c39a38e60634b.js" async=""></script><script src="/_next/static/chunks/3690-51312931ba1eae30.js" async=""></script><script src="/_next/static/chunks/796-36ee2d6829448c6d.js" async=""></script><script src="/_next/static/chunks/1603-1407afe510f0145a.js" async=""></script><script src="/_next/static/chunks/9417-06236cd650f1abcd.js" async=""></script><script src="/_next/static/chunks/8423-1dda16bc56236523.js" async=""></script><script src="/_next/static/chunks/5538-e5f3c9f4d67a64b9.js" async=""></script><script src="/_next/static/chunks/app/share/chat/page-47641b3691fb0856.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"/><meta property="og:description" content="Your Second Brain."/><meta property="og:url" content="https://app.khoj.dev/"/><meta property="og:site_name" content="Khoj AI"/><meta property="og:image" content="https://assets.khoj.dev/khoj_lantern_256x256.png"/><meta property="og:image:width" content="256"/><meta property="og:image:height" content="256"/><meta property="og:image" content="https://assets.khoj.dev/khoj_lantern_logomarktype_1200x630.png"/><meta property="og:image:width" content="1200"/><meta property="og:image:height" content="630"/><meta property="og:type" content="website"/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:title" content="Khoj AI"/><meta name="twitter:description" content="Your Second Brain."/><meta name="twitter:image" content="https://assets.khoj.dev/khoj_lantern_256x256.png"/><meta name="twitter:image:width" content="256"/><meta name="twitter:image:height" content="256"/><meta name="twitter:image" content="https://assets.khoj.dev/khoj_lantern_logomarktype_1200x630.png"/><meta name="twitter:image:width" content="1200"/><meta name="twitter:image:height" content="630"/><link rel="icon" href="/static/assets/icons/khoj_lantern.ico"/><link rel="apple-touch-icon" href="/static/assets/icons/khoj_lantern_256x256.png"/><meta name="next-size-adjust"/><script src="/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js" noModule=""></script></head><body class="__className_af6c42"><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-2389f756cfc04602.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/1a4038cc4acc8ee4.css\",\"style\"]\n4:HL[\"/_next/static/css/3cf13271869a4aeb.css\",\"style\"]\n5:HL[\"/_next/static/css/2ff098d0815fdbc1.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\",\"3072\",\"static/chunks/3072-be830e4f8412b9d2.js\",\"216\",\"static/chunks/216-b2e4344315b88832.js\",\"3124\",\"static/chunks/3124-e8410bbd01f6f188.js\",\"7592\",\"static/chunks/7592-a09c39a38e60634b.js\",\"3690\",\"static/chunks/3690-51312931ba1eae30.js\",\"796\",\"static/chunks/796-36ee2d6829448c6d.js\",\"1603\",\"static/chunks/1603-1407afe510f0145a.js\",\"9417\",\"static/chunks/9417-06236cd650f1abcd.js\",\"8423\",\"static/chunks/8423-1dda16bc56236523.js\",\"5538\",\"static/chunks/5538-e5f3c9f4d67a64b9.js\",\"3111\",\"static/chunks/app/share/chat/page-47641b3691fb0856.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\":\"Tua1S1yzYQvGP_toWnaaz\",\"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/2ff098d0815fdbc1.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/1a4038cc4acc8ee4.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[[\"$\",\"meta\",null,{\"httpEquiv\":\"Content-Security-Policy\",\"content\":\"default-src 'self' https://assets.khoj.dev; media-src * blob:; script-src 'self' https://assets.khoj.dev 'unsafe-inline' 'unsafe-eval'; connect-src 'self' blob: https://ipapi.co/json ws://localhost:42110; style-src 'self' https://assets.khoj.dev 'unsafe-inline' https://fonts.googleapis.com; img-src 'self' data: blob: https://*.khoj.dev https://*.googleusercontent.com https://*.google.com/ https://*.gstatic.com; font-src 'self' https://assets.khoj.dev https://fonts.gstatic.com; child-src 'none'; object-src 'none';\"}],[\"$\",\"body\",null,{\"className\":\"__className_af6c42\",\"children\":[\"$\",\"$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\"}],[\"$\",\"meta\",\"6\",{\"property\":\"og:description\",\"content\":\"Your Second Brain.\"}],[\"$\",\"meta\",\"7\",{\"property\":\"og:url\",\"content\":\"https://app.khoj.dev/\"}],[\"$\",\"meta\",\"8\",{\"property\":\"og:site_name\",\"content\":\"Khoj AI\"}],[\"$\",\"meta\",\"9\",{\"property\":\"og:image\",\"content\":\"https://assets.khoj.dev/khoj_lantern_256x256.png\"}],[\"$\",\"meta\",\"10\",{\"property\":\"og:image:width\",\"content\":\"256\"}],[\"$\",\"meta\",\"11\",{\"property\":\"og:image:height\",\"content\":\"256\"}],[\"$\",\"meta\",\"12\",{\"property\":\"og:image\",\"content\":\"https://assets.khoj.dev/khoj_lantern_logomarktype_1200x630.png\"}],[\"$\",\"meta\",\"13\",{\"property\":\"og:image:width\",\"content\":\"1200\"}],[\"$\",\"meta\",\"14\",{\"property\":\"og:image:height\",\"content\":\"630\"}],[\"$\",\"meta\",\"15\",{\"property\":\"og:type\",\"content\":\"website\"}],[\"$\",\"meta\",\"16\",{\"name\":\"twitter:card\",\"content\":\"summary_large_image\"}],[\"$\",\"meta\",\"17\",{\"name\":\"twitter:title\",\"content\":\"Khoj AI\"}],[\"$\",\"meta\",\"18\",{\"name\":\"twitter:description\",\"content\":\"Your Second Brain.\"}],[\"$\",\"meta\",\"19\",{\"name\":\"twitter:image\",\"content\":\"https://assets.khoj.dev/khoj_lantern_256x256.png\"}],[\"$\",\"meta\",\"20\",{\"name\":\"twitter:image:width\",\"content\":\"256\"}],[\"$\",\"meta\",\"21\",{\"name\":\"twitter:image:height\",\"content\":\"256\"}],[\"$\",\"meta\",\"22\",{\"name\":\"twitter:image\",\"content\":\"https://assets.khoj.dev/khoj_lantern_logomarktype_1200x630.png\"}],[\"$\",\"meta\",\"23\",{\"name\":\"twitter:image:width\",\"content\":\"1200\"}],[\"$\",\"meta\",\"24\",{\"name\":\"twitter:image:height\",\"content\":\"630\"}],[\"$\",\"link\",\"25\",{\"rel\":\"icon\",\"href\":\"/static/assets/icons/khoj_lantern.ico\"}],[\"$\",\"link\",\"26\",{\"rel\":\"apple-touch-icon\",\"href\":\"/static/assets/icons/khoj_lantern_256x256.png\"}],[\"$\",\"meta\",\"27\",{\"name\":\"next-size-adjust\"}]]\n"])</script><script>self.__next_f.push([1,"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","3124","static/chunks/3124-a4cea2eda163128d.js","3803","static/chunks/3803-d74118a2d0182c52.js","2261","static/chunks/2261-748f7c327df3c8c1.js","796","static/chunks/796-68f9e87f9cdfda1d.js","1603","static/chunks/1603-dc5fd983dbcd070d.js","9417","static/chunks/9417-32c4db52ca42e681.js","8423","static/chunks/8423-c0123d454681e03a.js","5538","static/chunks/5538-b87b60ecc0c27ceb.js","3111","static/chunks/app/share/chat/page-4a4c0f199b89bd80.js"],"default",1]
2
+ 3:I[5506,["3954","static/chunks/d3ac728e-a9e3522eef9b6b28.js","3072","static/chunks/3072-be830e4f8412b9d2.js","216","static/chunks/216-b2e4344315b88832.js","3124","static/chunks/3124-e8410bbd01f6f188.js","7592","static/chunks/7592-a09c39a38e60634b.js","3690","static/chunks/3690-51312931ba1eae30.js","796","static/chunks/796-36ee2d6829448c6d.js","1603","static/chunks/1603-1407afe510f0145a.js","9417","static/chunks/9417-06236cd650f1abcd.js","8423","static/chunks/8423-1dda16bc56236523.js","5538","static/chunks/5538-e5f3c9f4d67a64b9.js","3111","static/chunks/app/share/chat/page-47641b3691fb0856.js"],"default",1]
3
3
  4:I[39275,[],""]
4
4
  5:I[61343,[],""]
5
- 0:["bkshWraYdEa_w254xnxBc",[[["",{"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/2ff098d0815fdbc1.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/ed437164d77aa600.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]]]]
5
+ 0:["Tua1S1yzYQvGP_toWnaaz",[[["",{"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/2ff098d0815fdbc1.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/1a4038cc4acc8ee4.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":[["$","meta",null,{"httpEquiv":"Content-Security-Policy","content":"default-src 'self' https://assets.khoj.dev; media-src * blob:; script-src 'self' https://assets.khoj.dev 'unsafe-inline' 'unsafe-eval'; connect-src 'self' blob: https://ipapi.co/json ws://localhost:42110; style-src 'self' https://assets.khoj.dev 'unsafe-inline' https://fonts.googleapis.com; img-src 'self' data: blob: https://*.khoj.dev https://*.googleusercontent.com https://*.google.com/ https://*.gstatic.com; font-src 'self' https://assets.khoj.dev https://fonts.gstatic.com; child-src 'none'; object-src 'none';"}],["$","body",null,{"className":"__className_af6c42","children":["$","$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"}],["$","meta","6",{"property":"og:description","content":"Your Second Brain."}],["$","meta","7",{"property":"og:url","content":"https://app.khoj.dev/"}],["$","meta","8",{"property":"og:site_name","content":"Khoj AI"}],["$","meta","9",{"property":"og:image","content":"https://assets.khoj.dev/khoj_lantern_256x256.png"}],["$","meta","10",{"property":"og:image:width","content":"256"}],["$","meta","11",{"property":"og:image:height","content":"256"}],["$","meta","12",{"property":"og:image","content":"https://assets.khoj.dev/khoj_lantern_logomarktype_1200x630.png"}],["$","meta","13",{"property":"og:image:width","content":"1200"}],["$","meta","14",{"property":"og:image:height","content":"630"}],["$","meta","15",{"property":"og:type","content":"website"}],["$","meta","16",{"name":"twitter:card","content":"summary_large_image"}],["$","meta","17",{"name":"twitter:title","content":"Khoj AI"}],["$","meta","18",{"name":"twitter:description","content":"Your Second Brain."}],["$","meta","19",{"name":"twitter:image","content":"https://assets.khoj.dev/khoj_lantern_256x256.png"}],["$","meta","20",{"name":"twitter:image:width","content":"256"}],["$","meta","21",{"name":"twitter:image:height","content":"256"}],["$","meta","22",{"name":"twitter:image","content":"https://assets.khoj.dev/khoj_lantern_logomarktype_1200x630.png"}],["$","meta","23",{"name":"twitter:image:width","content":"1200"}],["$","meta","24",{"name":"twitter:image:height","content":"630"}],["$","link","25",{"rel":"icon","href":"/static/assets/icons/khoj_lantern.ico"}],["$","link","26",{"rel":"apple-touch-icon","href":"/static/assets/icons/khoj_lantern_256x256.png"}],["$","meta","27",{"name":"next-size-adjust"}]]
7
7
  1:null
@@ -18,7 +18,7 @@ from khoj.processor.conversation.utils import (
18
18
  get_image_from_url,
19
19
  )
20
20
  from khoj.utils import state
21
- from khoj.utils.helpers import in_debug_mode, is_none_or_empty
21
+ from khoj.utils.helpers import get_chat_usage_metrics, in_debug_mode, is_none_or_empty
22
22
 
23
23
  logger = logging.getLogger(__name__)
24
24
 
@@ -59,6 +59,7 @@ def anthropic_completion_with_backoff(
59
59
  aggregated_response = "{" if response_type == "json_object" else ""
60
60
  max_tokens = max_tokens or DEFAULT_MAX_TOKENS_ANTHROPIC
61
61
 
62
+ final_message = None
62
63
  model_kwargs = model_kwargs or dict()
63
64
  if system_prompt:
64
65
  model_kwargs["system"] = system_prompt
@@ -73,6 +74,12 @@ def anthropic_completion_with_backoff(
73
74
  ) as stream:
74
75
  for text in stream.text_stream:
75
76
  aggregated_response += text
77
+ final_message = stream.get_final_message()
78
+
79
+ # Calculate cost of chat
80
+ input_tokens = final_message.usage.input_tokens
81
+ output_tokens = final_message.usage.output_tokens
82
+ tracer["usage"] = get_chat_usage_metrics(model_name, input_tokens, output_tokens, tracer.get("usage"))
76
83
 
77
84
  # Save conversation trace
78
85
  tracer["chat_model"] = model_name
@@ -126,6 +133,7 @@ def anthropic_llm_thread(
126
133
  ]
127
134
 
128
135
  aggregated_response = ""
136
+ final_message = None
129
137
  with client.messages.stream(
130
138
  messages=formatted_messages,
131
139
  model=model_name, # type: ignore
@@ -138,6 +146,12 @@ def anthropic_llm_thread(
138
146
  for text in stream.text_stream:
139
147
  aggregated_response += text
140
148
  g.send(text)
149
+ final_message = stream.get_final_message()
150
+
151
+ # Calculate cost of chat
152
+ input_tokens = final_message.usage.input_tokens
153
+ output_tokens = final_message.usage.output_tokens
154
+ tracer["usage"] = get_chat_usage_metrics(model_name, input_tokens, output_tokens, tracer.get("usage"))
141
155
 
142
156
  # Save conversation trace
143
157
  tracer["chat_model"] = model_name
@@ -25,7 +25,7 @@ from khoj.processor.conversation.utils import (
25
25
  get_image_from_url,
26
26
  )
27
27
  from khoj.utils import state
28
- from khoj.utils.helpers import in_debug_mode, is_none_or_empty
28
+ from khoj.utils.helpers import get_chat_usage_metrics, in_debug_mode, is_none_or_empty
29
29
 
30
30
  logger = logging.getLogger(__name__)
31
31
 
@@ -68,6 +68,7 @@ def gemini_completion_with_backoff(
68
68
  response = chat_session.send_message(formatted_messages[-1]["parts"])
69
69
  response_text = response.text
70
70
  except StopCandidateException as e:
71
+ response = None
71
72
  response_text, _ = handle_gemini_response(e.args)
72
73
  # Respond with reason for stopping
73
74
  logger.warning(
@@ -75,6 +76,11 @@ def gemini_completion_with_backoff(
75
76
  + f"Last Message by {messages[-1].role}: {messages[-1].content}"
76
77
  )
77
78
 
79
+ # Aggregate cost of chat
80
+ input_tokens = response.usage_metadata.prompt_token_count if response else 0
81
+ output_tokens = response.usage_metadata.candidates_token_count if response else 0
82
+ tracer["usage"] = get_chat_usage_metrics(model_name, input_tokens, output_tokens, tracer.get("usage"))
83
+
78
84
  # Save conversation trace
79
85
  tracer["chat_model"] = model_name
80
86
  tracer["temperature"] = temperature
@@ -146,6 +152,11 @@ def gemini_llm_thread(
146
152
  if stopped:
147
153
  raise StopCandidateException(message)
148
154
 
155
+ # Calculate cost of chat
156
+ input_tokens = chunk.usage_metadata.prompt_token_count
157
+ output_tokens = chunk.usage_metadata.candidates_token_count
158
+ tracer["usage"] = get_chat_usage_metrics(model_name, input_tokens, output_tokens, tracer.get("usage"))
159
+
149
160
  # Save conversation trace
150
161
  tracer["chat_model"] = model_name
151
162
  tracer["temperature"] = temperature
@@ -4,6 +4,8 @@ from threading import Thread
4
4
  from typing import Dict
5
5
 
6
6
  import openai
7
+ from openai.types.chat.chat_completion import ChatCompletion
8
+ from openai.types.chat.chat_completion_chunk import ChatCompletionChunk
7
9
  from tenacity import (
8
10
  before_sleep_log,
9
11
  retry,
@@ -18,7 +20,7 @@ from khoj.processor.conversation.utils import (
18
20
  commit_conversation_trace,
19
21
  )
20
22
  from khoj.utils import state
21
- from khoj.utils.helpers import in_debug_mode
23
+ from khoj.utils.helpers import get_chat_usage_metrics, in_debug_mode
22
24
 
23
25
  logger = logging.getLogger(__name__)
24
26
 
@@ -56,7 +58,6 @@ def completion_with_backoff(
56
58
  # Update request parameters for compatability with o1 model series
57
59
  # Refer: https://platform.openai.com/docs/guides/reasoning/beta-limitations
58
60
  if model.startswith("o1"):
59
- stream = False
60
61
  temperature = 1
61
62
  model_kwargs.pop("stop", None)
62
63
  model_kwargs.pop("response_format", None)
@@ -64,27 +65,34 @@ def completion_with_backoff(
64
65
  if os.getenv("KHOJ_LLM_SEED"):
65
66
  model_kwargs["seed"] = int(os.getenv("KHOJ_LLM_SEED"))
66
67
 
67
- chat = client.chat.completions.create(
68
- stream=stream,
68
+ chat: ChatCompletion | openai.Stream[ChatCompletionChunk] = client.chat.completions.create(
69
69
  messages=formatted_messages, # type: ignore
70
70
  model=model, # type: ignore
71
+ stream=stream,
72
+ stream_options={"include_usage": True} if stream else {},
71
73
  temperature=temperature,
72
74
  timeout=20,
73
75
  **(model_kwargs or dict()),
74
76
  )
75
77
 
76
- if not stream:
77
- return chat.choices[0].message.content
78
-
79
78
  aggregated_response = ""
80
- for chunk in chat:
81
- if len(chunk.choices) == 0:
82
- continue
83
- delta_chunk = chunk.choices[0].delta # type: ignore
84
- if isinstance(delta_chunk, str):
85
- aggregated_response += delta_chunk
86
- elif delta_chunk.content:
87
- aggregated_response += delta_chunk.content
79
+ if not stream:
80
+ chunk = chat
81
+ aggregated_response = chunk.choices[0].message.content
82
+ else:
83
+ for chunk in chat:
84
+ if len(chunk.choices) == 0:
85
+ continue
86
+ delta_chunk = chunk.choices[0].delta # type: ignore
87
+ if isinstance(delta_chunk, str):
88
+ aggregated_response += delta_chunk
89
+ elif delta_chunk.content:
90
+ aggregated_response += delta_chunk.content
91
+
92
+ # Calculate cost of chat
93
+ input_tokens = chunk.usage.prompt_tokens if hasattr(chunk, "usage") and chunk.usage else 0
94
+ output_tokens = chunk.usage.completion_tokens if hasattr(chunk, "usage") and chunk.usage else 0
95
+ tracer["usage"] = get_chat_usage_metrics(model, input_tokens, output_tokens, tracer.get("usage"))
88
96
 
89
97
  # Save conversation trace
90
98
  tracer["chat_model"] = model
@@ -156,7 +164,6 @@ def llm_thread(
156
164
  # Update request parameters for compatability with o1 model series
157
165
  # Refer: https://platform.openai.com/docs/guides/reasoning/beta-limitations
158
166
  if model_name.startswith("o1"):
159
- stream = False
160
167
  temperature = 1
161
168
  model_kwargs.pop("stop", None)
162
169
  model_kwargs.pop("response_format", None)
@@ -164,10 +171,11 @@ def llm_thread(
164
171
  if os.getenv("KHOJ_LLM_SEED"):
165
172
  model_kwargs["seed"] = int(os.getenv("KHOJ_LLM_SEED"))
166
173
 
167
- chat = client.chat.completions.create(
168
- stream=stream,
174
+ chat: ChatCompletion | openai.Stream[ChatCompletionChunk] = client.chat.completions.create(
169
175
  messages=formatted_messages,
170
176
  model=model_name, # type: ignore
177
+ stream=stream,
178
+ stream_options={"include_usage": True} if stream else {},
171
179
  temperature=temperature,
172
180
  timeout=20,
173
181
  **(model_kwargs or dict()),
@@ -175,7 +183,8 @@ def llm_thread(
175
183
 
176
184
  aggregated_response = ""
177
185
  if not stream:
178
- aggregated_response = chat.choices[0].message.content
186
+ chunk = chat
187
+ aggregated_response = chunk.choices[0].message.content
179
188
  g.send(aggregated_response)
180
189
  else:
181
190
  for chunk in chat:
@@ -191,6 +200,11 @@ def llm_thread(
191
200
  aggregated_response += text_chunk
192
201
  g.send(text_chunk)
193
202
 
203
+ # Calculate cost of chat
204
+ input_tokens = chunk.usage.prompt_tokens if hasattr(chunk, "usage") and chunk.usage else 0
205
+ output_tokens = chunk.usage.completion_tokens if hasattr(chunk, "usage") and chunk.usage else 0
206
+ tracer["usage"] = get_chat_usage_metrics(model_name, input_tokens, output_tokens, tracer.get("usage"))
207
+
194
208
  # Save conversation trace
195
209
  tracer["chat_model"] = model_name
196
210
  tracer["temperature"] = temperature
@@ -183,20 +183,23 @@ Improved Prompt:
183
183
 
184
184
  improve_diagram_description_prompt = PromptTemplate.from_template(
185
185
  """
186
- you are an architect working with a novice artist using a diagramming tool.
186
+ you are an architect working with a novice digital artist using a diagramming software.
187
187
  {personality_context}
188
188
 
189
189
  you need to convert the user's query to a description format that the novice artist can use very well. you are allowed to use primitives like
190
190
  - text
191
191
  - rectangle
192
- - diamond
193
192
  - ellipse
194
193
  - line
195
194
  - arrow
196
195
 
197
196
  use these primitives to describe what sort of diagram the drawer should create. the artist must recreate the diagram every time, so include all relevant prior information in your description.
198
197
 
199
- use simple, concise language.
198
+ - include the full, exact description. the artist does not have much experience, so be precise.
199
+ - describe the layout.
200
+ - you can only use straight lines.
201
+ - use simple, concise language.
202
+ - keep it simple and easy to understand. the artist is easily distracted.
200
203
 
201
204
  Today's Date: {current_date}
202
205
  User's Location: {location}
@@ -218,19 +221,23 @@ Query: {query}
218
221
 
219
222
  excalidraw_diagram_generation_prompt = PromptTemplate.from_template(
220
223
  """
221
- You are a program manager with the ability to describe diagrams to compose in professional, fine detail.
224
+ You are a program manager with the ability to describe diagrams to compose in professional, fine detail. You LOVE getting into the details and making tedious labels, lines, and shapes look beautiful. You make everything look perfect.
222
225
  {personality_context}
223
226
 
224
- You need to create a declarative description of the diagram and relevant components, using this base schema. Use the `label` property to specify the text to be rendered in the respective elements. Always use light colors for the `backgroundColor` property, like white, or light blue, green, red. "type", "x", "y", "id", are required properties for all elements.
227
+ You need to create a declarative description of the diagram and relevant components, using this base schema.
228
+ - `label`: specify the text to be rendered in the respective elements.
229
+ - Always use light colors for the `backgroundColor` property, like white, or light blue, green, red
230
+ - **ALWAYS Required properties for ALL elements**: `type`, `x`, `y`, `id`.
231
+ - Be very generous with spacing and composition. Use ample space between elements.
225
232
 
226
233
  {{
227
234
  type: string,
228
235
  x: number,
229
236
  y: number,
230
- strokeColor: string,
231
- backgroundColor: string,
232
237
  width: number,
233
238
  height: number,
239
+ strokeColor: string,
240
+ backgroundColor: string,
234
241
  id: string,
235
242
  label: {{
236
243
  text: string,
@@ -240,28 +247,30 @@ You need to create a declarative description of the diagram and relevant compone
240
247
  Valid types:
241
248
  - text
242
249
  - rectangle
243
- - diamond
244
250
  - ellipse
245
251
  - line
246
252
  - arrow
247
253
 
248
- For arrows and lines, you can use the `points` property to specify the start and end points of the arrow. You may also use the `label` property to specify the text to be rendered. You may use the `start` and `end` properties to connect the linear elements to other elements. The start and end point can either be the ID to map to an existing object, or the `type` to create a new object. Mapping to an existing object is useful if you want to connect it to multiple objects. Lines and arrows can only start and end at rectangle, text, diamond, or ellipse elements.
254
+ For arrows and lines,
255
+ - `points`: specify the start and end points of the arrow
256
+ - **ALWAYS Required properties for ALL elements**: `type`, `x`, `y`, `id`.
257
+ - `start` and `end` properties: connect the linear elements to other elements. The start and end point can either be the ID to map to an existing object, or the `type` and `text` to create a new object. Mapping to an existing object is useful if you want to connect it to multiple objects. Lines and arrows can only start and end at rectangle, text, or ellipse elements. Even if you're using the `start` and `end` properties, you still need to specify the `x` and `y` properties for the start and end points.
249
258
 
250
259
  {{
251
260
  type: "arrow",
252
261
  id: string,
253
262
  x: number,
254
263
  y: number,
255
- width: number,
256
- height: number,
257
264
  strokeColor: string,
258
265
  start: {{
259
266
  id: string,
260
267
  type: string,
268
+ text: string,
261
269
  }},
262
270
  end: {{
263
271
  id: string,
264
272
  type: string,
273
+ text: string,
265
274
  }},
266
275
  label: {{
267
276
  text: string,
@@ -272,7 +281,11 @@ For arrows and lines, you can use the `points` property to specify the start and
272
281
  ]
273
282
  }}
274
283
 
275
- For text, you must use the `text` property to specify the text to be rendered. You may also use `fontSize` property to specify the font size of the text. Only use the `text` element for titles, subtitles, and overviews. For labels, use the `label` property in the respective elements.
284
+ For text,
285
+ - `text`: specify the text to be rendered
286
+ - **ALWAYS Required properties for ALL elements**: `type`, `x`, `y`, `id`.
287
+ - `fontSize`: optional property to specify the font size of the text
288
+ - Use this element only for titles, subtitles, and overviews. For labels, use the `label` property in the respective elements.
276
289
 
277
290
  {{
278
291
  type: "text",
@@ -287,19 +300,25 @@ Here's an example of a valid diagram:
287
300
 
288
301
  Design Description: Create a diagram describing a circular development process with 3 stages: design, implementation and feedback. The design stage is connected to the implementation stage and the implementation stage is connected to the feedback stage and the feedback stage is connected to the design stage. Each stage should be labeled with the stage name.
289
302
 
290
- Response:
291
-
292
- [
293
- {{"type":"text","x":-150,"y":50,"width":300,"height":40,"id":"title_text","text":"Circular Development Process","fontSize":24}},
294
- {{"type":"ellipse","x":-169,"y":113,"width":188,"height":202,"id":"design_ellipse", "label": {{"text": "Design"}}}},
295
- {{"type":"ellipse","x":62,"y":394,"width":186,"height":188,"id":"implement_ellipse", "label": {{"text": "Implement"}}}},
296
- {{"type":"ellipse","x":-348,"y":430,"width":184,"height":170,"id":"feedback_ellipse", "label": {{"text": "Feedback"}}}},
303
+ Example Response:
304
+ ```json
305
+ {{
306
+ "scratchpad": "The diagram represents a circular development process with 3 stages: design, implementation and feedback. Each stage is connected to the next stage using an arrow, forming a circular process.",
307
+ "elements": [
308
+ {{"type":"text","x":-150,"y":50,"id":"title_text","text":"Circular Development Process","fontSize":24}},
309
+ {{"type":"ellipse","x":-169,"y":113,"id":"design_ellipse", "label": {{"text": "Design"}}}},
310
+ {{"type":"ellipse","x":62,"y":394,"id":"implement_ellipse", "label": {{"text": "Implement"}}}},
311
+ {{"type":"ellipse","x":-348,"y":430,"id":"feedback_ellipse", "label": {{"text": "Feedback"}}}},
297
312
  {{"type":"arrow","x":21,"y":273,"id":"design_to_implement_arrow","points":[[0,0],[86,105]],"start":{{"id":"design_ellipse"}}, "end":{{"id":"implement_ellipse"}}}},
298
313
  {{"type":"arrow","x":50,"y":519,"id":"implement_to_feedback_arrow","points":[[0,0],[-198,-6]],"start":{{"id":"implement_ellipse"}}, "end":{{"id":"feedback_ellipse"}}}},
299
314
  {{"type":"arrow","x":-228,"y":417,"id":"feedback_to_design_arrow","points":[[0,0],[85,-123]],"start":{{"id":"feedback_ellipse"}}, "end":{{"id":"design_ellipse"}}}},
300
- ]
315
+ ]
316
+ }}
317
+ ```
318
+
319
+ Think about spacing and composition. Use ample space between elements. Double the amount of space you think you need. Create a detailed diagram from the provided context and user prompt below.
301
320
 
302
- Create a detailed diagram from the provided context and user prompt below. Return a valid JSON object:
321
+ Return a valid JSON object, where the drawing is in `elements` and your thought process is in `scratchpad`. If you can't make the whole diagram in one response, you can split it into multiple responses. If you need to simplify for brevity, simply do so in the `scratchpad` field. DO NOT add additional info in the `elements` field.
303
322
 
304
323
  Diagram Description: {query}
305
324
 
@@ -630,36 +649,36 @@ pick_relevant_tools = PromptTemplate.from_template(
630
649
  """
631
650
  You are Khoj, an extremely smart and helpful search assistant.
632
651
  {personality_context}
633
- - You have access to a variety of data sources to help you answer the user's question
634
- - You can use the data sources listed below to collect more relevant information
635
- - You can select certain types of output to respond to the user's question. Select just one output type to answer the user's question
636
- - You can use any combination of these data sources and output types to answer the user's question
652
+ - You have access to a variety of data sources to help you answer the user's question.
653
+ - You can use any subset of data sources listed below to collect more relevant information.
654
+ - You can select the most appropriate output format from the options listed below to respond to the user's question.
655
+ - Both the data sources and output format should be selected based on the user's query and relevant context provided in the chat history.
637
656
 
638
- Which of the tools listed below you would use to answer the user's question? You **only** have access to the following:
657
+ Which of the data sources, output format listed below would you use to answer the user's question? You **only** have access to the following:
639
658
 
640
- Inputs:
641
- {tools}
659
+ Data Sources:
660
+ {sources}
642
661
 
643
- Outputs:
662
+ Output Formats:
644
663
  {outputs}
645
664
 
646
665
  Here are some examples:
647
666
 
648
667
  Example:
649
668
  Chat History:
650
- User: I'm thinking of moving to a new city. I'm trying to decide between New York and San Francisco.
669
+ User: I'm thinking of moving to a new city. I'm trying to decide between New York and San Francisco
651
670
  AI: Moving to a new city can be challenging. Both New York and San Francisco are great cities to live in. New York is known for its diverse culture and San Francisco is known for its tech scene.
652
671
 
653
- Q: What is the population of each of those cities?
654
- Khoj: {{"source": ["online"], "output": ["text"]}}
672
+ Q: Chart the population growth of each of those cities in the last decade
673
+ Khoj: {{"source": ["online", "code"], "output": "text"}}
655
674
 
656
675
  Example:
657
676
  Chat History:
658
- User: I'm thinking of my next vacation idea. Ideally, I want to see something new and exciting.
677
+ User: I'm thinking of my next vacation idea. Ideally, I want to see something new and exciting
659
678
  AI: Excellent! Taking a vacation is a great way to relax and recharge.
660
679
 
661
680
  Q: Where did Grandma grow up?
662
- Khoj: {{"source": ["notes"], "output": ["text"]}}
681
+ Khoj: {{"source": ["notes"], "output": "text"}}
663
682
 
664
683
  Example:
665
684
  Chat History:
@@ -667,7 +686,7 @@ User: Good morning
667
686
  AI: Good morning! How can I help you today?
668
687
 
669
688
  Q: How can I share my files with Khoj?
670
- Khoj: {{"source": ["default", "online"], "output": ["text"]}}
689
+ Khoj: {{"source": ["default", "online"], "output": "text"}}
671
690
 
672
691
  Example:
673
692
  Chat History:
@@ -675,17 +694,18 @@ User: What is the first element in the periodic table?
675
694
  AI: The first element in the periodic table is Hydrogen.
676
695
 
677
696
  Q: Summarize this article https://en.wikipedia.org/wiki/Hydrogen
678
- Khoj: {{"source": ["webpage"], "output": ["text"]}}
697
+ Khoj: {{"source": ["webpage"], "output": "text"}}
679
698
 
680
699
  Example:
681
700
  Chat History:
682
- User: I want to start a new hobby. I'm thinking of learning to play the guitar.
683
- AI: Learning to play the guitar is a great hobby. It can be a lot of fun and a great way to express yourself.
701
+ User: I'm learning to play the guitar, so I can make a band with my friends
702
+ AI: Learning to play the guitar is a great hobby. It can be a fun way to socialize and express yourself.
684
703
 
685
- Q: Draw a painting of a guitar.
686
- Khoj: {{"source": ["general"], "output": ["image"]}}
704
+ Q: Create a painting of my recent jamming sessions
705
+ Khoj: {{"source": ["notes"], "output": "image"}}
687
706
 
688
- Now it's your turn to pick the data sources you would like to use to answer the user's question. Provide the data sources as a list of strings in a JSON object. Do not say anything else.
707
+ Now it's your turn to pick the appropriate data sources and output format to answer the user's query. Respond with a JSON object, including both `source` and `output` in the following format. Do not say anything else.
708
+ {{"source": list[str], "output': str}}
689
709
 
690
710
  Chat History:
691
711
  {chat_history}