khoj 1.29.2.dev5__py3-none-any.whl → 1.29.2.dev35__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 (51) hide show
  1. khoj/database/adapters/__init__.py +2 -0
  2. khoj/database/admin.py +32 -1
  3. khoj/interface/compiled/404/index.html +1 -1
  4. khoj/interface/compiled/_next/static/chunks/5538-b87b60ecc0c27ceb.js +1 -0
  5. khoj/interface/compiled/_next/static/chunks/796-68f9e87f9cdfda1d.js +3 -0
  6. khoj/interface/compiled/_next/static/chunks/8423-c0123d454681e03a.js +1 -0
  7. khoj/interface/compiled/_next/static/chunks/app/chat/{page-e95e87da53d725a7.js → page-e60a55d029b6216a.js} +1 -1
  8. khoj/interface/compiled/_next/static/chunks/app/page-fcf7411ff80b6bf5.js +1 -0
  9. khoj/interface/compiled/_next/static/chunks/app/share/chat/{page-3a752baa5fb62e20.js → page-4a4c0f199b89bd80.js} +1 -1
  10. khoj/interface/compiled/_next/static/chunks/{webpack-d37377886a1b4e56.js → webpack-323bbe2678102a2f.js} +1 -1
  11. khoj/interface/compiled/agents/index.html +1 -1
  12. khoj/interface/compiled/agents/index.txt +1 -1
  13. khoj/interface/compiled/automations/index.html +1 -1
  14. khoj/interface/compiled/automations/index.txt +1 -1
  15. khoj/interface/compiled/chat/index.html +1 -1
  16. khoj/interface/compiled/chat/index.txt +2 -2
  17. khoj/interface/compiled/index.html +1 -1
  18. khoj/interface/compiled/index.txt +2 -2
  19. khoj/interface/compiled/search/index.html +1 -1
  20. khoj/interface/compiled/search/index.txt +1 -1
  21. khoj/interface/compiled/settings/index.html +1 -1
  22. khoj/interface/compiled/settings/index.txt +1 -1
  23. khoj/interface/compiled/share/chat/index.html +1 -1
  24. khoj/interface/compiled/share/chat/index.txt +2 -2
  25. khoj/main.py +7 -3
  26. khoj/processor/content/pdf/pdf_to_entries.py +1 -1
  27. khoj/processor/conversation/anthropic/anthropic_chat.py +2 -3
  28. khoj/processor/conversation/google/gemini_chat.py +2 -3
  29. khoj/processor/conversation/offline/chat_model.py +2 -2
  30. khoj/processor/conversation/openai/gpt.py +2 -2
  31. khoj/processor/conversation/prompts.py +14 -69
  32. khoj/processor/conversation/utils.py +7 -0
  33. khoj/processor/tools/online_search.py +22 -4
  34. khoj/routers/api_chat.py +23 -15
  35. khoj/routers/helpers.py +36 -77
  36. khoj/routers/research.py +33 -30
  37. khoj/utils/constants.py +1 -1
  38. khoj/utils/helpers.py +5 -6
  39. khoj/utils/initialization.py +77 -10
  40. {khoj-1.29.2.dev5.dist-info → khoj-1.29.2.dev35.dist-info}/METADATA +1 -1
  41. {khoj-1.29.2.dev5.dist-info → khoj-1.29.2.dev35.dist-info}/RECORD +46 -47
  42. khoj/interface/compiled/_next/static/chunks/5538-32bd787d106700dc.js +0 -1
  43. khoj/interface/compiled/_next/static/chunks/5961-3c104d9736b7902b.js +0 -3
  44. khoj/interface/compiled/_next/static/chunks/8423-ffdc2b835629c7f8.js +0 -1
  45. khoj/interface/compiled/_next/static/chunks/app/page-774dcd8ca4459c7e.js +0 -1
  46. khoj/interface/web/assets/icons/favicon-128x128.ico +0 -0
  47. /khoj/interface/compiled/_next/static/{bIVLxe5g7EDG455p-cfe7 → bkshWraYdEa_w254xnxBc}/_buildManifest.js +0 -0
  48. /khoj/interface/compiled/_next/static/{bIVLxe5g7EDG455p-cfe7 → bkshWraYdEa_w254xnxBc}/_ssgManifest.js +0 -0
  49. {khoj-1.29.2.dev5.dist-info → khoj-1.29.2.dev35.dist-info}/WHEEL +0 -0
  50. {khoj-1.29.2.dev5.dist-info → khoj-1.29.2.dev35.dist-info}/entry_points.txt +0 -0
  51. {khoj-1.29.2.dev5.dist-info → khoj-1.29.2.dev35.dist-info}/licenses/LICENSE +0 -0
@@ -1,6 +1,6 @@
1
1
  khoj/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  khoj/configure.py,sha256=JKqLxXFVe2Xm3MUWYA-3E45SJj_xo0THiLB2YKPb9dU,17312
3
- khoj/main.py,sha256=9YMJEaKlVin5hxU0TcVH5X1CP6wX9HE8Z7qWSxNGPd0,8161
3
+ khoj/main.py,sha256=WaV3muJXT-2MOBOm80kwvx76beUv2njJKRlbxs7jYvA,8300
4
4
  khoj/manage.py,sha256=njo6uLxGaMamTPesHjFEOIBJbpIUrz39e1V59zKj544,664
5
5
  khoj/app/README.md,sha256=PSQjKCdpU2hgszLVF8yEhV7TWhbEEb-1aYLTRuuAsKI,2832
6
6
  khoj/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -8,10 +8,10 @@ khoj/app/asgi.py,sha256=soh3C1xazlgHt_bDgKzrfzo2TKXbNYJsckcXNEgTip8,388
8
8
  khoj/app/settings.py,sha256=M6sQUu_AdeKl3eruecBaifRBhYOBIait0KA2NPizcBM,6198
9
9
  khoj/app/urls.py,sha256=7ECnusoAPAfbO_H_b5FUzYGvnb4LLdWaRDyKNvYuBvg,869
10
10
  khoj/database/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
- khoj/database/admin.py,sha256=Tmvcc4f3HECgxtynIs9ISkjapvu9hsPaStugzVoCmyE,9640
11
+ khoj/database/admin.py,sha256=9xVVQ91gjLW4_ZpN1Ojp6zHynZBjMpJ_F_mEd1eyDA0,10718
12
12
  khoj/database/apps.py,sha256=pM4tkX5Odw4YW_hLLKK8Nd5kqGddf1en0oMCea44RZw,153
13
13
  khoj/database/tests.py,sha256=mrbGGRNg5jwbTJtWWa7zSKdDyeB4vmgZCRc2nk6VY-g,60
14
- khoj/database/adapters/__init__.py,sha256=gv2SNrTpJvW1cPzFwSSY7qF7DYYXY1bWWxi-A141nkM,69020
14
+ khoj/database/adapters/__init__.py,sha256=KxGzqtDpbDPJdy-CZFXOM7sLqogzJXYyp_NDHgXttEg,69084
15
15
  khoj/database/management/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  khoj/database/management/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  khoj/database/management/commands/change_default_model.py,sha256=HkFQOI-2rFjlu7YiulyRcTrITzSzXmY4WiV2hBmml0w,5209
@@ -111,17 +111,17 @@ khoj/interface/compiled/chat.svg,sha256=l2JoYRRgk201adTTdvJ-buKUrc0WGfsudix5xEvt
111
111
  khoj/interface/compiled/close.svg,sha256=hQ2iFLkNzHk0_iyTrSbwnWAeXYlgA-c2Eof2Iqh76n4,417
112
112
  khoj/interface/compiled/copy-button-success.svg,sha256=byqWAYD3Pn9IOXRjOKudJ-TJbP2UESbQGvtLWazNGjY,829
113
113
  khoj/interface/compiled/copy-button.svg,sha256=05bKM2eRxksfBlAPT7yMaoNJEk85bZCxQg67EVrPeHo,669
114
- khoj/interface/compiled/index.html,sha256=phsPSWlQeBTK9qRgVVZxEJbtDOs5e5xwgsWadlNUNYU,12156
115
- khoj/interface/compiled/index.txt,sha256=aBDwEEUg6io43NMPPSCYck5n5PP0FKu1jP7bH_wa8B4,5611
114
+ khoj/interface/compiled/index.html,sha256=FlkSzHS4YzCfVBCqIZb8kdcxeM7KeUSqEsM83QI6nnM,12156
115
+ khoj/interface/compiled/index.txt,sha256=ZVvdwuK24IVFgC0nuN8GTRMOny6lSHu9-yheuDjGeCk,5611
116
116
  khoj/interface/compiled/khoj.webmanifest,sha256=lsknYkvEdMbRTOUYKXPM_8krN2gamJmM4u3qj8u9lrU,1682
117
117
  khoj/interface/compiled/logo.svg,sha256=_QCKVYM4WT2Qhcf7aVFImjq_s5CwjynGXYAOgI7yf8w,8059
118
118
  khoj/interface/compiled/send.svg,sha256=VdavOWkVddcwcGcld6pdfmwfz7S91M-9O28cfeiKJkM,635
119
119
  khoj/interface/compiled/share.svg,sha256=91lwo75PvMDrgocuZQab6EQ62CxRbubh9Bhw7CWMKbg,1221
120
120
  khoj/interface/compiled/thumbs-down.svg,sha256=JGNl-DwoRmH2XFMPWwFFklmoYtKxaQbkLE3nuYKe8ZY,1019
121
121
  khoj/interface/compiled/thumbs-up.svg,sha256=yS1wxTRtiztkN-6nZciLoYQUB_KTYNPV8xFRwH2TQFw,1036
122
- khoj/interface/compiled/404/index.html,sha256=CcFnOA-B6eMXL_GIr9bgaPYM4ACB2vrFjyfejGvYClk,12023
123
- khoj/interface/compiled/_next/static/bIVLxe5g7EDG455p-cfe7/_buildManifest.js,sha256=6I9QUstNpJnhe3leR2Daw0pSXwzcbBscv6h2jmmPpms,224
124
- khoj/interface/compiled/_next/static/bIVLxe5g7EDG455p-cfe7/_ssgManifest.js,sha256=Z49s4suAsf5y_GfnQSvm4qtq2ggxEbZPfEDTXjy6XgA,80
122
+ khoj/interface/compiled/404/index.html,sha256=z4-8F3LWb-mP6_KuwZCUd0qCRKOmxgImvrMiHgYLa1o,12023
123
+ khoj/interface/compiled/_next/static/bkshWraYdEa_w254xnxBc/_buildManifest.js,sha256=6I9QUstNpJnhe3leR2Daw0pSXwzcbBscv6h2jmmPpms,224
124
+ khoj/interface/compiled/_next/static/bkshWraYdEa_w254xnxBc/_ssgManifest.js,sha256=Z49s4suAsf5y_GfnQSvm4qtq2ggxEbZPfEDTXjy6XgA,80
125
125
  khoj/interface/compiled/_next/static/chunks/1210.132a7e1910006bbb.js,sha256=2dJueIfOg5qlQdanOM9HrgwcfrUXCD57bfd8Iv7iJcU,2104
126
126
  khoj/interface/compiled/_next/static/chunks/1279-f37ee4a388ebf544.js,sha256=U_1WaocOdgJ4HZB8tRx_izzYGD1EZlCohC1uLCffCWc,45582
127
127
  khoj/interface/compiled/_next/static/chunks/1459.690bf20e7d7b7090.js,sha256=z-ruZPxF_Z3ef_WOThd9Ox36AMhxaW3znizVivNnA34,34239
@@ -134,12 +134,12 @@ khoj/interface/compiled/_next/static/chunks/3803-d74118a2d0182c52.js,sha256=Elqf
134
134
  khoj/interface/compiled/_next/static/chunks/4504-1629487c8bc82203.js,sha256=z6NvJ2KOjYPbMNsYQKyX9PV4DeURUoP6LKoNb4kZXg0,11637
135
135
  khoj/interface/compiled/_next/static/chunks/4602-8eeb4b76385ad159.js,sha256=pz2lEr0JOrMdrddv2R2vej4e9uxpOr5KFX966ClLbOU,29928
136
136
  khoj/interface/compiled/_next/static/chunks/5512-94c7c2bbcf58c19d.js,sha256=ySpWRBlOMbttpBPr-j6_y9FmVrWfeRdardPkVnYAXzw,103730
137
- khoj/interface/compiled/_next/static/chunks/5538-32bd787d106700dc.js,sha256=aZZKwp3YRs4ff6gzG5PGSlyeCPvrzYB9Rw5dsdfdZpU,34191
138
- khoj/interface/compiled/_next/static/chunks/5961-3c104d9736b7902b.js,sha256=qss4GGVTNo_Rp3x8bU1I_l-SZCa-XAoVaxbLYOOcDTU,1089568
137
+ khoj/interface/compiled/_next/static/chunks/5538-b87b60ecc0c27ceb.js,sha256=_gYTfk_4_QokG8JC41SvGJmxgCjViwHflNNTX2rlzXI,34236
139
138
  khoj/interface/compiled/_next/static/chunks/6297-d1c842ed3f714ab0.js,sha256=4nzZ2umR-q6wQ-8L4RSivWXKV_SE1dWoN9qA1I9lCRI,25675
140
139
  khoj/interface/compiled/_next/static/chunks/7023-a5bf5744d19b3bd3.js,sha256=TBJA7dTnI8nymtbljKuZzo2hbStXWR-P8Qkl57k2Tw8,123898
141
140
  khoj/interface/compiled/_next/static/chunks/7883-b1305ec254213afe.js,sha256=dDbERTNiKRIIdC7idybjZq03gnxQtudMawrekye0zH8,241134
142
- khoj/interface/compiled/_next/static/chunks/8423-ffdc2b835629c7f8.js,sha256=e2jAWQ-jQxP-067cJlzMogEtg-UwLZxrg9DP4DHstng,15238
141
+ khoj/interface/compiled/_next/static/chunks/796-68f9e87f9cdfda1d.js,sha256=sGuaWffm4HXr8jrS3_HpLzmiGSrZ9TJV1l0btptfPLA,1092974
142
+ khoj/interface/compiled/_next/static/chunks/8423-c0123d454681e03a.js,sha256=ZMV9-K9UbK23ldDrwnYVox4UU9vqxvbcwSgAPlqoeR8,15303
143
143
  khoj/interface/compiled/_next/static/chunks/9001-3b27af6d5f21df44.js,sha256=ran2mMGTO2kiAJebRGMyfyAu4Sdjw-WobS_m6g-qjz8,34223
144
144
  khoj/interface/compiled/_next/static/chunks/9417-32c4db52ca42e681.js,sha256=9r3lV-DxmhmQnYjroVbjAXPyX6rvSmhZKfUguE0dENw,15039
145
145
  khoj/interface/compiled/_next/static/chunks/94ca1967.5584df65931cfe83.js,sha256=lxdrZ8h3_IWkTuk6QlzM2Hd9Pvu9_p8h_EI4aveSOgE,1174519
@@ -150,22 +150,22 @@ khoj/interface/compiled/_next/static/chunks/framework-8e0e0f4a6b83a956.js,sha256
150
150
  khoj/interface/compiled/_next/static/chunks/main-1ea5c2e0fdef4626.js,sha256=8_u87PGI3PahFbDfGWGvpD-a18J7X7ChUqWIeqxVq7g,111061
151
151
  khoj/interface/compiled/_next/static/chunks/main-app-6d6ee3495efe03d4.js,sha256=i52E7sWOcSq1G8eYZL3mtTxbUbwRNxcAbSWQ6uWpMsY,475
152
152
  khoj/interface/compiled/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js,sha256=6QPOwdWeAVe8x-SsiDrm-Ga6u2DkqgG5SFqglrlyIgA,91381
153
- khoj/interface/compiled/_next/static/chunks/webpack-d37377886a1b4e56.js,sha256=uZx5Rho2ddFBfyZSvMYSu3v0CVZ6bZaB5oKzHGSvIbE,4054
153
+ khoj/interface/compiled/_next/static/chunks/webpack-323bbe2678102a2f.js,sha256=HWPppnK-y1VxwM3jvAhJmgztWlWV2ar1NZZUWFjBbWg,4054
154
154
  khoj/interface/compiled/_next/static/chunks/app/layout-86561d2fac35a91a.js,sha256=2EWsyKE2kcC5uDvsOtgG5OP0hHCX8sCph4NqhUU2rCg,442
155
- khoj/interface/compiled/_next/static/chunks/app/page-774dcd8ca4459c7e.js,sha256=ueEIbfyWJZsqjAz2b1gQBAEEyHek-hbiehBpxswXRnc,29683
155
+ khoj/interface/compiled/_next/static/chunks/app/page-fcf7411ff80b6bf5.js,sha256=VlOR_tnA5EULQXzWNDUPbUDTbsKCTxJAGPmWz6iXXig,33220
156
156
  khoj/interface/compiled/_next/static/chunks/app/_not-found/page-07ff4ab42b07845e.js,sha256=3mCUnxfMxyK44eqk21TVBrC6u--WSbvx31fTmQuOvMQ,1755
157
157
  khoj/interface/compiled/_next/static/chunks/app/agents/layout-e9838b642913a071.js,sha256=w3vWDf7m2_VG7q98_KGAWbCO06RI7iqFYsb4nDqGUDw,372
158
158
  khoj/interface/compiled/_next/static/chunks/app/agents/page-ee4f0da14df15091.js,sha256=uqFdU7KMW0ZqRQySoGhRNXTHvodXxMC34a1zhr47vVs,11750
159
159
  khoj/interface/compiled/_next/static/chunks/app/automations/layout-27c28e923c9b1ff0.js,sha256=d2vJ_lVB0pfeFXNUPzHAe1ca5NzdNowHPh___SPqugM,5143
160
160
  khoj/interface/compiled/_next/static/chunks/app/automations/page-da59a2b9ec07da16.js,sha256=R7auC6hEUsXt6aysFhuyAEcGGUaZ4QOnLxxc8XdDSbc,35349
161
161
  khoj/interface/compiled/_next/static/chunks/app/chat/layout-b0e7ff4baa3b5265.js,sha256=a-Qv2nHUrCa1gIs4Qo5txnOlhhQessAdcnAhhjaN3ag,374
162
- khoj/interface/compiled/_next/static/chunks/app/chat/page-e95e87da53d725a7.js,sha256=-2zXrMu8g66gPw4jsGKbeplGd8rXMlkqfsG8qAOtGf4,7181
162
+ khoj/interface/compiled/_next/static/chunks/app/chat/page-e60a55d029b6216a.js,sha256=qdjCIEOXvtnxAyZp9gjxODNq-WHzDOk-kI1UtEgmOU8,7070
163
163
  khoj/interface/compiled/_next/static/chunks/app/search/layout-ea6b73fdaf9b24ca.js,sha256=mBgNUjaTBNgIKOpZj722mh1ojg1CNIYRBPiupStSS6s,165
164
164
  khoj/interface/compiled/_next/static/chunks/app/search/page-4f44549ba3807021.js,sha256=3O3gUM_ALtxAqNVAwQ9X_FDedXFYEcNWEqndayZeTBY,6958
165
165
  khoj/interface/compiled/_next/static/chunks/app/settings/layout-254eaaf916449a60.js,sha256=kHAKleDbNFfhNM3e1WLJm3OFw6PDtGcjyj5toO24vps,5347
166
166
  khoj/interface/compiled/_next/static/chunks/app/settings/page-5591490850437232.js,sha256=p0kRFoAYcSHSxG2y8JOaUBU-Xc__jwCIbYrUs_NEJu8,32149
167
167
  khoj/interface/compiled/_next/static/chunks/app/share/chat/layout-cf7445cf0326bda3.js,sha256=W3axh1K4y-pLSXcXogLl4qLKXr5BZLY1uA7JfSWp5TU,373
168
- khoj/interface/compiled/_next/static/chunks/app/share/chat/page-3a752baa5fb62e20.js,sha256=gIcgm8Wtf38E8fP2jE58mPYm2GLOL5WU7HRxONXrK1g,4376
168
+ khoj/interface/compiled/_next/static/chunks/app/share/chat/page-4a4c0f199b89bd80.js,sha256=lj2nwWtCd_NUCCTc9jmBBBvO5U5m2VVEUGkdnnpSRu8,4375
169
169
  khoj/interface/compiled/_next/static/chunks/pages/_app-f870474a17b7f2fd.js,sha256=eqdFPAN_XFyMUzZ9qwFk-_rhMWZrU7lgNVt1foVUANo,286
170
170
  khoj/interface/compiled/_next/static/chunks/pages/_error-c66a4e8afc46f17b.js,sha256=vjERjtMAbVk-19LyPf1Jc-H6TMcrSznSz6brzNqbqf8,253
171
171
  khoj/interface/compiled/_next/static/css/0e9d53dcd7f11342.css,sha256=52_LSJ59Vwm1p2UpcDXEvq99pTjz2sW4EjF5iKf-dzs,2622
@@ -248,8 +248,8 @@ khoj/interface/compiled/_next/static/media/flags.3afdda2f.webp,sha256=M2AW_HLpBn
248
248
  khoj/interface/compiled/_next/static/media/flags@2x.5fbe9fc1.webp,sha256=BBeRPBZkxY3-aKkMnYv5TSkxmbeMbyUH4VRIPfrWg1E,137406
249
249
  khoj/interface/compiled/_next/static/media/globe.98e105ca.webp,sha256=g3ofb8-W9GM75zIhlvQhaS8I2py9TtrovOKR3_7Jf04,514
250
250
  khoj/interface/compiled/_next/static/media/globe@2x.974df6f8.webp,sha256=I_N7Yke3IOoS-0CC6XD8o0IUWG8PdPbrHmf6lpgWlZY,1380
251
- khoj/interface/compiled/agents/index.html,sha256=PW1EP2bWPYYpHUoi0Bj2VA7DqUTc788geqFgTUiAjWE,12658
252
- khoj/interface/compiled/agents/index.txt,sha256=NYEusCcSS7ptQDq5EUfe_oaSMxHkND6lNMfy2Wu9Aik,6045
251
+ khoj/interface/compiled/agents/index.html,sha256=RWqVGQRZs6cyi_xOEKqxrj7JQkXppysfuhgkSxNMBS4,12658
252
+ khoj/interface/compiled/agents/index.txt,sha256=g7ngehW8IjKwbHvwHoa5i7UlCkb222U59-AqQ36smwc,6045
253
253
  khoj/interface/compiled/assets/icons/khoj_lantern.ico,sha256=eggu-B_v3z1R53EjOFhIqqPnICBGdoaw1xnc0NrzHck,174144
254
254
  khoj/interface/compiled/assets/icons/khoj_lantern_128x128.png,sha256=aTxivDb3CYyThkVZWz8A19xl_dNut5DbkXhODWF3A9Q,5640
255
255
  khoj/interface/compiled/assets/icons/khoj_lantern_256x256.png,sha256=xPCMLHiaL7lYOdQLZrKwWE-Qjn5ZaysSZB0ScYv4UZU,12312
@@ -260,16 +260,16 @@ khoj/interface/compiled/assets/samples/desktop-remember-plan-sample.png,sha256=i
260
260
  khoj/interface/compiled/assets/samples/phone-browse-draw-sample.png,sha256=Dd4fPwtFl6BWqnHjeb1mCK_ND0hhHsWtx8sNE7EiMuE,406179
261
261
  khoj/interface/compiled/assets/samples/phone-plain-chat-sample.png,sha256=DEDaNRCkfEWUeh3kYZWIQDTVK1a6KKnYdwj5ZWisN_Q,82985
262
262
  khoj/interface/compiled/assets/samples/phone-remember-plan-sample.png,sha256=Ma3blirRmq3X4oYSsDbbT7MDn29rymDrjwmUfA9BMuM,236285
263
- khoj/interface/compiled/automations/index.html,sha256=c7BJGXDZfx-lLMmnseGmVisbJJrp9VsS8cUV_Cq6Fkw,30941
264
- khoj/interface/compiled/automations/index.txt,sha256=CzLja08Sht7ES0OZ8uU2HPi7W04UeUKHXOROFnlGFmo,5633
265
- khoj/interface/compiled/chat/index.html,sha256=CaW_I1YNcAm7cUTVq68ir3PrqJvyFJXsn1wXP5Ciwdw,13860
266
- khoj/interface/compiled/chat/index.txt,sha256=4EGC55bMvXrVMFx4h-WVxJir9i5H_39aecZKvpE0xeA,6590
267
- khoj/interface/compiled/search/index.html,sha256=gupaUQA80tHAoy6nDT7RV3TC074bYoe-zY-Sh-jNwPY,30161
268
- khoj/interface/compiled/search/index.txt,sha256=sI_qcZ48itrA80_uvfvKiVwR0tka2xBJ5_cXRcHibZU,5256
269
- khoj/interface/compiled/settings/index.html,sha256=6s81Ie776WybeagzRZJC3TONvT0n0P7NWMVGIRmx16Q,12831
270
- khoj/interface/compiled/settings/index.txt,sha256=Ql3KF4IltiX1PF_c-xU5ombx8y2n4xzkioo0iG2ySnQ,6078
271
- khoj/interface/compiled/share/chat/index.html,sha256=WtZGHfnQs5TK12nK56MDSAkrVnNZxjv0rb9lBEdBF1M,15157
272
- khoj/interface/compiled/share/chat/index.txt,sha256=o6H0BhBz-l4j_EhCFgi_PXNL6_fEgO61QIQ6J9bovzE,7387
263
+ khoj/interface/compiled/automations/index.html,sha256=VtUtB6H4cwXDfL2MvJfAaDCanPxLqbB4ouKwVdScAtM,30941
264
+ khoj/interface/compiled/automations/index.txt,sha256=PmrtVhsf1yL7EOf8weA6MnOewgdSI997n_w64hVLfqQ,5633
265
+ khoj/interface/compiled/chat/index.html,sha256=vlQZScMxIBHHnkPLPozaU-Y5qU5rpzyIQF2H_MujQZs,13857
266
+ khoj/interface/compiled/chat/index.txt,sha256=fTucaSGLJYtUntYQ9H2RLpm4k1DJxiK7nbwEZ0ZKR30,6588
267
+ khoj/interface/compiled/search/index.html,sha256=rpB5uN97ObKnKS_HC9OC1Bctsq79jRI5Kx0Epd66O5g,30161
268
+ khoj/interface/compiled/search/index.txt,sha256=wgD9tKbIgSrX1J1SbrORBaw_1NQ2K4RnIOHUsWAwwiQ,5256
269
+ khoj/interface/compiled/settings/index.html,sha256=35hwKBwaxZfdGh8VjbjzITkeL4JvLGv6Rn7TnNfbB_I,12831
270
+ khoj/interface/compiled/settings/index.txt,sha256=NWcTJw1pYtZx33VEiDUOk6IBHbwNnLf45EeFdMYAFgM,6078
271
+ khoj/interface/compiled/share/chat/index.html,sha256=F6DV_uUB6trYuBYxMCXtZHvFE_fUSGJcH4jbBAdPcVU,15154
272
+ khoj/interface/compiled/share/chat/index.txt,sha256=t-L2MQ443u_Ay4WCMw1qA6NkStAVzgUuFN53W-UFjN4,7385
273
273
  khoj/interface/email/feedback.html,sha256=xksuPFamx4hGWyTTxZKRgX_eiYQQEuv-eK9Xmkt-nwU,1216
274
274
  khoj/interface/email/magic_link.html,sha256=EoGKQucfPj3xQrWXhSZAzPFOYCHF_ZX94TWCd1XHl1M,941
275
275
  khoj/interface/email/task.html,sha256=tY7a0gzVeQ2lSQNu7WyXR_s7VYeWTrxWEj1iHVuoVE4,2813
@@ -283,7 +283,6 @@ khoj/interface/web/assets/utils.js,sha256=A22W1nOVuD1osI7TtZC8fZ0r1g4pE66tXQ_4XN
283
283
  khoj/interface/web/assets/icons/agents.svg,sha256=_DK73fRvvn5I-ajKZxH--9qLv-721QSiMk_lnwZKXlw,2609
284
284
  khoj/interface/web/assets/icons/automation.svg,sha256=6SHlGisTmg7iFQ3mLG1BQoSc-HMaaJKsLFVIYaFV2Hs,1579
285
285
  khoj/interface/web/assets/icons/chat.svg,sha256=cDicxL36Nn0BkCUFezwm7UOM0KefSClsid5HbRHxovU,2439
286
- khoj/interface/web/assets/icons/favicon-128x128.ico,sha256=JMZf9aZor9AUbh5kuFNDaG3Mjxvoau5k80yRA9ly5TQ,205167
287
286
  khoj/interface/web/assets/icons/github.svg,sha256=E789GwMweG0aU1wJNp0FjWHlFX1AxuA5H0durEnw5hQ,964
288
287
  khoj/interface/web/assets/icons/khoj-logo-sideways-200.png,sha256=2_F1PpTZzfjvaHej9jjENx03H1vKtFsVkolwTPLJP9Q,6637
289
288
  khoj/interface/web/assets/icons/khoj-logo-sideways-500.png,sha256=VQsQ20NC-sKYHa9UgAvLM2N25DWRISZUIGW0zhnRres,18603
@@ -317,45 +316,45 @@ khoj/processor/content/org_mode/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm
317
316
  khoj/processor/content/org_mode/org_to_entries.py,sha256=KQBn792yM9fsfaFu8FFoxk1PwYR-lmA07RUXEJQFkHs,10237
318
317
  khoj/processor/content/org_mode/orgnode.py,sha256=DlHZICxbCRxqGxA_osYf1faxslxpSuIqbHco8oxAKKM,18478
319
318
  khoj/processor/content/pdf/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
320
- khoj/processor/content/pdf/pdf_to_entries.py,sha256=ig7GzAoNewBD-9IwwLayWofTSlhvYYAUrMgkddkY0es,5016
319
+ khoj/processor/content/pdf/pdf_to_entries.py,sha256=GQUvab61okhV9_DK0g2MCrMq8wKpM208EbXvsaTAkzs,4995
321
320
  khoj/processor/content/plaintext/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
322
321
  khoj/processor/content/plaintext/plaintext_to_entries.py,sha256=wFZwK_zIc7gWbRtO9sOHo9KvfhGAzL9psX_nKWYFduo,4975
323
322
  khoj/processor/conversation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
324
- khoj/processor/conversation/prompts.py,sha256=jXVxeFYHBP6LBSAmdykYH6in297VTgVdEJ5IDsYlQnI,50319
325
- khoj/processor/conversation/utils.py,sha256=sp9NjsP6dl1RMlcmX4GGZTD9bIUozXr9OD6gDvxxLV4,27635
323
+ khoj/processor/conversation/prompts.py,sha256=20IFC1uyyPLAe3OYyVlQ1TlFVbZuMh0IQwp6Hz0x39k,48831
324
+ khoj/processor/conversation/utils.py,sha256=2gbglhzKMEuldL0P9Y6miCF8BNooiEgFFNdgc8lvneQ,27870
326
325
  khoj/processor/conversation/anthropic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
327
- khoj/processor/conversation/anthropic/anthropic_chat.py,sha256=4QE0sa6Oqq_rpKp7Xj24ta2zCVr_H2p_LhIDlLqZZxI,8701
326
+ khoj/processor/conversation/anthropic/anthropic_chat.py,sha256=8w7oSTBIxcZa6y03Zo2nuQFa2WMiazwK_qfO2q_O-6c,8618
328
327
  khoj/processor/conversation/anthropic/utils.py,sha256=6_FnsfLRqjkubkfMVmPTEEBzvMUOAccIz5AHV6B9mU8,6623
329
328
  khoj/processor/conversation/google/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
330
- khoj/processor/conversation/google/gemini_chat.py,sha256=hGdC9uBNpi0eHoOwzZA_2gUrEgdWCODx-PiFqarCVYc,8902
329
+ khoj/processor/conversation/google/gemini_chat.py,sha256=MABG3OAqfz-DDp6sHbkHcyM3VTevPOUV6x3iCB__mcc,8819
331
330
  khoj/processor/conversation/google/utils.py,sha256=-Z5crXL6-xJraEX4qShbI3Y4PAqKi55PEWiEDPSi-LM,10205
332
331
  khoj/processor/conversation/offline/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
333
- khoj/processor/conversation/offline/chat_model.py,sha256=BiH-p6CigmZSXNzs6oNvjcYeiSEsVTRPdTPH0oTPPlM,11000
332
+ khoj/processor/conversation/offline/chat_model.py,sha256=SCkloMOcQlC01yE-mYOU_hF5efpq_sDpaOYK6aYxN_c,10941
334
333
  khoj/processor/conversation/offline/utils.py,sha256=51McImxl6u1qgRYvMt7uzsgLGSLq5SMFy74ymlNjIcc,3033
335
334
  khoj/processor/conversation/offline/whisper.py,sha256=DJI-8y8DULO2cQ49m2VOvRyIZ2TxBypc15gM8O3HuMI,470
336
335
  khoj/processor/conversation/openai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
337
- khoj/processor/conversation/openai/gpt.py,sha256=szg-45KuDsUJXDg4CSMaeCEA3WZ8LDGA1ajOxW1Wc1U,8163
336
+ khoj/processor/conversation/openai/gpt.py,sha256=IYv1PAiO1KaD5hCxWKQfzfSBRYR7seMP_kfofuLrexQ,8104
338
337
  khoj/processor/conversation/openai/utils.py,sha256=n_lFlgNjsFbghF1gfNPRtPvR3GG2JjUwWTGbjvnxbLU,6448
339
338
  khoj/processor/conversation/openai/whisper.py,sha256=zoEeK1LNCg_tzP4xzYi5vRPzNPGuDGzpkrkG7d1LUn4,447
340
339
  khoj/processor/image/generate.py,sha256=i5J51AwlMZbdlHHov-_MAw9bYgdVYmGgFjCYWDfx02s,9120
341
340
  khoj/processor/speech/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
342
341
  khoj/processor/speech/text_to_speech.py,sha256=Q7sapi5Hv6woXOumtrGqR0t6izZrFBkWXFOGrHM6dJ4,1929
343
342
  khoj/processor/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
344
- khoj/processor/tools/online_search.py,sha256=uxwtvKReGEW1XhkeToi7XB_oZ301DIcnD7Wr3xojuM4,16307
343
+ khoj/processor/tools/online_search.py,sha256=X8D3ClKpg34r_LMol28GdBqZ--YVGGVBPc9lUSgb2mg,17128
345
344
  khoj/processor/tools/run_code.py,sha256=i9ce53dw0y5ZNhPorRNYJieIKw6eyrZQX0ABDrWiW8M,7738
346
345
  khoj/routers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
347
346
  khoj/routers/api.py,sha256=_AI1pnQMQM75L6WVZSAVfvrk04pLEdLbHA0fkyxnUbo,28489
348
347
  khoj/routers/api_agents.py,sha256=vHPruCjlQxGBdm0lcmymEb9-aAELqbOplqh21WwD0DQ,9699
349
- khoj/routers/api_chat.py,sha256=83jqlGex6K3bry9_Pq4Ti8pEGHhENsjtlW4EgWbL-88,48704
348
+ khoj/routers/api_chat.py,sha256=QQA2hg_TL_kShFHWPdCXmauftLNkvknwWyDJMtXLDkE,49193
350
349
  khoj/routers/api_content.py,sha256=WNlB6lVwRW8hHDthO2HypbpPvqrqt9rTU5oMRNknpMU,21070
351
350
  khoj/routers/api_model.py,sha256=KDsxNwHspC94eTcv6l3ehr773EOvgc670UnZLE1WZ4o,3642
352
351
  khoj/routers/api_phone.py,sha256=p9yfc4WeMHDC0hg3aQk60a2VBy8rZPdEnz9wdJ7DzkU,2208
353
352
  khoj/routers/api_subscription.py,sha256=J6xZNZDdOA71vCfethlPfAyfvRBq4HGCBpbsOZ9CWj0,5333
354
353
  khoj/routers/auth.py,sha256=HO54PR-BkWA_iJIktEobUrObcXVYG-00jpnIcEVdR5s,6564
355
354
  khoj/routers/email.py,sha256=SGYNPQvfcvYeHf70F0YqpY0FLMRElF2ZekROXdwGI18,3821
356
- khoj/routers/helpers.py,sha256=v-dnh2AwuXQNCWGHYLacGnq-8bNSluU2Ym8z7JG4ek0,82672
355
+ khoj/routers/helpers.py,sha256=z16PnK26S4KWDYlxKgAqULhtR0FfIo-H6m08blLGxrg,81603
357
356
  khoj/routers/notion.py,sha256=g53xyYFmjr2JnuIrTW2vytbfkiK_UkoRTxqnnLSmD5o,2802
358
- khoj/routers/research.py,sha256=lWD7ZLkgRUh2rxmjhzj9RIuibixNrbeqSzlLCEda1aI,15721
357
+ khoj/routers/research.py,sha256=SczFMS9a8_Wxhh3n_Zt9CJ-zZugBDAd_WmiZGFa6RR8,16117
359
358
  khoj/routers/storage.py,sha256=tJrwhFRVWv0MHv7V7huMc1Diwm-putZSwnZXJ3tqT_c,2338
360
359
  khoj/routers/twilio.py,sha256=MLsuCm4--ETvr3sLxbF0CL_ehlg_l2rKBSLR2Qh2Xls,1081
361
360
  khoj/routers/web_client.py,sha256=frH03Sh0AR7c2MvRyc5a3tOFyxyVak3d1pl1sLcLLD4,4212
@@ -369,17 +368,17 @@ khoj/search_type/text_search.py,sha256=PZzJVCXpeBM795SIqiAKXAxgnCp1NIRiVikm040r1
369
368
  khoj/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
370
369
  khoj/utils/cli.py,sha256=EA7IvWAInUIll8YFTOpQtqLtCQXwphfHi5rJ2TKAdSQ,3757
371
370
  khoj/utils/config.py,sha256=aiOkH0je8A30DAGYTHMRePrgJonFv_i07_7CdhhhcdA,1805
372
- khoj/utils/constants.py,sha256=UwE7U9bNsfeqTb0K2lcdXdAscM4-7uuVoR3KbZS03Pg,1216
371
+ khoj/utils/constants.py,sha256=DNts_NN4ZL9nRCA9KH3ZD_6PBK9VVggtun79pQxzNnU,1219
373
372
  khoj/utils/fs_syncer.py,sha256=5nqwAZqRk3Nwhkwd8y4IomTPZQmW32GwAqyMzal5KyY,9996
374
- khoj/utils/helpers.py,sha256=JMCxQKEmz9ktZrSLQQh3cpm97dVsHT5J0rKY3bTrNco,20126
375
- khoj/utils/initialization.py,sha256=TjA2ZImYKI-J1tEBE_0TaOLnVQidVV5GDEFBOPq8aik,10048
373
+ khoj/utils/helpers.py,sha256=tdwRlkI5IqOr07cxw4zKindR3hSn6cGthPYHSXs2BcU,20239
374
+ khoj/utils/initialization.py,sha256=nJtqPUv52SPA6sPHn0_vs1uSBdDihX25Dvvagu81Xbs,13490
376
375
  khoj/utils/jsonl.py,sha256=0Ac_COqr8sLCXntzZtquxuCEVRM2c3yKeDRGhgOBRpQ,1192
377
376
  khoj/utils/models.py,sha256=Q5tcC9-z25sCiub048fLnvZ6_IIO1bcPNxt5payekk0,2009
378
377
  khoj/utils/rawconfig.py,sha256=bQ_MGbBzYt6ZUIsHUwZjaHKDLh6GQ7h-sENkv3fyVbQ,5028
379
378
  khoj/utils/state.py,sha256=KtUEIKAZdGGN_Qr58RS1pgcywgSafun8YIXx-YEclAY,1645
380
379
  khoj/utils/yaml.py,sha256=qy1Tkc61rDMesBw_Cyx2vOR6H-Hngcsm5kYfjwQBwkE,1543
381
- khoj-1.29.2.dev5.dist-info/METADATA,sha256=Nh_eOPBR007B4US8wNq8qblBiowZYWm_PIt8qoiVHGs,7119
382
- khoj-1.29.2.dev5.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
383
- khoj-1.29.2.dev5.dist-info/entry_points.txt,sha256=KBIcez5N_jCgq_ER4Uxf-e1lxTBMTE_BBjMwwfeZyAg,39
384
- khoj-1.29.2.dev5.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
385
- khoj-1.29.2.dev5.dist-info/RECORD,,
380
+ khoj-1.29.2.dev35.dist-info/METADATA,sha256=u3KlwJ3TalfjlqARcFoPsAK57lbHJkWmRm2TeSN-fBE,7120
381
+ khoj-1.29.2.dev35.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
382
+ khoj-1.29.2.dev35.dist-info/entry_points.txt,sha256=KBIcez5N_jCgq_ER4Uxf-e1lxTBMTE_BBjMwwfeZyAg,39
383
+ khoj-1.29.2.dev35.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
384
+ khoj-1.29.2.dev35.dist-info/RECORD,,
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5538],{55538:function(e,t,a){"use strict";a.d(t,{Z:function(){return eC}});var n=a(57437),s=a(15238),o=a.n(s),l=a(2265),r=a(34531),c=a.n(r),i=a(14944),d=a(39952),u=a.n(d),h=a(34040);a(7395);var m=a(11961),g=a(26100),f=a(36013),p=a(13304),x=a(12218),v=a(74697),j=a(37440);let w=p.fC,b=p.xz;p.x8;let y=p.h_,C=l.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(p.aV,{className:(0,j.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...s,ref:t})});C.displayName=p.aV.displayName;let N=(0,x.j)("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),M=l.forwardRef((e,t)=>{let{side:a="right",className:s,children:o,...l}=e;return(0,n.jsxs)(y,{children:[(0,n.jsx)(C,{}),(0,n.jsxs)(p.VY,{ref:t,className:(0,j.cn)(N({side:a}),s),...l,children:[o,(0,n.jsxs)(p.x8,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[(0,n.jsx)(v.Z,{className:"h-4 w-4"}),(0,n.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});M.displayName=p.VY.displayName;let k=e=>{let{className:t,...a}=e;return(0,n.jsx)("div",{className:(0,j.cn)("flex flex-col space-y-2 text-center sm:text-left",t),...a})};k.displayName="SheetHeader";let _=l.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(p.Dx,{ref:t,className:(0,j.cn)("text-lg font-semibold text-foreground",a),...s})});_.displayName=p.Dx.displayName;let R=l.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(p.dk,{ref:t,className:(0,j.cn)("text-sm text-muted-foreground",a),...s})});R.displayName=p.dk.displayName;var I=a(19573),T=a(11838),E=a.n(T),F=a(89417);let D=new i.Z({html:!0,linkify:!0,typographer:!0});function S(e){let t=(0,F.Le)(e.title||".txt","w-6 h-6 text-muted-foreground inline-flex mr-2"),a=e.title.split("/").pop()||e.title,s=function(e){let t=["org","md","markdown"].includes(e.title.split(".").pop()||"")?e.content.split("\n").slice(1).join("\n"):e.content;return e.showFullContent?E().sanitize(D.render(t)):E().sanitize(t)}(e),[o,r]=(0,l.useState)(!1);return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(I.J2,{open:o&&!e.showFullContent,onOpenChange:r,children:[(0,n.jsx)(I.xo,{asChild:!0,children:(0,n.jsxs)(f.Zb,{onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),className:"".concat(e.showFullContent?"w-auto":"w-[200px]"," overflow-hidden break-words text-balance rounded-lg border-none p-2 bg-muted"),children:[(0,n.jsxs)("h3",{className:"".concat(e.showFullContent?"block":"line-clamp-1"," text-muted-foreground}"),children:[t,e.showFullContent?e.title:a]}),(0,n.jsx)("p",{className:"text-sm ".concat(e.showFullContent?"overflow-x-auto block":"overflow-hidden line-clamp-2"),dangerouslySetInnerHTML:{__html:s}})]})}),(0,n.jsx)(I.yk,{className:"w-[400px] mx-2",children:(0,n.jsxs)(f.Zb,{className:"w-auto overflow-hidden break-words text-balance rounded-lg border-none p-2",children:[(0,n.jsxs)("h3",{className:"line-clamp-2 text-muted-foreground}",children:[t,e.title]}),(0,n.jsx)("p",{className:"border-t mt-1 pt-1 text-sm overflow-hidden line-clamp-5",dangerouslySetInnerHTML:{__html:s}})]})})]})})}function L(e){var t,a,s,o,r,c;let i=(0,F.Le)(".py","!w-4 h-4 text-muted-foreground flex-shrink-0"),d=E().sanitize(e.code),[u,h]=(0,l.useState)(!1),[g,p]=(0,l.useState)(!1),x=e=>{let t="text/plain",a=e.b64_data;e.filename.match(/\.(png|jpg|jpeg|webp)$/)?(t="image/".concat(e.filename.split(".").pop()),a=atob(e.b64_data)):e.filename.endsWith(".json")?t="application/json":e.filename.endsWith(".csv")&&(t="text/csv");let n=new ArrayBuffer(a.length),s=new Uint8Array(n);for(let e=0;e<a.length;e++)s[e]=a.charCodeAt(e);let o=new Blob([n],{type:t}),l=URL.createObjectURL(o),r=document.createElement("a");r.href=l,r.download=e.filename,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(l)},v=(t,a)=>(null==t?void 0:t.length)==0?null:(0,n.jsx)("div",{className:"".concat(a||e.showFullContent?"border-t mt-1 pt-1":void 0),children:t.slice(0,e.showFullContent?void 0:1).map((t,s)=>(0,n.jsxs)("div",{children:[(0,n.jsxs)("h4",{className:"text-sm text-muted-foreground flex items-center",children:[(0,n.jsx)("span",{className:"overflow-hidden mr-2 font-bold ".concat(e.showFullContent?void 0:"line-clamp-1"),children:t.filename}),(0,n.jsx)("button",{className:"".concat(a?"hidden":void 0),onClick:e=>{e.preventDefault(),x(t)},onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),title:"Download file: ".concat(t.filename),children:(0,n.jsx)(m.b,{className:"w-4 h-4",weight:g?"fill":"regular"})})]}),t.filename.match(/\.(txt|org|md|csv|json)$/)?(0,n.jsx)("pre",{className:"".concat(e.showFullContent?"block":"line-clamp-2"," text-sm mt-1 p-1 bg-background rounded overflow-x-auto"),children:t.b64_data}):t.filename.match(/\.(png|jpg|jpeg|webp)$/)?(0,n.jsx)("img",{src:"data:image/".concat(t.filename.split(".").pop(),";base64,").concat(t.b64_data),alt:t.filename,className:"mt-1 max-h-32 rounded"}):null]},"".concat(t.filename,"-").concat(s)))});return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(I.J2,{open:u&&!e.showFullContent,onOpenChange:h,children:[(0,n.jsx)(I.xo,{asChild:!0,children:(0,n.jsx)(f.Zb,{onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),className:"".concat(e.showFullContent?"w-auto":"w-[200px]"," overflow-hidden break-words text-balance rounded-lg border-none p-2 bg-muted"),children:(0,n.jsxs)("div",{className:"flex flex-col px-1",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[i,(0,n.jsxs)("h3",{className:"overflow-hidden ".concat(e.showFullContent?"block":"line-clamp-1"," text-muted-foreground flex-grow"),children:["code ",(null===(t=e.output_files)||void 0===t?void 0:t.length)>0?"artifacts":""]})]}),(0,n.jsx)("pre",{className:"text-xs pb-2 ".concat(e.showFullContent?"block overflow-x-auto":(null===(a=e.output_files)||void 0===a?void 0:a.length)>0?"hidden":"overflow-hidden line-clamp-3"),children:d}),(null===(s=e.output_files)||void 0===s?void 0:s.length)>0&&v(e.output_files,!1)]})})}),(0,n.jsx)(I.yk,{className:"w-[400px] mx-2",children:(0,n.jsxs)(f.Zb,{className:"w-auto overflow-hidden break-words text-balance rounded-lg border-none p-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[i,(0,n.jsxs)("h3",{className:"overflow-hidden ".concat(e.showFullContent?"block":"line-clamp-1"," text-muted-foreground flex-grow"),children:["code ",(null===(o=e.output_files)||void 0===o?void 0:o.length)>0?"artifact":""]})]}),(null===(r=e.output_files)||void 0===r?void 0:r.length)>0&&v(null===(c=e.output_files)||void 0===c?void 0:c.slice(0,1),!0)||(0,n.jsx)("pre",{className:"text-xs border-t mt-1 pt-1 verflow-hidden line-clamp-10",children:d})]})})]})})}function O(e){let[t,a]=(0,l.useState)(!1);if(!e.link||e.link.split(" ").length>1)return null;let s="https://www.google.com/s2/favicons?domain=globe",o="unknown";try{o=new URL(e.link).hostname,s="https://www.google.com/s2/favicons?domain=".concat(o)}catch(t){return console.warn("Error parsing domain from link: ".concat(e.link)),null}return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(I.J2,{open:t&&!e.showFullContent,onOpenChange:a,children:[(0,n.jsx)(I.xo,{asChild:!0,children:(0,n.jsx)(f.Zb,{onMouseEnter:()=>{a(!0)},onMouseLeave:()=>{a(!1)},className:"".concat(e.showFullContent?"w-auto":"w-[200px]"," overflow-hidden break-words text-balance rounded-lg border-none p-2 bg-muted"),children:(0,n.jsx)("div",{className:"flex flex-col",children:(0,n.jsxs)("a",{href:e.link,target:"_blank",rel:"noreferrer",className:"!no-underline px-1",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("img",{src:s,alt:"",className:"!w-4 h-4 flex-shrink-0"}),(0,n.jsx)("h3",{className:"overflow-hidden ".concat(e.showFullContent?"block":"line-clamp-1"," text-muted-foreground flex-grow"),children:o})]}),(0,n.jsx)("h3",{className:"overflow-hidden ".concat(e.showFullContent?"block":"line-clamp-1"," font-bold"),children:e.title}),(0,n.jsx)("p",{className:"overflow-hidden text-sm ".concat(e.showFullContent?"block":"line-clamp-2"),children:e.description})]})})})}),(0,n.jsx)(I.yk,{className:"w-[400px] mx-2",children:(0,n.jsx)(f.Zb,{className:"w-auto overflow-hidden break-words text-balance rounded-lg border-none",children:(0,n.jsx)("div",{className:"flex flex-col",children:(0,n.jsxs)("a",{href:e.link,target:"_blank",rel:"noreferrer",className:"!no-underline px-1",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("img",{src:s,alt:"",className:"!w-4 h-4 flex-shrink-0"}),(0,n.jsx)("h3",{className:"overflow-hidden ".concat(e.showFullContent?"block":"line-clamp-2"," text-muted-foreground flex-grow"),children:o})]}),(0,n.jsx)("h3",{className:"border-t mt-1 pt-1 overflow-hidden ".concat(e.showFullContent?"block":"line-clamp-2"," font-bold"),children:e.title}),(0,n.jsx)("p",{className:"overflow-hidden text-sm ".concat(e.showFullContent?"block":"line-clamp-5"),children:e.description})]})})})})]})})}function B(e){let[t,a]=(0,l.useState)(3);(0,l.useEffect)(()=>{a(e.isMobileWidth?1:3)},[e.isMobileWidth]);let s=e.codeReferenceCardData.slice(0,t),o=e.notesReferenceCardData.slice(0,t-s.length),r=o.length+s.length<t?e.onlineReferenceCardData.slice(0,t-s.length-o.length):[],c=e.notesReferenceCardData.length>0||e.codeReferenceCardData.length>0||e.onlineReferenceCardData.length>0,i=e.notesReferenceCardData.length+e.codeReferenceCardData.length+e.onlineReferenceCardData.length;return 0===i?null:(0,n.jsxs)("div",{className:"pt-0 px-4 pb-4 md:px-6",children:[(0,n.jsxs)("h3",{className:"inline-flex items-center",children:["References",(0,n.jsxs)("p",{className:"text-gray-400 m-2",children:[i," sources"]})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2 w-auto mt-2",children:[s.map((e,t)=>(0,l.createElement)(L,{showFullContent:!1,...e,key:"code-".concat(t)})),o.map((e,t)=>(0,l.createElement)(S,{showFullContent:!1,...e,key:"".concat(e.title,"-").concat(t)})),r.map((e,t)=>(0,l.createElement)(O,{showFullContent:!1,...e,key:"".concat(e.title,"-").concat(t)})),c&&(0,n.jsx)(q,{notesReferenceCardData:e.notesReferenceCardData,onlineReferenceCardData:e.onlineReferenceCardData,codeReferenceCardData:e.codeReferenceCardData})]})]})}function q(e){return e.notesReferenceCardData||e.onlineReferenceCardData?(0,n.jsxs)(w,{children:[(0,n.jsxs)(b,{className:"text-balance w-auto md:w-[200px] justify-start overflow-hidden break-words p-0 bg-transparent border-none text-gray-400 align-middle items-center !m-2 inline-flex",children:["View references",(0,n.jsx)(g.o,{className:"m-1"})]}),(0,n.jsxs)(M,{className:"overflow-y-scroll",children:[(0,n.jsxs)(k,{children:[(0,n.jsx)(_,{children:"References"}),(0,n.jsx)(R,{children:"View all references for this response"})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2 w-auto mt-2",children:[e.codeReferenceCardData.map((e,t)=>(0,l.createElement)(L,{showFullContent:!0,...e,key:"code-".concat(t)})),e.notesReferenceCardData.map((e,t)=>(0,l.createElement)(S,{showFullContent:!0,...e,key:"".concat(e.title,"-").concat(t)})),e.onlineReferenceCardData.map((e,t)=>(0,l.createElement)(O,{showFullContent:!0,...e,key:"".concat(e.title,"-").concat(t)}))]})]})]}):null}var H=a(9557),A=a(34149),W=a(29386),z=a(31784),U=a(60665),Z=a(96006),V=a(18444),$=a(35304),P=a(8589),G=a(13493),J=a(63205),Q=a(56698),Y=a(32970),K=a(84120),X=a(92880),ee=a(48408),et=a(55362),ea=a(67722),en=a(58485),es=a(58575),eo=a(25800);let el=(0,a(57818).default)(()=>Promise.all([a.e(6555),a.e(7293),a.e(1459),a.e(1210)]).then(a.bind(a,51210)).then(e=>e.default),{loadableGenerated:{webpack:()=>[51210]},ssr:!1});function er(e){return(0,n.jsx)(l.Suspense,{fallback:(0,n.jsx)(en.Z,{}),children:(0,n.jsx)(el,{data:e.data})})}var ec=a(90837),ei=a(69591),ed=a(94880);let eu=new i.Z({html:!0,linkify:!0,typographer:!0});function eh(e,t,a){fetch("/api/chat/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({uquery:e,kquery:t,sentiment:a})})}function em(e){let{uquery:t,kquery:a}=e,[s,o]=(0,l.useState)(null);return(0,l.useEffect)(()=>{null!==s&&setTimeout(()=>{o(null)},2e3)},[s]),(0,n.jsxs)("div",{className:"".concat(c().feedbackButtons," flex align-middle justify-center items-center"),children:[(0,n.jsx)("button",{title:"Like",className:c().thumbsUpButton,disabled:null!==s,onClick:()=>{eh(t,a,"positive"),o(!0)},children:!0===s?(0,n.jsx)(A.V,{alt:"Liked Message",className:"text-green-500",weight:"fill"}):(0,n.jsx)(A.V,{alt:"Like Message",className:"hsl(var(--muted-foreground)) hover:text-green-500"})}),(0,n.jsx)("button",{title:"Dislike",className:c().thumbsDownButton,disabled:null!==s,onClick:()=>{eh(t,a,"negative"),o(!1)},children:!1===s?(0,n.jsx)(W.L,{alt:"Disliked Message",className:"text-red-500",weight:"fill"}):(0,n.jsx)(W.L,{alt:"Dislike Message",className:"hsl(var(--muted-foreground)) hover:text-red-500"})})]})}function eg(e){let t=e.message.match(/\*\*(.*)\*\*/),a=function(e,t){let a=e.toLowerCase(),s="inline mt-1 mr-2 ".concat(t," h-4 w-4");return a.includes("understanding")?(0,n.jsx)(z.a,{className:"".concat(s)}):a.includes("generating")?(0,n.jsx)(U.Z,{className:"".concat(s)}):a.includes("data sources")||a.includes("notes")?(0,n.jsx)(Z.g,{className:"".concat(s)}):a.includes("read")?(0,n.jsx)(V.f,{className:"".concat(s)}):a.includes("search")?(0,n.jsx)($.Y,{className:"".concat(s)}):a.includes("summary")||a.includes("summarize")||a.includes("enhanc")?(0,n.jsx)(P.u,{className:"".concat(s)}):a.includes("diagram")?(0,n.jsx)(G.j,{className:"".concat(s)}):a.includes("paint")?(0,n.jsx)(J.Y,{className:"".concat(s)}):a.includes("code")?(0,n.jsx)(Q.E,{className:"".concat(s)}):(0,n.jsx)(z.a,{className:"".concat(s)})}(t?t[1]:"",e.primary?(0,es.oz)(e.agentColor):"text-gray-500"),s=E().sanitize(eu.render(e.message));return s=s.replace(/<h[1-6].*?<\/h[1-6]>/g,""),(0,n.jsxs)("div",{className:"".concat(c().trainOfThoughtElement," break-words items-center ").concat(e.primary?"text-gray-400":"text-gray-300"," ").concat(c().trainOfThought," ").concat(e.primary?c().primary:""),children:[a,(0,n.jsx)("div",{dangerouslySetInnerHTML:{__html:s},className:"break-words"})]})}eu.use(u(),{inline:!0,code:!0});let ef=(0,l.forwardRef)((e,t)=>{var a,s;let o,r,i,d,u;let[m,g]=(0,l.useState)(!1),[f,x]=(0,l.useState)(!1),[v,j]=(0,l.useState)(""),[w,b]=(0,l.useState)(""),[y,C]=(0,l.useState)(!1),[N,M]=(0,l.useState)(!1),[k,_]=(0,l.useState)(""),R=(0,l.useRef)(!1),I=(0,l.useRef)(null);async function T(){let t=e.chatMessage.message.match(/[^.!?]+[.!?]*/g)||[];if(!t||0===t.length||!t[0])return;C(!0);let a=D(t[0]);for(let e=0;e<t.length&&!R.current;e++){let n=a;e<t.length-1&&(a=D(t[e+1]));try{let e=await n,t=URL.createObjectURL(e);await function(e){return new Promise((t,a)=>{let n=new Audio(e);n.onended=t,n.onerror=a,n.play()})}(t)}catch(e){console.error("Error:",e);break}}C(!1),M(!1)}async function D(e){let t=await fetch("/api/chat/speech?text=".concat(encodeURIComponent(e)),{method:"POST",headers:{"Content-Type":"application/json"}});if(!t.ok)throw Error("Network response was not ok");return await t.blob()}(0,l.useEffect)(()=>{R.current=N},[N]),(0,l.useEffect)(()=>{let e=new MutationObserver((e,t)=>{if(I.current)for(let t of e)"childList"===t.type&&t.addedNodes.length>0&&(0,eo.Z)(I.current,{delimiters:[{left:"$$",right:"$$",display:!0},{left:"\\[",right:"\\]",display:!0},{left:"\\(",right:"\\)",display:!1}]})});return I.current&&e.observe(I.current,{childList:!0}),()=>e.disconnect()},[I.current]),(0,l.useEffect)(()=>{let t=e.chatMessage.message;e.chatMessage.intent&&"excalidraw"==e.chatMessage.intent.type&&(t=e.chatMessage.intent["inferred-queries"][0],_(e.chatMessage.message)),t=t.replace(/\\\(/g,"LEFTPAREN").replace(/\\\)/g,"RIGHTPAREN").replace(/\\\[/g,"LEFTBRACKET").replace(/\\\]/g,"RIGHTBRACKET");let a={"text-to-image":e=>"![generated image](data:image/png;base64,".concat(e,")"),"text-to-image2":e=>"![generated image](".concat(e,")"),"text-to-image-v3":e=>"![generated image](data:image/webp;base64,".concat(e,")"),excalidraw:e=>e};if(e.chatMessage.intent){let{type:n,"inferred-queries":s}=e.chatMessage.intent;n in a&&(t=a[n](t)),n.includes("text-to-image")&&(null==s?void 0:s.length)>0&&(t+="\n\n".concat(s[0]))}t=(0,H.AQ)(t,e.chatMessage.codeContext),e.chatMessage.codeContext&&Object.entries(e.chatMessage.codeContext).forEach(e=>{var a;let[n,s]=e;null===(a=s.results.output_files)||void 0===a||a.forEach(e=>{(e.filename.endsWith(".png")||e.filename.endsWith(".jpg"))&&!t.includes("![".concat(e.filename,"]("))&&(t+="\n\n![".concat(e.filename,"](data:image/png;base64,").concat(e.b64_data,")"))})});let n=t,s=t;if(e.chatMessage.images&&e.chatMessage.images.length>0){let t=e.chatMessage.images.map(e=>{let t=e.startsWith("data%3Aimage")?decodeURIComponent(e):e;return E().sanitize(t)}),a=t.map((e,t)=>"![uploaded image ".concat(t+1,"](").concat(e,")")).join("\n"),o=t.map((e,t)=>'<div class="'.concat(c().imageWrapper,'"><img src="').concat(e,'" alt="uploaded image ').concat(t+1,'" /></div>')).join(""),l='<div class="'.concat(c().imagesContainer,'">').concat(o,"</div>");n="".concat(a,"\n\n").concat(n),s="".concat(l).concat(s)}j(n);let o=eu.render(s);o=o.replace(/LEFTPAREN/g,"\\(").replace(/RIGHTPAREN/g,"\\)").replace(/LEFTBRACKET/g,"\\[").replace(/RIGHTBRACKET/g,"\\]"),b(E().sanitize(o))},[e.chatMessage.message,e.chatMessage.images,e.chatMessage.intent]),(0,l.useEffect)(()=>{m&&setTimeout(()=>{g(!1)},2e3)},[m]),(0,l.useEffect)(()=>{I.current&&(I.current.querySelectorAll("pre > .hljs").forEach(e=>{if(!e.querySelector("".concat(c().codeCopyButton))){let t=document.createElement("button"),a=(0,n.jsx)(Y.w,{size:24});(0,h.createRoot)(t).render(a),t.className="hljs ".concat(c().codeCopyButton),t.addEventListener("click",()=>{let a=e.textContent||"";a=(a=(a=a.replace(/^\$+/,"")).replace(/^Copy/,"")).trim(),navigator.clipboard.writeText(a);let s=(0,n.jsx)(K.J,{size:24});(0,h.createRoot)(t).render(s)}),e.prepend(t)}}),(0,eo.Z)(I.current,{delimiters:[{left:"$$",right:"$$",display:!0},{left:"\\[",right:"\\]",display:!0},{left:"\\(",right:"\\)",display:!1}]}))},[w,f,I]);let S=async t=>{let a=t.turnId||e.turnId;(await fetch("/api/chat/conversation/message",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({conversation_id:e.conversationId,turn_id:a})})).ok?e.onDeleteMessage(a):console.error("Failed to delete message")},L=function(e,t,a){let n=[],s=[],o=[];if(a)for(let[e,t]of Object.entries(a))t.results&&o.push({code:t.code,output:t.results.std_out,output_files:t.results.output_files,error:t.results.std_err});if(t){let e=[];for(let[a,n]of Object.entries(t)){if(n.answerBox&&e.push({title:n.answerBox.title,description:n.answerBox.answer,link:n.answerBox.source}),n.knowledgeGraph&&e.push({title:n.knowledgeGraph.title,description:n.knowledgeGraph.description,link:n.knowledgeGraph.descriptionLink}),n.webpages){if(n.webpages instanceof Array){let t=n.webpages.map(e=>({title:e.query,description:e.snippet,link:e.link}));e.push(...t)}else{let t=n.webpages;e.push({title:t.query,description:t.snippet,link:t.link})}}if(n.organic){let t=n.organic.map(e=>({title:e.title,description:e.snippet,link:e.link}));e.push(...t)}}n.push(...e)}if(e){let t=e.map(e=>e.compiled?{title:e.file,content:e.compiled}:{title:e.split("\n")[0],content:e.split("\n").slice(1).join("\n")});s.push(...t)}return{notesReferenceCardData:s,onlineReferenceCardData:n,codeReferenceCardData:o}}(e.chatMessage.context,e.chatMessage.onlineContext,e.chatMessage.codeContext);return(0,n.jsxs)("div",{ref:t,className:(a=e.chatMessage,(o=[c().chatMessageContainer,"shadow-md"]).push(c()[a.by]),a.message||o.push(c().emptyChatMessage),e.customClassName&&o.push(c()["".concat(a.by).concat(e.customClassName)]),o.join(" ")),onMouseLeave:e=>x(!1),onMouseEnter:e=>x(!0),children:[(0,n.jsxs)("div",{className:(s=e.chatMessage,(r=[c().chatMessageWrapper]).push(c()[s.by]),"khoj"===s.by&&r.push("border-l-4 border-opacity-50 ".concat("border-l-"+e.borderLeftColor)),r.join(" ")),children:[e.chatMessage.queryFiles&&e.chatMessage.queryFiles.length>0&&(0,n.jsx)("div",{className:"flex flex-wrap flex-col mb-2 max-w-full",children:e.chatMessage.queryFiles.map((e,t)=>(0,n.jsxs)(ec.Vq,{children:[(0,n.jsx)(ec.hg,{asChild:!0,children:(0,n.jsxs)("div",{className:"flex items-center space-x-2 cursor-pointer bg-gray-500 bg-opacity-25 rounded-lg p-2 w-full ",children:[(0,n.jsx)("div",{className:"flex-shrink-0",children:(0,F.Le)(e.file_type)}),(0,n.jsx)("span",{className:"truncate flex-1 min-w-0 max-w-[200px]",children:e.name}),e.size&&(0,n.jsxs)("span",{className:"text-gray-400 flex-shrink-0",children:["(",(0,ei.xq)(e.size),")"]})]})}),(0,n.jsxs)(ec.cZ,{children:[(0,n.jsx)(ec.fK,{children:(0,n.jsx)(p.$N,{children:(0,n.jsx)("div",{className:"truncate min-w-0 break-words break-all text-wrap max-w-full whitespace-normal",children:e.name})})}),(0,n.jsx)(ec.Be,{children:(0,n.jsx)(ed.x,{className:"h-72 w-full rounded-md break-words break-all text-wrap",children:e.content})})]})]},t))}),(0,n.jsx)("div",{ref:I,className:c().chatMessage,dangerouslySetInnerHTML:{__html:w}}),k&&(0,n.jsx)(er,{data:k})]}),(0,n.jsx)("div",{className:c().teaserReferencesContainer,children:(0,n.jsx)(B,{isMobileWidth:e.isMobileWidth,notesReferenceCardData:L.notesReferenceCardData,onlineReferenceCardData:L.onlineReferenceCardData,codeReferenceCardData:L.codeReferenceCardData})}),(0,n.jsx)("div",{className:c().chatFooter,children:(f||e.isMobileWidth||e.isLastMessage||y)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{title:(d=(i=new Date(e.chatMessage.created+"Z")).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0}).toUpperCase(),u=i.toLocaleString("en-US",{year:"numeric",month:"short",day:"2-digit"}).replaceAll("-"," "),"".concat(d," on ").concat(u)),className:"text-gray-400 relative top-0 left-4",children:function(e){e.endsWith("Z")||(e+="Z");let t=new Date(e),a=new Date().getTime()-t.getTime();return a<6e4?"Just now":a<36e5?"".concat(Math.round(a/6e4),"m ago"):a<864e5?"".concat(Math.round(a/36e5),"h ago"):"".concat(Math.round(a/864e5),"d ago")}(e.chatMessage.created)}),(0,n.jsxs)("div",{className:"".concat(c().chatButtons," shadow-sm"),children:["khoj"===e.chatMessage.by&&(y?N?(0,n.jsx)(en.l,{iconClassName:"p-0",className:"m-0"}):(0,n.jsx)("button",{title:"Pause Speech",onClick:e=>M(!0),children:(0,n.jsx)(X.d,{alt:"Pause Message",className:"hsl(var(--muted-foreground))"})}):(0,n.jsx)("button",{title:"Speak",onClick:e=>T(),children:(0,n.jsx)(ee.j,{alt:"Speak Message",className:"hsl(var(--muted-foreground)) hover:text-green-500"})})),e.chatMessage.turnId&&(0,n.jsx)("button",{title:"Delete",className:"".concat(c().deleteButton),onClick:()=>S(e.chatMessage),children:(0,n.jsx)(et.r,{alt:"Delete Message",className:"hsl(var(--muted-foreground)) hover:text-red-500"})}),(0,n.jsx)("button",{title:"Copy",className:"".concat(c().copyButton),onClick:()=>{navigator.clipboard.writeText(v),g(!0)},children:m?(0,n.jsx)(ea.C,{alt:"Copied Message",weight:"fill",className:"text-green-500"}):(0,n.jsx)(ea.C,{alt:"Copy Message",className:"hsl(var(--muted-foreground)) hover:text-green-500"})}),"khoj"===e.chatMessage.by&&(e.chatMessage.intent?(0,n.jsx)(em,{uquery:e.chatMessage.intent.query,kquery:e.chatMessage.message}):(0,n.jsx)(em,{uquery:e.chatMessage.rawQuery||e.chatMessage.message,kquery:e.chatMessage.message}))]})]})})]})});ef.displayName="ChatMessage";var ep=a(84511),ex=a(16288),ev=a(20721),ej=a(19666),ew=a(50495),eb=e=>{let{name:t,avatar:a,link:s,description:o}=e;return(0,n.jsx)("div",{className:"relative group flex",children:(0,n.jsx)(ej.pn,{children:(0,n.jsxs)(ej.u,{delayDuration:0,children:[(0,n.jsx)(ej.aJ,{asChild:!0,children:(0,n.jsxs)(ew.z,{variant:"ghost",className:"flex items-center justify-center",children:[a,(0,n.jsx)("div",{children:t})]})}),(0,n.jsx)(ej._v,{children:(0,n.jsxs)("div",{className:"w-80 h-30",children:[(0,n.jsx)("a",{href:s,target:"_blank",rel:"noreferrer",className:"mt-1 ml-2 block no-underline",children:(0,n.jsxs)("div",{className:"flex items-center justify-start gap-2",children:[a,(0,n.jsxs)("div",{className:"mr-2 mt-1 flex justify-center items-center text-sm font-semibold text-gray-800",children:[t,(0,n.jsx)(g.o,{weight:"bold",className:"ml-1"})]})]})}),o&&(0,n.jsx)("p",{className:"mt-2 ml-6 text-sm text-gray-600 line-clamp-2",children:o||"A Khoj agent"})]})})]})})})};function ey(e){let t=e.trainOfThought.length-1,[a,s]=(0,l.useState)(e.completed);return(0,n.jsxs)("div",{className:"".concat(a?"":o().trainOfThought+" shadow-sm"),children:[!e.completed&&(0,n.jsx)(en.l,{className:"float-right"}),e.completed&&(a?(0,n.jsx)(ew.z,{className:"w-fit text-left justify-start content-start text-xs",onClick:()=>s(!1),variant:"ghost",size:"sm",children:"What was my train of thought?"}):(0,n.jsxs)(ew.z,{className:"w-fit text-left justify-start content-start text-xs p-0 h-fit",onClick:()=>s(!0),variant:"ghost",size:"sm",children:[(0,n.jsx)(ep.a,{size:16,className:"mr-1"}),"Close"]})),!a&&e.trainOfThought.map((a,s)=>(0,n.jsx)(eg,{message:a,primary:s===t&&e.lastMessage&&!e.completed,agentColor:e.agentColor},"train-".concat(s)))]},e.keyId)}function eC(e){var t,a,s,r,c,i,d,u,h;let[m,g]=(0,l.useState)(null),[f,p]=(0,l.useState)(0),[x,v]=(0,l.useState)(!0),[j,w]=(0,l.useState)(null),b=(0,l.useRef)(null),y=(0,l.useRef)(null),C=(0,l.useRef)(null),N=(0,l.useRef)(null),[M,k]=(0,l.useState)(null),[_,R]=(0,l.useState)(!1),[I,T]=(0,l.useState)(!0),E=(0,ei.IC)(),D="[data-radix-scroll-area-viewport]";(0,l.useEffect)(()=>{var e;let t=null===(e=y.current)||void 0===e?void 0:e.querySelector(D);if(!t)return;let a=()=>{let{scrollTop:e,scrollHeight:a,clientHeight:n}=t;T(a-(e+n)<=50)};return t.addEventListener("scroll",a),()=>t.removeEventListener("scroll",a)},[]),(0,l.useEffect)(()=>{e.incomingMessages&&e.incomingMessages.length>0&&I&&L()},[e.incomingMessages,I]),(0,l.useEffect)(()=>{m&&m.chat&&m.chat.length>0&&f<2&&requestAnimationFrame(()=>{var e;null===(e=C.current)||void 0===e||e.scrollIntoView({behavior:"auto",block:"start"})})},[m,f]),(0,l.useEffect)(()=>{if(!x||_)return;let t=new IntersectionObserver(t=>{t[0].isIntersecting&&x&&(R(!0),function(t){if(!x||_)return;let a=(t+1)*10,n="";if(e.conversationId)n="/api/chat/history?client=web&conversation_id=".concat(encodeURIComponent(e.conversationId),"&n=").concat(a);else{if(!e.publicConversationSlug)return;n="/api/chat/share/history?client=web&public_conversation_slug=".concat(e.publicConversationSlug,"&n=").concat(a)}fetch(n).then(e=>e.json()).then(a=>{if(e.setTitle(a.response.slug),a&&a.response&&a.response.chat&&a.response.chat.length>0){if(p(Math.ceil(a.response.chat.length/10)),a.response.chat.length===(null==m?void 0:m.chat.length)){v(!1),R(!1);return}e.setAgent(a.response.agent),g(a.response),R(!1),0===t?L(!0):S()}else{if(a.response.agent&&a.response.conversation_id){let t={chat:[],agent:a.response.agent,conversation_id:a.response.conversation_id,slug:a.response.slug};e.setAgent(a.response.agent),g(t)}v(!1),R(!1)}}).catch(e=>{console.error(e),window.location.href="/"})}(f))},{threshold:1});return b.current&&t.observe(b.current),()=>t.disconnect()},[x,f,_]),(0,l.useEffect)(()=>{v(!0),R(!1),p(0),g(null)},[e.conversationId]),(0,l.useEffect)(()=>{if(e.incomingMessages){let t=e.incomingMessages[e.incomingMessages.length-1];t&&!t.completed&&(k(e.incomingMessages.length-1),e.setTitle(t.rawQuery),t.turnId&&w(t.turnId))}},[e.incomingMessages]);let S=()=>{var e;let t=null===(e=y.current)||void 0===e?void 0:e.querySelector(D);requestAnimationFrame(()=>{var e;null===(e=N.current)||void 0===e||e.scrollIntoView({behavior:"auto",block:"start"}),null==t||t.scrollBy({behavior:"smooth",top:-150})})},L=function(){var e;let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=null===(e=y.current)||void 0===e?void 0:e.querySelector(D);requestAnimationFrame(()=>{null==a||a.scrollTo({top:a.scrollHeight,behavior:t?"auto":"smooth"})}),T(!0)},O=t=>{t&&(g(e=>e&&t?{...e,chat:e.chat.filter(e=>e.turnId!==t)}:e),e.incomingMessages&&e.setIncomingMessages&&e.setIncomingMessages(e.incomingMessages.filter(e=>e.turnId!==t)))};return e.conversationId||e.publicConversationSlug?(0,n.jsx)(ed.x,{className:"h-[73vh] relative",ref:y,children:(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"".concat(o().chatHistory," ").concat(e.customClassName),children:[(0,n.jsx)("div",{ref:b,style:{height:"1px"},children:_&&(0,n.jsx)(en.l,{className:"opacity-50"})}),m&&m.chat&&m.chat.map((t,a)=>{var s,o,l;return(0,n.jsxs)(n.Fragment,{children:[t.trainOfThought&&"khoj"===t.by&&(0,n.jsx)(ey,{trainOfThought:null===(s=t.trainOfThought)||void 0===s?void 0:s.map(e=>e.data),lastMessage:!1,agentColor:(null==m?void 0:null===(o=m.agent)||void 0===o?void 0:o.color)||"orange",keyId:"".concat(a,"trainOfThought"),completed:!0},"".concat(a,"trainOfThought")),(0,n.jsx)(ef,{ref:a===m.chat.length-2?C:a===m.chat.length-(f-1)*10?N:null,isMobileWidth:E,chatMessage:t,customClassName:"fullHistory",borderLeftColor:"".concat(null==m?void 0:null===(l=m.agent)||void 0===l?void 0:l.color,"-500"),isLastMessage:a===m.chat.length-1,onDeleteMessage:O,conversationId:e.conversationId},"".concat(a,"fullHistory"))]})}),e.incomingMessages&&e.incomingMessages.map((t,a)=>{var s,o,r,c,i;let d=null!==(i=null!==(c=t.turnId)&&void 0!==c?c:j)&&void 0!==i?i:void 0;return(0,n.jsxs)(l.Fragment,{children:[(0,n.jsx)(ef,{isMobileWidth:E,chatMessage:{message:t.rawQuery,context:[],onlineContext:{},codeContext:{},created:t.timestamp,by:"you",automationId:"",images:t.images,conversationId:e.conversationId,turnId:d,queryFiles:t.queryFiles},customClassName:"fullHistory",borderLeftColor:"".concat(null==m?void 0:null===(s=m.agent)||void 0===s?void 0:s.color,"-500"),onDeleteMessage:O,conversationId:e.conversationId,turnId:d},"".concat(a,"outgoing")),t.trainOfThought&&(0,n.jsx)(ey,{trainOfThought:t.trainOfThought,lastMessage:a===M,agentColor:(null==m?void 0:null===(o=m.agent)||void 0===o?void 0:o.color)||"orange",keyId:"".concat(a,"trainOfThought"),completed:t.completed},"".concat(a,"trainOfThought")),(0,n.jsx)(ef,{isMobileWidth:E,chatMessage:{message:t.rawResponse,context:t.context,onlineContext:t.onlineContext,codeContext:t.codeContext,created:t.timestamp,by:"khoj",automationId:"",rawQuery:t.rawQuery,intent:{type:t.intentType||"",query:t.rawQuery,"memory-type":"","inferred-queries":t.inferredQueries||[]},conversationId:e.conversationId,turnId:d},conversationId:e.conversationId,turnId:d,onDeleteMessage:O,customClassName:"fullHistory",borderLeftColor:"".concat(null==m?void 0:null===(r=m.agent)||void 0===r?void 0:r.color,"-500"),isLastMessage:!0},"".concat(a,"incoming"))]},"incomingMessage".concat(a))}),e.pendingMessage&&(0,n.jsx)(ef,{isMobileWidth:E,chatMessage:{message:e.pendingMessage,context:[],onlineContext:{},codeContext:{},created:new Date().getTime().toString(),by:"you",automationId:"",conversationId:e.conversationId,turnId:void 0},conversationId:e.conversationId,onDeleteMessage:O,customClassName:"fullHistory",borderLeftColor:"".concat(null==m?void 0:null===(t=m.agent)||void 0===t?void 0:t.color,"-500"),isLastMessage:!0},"pendingMessage-".concat(e.pendingMessage.length)),m&&(0,n.jsx)("div",{className:"".concat(o().agentIndicator," pb-4"),children:(0,n.jsx)("div",{className:"relative group mx-2 cursor-pointer",children:(0,n.jsx)(eb,{name:m&&m.agent&&(null===(r=m.agent)||void 0===r?void 0:r.name)?null===(c=m.agent)||void 0===c?void 0:c.name:"Agent",link:m&&m.agent&&(null===(i=m.agent)||void 0===i?void 0:i.slug)?"/agents?agent=".concat(null===(d=m.agent)||void 0===d?void 0:d.slug):"/agents",avatar:(0,F.TI)(null===(a=m.agent)||void 0===a?void 0:a.icon,null===(s=m.agent)||void 0===s?void 0:s.color)||(0,n.jsx)(ex.v,{}),description:m&&m.agent&&(null===(u=m.agent)||void 0===u?void 0:u.persona)?null===(h=m.agent)||void 0===h?void 0:h.persona:"Your agent is no longer available. You will be reset to the default agent."})})})]}),(0,n.jsx)("div",{className:"".concat(e.customClassName," fixed bottom-[20%] z-10"),children:!I&&(0,n.jsx)("button",{title:"Scroll to bottom",className:"absolute bottom-0 right-0 bg-white dark:bg-[hsl(var(--background))] text-neutral-500 dark:text-white p-2 rounded-full shadow-xl",onClick:()=>{L(),T(!0)},children:(0,n.jsx)(ev.K,{size:24})})})]})}):null}},15238:function(e){e.exports={chatHistory:"chatHistory_chatHistory__CoaVT",agentIndicator:"chatHistory_agentIndicator__wOU1f",trainOfThought:"chatHistory_trainOfThought__mMWSR"}},34531:function(e){e.exports={chatMessageContainer:"chatMessage_chatMessageContainer__sAivf",chatMessageWrapper:"chatMessage_chatMessageWrapper__u5m8A",khojfullHistory:"chatMessage_khojfullHistory__NPu2l",youfullHistory:"chatMessage_youfullHistory__ioyfH",you:"chatMessage_you__6GUC4",khoj:"chatMessage_khoj__cjWON",khojChatMessage:"chatMessage_khojChatMessage__BabQz",emptyChatMessage:"chatMessage_emptyChatMessage__J9JRn",imagesContainer:"chatMessage_imagesContainer__HTRjT",imageWrapper:"chatMessage_imageWrapper__DF92M",author:"chatMessage_author__muRtC",chatFooter:"chatMessage_chatFooter__0vR8s",chatButtons:"chatMessage_chatButtons__Lbk8T",codeCopyButton:"chatMessage_codeCopyButton__Y_Ujv",feedbackButtons:"chatMessage_feedbackButtons___Brdy",copyButton:"chatMessage_copyButton__jd7q7",trainOfThought:"chatMessage_trainOfThought__mR2Gg",primary:"chatMessage_primary__WYPEb",trainOfThoughtElement:"chatMessage_trainOfThoughtElement__le_bC"}}}]);