khoj 1.26.5.dev29__py3-none-any.whl → 1.27.1.dev1__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 (53) hide show
  1. khoj/configure.py +2 -2
  2. khoj/database/adapters/__init__.py +41 -28
  3. khoj/database/admin.py +2 -0
  4. khoj/database/management/commands/change_default_model.py +182 -0
  5. khoj/database/migrations/0071_subscription_enabled_trial_at_and_more.py +32 -0
  6. khoj/database/migrations/0072_entry_search_model.py +24 -0
  7. khoj/database/models/__init__.py +4 -1
  8. khoj/interface/compiled/404/index.html +1 -1
  9. khoj/interface/compiled/_next/static/chunks/{3423-aad88d6c1f029135.js → 3423-0b533af8bf6ac218.js} +1 -1
  10. khoj/interface/compiled/_next/static/chunks/{3678-ef0d20e267e9f010.js → 7883-b1305ec254213afe.js} +2 -2
  11. khoj/interface/compiled/_next/static/chunks/app/{page-75bbfb564884054b.js → page-bf90ab8e0431b578.js} +1 -1
  12. khoj/interface/compiled/_next/static/chunks/app/settings/page-7a8c382af2a7e870.js +1 -0
  13. khoj/interface/compiled/_next/static/chunks/{webpack-8f4afe09848e24e1.js → webpack-60a713fe80176ab8.js} +1 -1
  14. khoj/interface/compiled/agents/index.html +1 -1
  15. khoj/interface/compiled/agents/index.txt +2 -2
  16. khoj/interface/compiled/automations/index.html +1 -1
  17. khoj/interface/compiled/automations/index.txt +1 -1
  18. khoj/interface/compiled/chat/index.html +1 -1
  19. khoj/interface/compiled/chat/index.txt +2 -2
  20. khoj/interface/compiled/factchecker/index.html +1 -1
  21. khoj/interface/compiled/factchecker/index.txt +2 -2
  22. khoj/interface/compiled/index.html +1 -1
  23. khoj/interface/compiled/index.txt +2 -2
  24. khoj/interface/compiled/search/index.html +1 -1
  25. khoj/interface/compiled/search/index.txt +2 -2
  26. khoj/interface/compiled/settings/index.html +1 -1
  27. khoj/interface/compiled/settings/index.txt +2 -2
  28. khoj/interface/compiled/share/chat/index.html +1 -1
  29. khoj/interface/compiled/share/chat/index.txt +2 -2
  30. khoj/processor/content/text_to_entries.py +4 -2
  31. khoj/processor/conversation/anthropic/anthropic_chat.py +21 -21
  32. khoj/processor/conversation/anthropic/utils.py +51 -1
  33. khoj/processor/conversation/google/utils.py +2 -15
  34. khoj/processor/conversation/prompts.py +1 -1
  35. khoj/processor/conversation/utils.py +39 -1
  36. khoj/processor/image/generate.py +2 -1
  37. khoj/routers/api.py +5 -2
  38. khoj/routers/api_model.py +0 -33
  39. khoj/routers/{subscription.py → api_subscription.py} +20 -2
  40. khoj/routers/helpers.py +22 -23
  41. khoj/search_type/text_search.py +6 -2
  42. khoj/utils/helpers.py +1 -1
  43. {khoj-1.26.5.dev29.dist-info → khoj-1.27.1.dev1.dist-info}/METADATA +1 -1
  44. {khoj-1.26.5.dev29.dist-info → khoj-1.27.1.dev1.dist-info}/RECORD +52 -49
  45. khoj/interface/compiled/_next/static/chunks/app/settings/page-989cf38b87b19427.js +0 -1
  46. /khoj/interface/compiled/_next/static/{ZLHCGFLxZSUj0jEJSc99T → _uA36nxS-kekBHGobT8yS}/_buildManifest.js +0 -0
  47. /khoj/interface/compiled/_next/static/{ZLHCGFLxZSUj0jEJSc99T → _uA36nxS-kekBHGobT8yS}/_ssgManifest.js +0 -0
  48. /khoj/interface/compiled/_next/static/chunks/{1970-1d6d0c1b00b4f343.js → 1970-60c96aed937a4928.js} +0 -0
  49. /khoj/interface/compiled/_next/static/chunks/{9417-759984ad62caa3dc.js → 9417-2ca87207387fc790.js} +0 -0
  50. /khoj/interface/compiled/_next/static/chunks/{9479-4b443fdcc99141c9.js → 9479-646dff2911c5d2e1.js} +0 -0
  51. {khoj-1.26.5.dev29.dist-info → khoj-1.27.1.dev1.dist-info}/WHEEL +0 -0
  52. {khoj-1.26.5.dev29.dist-info → khoj-1.27.1.dev1.dist-info}/entry_points.txt +0 -0
  53. {khoj-1.26.5.dev29.dist-info → khoj-1.27.1.dev1.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/76d55eb435962b19.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/3cf13271869a4aeb.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/ddcc0cf73e062476.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/2272c73fc7a3b571.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-8f4afe09848e24e1.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/1603-b9d95833e0e025e8.js" async=""></script><script src="/_next/static/chunks/9417-759984ad62caa3dc.js" async=""></script><script src="/_next/static/chunks/3423-aad88d6c1f029135.js" async=""></script><script src="/_next/static/chunks/9479-4b443fdcc99141c9.js" async=""></script><script src="/_next/static/chunks/2697-61fcba89fd87eab4.js" async=""></script><script src="/_next/static/chunks/app/share/chat/page-eb9e282691858f2e.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-8f4afe09848e24e1.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/76d55eb435962b19.css\",\"style\"]\n4:HL[\"/_next/static/css/3cf13271869a4aeb.css\",\"style\"]\n5:HL[\"/_next/static/css/ddcc0cf73e062476.css\",\"style\"]\n6:HL[\"/_next/static/css/2272c73fc7a3b571.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"7:I[95751,[],\"\"]\n9:I[66513,[],\"ClientPageRoot\"]\na:I[5506,[\"3954\",\"static/chunks/d3ac728e-a9e3522eef9b6b28.js\",\"9001\",\"static/chunks/9001-3b27af6d5f21df44.js\",\"3062\",\"static/chunks/3062-71ed4b46ac2bb87c.js\",\"8840\",\"static/chunks/8840-b8d7b9f0923c6651.js\",\"7113\",\"static/chunks/7113-f2e114d7034a0835.js\",\"3110\",\"static/chunks/3110-ef2cacd1b8d79ad8.js\",\"394\",\"static/chunks/394-6bcb8c429f168f21.js\",\"1603\",\"static/chunks/1603-b9d95833e0e025e8.js\",\"9417\",\"static/chunks/9417-759984ad62caa3dc.js\",\"3423\",\"static/chunks/3423-aad88d6c1f029135.js\",\"9479\",\"static/chunks/9479-4b443fdcc99141c9.js\",\"2697\",\"static/chunks/2697-61fcba89fd87eab4.js\",\"3111\",\"static/chunks/app/share/chat/page-eb9e282691858f2e.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\":\"ZLHCGFLxZSUj0jEJSc99T\",\"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/ddcc0cf73e062476.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"2\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/2272c73fc7a3b571.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}]]],null],null]},[[null,[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[[\"$\",\"meta\",null,{\"httpEquiv\":\"Content-Security-Policy\",\"content\":\"default-src 'self' https://assets.khoj.dev; script-src 'self' https://assets.khoj.dev 'unsafe-inline' 'unsafe-eval'; connect-src 'self' blob: https://ipapi.co/json ws://localhost:42110; style-src 'self' https://assets.khoj.dev 'unsafe-inline' https://fonts.googleapis.com; img-src 'self' data: blob: https://*.khoj.dev https://*.googleusercontent.com https://*.google.com/ https://*.gstatic.com; font-src 'self' https://assets.khoj.dev https://fonts.gstatic.com; child-src 'none'; object-src 'none';\"}],[\"$\",\"body\",null,{\"className\":\"__className_e594dd\",\"children\":[[\"$\",\"$Lb\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"share\",\"children\",\"chat\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$Lc\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\"}],[\"$\",\"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/76d55eb435962b19.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[[\"$\",\"meta\",null,{\"httpEquiv\":\"Content-Security-Policy\",\"content\":\"default-src 'self' https://assets.khoj.dev; media-src * blob:; script-src 'self' https://assets.khoj.dev 'unsafe-inline' 'unsafe-eval'; connect-src 'self' blob: https://ipapi.co/json ws://localhost:42110; style-src 'self' https://assets.khoj.dev 'unsafe-inline' https://fonts.googleapis.com; img-src 'self' data: blob: https://*.khoj.dev https://*.googleusercontent.com https://*.google.com/ https://*.gstatic.com; font-src 'self' https://assets.khoj.dev https://fonts.gstatic.com; child-src 'none'; object-src 'none';\"}],[\"$\",\"body\",null,{\"className\":\"__className_e594dd\",\"children\":[\"$\",\"$Lb\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$Lc\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],\"notFoundStyles\":[]}]}]]}]],null],null],\"couldBeIntercepted\":false,\"initialHead\":[null,\"$Ld\"],\"globalErrorComponent\":\"$e\",\"missingSlots\":\"$Wf\"}]\n"])</script><script>self.__next_f.push([1,"d:[[\"$\",\"meta\",\"0\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}],[\"$\",\"meta\",\"1\",{\"charSet\":\"utf-8\"}],[\"$\",\"title\",\"2\",{\"children\":\"Khoj AI - Chat\"}],[\"$\",\"meta\",\"3\",{\"name\":\"description\",\"content\":\"Use this page to view a chat with Khoj AI.\"}],[\"$\",\"link\",\"4\",{\"rel\":\"manifest\",\"href\":\"/static/khoj.webmanifest\",\"crossOrigin\":\"use-credentials\"}],[\"$\",\"meta\",\"5\",{\"property\":\"og:title\",\"content\":\"Khoj AI - Home\"}],[\"$\",\"meta\",\"6\",{\"property\":\"og:description\",\"content\":\"Your Second Brain.\"}],[\"$\",\"meta\",\"7\",{\"property\":\"og:url\",\"content\":\"https://app.khoj.dev/\"}],[\"$\",\"meta\",\"8\",{\"property\":\"og:site_name\",\"content\":\"Khoj AI\"}],[\"$\",\"meta\",\"9\",{\"property\":\"og:image\",\"content\":\"https://assets.khoj.dev/khoj_lantern_256x256.png\"}],[\"$\",\"meta\",\"10\",{\"property\":\"og:image:width\",\"content\":\"256\"}],[\"$\",\"meta\",\"11\",{\"property\":\"og:image:height\",\"content\":\"256\"}],[\"$\",\"meta\",\"12\",{\"property\":\"og:image\",\"content\":\"https://assets.khoj.dev/khoj_lantern_logomarktype_1200x630.png\"}],[\"$\",\"meta\",\"13\",{\"property\":\"og:image:width\",\"content\":\"1200\"}],[\"$\",\"meta\",\"14\",{\"property\":\"og:image:height\",\"content\":\"630\"}],[\"$\",\"meta\",\"15\",{\"property\":\"og:type\",\"content\":\"website\"}],[\"$\",\"meta\",\"16\",{\"name\":\"twitter:card\",\"content\":\"summary_large_image\"}],[\"$\",\"meta\",\"17\",{\"name\":\"twitter:title\",\"content\":\"Khoj AI - Home\"}],[\"$\",\"meta\",\"18\",{\"name\":\"twitter:description\",\"content\":\"Your Second Brain.\"}],[\"$\",\"meta\",\"19\",{\"name\":\"twitter:image\",\"content\":\"https://assets.khoj.dev/khoj_lantern_256x256.png\"}],[\"$\",\"meta\",\"20\",{\"name\":\"twitter:image:width\",\"content\":\"256\"}],[\"$\",\"meta\",\"21\",{\"name\":\"twitter:image:height\",\"content\":\"256\"}],[\"$\",\"meta\",\"22\",{\"name\":\"twitter:image\",\"content\":\"https://assets.khoj.dev/khoj_lantern_logomarktype_1200x630.png\"}],[\"$\",\"meta\",\"23\",{\"name\":\"twitter:image:width\",\"content\":\"1200\"}],[\"$\",\"meta\",\"24\",{\"name\":\"twitter:image:height\",\"content\":\"630\"}],[\"$\",\"link\",\"25\",{\"rel\":\"icon\",\"href\":\"/static/assets/icons/khoj_lantern.ico\"}],[\"$\",\"link\",\"26\",{\"rel\":\"apple-touch-icon\",\"href\":\"/static/assets/icons/khoj_lantern_256x256.png\"}],[\"$\",\"meta\",\"27\",{\"name\":\"next-size-adjust\"}]]\n"])</script><script>self.__next_f.push([1,"8:null\n"])</script></body></html>
1
+ <!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" href="/_next/static/media/0e790e04fd40ad16-s.p.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="stylesheet" href="/_next/static/css/467a524c75e7d7c0.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/76d55eb435962b19.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/3cf13271869a4aeb.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/ddcc0cf73e062476.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/2272c73fc7a3b571.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-60a713fe80176ab8.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/1603-b9d95833e0e025e8.js" async=""></script><script src="/_next/static/chunks/9417-2ca87207387fc790.js" async=""></script><script src="/_next/static/chunks/3423-0b533af8bf6ac218.js" async=""></script><script src="/_next/static/chunks/9479-646dff2911c5d2e1.js" async=""></script><script src="/_next/static/chunks/2697-61fcba89fd87eab4.js" async=""></script><script src="/_next/static/chunks/app/share/chat/page-eb9e282691858f2e.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-60a713fe80176ab8.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/76d55eb435962b19.css\",\"style\"]\n4:HL[\"/_next/static/css/3cf13271869a4aeb.css\",\"style\"]\n5:HL[\"/_next/static/css/ddcc0cf73e062476.css\",\"style\"]\n6:HL[\"/_next/static/css/2272c73fc7a3b571.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"7:I[95751,[],\"\"]\n9:I[66513,[],\"ClientPageRoot\"]\na:I[5506,[\"3954\",\"static/chunks/d3ac728e-a9e3522eef9b6b28.js\",\"9001\",\"static/chunks/9001-3b27af6d5f21df44.js\",\"3062\",\"static/chunks/3062-71ed4b46ac2bb87c.js\",\"8840\",\"static/chunks/8840-b8d7b9f0923c6651.js\",\"7113\",\"static/chunks/7113-f2e114d7034a0835.js\",\"3110\",\"static/chunks/3110-ef2cacd1b8d79ad8.js\",\"394\",\"static/chunks/394-6bcb8c429f168f21.js\",\"1603\",\"static/chunks/1603-b9d95833e0e025e8.js\",\"9417\",\"static/chunks/9417-2ca87207387fc790.js\",\"3423\",\"static/chunks/3423-0b533af8bf6ac218.js\",\"9479\",\"static/chunks/9479-646dff2911c5d2e1.js\",\"2697\",\"static/chunks/2697-61fcba89fd87eab4.js\",\"3111\",\"static/chunks/app/share/chat/page-eb9e282691858f2e.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\":\"_uA36nxS-kekBHGobT8yS\",\"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/ddcc0cf73e062476.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"2\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/2272c73fc7a3b571.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}]]],null],null]},[[null,[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[[\"$\",\"meta\",null,{\"httpEquiv\":\"Content-Security-Policy\",\"content\":\"default-src 'self' https://assets.khoj.dev; script-src 'self' https://assets.khoj.dev 'unsafe-inline' 'unsafe-eval'; connect-src 'self' blob: https://ipapi.co/json ws://localhost:42110; style-src 'self' https://assets.khoj.dev 'unsafe-inline' https://fonts.googleapis.com; img-src 'self' data: blob: https://*.khoj.dev https://*.googleusercontent.com https://*.google.com/ https://*.gstatic.com; font-src 'self' https://assets.khoj.dev https://fonts.gstatic.com; child-src 'none'; object-src 'none';\"}],[\"$\",\"body\",null,{\"className\":\"__className_e594dd\",\"children\":[[\"$\",\"$Lb\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"share\",\"children\",\"chat\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$Lc\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\"}],[\"$\",\"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/76d55eb435962b19.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[[\"$\",\"meta\",null,{\"httpEquiv\":\"Content-Security-Policy\",\"content\":\"default-src 'self' https://assets.khoj.dev; media-src * blob:; script-src 'self' https://assets.khoj.dev 'unsafe-inline' 'unsafe-eval'; connect-src 'self' blob: https://ipapi.co/json ws://localhost:42110; style-src 'self' https://assets.khoj.dev 'unsafe-inline' https://fonts.googleapis.com; img-src 'self' data: blob: https://*.khoj.dev https://*.googleusercontent.com https://*.google.com/ https://*.gstatic.com; font-src 'self' https://assets.khoj.dev https://fonts.gstatic.com; child-src 'none'; object-src 'none';\"}],[\"$\",\"body\",null,{\"className\":\"__className_e594dd\",\"children\":[\"$\",\"$Lb\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$Lc\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],\"notFoundStyles\":[]}]}]]}]],null],null],\"couldBeIntercepted\":false,\"initialHead\":[null,\"$Ld\"],\"globalErrorComponent\":\"$e\",\"missingSlots\":\"$Wf\"}]\n"])</script><script>self.__next_f.push([1,"d:[[\"$\",\"meta\",\"0\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}],[\"$\",\"meta\",\"1\",{\"charSet\":\"utf-8\"}],[\"$\",\"title\",\"2\",{\"children\":\"Khoj AI - Chat\"}],[\"$\",\"meta\",\"3\",{\"name\":\"description\",\"content\":\"Use this page to view a chat with Khoj AI.\"}],[\"$\",\"link\",\"4\",{\"rel\":\"manifest\",\"href\":\"/static/khoj.webmanifest\",\"crossOrigin\":\"use-credentials\"}],[\"$\",\"meta\",\"5\",{\"property\":\"og:title\",\"content\":\"Khoj AI - Home\"}],[\"$\",\"meta\",\"6\",{\"property\":\"og:description\",\"content\":\"Your Second Brain.\"}],[\"$\",\"meta\",\"7\",{\"property\":\"og:url\",\"content\":\"https://app.khoj.dev/\"}],[\"$\",\"meta\",\"8\",{\"property\":\"og:site_name\",\"content\":\"Khoj AI\"}],[\"$\",\"meta\",\"9\",{\"property\":\"og:image\",\"content\":\"https://assets.khoj.dev/khoj_lantern_256x256.png\"}],[\"$\",\"meta\",\"10\",{\"property\":\"og:image:width\",\"content\":\"256\"}],[\"$\",\"meta\",\"11\",{\"property\":\"og:image:height\",\"content\":\"256\"}],[\"$\",\"meta\",\"12\",{\"property\":\"og:image\",\"content\":\"https://assets.khoj.dev/khoj_lantern_logomarktype_1200x630.png\"}],[\"$\",\"meta\",\"13\",{\"property\":\"og:image:width\",\"content\":\"1200\"}],[\"$\",\"meta\",\"14\",{\"property\":\"og:image:height\",\"content\":\"630\"}],[\"$\",\"meta\",\"15\",{\"property\":\"og:type\",\"content\":\"website\"}],[\"$\",\"meta\",\"16\",{\"name\":\"twitter:card\",\"content\":\"summary_large_image\"}],[\"$\",\"meta\",\"17\",{\"name\":\"twitter:title\",\"content\":\"Khoj AI - Home\"}],[\"$\",\"meta\",\"18\",{\"name\":\"twitter:description\",\"content\":\"Your Second Brain.\"}],[\"$\",\"meta\",\"19\",{\"name\":\"twitter:image\",\"content\":\"https://assets.khoj.dev/khoj_lantern_256x256.png\"}],[\"$\",\"meta\",\"20\",{\"name\":\"twitter:image:width\",\"content\":\"256\"}],[\"$\",\"meta\",\"21\",{\"name\":\"twitter:image:height\",\"content\":\"256\"}],[\"$\",\"meta\",\"22\",{\"name\":\"twitter:image\",\"content\":\"https://assets.khoj.dev/khoj_lantern_logomarktype_1200x630.png\"}],[\"$\",\"meta\",\"23\",{\"name\":\"twitter:image:width\",\"content\":\"1200\"}],[\"$\",\"meta\",\"24\",{\"name\":\"twitter:image:height\",\"content\":\"630\"}],[\"$\",\"link\",\"25\",{\"rel\":\"icon\",\"href\":\"/static/assets/icons/khoj_lantern.ico\"}],[\"$\",\"link\",\"26\",{\"rel\":\"apple-touch-icon\",\"href\":\"/static/assets/icons/khoj_lantern_256x256.png\"}],[\"$\",\"meta\",\"27\",{\"name\":\"next-size-adjust\"}]]\n"])</script><script>self.__next_f.push([1,"8:null\n"])</script></body></html>
@@ -1,7 +1,7 @@
1
1
  2:I[66513,[],"ClientPageRoot"]
2
- 3:I[5506,["3954","static/chunks/d3ac728e-a9e3522eef9b6b28.js","9001","static/chunks/9001-3b27af6d5f21df44.js","3062","static/chunks/3062-71ed4b46ac2bb87c.js","8840","static/chunks/8840-b8d7b9f0923c6651.js","7113","static/chunks/7113-f2e114d7034a0835.js","3110","static/chunks/3110-ef2cacd1b8d79ad8.js","394","static/chunks/394-6bcb8c429f168f21.js","1603","static/chunks/1603-b9d95833e0e025e8.js","9417","static/chunks/9417-759984ad62caa3dc.js","3423","static/chunks/3423-aad88d6c1f029135.js","9479","static/chunks/9479-4b443fdcc99141c9.js","2697","static/chunks/2697-61fcba89fd87eab4.js","3111","static/chunks/app/share/chat/page-eb9e282691858f2e.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","7113","static/chunks/7113-f2e114d7034a0835.js","3110","static/chunks/3110-ef2cacd1b8d79ad8.js","394","static/chunks/394-6bcb8c429f168f21.js","1603","static/chunks/1603-b9d95833e0e025e8.js","9417","static/chunks/9417-2ca87207387fc790.js","3423","static/chunks/3423-0b533af8bf6ac218.js","9479","static/chunks/9479-646dff2911c5d2e1.js","2697","static/chunks/2697-61fcba89fd87eab4.js","3111","static/chunks/app/share/chat/page-eb9e282691858f2e.js"],"default",1]
3
3
  4:I[39275,[],""]
4
4
  5:I[61343,[],""]
5
- 0:["ZLHCGFLxZSUj0jEJSc99T",[[["",{"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/ddcc0cf73e062476.css","precedence":"next","crossOrigin":"$undefined"}],["$","link","2",{"rel":"stylesheet","href":"/_next/static/css/2272c73fc7a3b571.css","precedence":"next","crossOrigin":"$undefined"}]]],null],null]},[[null,["$","html",null,{"lang":"en","children":[["$","meta",null,{"httpEquiv":"Content-Security-Policy","content":"default-src 'self' https://assets.khoj.dev; script-src 'self' https://assets.khoj.dev 'unsafe-inline' 'unsafe-eval'; connect-src 'self' blob: https://ipapi.co/json ws://localhost:42110; style-src 'self' https://assets.khoj.dev 'unsafe-inline' https://fonts.googleapis.com; img-src 'self' data: blob: https://*.khoj.dev https://*.googleusercontent.com https://*.google.com/ https://*.gstatic.com; font-src 'self' https://assets.khoj.dev https://fonts.gstatic.com; child-src 'none'; object-src 'none';"}],["$","body",null,{"className":"__className_e594dd","children":[["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","share","children","chat","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}],["$","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/76d55eb435962b19.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:["_uA36nxS-kekBHGobT8yS",[[["",{"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/ddcc0cf73e062476.css","precedence":"next","crossOrigin":"$undefined"}],["$","link","2",{"rel":"stylesheet","href":"/_next/static/css/2272c73fc7a3b571.css","precedence":"next","crossOrigin":"$undefined"}]]],null],null]},[[null,["$","html",null,{"lang":"en","children":[["$","meta",null,{"httpEquiv":"Content-Security-Policy","content":"default-src 'self' https://assets.khoj.dev; script-src 'self' https://assets.khoj.dev 'unsafe-inline' 'unsafe-eval'; connect-src 'self' blob: https://ipapi.co/json ws://localhost:42110; style-src 'self' https://assets.khoj.dev 'unsafe-inline' https://fonts.googleapis.com; img-src 'self' data: blob: https://*.khoj.dev https://*.googleusercontent.com https://*.google.com/ https://*.gstatic.com; font-src 'self' https://assets.khoj.dev https://fonts.gstatic.com; child-src 'none'; object-src 'none';"}],["$","body",null,{"className":"__className_e594dd","children":[["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","share","children","chat","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}],["$","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/76d55eb435962b19.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":[["$","meta",null,{"httpEquiv":"Content-Security-Policy","content":"default-src 'self' https://assets.khoj.dev; media-src * blob:; script-src 'self' https://assets.khoj.dev 'unsafe-inline' 'unsafe-eval'; connect-src 'self' blob: https://ipapi.co/json ws://localhost:42110; style-src 'self' https://assets.khoj.dev 'unsafe-inline' https://fonts.googleapis.com; img-src 'self' data: blob: https://*.khoj.dev https://*.googleusercontent.com https://*.google.com/ https://*.gstatic.com; font-src 'self' https://assets.khoj.dev https://fonts.gstatic.com; child-src 'none'; object-src 'none';"}],["$","body",null,{"className":"__className_e594dd","children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[]}]}]]}]],null],null],["$L6",null]]]]
6
6
  6:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"Khoj AI - Chat"}],["$","meta","3",{"name":"description","content":"Use this page to view a chat with Khoj AI."}],["$","link","4",{"rel":"manifest","href":"/static/khoj.webmanifest","crossOrigin":"use-credentials"}],["$","meta","5",{"property":"og:title","content":"Khoj AI - Home"}],["$","meta","6",{"property":"og:description","content":"Your Second Brain."}],["$","meta","7",{"property":"og:url","content":"https://app.khoj.dev/"}],["$","meta","8",{"property":"og:site_name","content":"Khoj AI"}],["$","meta","9",{"property":"og:image","content":"https://assets.khoj.dev/khoj_lantern_256x256.png"}],["$","meta","10",{"property":"og:image:width","content":"256"}],["$","meta","11",{"property":"og:image:height","content":"256"}],["$","meta","12",{"property":"og:image","content":"https://assets.khoj.dev/khoj_lantern_logomarktype_1200x630.png"}],["$","meta","13",{"property":"og:image:width","content":"1200"}],["$","meta","14",{"property":"og:image:height","content":"630"}],["$","meta","15",{"property":"og:type","content":"website"}],["$","meta","16",{"name":"twitter:card","content":"summary_large_image"}],["$","meta","17",{"name":"twitter:title","content":"Khoj AI - Home"}],["$","meta","18",{"name":"twitter:description","content":"Your Second Brain."}],["$","meta","19",{"name":"twitter:image","content":"https://assets.khoj.dev/khoj_lantern_256x256.png"}],["$","meta","20",{"name":"twitter:image:width","content":"256"}],["$","meta","21",{"name":"twitter:image:height","content":"256"}],["$","meta","22",{"name":"twitter:image","content":"https://assets.khoj.dev/khoj_lantern_logomarktype_1200x630.png"}],["$","meta","23",{"name":"twitter:image:width","content":"1200"}],["$","meta","24",{"name":"twitter:image:height","content":"630"}],["$","link","25",{"rel":"icon","href":"/static/assets/icons/khoj_lantern.ico"}],["$","link","26",{"rel":"apple-touch-icon","href":"/static/assets/icons/khoj_lantern_256x256.png"}],["$","meta","27",{"name":"next-size-adjust"}]]
7
7
  1:null
@@ -12,7 +12,8 @@ from tqdm import tqdm
12
12
  from khoj.database.adapters import (
13
13
  EntryAdapters,
14
14
  FileObjectAdapters,
15
- get_user_search_model_or_default,
15
+ get_default_search_model,
16
+ get_user_default_search_model,
16
17
  )
17
18
  from khoj.database.models import Entry as DbEntry
18
19
  from khoj.database.models import EntryDates, KhojUser
@@ -148,10 +149,10 @@ class TextToEntries(ABC):
148
149
  hashes_to_process |= hashes_for_file - existing_entry_hashes
149
150
 
150
151
  embeddings = []
152
+ model = get_user_default_search_model(user=user)
151
153
  with timer("Generated embeddings for entries to add to database in", logger):
152
154
  entries_to_process = [hash_to_current_entries[hashed_val] for hashed_val in hashes_to_process]
153
155
  data_to_embed = [getattr(entry, key) for entry in entries_to_process]
154
- model = get_user_search_model_or_default(user)
155
156
  embeddings += self.embeddings_model[model.name].embed_documents(data_to_embed)
156
157
 
157
158
  added_entries: list[DbEntry] = []
@@ -177,6 +178,7 @@ class TextToEntries(ABC):
177
178
  file_type=file_type,
178
179
  hashed_value=entry_hash,
179
180
  corpus_id=entry.corpus_id,
181
+ search_model=model,
180
182
  )
181
183
  )
182
184
  try:
@@ -11,8 +11,12 @@ from khoj.processor.conversation import prompts
11
11
  from khoj.processor.conversation.anthropic.utils import (
12
12
  anthropic_chat_completion_with_backoff,
13
13
  anthropic_completion_with_backoff,
14
+ format_messages_for_anthropic,
15
+ )
16
+ from khoj.processor.conversation.utils import (
17
+ construct_structured_message,
18
+ generate_chatml_messages_with_context,
14
19
  )
15
- from khoj.processor.conversation.utils import generate_chatml_messages_with_context
16
20
  from khoj.utils.helpers import ConversationCommand, is_none_or_empty
17
21
  from khoj.utils.rawconfig import LocationData
18
22
 
@@ -27,6 +31,8 @@ def extract_questions_anthropic(
27
31
  temperature=0.7,
28
32
  location_data: LocationData = None,
29
33
  user: KhojUser = None,
34
+ query_images: Optional[list[str]] = None,
35
+ vision_enabled: bool = False,
30
36
  personality_context: Optional[str] = None,
31
37
  ):
32
38
  """
@@ -68,6 +74,13 @@ def extract_questions_anthropic(
68
74
  text=text,
69
75
  )
70
76
 
77
+ prompt = construct_structured_message(
78
+ message=prompt,
79
+ images=query_images,
80
+ model_type=ChatModelOptions.ModelType.ANTHROPIC,
81
+ vision_enabled=vision_enabled,
82
+ )
83
+
71
84
  messages = [ChatMessage(content=prompt, role="user")]
72
85
 
73
86
  response = anthropic_completion_with_backoff(
@@ -101,17 +114,7 @@ def anthropic_send_message_to_model(messages, api_key, model):
101
114
  """
102
115
  Send message to model
103
116
  """
104
- # Anthropic requires the first message to be a 'user' message, and the system prompt is not to be sent in the messages parameter
105
- system_prompt = None
106
-
107
- if len(messages) == 1:
108
- messages[0].role = "user"
109
- else:
110
- system_prompt = ""
111
- for message in messages.copy():
112
- if message.role == "system":
113
- system_prompt += message.content
114
- messages.remove(message)
117
+ messages, system_prompt = format_messages_for_anthropic(messages)
115
118
 
116
119
  # Get Response from GPT. Don't use response_type because Anthropic doesn't support it.
117
120
  return anthropic_completion_with_backoff(
@@ -127,7 +130,7 @@ def converse_anthropic(
127
130
  user_query,
128
131
  online_results: Optional[Dict[str, Dict]] = None,
129
132
  conversation_log={},
130
- model: Optional[str] = "claude-instant-1.2",
133
+ model: Optional[str] = "claude-3-5-sonnet-20241022",
131
134
  api_key: Optional[str] = None,
132
135
  completion_func=None,
133
136
  conversation_commands=[ConversationCommand.Default],
@@ -136,6 +139,8 @@ def converse_anthropic(
136
139
  location_data: LocationData = None,
137
140
  user_name: str = None,
138
141
  agent: Agent = None,
142
+ query_images: Optional[list[str]] = None,
143
+ vision_available: bool = False,
139
144
  ):
140
145
  """
141
146
  Converse with user using Anthropic's Claude
@@ -189,17 +194,12 @@ def converse_anthropic(
189
194
  model_name=model,
190
195
  max_prompt_size=max_prompt_size,
191
196
  tokenizer_name=tokenizer_name,
197
+ query_images=query_images,
198
+ vision_enabled=vision_available,
192
199
  model_type=ChatModelOptions.ModelType.ANTHROPIC,
193
200
  )
194
201
 
195
- if len(messages) > 1:
196
- if messages[0].role == "assistant":
197
- messages = messages[1:]
198
-
199
- for message in messages.copy():
200
- if message.role == "system":
201
- system_prompt += message.content
202
- messages.remove(message)
202
+ messages, system_prompt = format_messages_for_anthropic(messages, system_prompt)
203
203
 
204
204
  truncated_messages = "\n".join({f"{message.content[:40]}..." for message in messages})
205
205
  logger.debug(f"Conversation Context for Claude: {truncated_messages}")
@@ -3,6 +3,7 @@ from threading import Thread
3
3
  from typing import Dict, List
4
4
 
5
5
  import anthropic
6
+ from langchain.schema import ChatMessage
6
7
  from tenacity import (
7
8
  before_sleep_log,
8
9
  retry,
@@ -11,7 +12,8 @@ from tenacity import (
11
12
  wait_random_exponential,
12
13
  )
13
14
 
14
- from khoj.processor.conversation.utils import ThreadedGenerator
15
+ from khoj.processor.conversation.utils import ThreadedGenerator, get_image_from_url
16
+ from khoj.utils.helpers import is_none_or_empty
15
17
 
16
18
  logger = logging.getLogger(__name__)
17
19
 
@@ -115,3 +117,51 @@ def anthropic_llm_thread(
115
117
  logger.error(f"Error in anthropic_llm_thread: {e}", exc_info=True)
116
118
  finally:
117
119
  g.close()
120
+
121
+
122
+ def format_messages_for_anthropic(messages: list[ChatMessage], system_prompt=None):
123
+ """
124
+ Format messages for Anthropic
125
+ """
126
+ # Extract system prompt
127
+ system_prompt = system_prompt or ""
128
+ for message in messages.copy():
129
+ if message.role == "system":
130
+ system_prompt += message.content
131
+ messages.remove(message)
132
+ system_prompt = None if is_none_or_empty(system_prompt) else system_prompt
133
+
134
+ # Anthropic requires the first message to be a 'user' message
135
+ if len(messages) == 1:
136
+ messages[0].role = "user"
137
+ elif len(messages) > 1 and messages[0].role == "assistant":
138
+ messages = messages[1:]
139
+
140
+ # Convert image urls to base64 encoded images in Anthropic message format
141
+ for message in messages:
142
+ if isinstance(message.content, list):
143
+ content = []
144
+ # Sort the content. Anthropic models prefer that text comes after images.
145
+ message.content.sort(key=lambda x: 0 if x["type"] == "image_url" else 1)
146
+ for idx, part in enumerate(message.content):
147
+ if part["type"] == "text":
148
+ content.append({"type": "text", "text": part["text"]})
149
+ elif part["type"] == "image_url":
150
+ image = get_image_from_url(part["image_url"]["url"], type="b64")
151
+ # Prefix each image with text block enumerating the image number
152
+ # This helps the model reference the image in its response. Recommended by Anthropic
153
+ content.extend(
154
+ [
155
+ {
156
+ "type": "text",
157
+ "text": f"Image {idx + 1}:",
158
+ },
159
+ {
160
+ "type": "image",
161
+ "source": {"type": "base64", "media_type": image.type, "data": image.content},
162
+ },
163
+ ]
164
+ )
165
+ message.content = content
166
+
167
+ return messages, system_prompt
@@ -1,11 +1,8 @@
1
1
  import logging
2
2
  import random
3
- from io import BytesIO
4
3
  from threading import Thread
5
4
 
6
5
  import google.generativeai as genai
7
- import PIL.Image
8
- import requests
9
6
  from google.generativeai.types.answer_types import FinishReason
10
7
  from google.generativeai.types.generation_types import StopCandidateException
11
8
  from google.generativeai.types.safety_types import (
@@ -22,7 +19,7 @@ from tenacity import (
22
19
  wait_random_exponential,
23
20
  )
24
21
 
25
- from khoj.processor.conversation.utils import ThreadedGenerator
22
+ from khoj.processor.conversation.utils import ThreadedGenerator, get_image_from_url
26
23
  from khoj.utils.helpers import is_none_or_empty
27
24
 
28
25
  logger = logging.getLogger(__name__)
@@ -207,7 +204,7 @@ def format_messages_for_gemini(messages: list[ChatMessage], system_prompt: str =
207
204
  if isinstance(message.content, list):
208
205
  # Convert image_urls to PIL.Image and place them at beginning of list (better for Gemini)
209
206
  message.content = [
210
- get_image_from_url(item["image_url"]["url"]) if item["type"] == "image_url" else item["text"]
207
+ get_image_from_url(item["image_url"]["url"]).content if item["type"] == "image_url" else item["text"]
211
208
  for item in sorted(message.content, key=lambda x: 0 if x["type"] == "image_url" else 1)
212
209
  ]
213
210
  elif isinstance(message.content, str):
@@ -220,13 +217,3 @@ def format_messages_for_gemini(messages: list[ChatMessage], system_prompt: str =
220
217
  messages[0].role = "user"
221
218
 
222
219
  return messages, system_prompt
223
-
224
-
225
- def get_image_from_url(image_url: str) -> PIL.Image:
226
- try:
227
- response = requests.get(image_url)
228
- response.raise_for_status() # Check if the request was successful
229
- return PIL.Image.open(BytesIO(response.content))
230
- except requests.exceptions.RequestException as e:
231
- logger.error(f"Failed to get image from URL {image_url}: {e}")
232
- return None
@@ -619,7 +619,7 @@ AI: It's currently 28°C and partly cloudy in Bali.
619
619
  Q: Share a painting using the weather for Bali every morning.
620
620
  Khoj: {{"output": "automation"}}
621
621
 
622
- Now it's your turn to pick the mode you would like to use to answer the user's question. Provide your response as a JSON.
622
+ Now it's your turn to pick the mode you would like to use to answer the user's question. Provide your response as a JSON. Do not say anything else.
623
623
 
624
624
  Chat History:
625
625
  {chat_history}
@@ -1,10 +1,16 @@
1
+ import base64
1
2
  import logging
2
3
  import math
4
+ import mimetypes
3
5
  import queue
6
+ from dataclasses import dataclass
4
7
  from datetime import datetime
8
+ from io import BytesIO
5
9
  from time import perf_counter
6
10
  from typing import Any, Dict, List, Optional
7
11
 
12
+ import PIL.Image
13
+ import requests
8
14
  import tiktoken
9
15
  from langchain.schema import ChatMessage
10
16
  from llama_cpp.llama import Llama
@@ -152,7 +158,11 @@ def construct_structured_message(message: str, images: list[str], model_type: st
152
158
  if not images or not vision_enabled:
153
159
  return message
154
160
 
155
- if model_type in [ChatModelOptions.ModelType.OPENAI, ChatModelOptions.ModelType.GOOGLE]:
161
+ if model_type in [
162
+ ChatModelOptions.ModelType.OPENAI,
163
+ ChatModelOptions.ModelType.GOOGLE,
164
+ ChatModelOptions.ModelType.ANTHROPIC,
165
+ ]:
156
166
  return [
157
167
  {"type": "text", "text": message},
158
168
  *[{"type": "image_url", "image_url": {"url": image}} for image in images],
@@ -306,3 +316,31 @@ def reciprocal_conversation_to_chatml(message_pair):
306
316
  def remove_json_codeblock(response: str):
307
317
  """Remove any markdown json codeblock formatting if present. Useful for non schema enforceable models"""
308
318
  return response.removeprefix("```json").removesuffix("```")
319
+
320
+
321
+ @dataclass
322
+ class ImageWithType:
323
+ content: Any
324
+ type: str
325
+
326
+
327
+ def get_image_from_url(image_url: str, type="pil"):
328
+ try:
329
+ response = requests.get(image_url)
330
+ response.raise_for_status() # Check if the request was successful
331
+
332
+ # Get content type from response or infer from URL
333
+ content_type = response.headers.get("content-type") or mimetypes.guess_type(image_url)[0] or "image/webp"
334
+
335
+ # Convert image to desired format
336
+ if type == "b64":
337
+ image_data = base64.b64encode(response.content).decode("utf-8")
338
+ elif type == "pil":
339
+ image_data = PIL.Image.open(BytesIO(response.content))
340
+ else:
341
+ raise ValueError(f"Invalid image type: {type}")
342
+
343
+ return ImageWithType(content=image_data, type=content_type)
344
+ except requests.exceptions.RequestException as e:
345
+ logger.error(f"Failed to get image from URL {image_url}: {e}")
346
+ return ImageWithType(content=None, type=None)
@@ -204,9 +204,10 @@ def generate_image_with_replicate(
204
204
 
205
205
  # Raise exception if the image generation task fails
206
206
  if status != "succeeded":
207
+ error = get_prediction.get("error")
207
208
  if retry_count >= 10:
208
209
  raise requests.RequestException("Image generation timed out")
209
- raise requests.RequestException(f"Image generation failed with status: {status}")
210
+ raise requests.RequestException(f"Image generation failed with status: {status}, message: {error}")
210
211
 
211
212
  # Get the generated image
212
213
  image_url = get_prediction["output"][0] if isinstance(get_prediction["output"], list) else get_prediction["output"]
khoj/routers/api.py CHANGED
@@ -25,8 +25,9 @@ from khoj.database.adapters import (
25
25
  AutomationAdapters,
26
26
  ConversationAdapters,
27
27
  EntryAdapters,
28
+ get_default_search_model,
29
+ get_user_default_search_model,
28
30
  get_user_photo,
29
- get_user_search_model_or_default,
30
31
  )
31
32
  from khoj.database.models import (
32
33
  Agent,
@@ -149,7 +150,7 @@ async def execute_search(
149
150
  encoded_asymmetric_query = None
150
151
  if t != SearchType.Image:
151
152
  with timer("Encoding query took", logger=logger):
152
- search_model = await sync_to_async(get_user_search_model_or_default)(user)
153
+ search_model = await sync_to_async(get_user_default_search_model)(user)
153
154
  encoded_asymmetric_query = state.embeddings_model[search_model.name].embed_query(defiltered_query)
154
155
 
155
156
  with concurrent.futures.ThreadPoolExecutor() as executor:
@@ -447,11 +448,13 @@ async def extract_references_and_questions(
447
448
  chat_model = conversation_config.chat_model
448
449
  inferred_queries = extract_questions_anthropic(
449
450
  defiltered_query,
451
+ query_images=query_images,
450
452
  model=chat_model,
451
453
  api_key=api_key,
452
454
  conversation_log=meta_log,
453
455
  location_data=location_data,
454
456
  user=user,
457
+ vision_enabled=vision_enabled,
455
458
  personality_context=personality_context,
456
459
  )
457
460
  elif conversation_config.model_type == ChatModelOptions.ModelType.GOOGLE:
khoj/routers/api_model.py CHANGED
@@ -94,39 +94,6 @@ async def update_voice_model(
94
94
  return Response(status_code=202, content=json.dumps({"status": "ok"}))
95
95
 
96
96
 
97
- @api_model.post("/search", status_code=200)
98
- @requires(["authenticated"])
99
- async def update_search_model(
100
- request: Request,
101
- id: str,
102
- client: Optional[str] = None,
103
- ):
104
- user = request.user.object
105
-
106
- prev_config = await adapters.aget_user_search_model(user)
107
- new_config = await adapters.aset_user_search_model(user, int(id))
108
-
109
- if prev_config and int(id) != prev_config.id and new_config:
110
- await EntryAdapters.adelete_all_entries(user)
111
-
112
- if not prev_config:
113
- # If the use was just using the default config, delete all the entries and set the new config.
114
- await EntryAdapters.adelete_all_entries(user)
115
-
116
- if new_config is None:
117
- return {"status": "error", "message": "Model not found"}
118
- else:
119
- update_telemetry_state(
120
- request=request,
121
- telemetry_type="api",
122
- api="set_search_model",
123
- client=client,
124
- metadata={"search_model": new_config.setting.name},
125
- )
126
-
127
- return {"status": "ok"}
128
-
129
-
130
97
  @api_model.post("/paint", status_code=200)
131
98
  @requires(["authenticated"])
132
99
  async def update_paint_model(
@@ -1,12 +1,14 @@
1
+ import json
1
2
  import logging
2
3
  import os
3
4
  from datetime import datetime, timezone
4
5
 
5
6
  from asgiref.sync import sync_to_async
6
- from fastapi import APIRouter, Request
7
+ from fastapi import APIRouter, Request, Response
7
8
  from starlette.authentication import requires
8
9
 
9
10
  from khoj.database import adapters
11
+ from khoj.database.models import KhojUser, Subscription
10
12
  from khoj.routers.helpers import update_telemetry_state
11
13
  from khoj.utils import state
12
14
 
@@ -73,7 +75,7 @@ async def subscribe(request: Request):
73
75
  elif event_type in {"customer.subscription.deleted"}:
74
76
  # Reset the user to trial state
75
77
  user, is_new = await adapters.set_user_subscription(
76
- customer_email, is_recurring=False, renewal_date=False, type="trial"
78
+ customer_email, is_recurring=False, renewal_date=False, type=Subscription.Type.TRIAL
77
79
  )
78
80
  success = user is not None
79
81
 
@@ -116,3 +118,19 @@ async def update_subscription(request: Request, email: str, operation: str):
116
118
  return {"success": False, "message": "No subscription found that is set to cancel"}
117
119
 
118
120
  return {"success": False, "message": "Invalid operation"}
121
+
122
+
123
+ @subscription_router.post("/trial", response_class=Response)
124
+ @requires(["authenticated"])
125
+ async def start_trial(request: Request) -> Response:
126
+ user: KhojUser = request.user.object
127
+
128
+ # Start a trial for the user
129
+ updated_subscription = await adapters.astart_trial_subscription(user)
130
+
131
+ # Return trial status as a JSON response
132
+ return Response(
133
+ content=json.dumps({"trial_enabled": updated_subscription is not None}),
134
+ media_type="application/json",
135
+ status_code=200,
136
+ )