khoj 1.30.1.dev10__py3-none-any.whl → 1.30.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- khoj/database/adapters/__init__.py +1 -1
- khoj/database/admin.py +39 -0
- khoj/interface/compiled/404/index.html +1 -1
- khoj/interface/compiled/_next/static/chunks/1210.ef7a0f9a7e43da1d.js +1 -0
- khoj/interface/compiled/_next/static/chunks/1279-4cb23143aa2c0228.js +1 -0
- khoj/interface/compiled/_next/static/chunks/1603-ba5f9f05e92c8412.js +1 -0
- khoj/interface/compiled/_next/static/chunks/1970-1b63ac1497b03a10.js +1 -0
- khoj/interface/compiled/_next/static/chunks/2646-92ba433951d02d52.js +20 -0
- khoj/interface/compiled/_next/static/chunks/3072-be830e4f8412b9d2.js +1 -0
- khoj/interface/compiled/_next/static/chunks/3463-081c031e873b7966.js +3 -0
- khoj/interface/compiled/_next/static/chunks/3690-51312931ba1eae30.js +1 -0
- khoj/interface/compiled/_next/static/chunks/{6297-d1c842ed3f714ab0.js → 3717-b46079dbe9f55694.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/4504-62ac13e7d94c52f9.js +1 -0
- khoj/interface/compiled/_next/static/chunks/4752-554a3db270186ce3.js +1 -0
- khoj/interface/compiled/_next/static/chunks/5512-7cc62049bbe60e11.js +1 -0
- khoj/interface/compiled/_next/static/chunks/5538-e5f3c9f4d67a64b9.js +1 -0
- khoj/interface/compiled/_next/static/chunks/7592-a09c39a38e60634b.js +1 -0
- khoj/interface/compiled/_next/static/chunks/8423-1dda16bc56236523.js +1 -0
- khoj/interface/compiled/_next/static/chunks/app/agents/{page-4353b1a532795ad1.js → page-f5c0801b27a8e95e.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/automations/{layout-27c28e923c9b1ff0.js → layout-7f1b79a2c67af0b4.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/automations/{page-c9f13c865e739607.js → page-0393501fad5f8e3d.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/chat/{page-2790303dee566590.js → page-f2539e3197d03c0d.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/{page-e83f8a77f5c3caef.js → page-5cc56a8db5d21b38.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/search/{page-8e28deacb61f75aa.js → page-e8b578d155550386.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/settings/{layout-254eaaf916449a60.js → layout-1f4d76a8b09517b1.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/settings/page-b6c835050c970be7.js +1 -0
- khoj/interface/compiled/_next/static/chunks/app/share/chat/{page-07e1a8a345e768de.js → page-635635e4fb39fe29.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/webpack-5dbccc5145b80b64.js +1 -0
- khoj/interface/compiled/_next/static/css/4cae6c0e5c72fb2d.css +1 -0
- khoj/interface/compiled/_next/static/css/5d8d85d3f2e95bae.css +25 -0
- khoj/interface/compiled/_next/static/css/63e106a52a0ec4ca.css +1 -0
- khoj/interface/compiled/agents/index.html +1 -1
- khoj/interface/compiled/agents/index.txt +2 -2
- khoj/interface/compiled/automations/index.html +1 -1
- khoj/interface/compiled/automations/index.txt +3 -3
- khoj/interface/compiled/chat/index.html +1 -1
- khoj/interface/compiled/chat/index.txt +2 -2
- khoj/interface/compiled/index.html +1 -1
- khoj/interface/compiled/index.txt +2 -2
- khoj/interface/compiled/search/index.html +1 -1
- khoj/interface/compiled/search/index.txt +2 -2
- khoj/interface/compiled/settings/index.html +1 -1
- khoj/interface/compiled/settings/index.txt +3 -3
- khoj/interface/compiled/share/chat/index.html +1 -1
- khoj/interface/compiled/share/chat/index.txt +2 -2
- khoj/main.py +4 -0
- khoj/processor/conversation/anthropic/anthropic_chat.py +8 -2
- khoj/processor/conversation/anthropic/utils.py +22 -3
- khoj/processor/conversation/google/gemini_chat.py +8 -2
- khoj/processor/conversation/google/utils.py +19 -3
- khoj/processor/conversation/offline/chat_model.py +12 -4
- khoj/processor/conversation/openai/gpt.py +9 -2
- khoj/processor/conversation/openai/utils.py +39 -21
- khoj/processor/conversation/prompts.py +40 -21
- khoj/processor/conversation/utils.py +15 -9
- khoj/processor/tools/run_code.py +1 -25
- khoj/routers/api_chat.py +41 -16
- khoj/routers/api_subscription.py +9 -2
- khoj/routers/auth.py +2 -2
- khoj/routers/helpers.py +20 -5
- khoj/routers/research.py +2 -1
- khoj/utils/cli.py +2 -0
- khoj/utils/constants.py +17 -0
- khoj/utils/helpers.py +55 -1
- khoj/utils/state.py +1 -0
- {khoj-1.30.1.dev10.dist-info → khoj-1.30.2.dist-info}/METADATA +9 -4
- {khoj-1.30.1.dev10.dist-info → khoj-1.30.2.dist-info}/RECORD +76 -78
- khoj/interface/compiled/_next/static/chunks/1210.132a7e1910006bbb.js +0 -1
- khoj/interface/compiled/_next/static/chunks/1279-f37ee4a388ebf544.js +0 -1
- khoj/interface/compiled/_next/static/chunks/1603-dc5fd983dbcd070d.js +0 -1
- khoj/interface/compiled/_next/static/chunks/1970-c78f6acc8e16e30b.js +0 -1
- khoj/interface/compiled/_next/static/chunks/2261-748f7c327df3c8c1.js +0 -1
- khoj/interface/compiled/_next/static/chunks/3062-71ed4b46ac2bb87c.js +0 -1
- khoj/interface/compiled/_next/static/chunks/3124-a4cea2eda163128d.js +0 -1
- khoj/interface/compiled/_next/static/chunks/3803-d74118a2d0182c52.js +0 -1
- khoj/interface/compiled/_next/static/chunks/4504-1629487c8bc82203.js +0 -1
- khoj/interface/compiled/_next/static/chunks/5512-94c7c2bbcf58c19d.js +0 -1
- khoj/interface/compiled/_next/static/chunks/5538-b87b60ecc0c27ceb.js +0 -1
- khoj/interface/compiled/_next/static/chunks/7883-b1305ec254213afe.js +0 -20
- khoj/interface/compiled/_next/static/chunks/796-68f9e87f9cdfda1d.js +0 -3
- khoj/interface/compiled/_next/static/chunks/8423-c0123d454681e03a.js +0 -1
- khoj/interface/compiled/_next/static/chunks/9001-3b27af6d5f21df44.js +0 -1
- khoj/interface/compiled/_next/static/chunks/9417-32c4db52ca42e681.js +0 -1
- khoj/interface/compiled/_next/static/chunks/app/settings/page-610d33158b233b34.js +0 -1
- khoj/interface/compiled/_next/static/chunks/webpack-6e43825796b7dfa6.js +0 -1
- khoj/interface/compiled/_next/static/css/2d097a35da6bfe8d.css +0 -1
- khoj/interface/compiled/_next/static/css/80bd6301fc657983.css +0 -1
- khoj/interface/compiled/_next/static/css/ed437164d77aa600.css +0 -25
- /khoj/interface/compiled/_next/static/{JPhknrX7SEOfts8Nop-c9 → UR4enQiSbkZKb3SDFX2tx}/_buildManifest.js +0 -0
- /khoj/interface/compiled/_next/static/{JPhknrX7SEOfts8Nop-c9 → UR4enQiSbkZKb3SDFX2tx}/_ssgManifest.js +0 -0
- /khoj/interface/compiled/_next/static/chunks/{4602-8eeb4b76385ad159.js → 4602-460621c3241e0d13.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/{7023-a5bf5744d19b3bd3.js → 7023-e8de2bded4df6539.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/app/_not-found/{page-07ff4ab42b07845e.js → page-cfba071f5a657256.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/{fd9d1056-2b978342deb60015.js → fd9d1056-2e6c8140e79afc3b.js} +0 -0
- {khoj-1.30.1.dev10.dist-info → khoj-1.30.2.dist-info}/WHEEL +0 -0
- {khoj-1.30.1.dev10.dist-info → khoj-1.30.2.dist-info}/entry_points.txt +0 -0
- {khoj-1.30.1.dev10.dist-info → khoj-1.30.2.dist-info}/licenses/LICENSE +0 -0
@@ -1 +1 @@
|
|
1
|
-
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" href="/_next/static/media/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/2d097a35da6bfe8d.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-6e43825796b7dfa6.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-07e1a8a345e768de.js" async=""></script><meta http-equiv="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';"/><meta http-equiv="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';"/><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-6e43825796b7dfa6.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/2d097a35da6bfe8d.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-07e1a8a345e768de.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\":\"JPhknrX7SEOfts8Nop-c9\",\"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/2d097a35da6bfe8d.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/5d8d85d3f2e95bae.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/3cf13271869a4aeb.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/63e106a52a0ec4ca.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/1f293605f2871853.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-5dbccc5145b80b64.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/4752-554a3db270186ce3.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/3463-081c031e873b7966.js" async=""></script><script src="/_next/static/chunks/1603-ba5f9f05e92c8412.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-635635e4fb39fe29.js" async=""></script><meta http-equiv="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';"/><meta http-equiv="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';"/><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-5dbccc5145b80b64.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/5d8d85d3f2e95bae.css\",\"style\"]\n4:HL[\"/_next/static/css/3cf13271869a4aeb.css\",\"style\"]\n5:HL[\"/_next/static/css/63e106a52a0ec4ca.css\",\"style\"]\n6:HL[\"/_next/static/css/1f293605f2871853.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"7:I[95751,[],\"\"]\n9:I[66513,[],\"ClientPageRoot\"]\na:I[5506,[\"3954\",\"static/chunks/d3ac728e-a9e3522eef9b6b28.js\",\"3072\",\"static/chunks/3072-be830e4f8412b9d2.js\",\"4752\",\"static/chunks/4752-554a3db270186ce3.js\",\"7592\",\"static/chunks/7592-a09c39a38e60634b.js\",\"3690\",\"static/chunks/3690-51312931ba1eae30.js\",\"3463\",\"static/chunks/3463-081c031e873b7966.js\",\"1603\",\"static/chunks/1603-ba5f9f05e92c8412.js\",\"8423\",\"static/chunks/8423-1dda16bc56236523.js\",\"5538\",\"static/chunks/5538-e5f3c9f4d67a64b9.js\",\"3111\",\"static/chunks/app/share/chat/page-635635e4fb39fe29.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\":\"UR4enQiSbkZKb3SDFX2tx\",\"assetPrefix\":\"\",\"urlParts\":[\"\",\"share\",\"chat\",\"\"],\"initialTree\":[\"\",{\"children\":[\"share\",{\"children\":[\"chat\",{\"children\":[\"__PAGE__\",{}]}]}]},\"$undefined\",\"$undefined\",true],\"initialSeedData\":[\"\",{\"children\":[\"share\",{\"children\":[\"chat\",{\"children\":[\"__PAGE__\",{},[[\"$L8\",[\"$\",\"$L9\",null,{\"props\":{\"params\":{},\"searchParams\":{}},\"Component\":\"$a\"}],[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/3cf13271869a4aeb.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/63e106a52a0ec4ca.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"2\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/1f293605f2871853.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}]]],null],null]},[[null,[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[[\"$\",\"meta\",null,{\"httpEquiv\":\"Content-Security-Policy\",\"content\":\"default-src 'self' https://assets.khoj.dev; script-src 'self' https://assets.khoj.dev 'unsafe-inline' 'unsafe-eval'; connect-src 'self' blob: https://ipapi.co/json ws://localhost:42110; style-src 'self' https://assets.khoj.dev 'unsafe-inline' https://fonts.googleapis.com; img-src 'self' data: blob: https://*.khoj.dev https://*.googleusercontent.com https://*.google.com/ https://*.gstatic.com; font-src 'self' https://assets.khoj.dev https://fonts.gstatic.com; child-src 'none'; object-src 'none';\"}],[\"$\",\"body\",null,{\"className\":\"__className_af6c42\",\"children\":[[\"$\",\"$Lb\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"share\",\"children\",\"chat\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$Lc\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\"}],[\"$\",\"script\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"window.EXCALIDRAW_ASSET_PATH = 'https://assets.khoj.dev/@excalidraw/excalidraw/dist/';\"}}]]}]]}]],null],null]},[null,[\"$\",\"$Lb\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"share\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$Lc\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\"}]],null]},[[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/0e9d53dcd7f11342.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/5d8d85d3f2e95bae.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","
|
2
|
+
3:I[5506,["3954","static/chunks/d3ac728e-a9e3522eef9b6b28.js","3072","static/chunks/3072-be830e4f8412b9d2.js","4752","static/chunks/4752-554a3db270186ce3.js","7592","static/chunks/7592-a09c39a38e60634b.js","3690","static/chunks/3690-51312931ba1eae30.js","3463","static/chunks/3463-081c031e873b7966.js","1603","static/chunks/1603-ba5f9f05e92c8412.js","8423","static/chunks/8423-1dda16bc56236523.js","5538","static/chunks/5538-e5f3c9f4d67a64b9.js","3111","static/chunks/app/share/chat/page-635635e4fb39fe29.js"],"default",1]
|
3
3
|
4:I[39275,[],""]
|
4
4
|
5:I[61343,[],""]
|
5
|
-
0:["
|
5
|
+
0:["UR4enQiSbkZKb3SDFX2tx",[[["",{"children":["share",{"children":["chat",{"children":["__PAGE__",{}]}]}]},"$undefined","$undefined",true],["",{"children":["share",{"children":["chat",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/3cf13271869a4aeb.css","precedence":"next","crossOrigin":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/_next/static/css/63e106a52a0ec4ca.css","precedence":"next","crossOrigin":"$undefined"}],["$","link","2",{"rel":"stylesheet","href":"/_next/static/css/1f293605f2871853.css","precedence":"next","crossOrigin":"$undefined"}]]],null],null]},[[null,["$","html",null,{"lang":"en","children":[["$","meta",null,{"httpEquiv":"Content-Security-Policy","content":"default-src 'self' https://assets.khoj.dev; script-src 'self' https://assets.khoj.dev 'unsafe-inline' 'unsafe-eval'; connect-src 'self' blob: https://ipapi.co/json ws://localhost:42110; style-src 'self' https://assets.khoj.dev 'unsafe-inline' https://fonts.googleapis.com; img-src 'self' data: blob: https://*.khoj.dev https://*.googleusercontent.com https://*.google.com/ https://*.gstatic.com; font-src 'self' https://assets.khoj.dev https://fonts.gstatic.com; child-src 'none'; object-src 'none';"}],["$","body",null,{"className":"__className_af6c42","children":[["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","share","children","chat","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}],["$","script",null,{"dangerouslySetInnerHTML":{"__html":"window.EXCALIDRAW_ASSET_PATH = 'https://assets.khoj.dev/@excalidraw/excalidraw/dist/';"}}]]}]]}]],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","share","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/0e9d53dcd7f11342.css","precedence":"next","crossOrigin":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/_next/static/css/5d8d85d3f2e95bae.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
|
khoj/main.py
CHANGED
@@ -208,6 +208,9 @@ def set_state(args):
|
|
208
208
|
state.verbose = args.verbose
|
209
209
|
state.host = args.host
|
210
210
|
state.port = args.port
|
211
|
+
state.ssl_config = (
|
212
|
+
{"ssl_certfile": args.sslcert, "ssl_keyfile": args.sslkey} if args.sslcert and args.sslkey else None
|
213
|
+
)
|
211
214
|
state.anonymous_mode = args.anonymous_mode
|
212
215
|
state.khoj_version = version("khoj")
|
213
216
|
state.chat_on_gpu = args.chat_on_gpu
|
@@ -226,6 +229,7 @@ def start_server(app, host=None, port=None, socket=None):
|
|
226
229
|
use_colors=True,
|
227
230
|
log_config=None,
|
228
231
|
timeout_keep_alive=60,
|
232
|
+
**state.ssl_config if state.ssl_config else {},
|
229
233
|
)
|
230
234
|
logger.info("🌒 Stopping Khoj")
|
231
235
|
|
@@ -19,7 +19,11 @@ from khoj.processor.conversation.utils import (
|
|
19
19
|
generate_chatml_messages_with_context,
|
20
20
|
messages_to_print,
|
21
21
|
)
|
22
|
-
from khoj.utils.helpers import
|
22
|
+
from khoj.utils.helpers import (
|
23
|
+
ConversationCommand,
|
24
|
+
is_none_or_empty,
|
25
|
+
truncate_code_context,
|
26
|
+
)
|
23
27
|
from khoj.utils.rawconfig import LocationData
|
24
28
|
from khoj.utils.yaml import yaml_dump
|
25
29
|
|
@@ -197,7 +201,9 @@ def converse_anthropic(
|
|
197
201
|
if ConversationCommand.Online in conversation_commands or ConversationCommand.Webpage in conversation_commands:
|
198
202
|
context_message += f"{prompts.online_search_conversation.format(online_results=yaml_dump(online_results))}\n\n"
|
199
203
|
if ConversationCommand.Code in conversation_commands and not is_none_or_empty(code_results):
|
200
|
-
context_message +=
|
204
|
+
context_message += (
|
205
|
+
f"{prompts.code_executed_context.format(code_results=truncate_code_context(code_results))}\n\n"
|
206
|
+
)
|
201
207
|
context_message = context_message.strip()
|
202
208
|
|
203
209
|
# Setup Prompt with Primer or Conversation History
|
@@ -18,7 +18,12 @@ 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
|
21
|
+
from khoj.utils.helpers import (
|
22
|
+
get_chat_usage_metrics,
|
23
|
+
in_debug_mode,
|
24
|
+
is_none_or_empty,
|
25
|
+
is_promptrace_enabled,
|
26
|
+
)
|
22
27
|
|
23
28
|
logger = logging.getLogger(__name__)
|
24
29
|
|
@@ -59,6 +64,7 @@ def anthropic_completion_with_backoff(
|
|
59
64
|
aggregated_response = "{" if response_type == "json_object" else ""
|
60
65
|
max_tokens = max_tokens or DEFAULT_MAX_TOKENS_ANTHROPIC
|
61
66
|
|
67
|
+
final_message = None
|
62
68
|
model_kwargs = model_kwargs or dict()
|
63
69
|
if system_prompt:
|
64
70
|
model_kwargs["system"] = system_prompt
|
@@ -73,11 +79,17 @@ def anthropic_completion_with_backoff(
|
|
73
79
|
) as stream:
|
74
80
|
for text in stream.text_stream:
|
75
81
|
aggregated_response += text
|
82
|
+
final_message = stream.get_final_message()
|
83
|
+
|
84
|
+
# Calculate cost of chat
|
85
|
+
input_tokens = final_message.usage.input_tokens
|
86
|
+
output_tokens = final_message.usage.output_tokens
|
87
|
+
tracer["usage"] = get_chat_usage_metrics(model_name, input_tokens, output_tokens, tracer.get("usage"))
|
76
88
|
|
77
89
|
# Save conversation trace
|
78
90
|
tracer["chat_model"] = model_name
|
79
91
|
tracer["temperature"] = temperature
|
80
|
-
if
|
92
|
+
if is_promptrace_enabled():
|
81
93
|
commit_conversation_trace(messages, aggregated_response, tracer)
|
82
94
|
|
83
95
|
return aggregated_response
|
@@ -126,6 +138,7 @@ def anthropic_llm_thread(
|
|
126
138
|
]
|
127
139
|
|
128
140
|
aggregated_response = ""
|
141
|
+
final_message = None
|
129
142
|
with client.messages.stream(
|
130
143
|
messages=formatted_messages,
|
131
144
|
model=model_name, # type: ignore
|
@@ -138,11 +151,17 @@ def anthropic_llm_thread(
|
|
138
151
|
for text in stream.text_stream:
|
139
152
|
aggregated_response += text
|
140
153
|
g.send(text)
|
154
|
+
final_message = stream.get_final_message()
|
155
|
+
|
156
|
+
# Calculate cost of chat
|
157
|
+
input_tokens = final_message.usage.input_tokens
|
158
|
+
output_tokens = final_message.usage.output_tokens
|
159
|
+
tracer["usage"] = get_chat_usage_metrics(model_name, input_tokens, output_tokens, tracer.get("usage"))
|
141
160
|
|
142
161
|
# Save conversation trace
|
143
162
|
tracer["chat_model"] = model_name
|
144
163
|
tracer["temperature"] = temperature
|
145
|
-
if
|
164
|
+
if is_promptrace_enabled():
|
146
165
|
commit_conversation_trace(messages, aggregated_response, tracer)
|
147
166
|
except Exception as e:
|
148
167
|
logger.error(f"Error in anthropic_llm_thread: {e}", exc_info=True)
|
@@ -19,7 +19,11 @@ from khoj.processor.conversation.utils import (
|
|
19
19
|
generate_chatml_messages_with_context,
|
20
20
|
messages_to_print,
|
21
21
|
)
|
22
|
-
from khoj.utils.helpers import
|
22
|
+
from khoj.utils.helpers import (
|
23
|
+
ConversationCommand,
|
24
|
+
is_none_or_empty,
|
25
|
+
truncate_code_context,
|
26
|
+
)
|
23
27
|
from khoj.utils.rawconfig import LocationData
|
24
28
|
from khoj.utils.yaml import yaml_dump
|
25
29
|
|
@@ -208,7 +212,9 @@ def converse_gemini(
|
|
208
212
|
if ConversationCommand.Online in conversation_commands or ConversationCommand.Webpage in conversation_commands:
|
209
213
|
context_message += f"{prompts.online_search_conversation.format(online_results=yaml_dump(online_results))}\n\n"
|
210
214
|
if ConversationCommand.Code in conversation_commands and not is_none_or_empty(code_results):
|
211
|
-
context_message +=
|
215
|
+
context_message += (
|
216
|
+
f"{prompts.code_executed_context.format(code_results=truncate_code_context(code_results))}\n\n"
|
217
|
+
)
|
212
218
|
context_message = context_message.strip()
|
213
219
|
|
214
220
|
# Setup Prompt with Primer or Conversation History
|
@@ -25,7 +25,12 @@ 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
|
28
|
+
from khoj.utils.helpers import (
|
29
|
+
get_chat_usage_metrics,
|
30
|
+
in_debug_mode,
|
31
|
+
is_none_or_empty,
|
32
|
+
is_promptrace_enabled,
|
33
|
+
)
|
29
34
|
|
30
35
|
logger = logging.getLogger(__name__)
|
31
36
|
|
@@ -68,6 +73,7 @@ def gemini_completion_with_backoff(
|
|
68
73
|
response = chat_session.send_message(formatted_messages[-1]["parts"])
|
69
74
|
response_text = response.text
|
70
75
|
except StopCandidateException as e:
|
76
|
+
response = None
|
71
77
|
response_text, _ = handle_gemini_response(e.args)
|
72
78
|
# Respond with reason for stopping
|
73
79
|
logger.warning(
|
@@ -75,10 +81,15 @@ def gemini_completion_with_backoff(
|
|
75
81
|
+ f"Last Message by {messages[-1].role}: {messages[-1].content}"
|
76
82
|
)
|
77
83
|
|
84
|
+
# Aggregate cost of chat
|
85
|
+
input_tokens = response.usage_metadata.prompt_token_count if response else 0
|
86
|
+
output_tokens = response.usage_metadata.candidates_token_count if response else 0
|
87
|
+
tracer["usage"] = get_chat_usage_metrics(model_name, input_tokens, output_tokens, tracer.get("usage"))
|
88
|
+
|
78
89
|
# Save conversation trace
|
79
90
|
tracer["chat_model"] = model_name
|
80
91
|
tracer["temperature"] = temperature
|
81
|
-
if
|
92
|
+
if is_promptrace_enabled():
|
82
93
|
commit_conversation_trace(messages, response_text, tracer)
|
83
94
|
|
84
95
|
return response_text
|
@@ -146,10 +157,15 @@ def gemini_llm_thread(
|
|
146
157
|
if stopped:
|
147
158
|
raise StopCandidateException(message)
|
148
159
|
|
160
|
+
# Calculate cost of chat
|
161
|
+
input_tokens = chunk.usage_metadata.prompt_token_count
|
162
|
+
output_tokens = chunk.usage_metadata.candidates_token_count
|
163
|
+
tracer["usage"] = get_chat_usage_metrics(model_name, input_tokens, output_tokens, tracer.get("usage"))
|
164
|
+
|
149
165
|
# Save conversation trace
|
150
166
|
tracer["chat_model"] = model_name
|
151
167
|
tracer["temperature"] = temperature
|
152
|
-
if
|
168
|
+
if is_promptrace_enabled():
|
153
169
|
commit_conversation_trace(messages, aggregated_response, tracer)
|
154
170
|
except StopCandidateException as e:
|
155
171
|
logger.warning(
|
@@ -19,7 +19,13 @@ from khoj.processor.conversation.utils import (
|
|
19
19
|
)
|
20
20
|
from khoj.utils import state
|
21
21
|
from khoj.utils.constants import empty_escape_sequences
|
22
|
-
from khoj.utils.helpers import
|
22
|
+
from khoj.utils.helpers import (
|
23
|
+
ConversationCommand,
|
24
|
+
in_debug_mode,
|
25
|
+
is_none_or_empty,
|
26
|
+
is_promptrace_enabled,
|
27
|
+
truncate_code_context,
|
28
|
+
)
|
23
29
|
from khoj.utils.rawconfig import LocationData
|
24
30
|
from khoj.utils.yaml import yaml_dump
|
25
31
|
|
@@ -206,7 +212,9 @@ def converse_offline(
|
|
206
212
|
|
207
213
|
context_message += f"{prompts.online_search_conversation_offline.format(online_results=yaml_dump(simplified_online_results))}\n\n"
|
208
214
|
if ConversationCommand.Code in conversation_commands and not is_none_or_empty(code_results):
|
209
|
-
context_message +=
|
215
|
+
context_message += (
|
216
|
+
f"{prompts.code_executed_context.format(code_results=truncate_code_context(code_results))}\n\n"
|
217
|
+
)
|
210
218
|
context_message = context_message.strip()
|
211
219
|
|
212
220
|
# Setup Prompt with Primer or Conversation History
|
@@ -246,7 +254,7 @@ def llm_thread(g, messages: List[ChatMessage], model: Any, max_prompt_size: int
|
|
246
254
|
g.send(response_delta)
|
247
255
|
|
248
256
|
# Save conversation trace
|
249
|
-
if
|
257
|
+
if is_promptrace_enabled():
|
250
258
|
commit_conversation_trace(messages, aggregated_response, tracer)
|
251
259
|
|
252
260
|
finally:
|
@@ -287,7 +295,7 @@ def send_message_to_model_offline(
|
|
287
295
|
# Streamed responses need to be saved by the calling function
|
288
296
|
tracer["chat_model"] = model
|
289
297
|
tracer["temperature"] = temperature
|
290
|
-
if
|
298
|
+
if is_promptrace_enabled():
|
291
299
|
commit_conversation_trace(messages, response_text, tracer)
|
292
300
|
|
293
301
|
return response_text
|
@@ -17,7 +17,11 @@ from khoj.processor.conversation.utils import (
|
|
17
17
|
generate_chatml_messages_with_context,
|
18
18
|
messages_to_print,
|
19
19
|
)
|
20
|
-
from khoj.utils.helpers import
|
20
|
+
from khoj.utils.helpers import (
|
21
|
+
ConversationCommand,
|
22
|
+
is_none_or_empty,
|
23
|
+
truncate_code_context,
|
24
|
+
)
|
21
25
|
from khoj.utils.rawconfig import LocationData
|
22
26
|
from khoj.utils.yaml import yaml_dump
|
23
27
|
|
@@ -196,7 +200,10 @@ def converse(
|
|
196
200
|
if not is_none_or_empty(online_results):
|
197
201
|
context_message += f"{prompts.online_search_conversation.format(online_results=yaml_dump(online_results))}\n\n"
|
198
202
|
if not is_none_or_empty(code_results):
|
199
|
-
context_message +=
|
203
|
+
context_message += (
|
204
|
+
f"{prompts.code_executed_context.format(code_results=truncate_code_context(code_results))}\n\n"
|
205
|
+
)
|
206
|
+
|
200
207
|
context_message = context_message.strip()
|
201
208
|
|
202
209
|
# Setup Prompt with Primer or Conversation History
|
@@ -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,11 @@ 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
|
23
|
+
from khoj.utils.helpers import (
|
24
|
+
get_chat_usage_metrics,
|
25
|
+
in_debug_mode,
|
26
|
+
is_promptrace_enabled,
|
27
|
+
)
|
22
28
|
|
23
29
|
logger = logging.getLogger(__name__)
|
24
30
|
|
@@ -56,7 +62,6 @@ def completion_with_backoff(
|
|
56
62
|
# Update request parameters for compatability with o1 model series
|
57
63
|
# Refer: https://platform.openai.com/docs/guides/reasoning/beta-limitations
|
58
64
|
if model.startswith("o1"):
|
59
|
-
stream = False
|
60
65
|
temperature = 1
|
61
66
|
model_kwargs.pop("stop", None)
|
62
67
|
model_kwargs.pop("response_format", None)
|
@@ -64,32 +69,39 @@ def completion_with_backoff(
|
|
64
69
|
if os.getenv("KHOJ_LLM_SEED"):
|
65
70
|
model_kwargs["seed"] = int(os.getenv("KHOJ_LLM_SEED"))
|
66
71
|
|
67
|
-
chat = client.chat.completions.create(
|
68
|
-
stream=stream,
|
72
|
+
chat: ChatCompletion | openai.Stream[ChatCompletionChunk] = client.chat.completions.create(
|
69
73
|
messages=formatted_messages, # type: ignore
|
70
74
|
model=model, # type: ignore
|
75
|
+
stream=stream,
|
76
|
+
stream_options={"include_usage": True} if stream else {},
|
71
77
|
temperature=temperature,
|
72
78
|
timeout=20,
|
73
79
|
**(model_kwargs or dict()),
|
74
80
|
)
|
75
81
|
|
76
|
-
if not stream:
|
77
|
-
return chat.choices[0].message.content
|
78
|
-
|
79
82
|
aggregated_response = ""
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
83
|
+
if not stream:
|
84
|
+
chunk = chat
|
85
|
+
aggregated_response = chunk.choices[0].message.content
|
86
|
+
else:
|
87
|
+
for chunk in chat:
|
88
|
+
if len(chunk.choices) == 0:
|
89
|
+
continue
|
90
|
+
delta_chunk = chunk.choices[0].delta # type: ignore
|
91
|
+
if isinstance(delta_chunk, str):
|
92
|
+
aggregated_response += delta_chunk
|
93
|
+
elif delta_chunk.content:
|
94
|
+
aggregated_response += delta_chunk.content
|
95
|
+
|
96
|
+
# Calculate cost of chat
|
97
|
+
input_tokens = chunk.usage.prompt_tokens if hasattr(chunk, "usage") and chunk.usage else 0
|
98
|
+
output_tokens = chunk.usage.completion_tokens if hasattr(chunk, "usage") and chunk.usage else 0
|
99
|
+
tracer["usage"] = get_chat_usage_metrics(model, input_tokens, output_tokens, tracer.get("usage"))
|
88
100
|
|
89
101
|
# Save conversation trace
|
90
102
|
tracer["chat_model"] = model
|
91
103
|
tracer["temperature"] = temperature
|
92
|
-
if
|
104
|
+
if is_promptrace_enabled():
|
93
105
|
commit_conversation_trace(messages, aggregated_response, tracer)
|
94
106
|
|
95
107
|
return aggregated_response
|
@@ -156,7 +168,6 @@ def llm_thread(
|
|
156
168
|
# Update request parameters for compatability with o1 model series
|
157
169
|
# Refer: https://platform.openai.com/docs/guides/reasoning/beta-limitations
|
158
170
|
if model_name.startswith("o1"):
|
159
|
-
stream = False
|
160
171
|
temperature = 1
|
161
172
|
model_kwargs.pop("stop", None)
|
162
173
|
model_kwargs.pop("response_format", None)
|
@@ -164,10 +175,11 @@ def llm_thread(
|
|
164
175
|
if os.getenv("KHOJ_LLM_SEED"):
|
165
176
|
model_kwargs["seed"] = int(os.getenv("KHOJ_LLM_SEED"))
|
166
177
|
|
167
|
-
chat = client.chat.completions.create(
|
168
|
-
stream=stream,
|
178
|
+
chat: ChatCompletion | openai.Stream[ChatCompletionChunk] = client.chat.completions.create(
|
169
179
|
messages=formatted_messages,
|
170
180
|
model=model_name, # type: ignore
|
181
|
+
stream=stream,
|
182
|
+
stream_options={"include_usage": True} if stream else {},
|
171
183
|
temperature=temperature,
|
172
184
|
timeout=20,
|
173
185
|
**(model_kwargs or dict()),
|
@@ -175,7 +187,8 @@ def llm_thread(
|
|
175
187
|
|
176
188
|
aggregated_response = ""
|
177
189
|
if not stream:
|
178
|
-
|
190
|
+
chunk = chat
|
191
|
+
aggregated_response = chunk.choices[0].message.content
|
179
192
|
g.send(aggregated_response)
|
180
193
|
else:
|
181
194
|
for chunk in chat:
|
@@ -191,10 +204,15 @@ def llm_thread(
|
|
191
204
|
aggregated_response += text_chunk
|
192
205
|
g.send(text_chunk)
|
193
206
|
|
207
|
+
# Calculate cost of chat
|
208
|
+
input_tokens = chunk.usage.prompt_tokens if hasattr(chunk, "usage") and chunk.usage else 0
|
209
|
+
output_tokens = chunk.usage.completion_tokens if hasattr(chunk, "usage") and chunk.usage else 0
|
210
|
+
tracer["usage"] = get_chat_usage_metrics(model_name, input_tokens, output_tokens, tracer.get("usage"))
|
211
|
+
|
194
212
|
# Save conversation trace
|
195
213
|
tracer["chat_model"] = model_name
|
196
214
|
tracer["temperature"] = temperature
|
197
|
-
if
|
215
|
+
if is_promptrace_enabled():
|
198
216
|
commit_conversation_trace(messages, aggregated_response, tracer)
|
199
217
|
except Exception as e:
|
200
218
|
logger.error(f"Error in llm_thread: {e}", exc_info=True)
|