khoj 1.42.2.dev1__py3-none-any.whl → 1.42.2.dev19__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 (65) hide show
  1. khoj/configure.py +2 -0
  2. khoj/database/adapters/__init__.py +6 -6
  3. khoj/interface/compiled/404/index.html +2 -2
  4. khoj/interface/compiled/_next/static/chunks/{2117-1c18aa2098982bf9.js → 2117-056a00add390772b.js} +1 -1
  5. khoj/interface/compiled/_next/static/chunks/{2327-f03b2a77f67b8f8c.js → 2327-aa22697ed9c8d54a.js} +1 -1
  6. khoj/interface/compiled/_next/static/chunks/7127-79a3af5138960272.js +1 -0
  7. khoj/interface/compiled/_next/static/chunks/{5138-81457f7f59956b56.js → 7211-7fedd2ee3655239c.js} +1 -1
  8. khoj/interface/compiled/_next/static/chunks/app/agents/{page-2fac1d5ac7192e73.js → page-774c78ff0f55a228.js} +1 -1
  9. khoj/interface/compiled/_next/static/chunks/app/automations/page-fc4f5a3ca7201154.js +1 -0
  10. khoj/interface/compiled/_next/static/chunks/app/chat/page-14cf05b18e3c00ad.js +1 -0
  11. khoj/interface/compiled/_next/static/chunks/app/{page-45ae5e99e8a61821.js → page-f7a0286dfc31ad6b.js} +1 -1
  12. khoj/interface/compiled/_next/static/chunks/app/search/layout-f5881c7ae3ba0795.js +1 -0
  13. khoj/interface/compiled/_next/static/chunks/app/search/{page-afb5e7ed13d221c1.js → page-f1a7f278c89e09b6.js} +1 -1
  14. khoj/interface/compiled/_next/static/chunks/app/settings/{page-8fb6cc97be8774a7.js → page-5d9134d4a97f8834.js} +1 -1
  15. khoj/interface/compiled/_next/static/chunks/app/share/chat/layout-abb6c5f4239ad7be.js +1 -0
  16. khoj/interface/compiled/_next/static/chunks/app/share/chat/{page-9a167dc9b5fcd464.js → page-bcc8f41edcfbcb6c.js} +1 -1
  17. khoj/interface/compiled/_next/static/chunks/{main-876327ac335776ab.js → main-63d6432f34cdf74b.js} +1 -1
  18. khoj/interface/compiled/_next/static/chunks/{webpack-1c900156837baf90.js → webpack-f39eedae8f597e56.js} +1 -1
  19. khoj/interface/compiled/_next/static/css/{c34713c98384ee87.css → 4398afc6d5a37666.css} +1 -1
  20. khoj/interface/compiled/_next/static/css/{9c223d337a984468.css → 7017ee76c2f2cd87.css} +1 -1
  21. khoj/interface/compiled/_next/static/css/e1bf03aa79521f86.css +1 -0
  22. khoj/interface/compiled/agents/index.html +2 -2
  23. khoj/interface/compiled/agents/index.txt +2 -2
  24. khoj/interface/compiled/automations/index.html +2 -2
  25. khoj/interface/compiled/automations/index.txt +3 -3
  26. khoj/interface/compiled/chat/index.html +2 -2
  27. khoj/interface/compiled/chat/index.txt +2 -2
  28. khoj/interface/compiled/index.html +2 -2
  29. khoj/interface/compiled/index.txt +2 -2
  30. khoj/interface/compiled/search/index.html +2 -2
  31. khoj/interface/compiled/search/index.txt +2 -2
  32. khoj/interface/compiled/settings/index.html +2 -2
  33. khoj/interface/compiled/settings/index.txt +4 -4
  34. khoj/interface/compiled/share/chat/index.html +2 -2
  35. khoj/interface/compiled/share/chat/index.txt +2 -2
  36. khoj/processor/conversation/anthropic/anthropic_chat.py +17 -132
  37. khoj/processor/conversation/anthropic/utils.py +1 -1
  38. khoj/processor/conversation/google/gemini_chat.py +18 -139
  39. khoj/processor/conversation/offline/chat_model.py +21 -151
  40. khoj/processor/conversation/openai/gpt.py +12 -126
  41. khoj/processor/conversation/prompts.py +2 -63
  42. khoj/routers/api.py +5 -533
  43. khoj/routers/api_automation.py +243 -0
  44. khoj/routers/api_chat.py +35 -116
  45. khoj/routers/helpers.py +329 -80
  46. khoj/routers/research.py +3 -33
  47. khoj/utils/helpers.py +0 -6
  48. {khoj-1.42.2.dev1.dist-info → khoj-1.42.2.dev19.dist-info}/METADATA +2 -2
  49. {khoj-1.42.2.dev1.dist-info → khoj-1.42.2.dev19.dist-info}/RECORD +59 -58
  50. khoj/interface/compiled/_next/static/chunks/7127-d3199617463d45f0.js +0 -1
  51. khoj/interface/compiled/_next/static/chunks/app/automations/page-465741d9149dfd48.js +0 -1
  52. khoj/interface/compiled/_next/static/chunks/app/chat/page-1726184cf1c1b86e.js +0 -1
  53. khoj/interface/compiled/_next/static/chunks/app/search/layout-c02531d586972d7d.js +0 -1
  54. khoj/interface/compiled/_next/static/chunks/app/share/chat/layout-e8e5db7830bf3f47.js +0 -1
  55. khoj/interface/compiled/_next/static/css/fca983d49c3dd1a3.css +0 -1
  56. /khoj/interface/compiled/_next/static/chunks/{1915-ab4353eaca76f690.js → 1915-1943ee8a628b893c.js} +0 -0
  57. /khoj/interface/compiled/_next/static/chunks/{4363-4efaf12abe696251.js → 4363-e6ac2203564d1a3b.js} +0 -0
  58. /khoj/interface/compiled/_next/static/chunks/{4447-5d44807c40355b1a.js → 4447-e038b251d626c340.js} +0 -0
  59. /khoj/interface/compiled/_next/static/chunks/{8667-adbe6017a66cef10.js → 8667-8136f74e9a086fca.js} +0 -0
  60. /khoj/interface/compiled/_next/static/chunks/{9259-d8bcd9da9e80c81e.js → 9259-640fdd77408475df.js} +0 -0
  61. /khoj/interface/compiled/_next/static/{Dzg_ViqMwQEjqMgetZPRc → oXUhXGFp7bJNGngoyQu8D}/_buildManifest.js +0 -0
  62. /khoj/interface/compiled/_next/static/{Dzg_ViqMwQEjqMgetZPRc → oXUhXGFp7bJNGngoyQu8D}/_ssgManifest.js +0 -0
  63. {khoj-1.42.2.dev1.dist-info → khoj-1.42.2.dev19.dist-info}/WHEEL +0 -0
  64. {khoj-1.42.2.dev1.dist-info → khoj-1.42.2.dev19.dist-info}/entry_points.txt +0 -0
  65. {khoj-1.42.2.dev1.dist-info → khoj-1.42.2.dev19.dist-info}/licenses/LICENSE +0 -0
@@ -1,5 +1,5 @@
1
1
  khoj/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- khoj/configure.py,sha256=tOue0mllL8MkUA-LC6_9BE2HpyVDi1LM9RhuTdNd-jw,18870
2
+ khoj/configure.py,sha256=Z3c3cE4-pqZ5eqGA8lRqcpNlDRby4cjtcFYVD2RD4i8,18994
3
3
  khoj/main.py,sha256=UScenj61cw-FK8mrf6G2P6jE63SztDsQzWwNjFRfBkg,8523
4
4
  khoj/manage.py,sha256=njo6uLxGaMamTPesHjFEOIBJbpIUrz39e1V59zKj544,664
5
5
  khoj/app/README.md,sha256=PSQjKCdpU2hgszLVF8yEhV7TWhbEEb-1aYLTRuuAsKI,2832
@@ -11,7 +11,7 @@ khoj/database/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  khoj/database/admin.py,sha256=yX_g1CUpEijnufIgTdefUfiakmd3MB3GSYwKfZo-Cms,13206
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=E6xLo77ZYueKHZyMhDdngctUbfKcD-KZ9rYv3pvjke0,80621
14
+ khoj/database/adapters/__init__.py,sha256=vUgz_fu5zTCyV8CLQ4NdoU4wC_vy9VIJVX1uStT30UM,80729
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=6QXJttG58gpU7vZApQEeEPVNAuhjU2xa6_BwJsfz320,4877
@@ -130,25 +130,23 @@ khoj/interface/compiled/chat.svg,sha256=l2JoYRRgk201adTTdvJ-buKUrc0WGfsudix5xEvt
130
130
  khoj/interface/compiled/close.svg,sha256=hQ2iFLkNzHk0_iyTrSbwnWAeXYlgA-c2Eof2Iqh76n4,417
131
131
  khoj/interface/compiled/copy-button-success.svg,sha256=byqWAYD3Pn9IOXRjOKudJ-TJbP2UESbQGvtLWazNGjY,829
132
132
  khoj/interface/compiled/copy-button.svg,sha256=05bKM2eRxksfBlAPT7yMaoNJEk85bZCxQg67EVrPeHo,669
133
- khoj/interface/compiled/index.html,sha256=tiROo4V0AyLKKU3b5eBLoUZWpJoWT4cSa_SiWmmgFVg,53043
134
- khoj/interface/compiled/index.txt,sha256=Tq66EcuSjJOQiZEyKcmJUgybhoLbMP0vd4W_UrJCPp8,7616
133
+ khoj/interface/compiled/index.html,sha256=if-sn9a-5XzFlPTYY3xCXtQx0ztmwChq6EyaRpXDcJs,53043
134
+ khoj/interface/compiled/index.txt,sha256=n4zs9ubKh8DrqIUc67LluSwr4hGszWnDy808VOIV1a0,7616
135
135
  khoj/interface/compiled/khoj.webmanifest,sha256=9wOK2BMS6xH5NKd2eaUgTLg9WepIxB2K2U33KU89LD8,2543
136
136
  khoj/interface/compiled/logo.svg,sha256=_QCKVYM4WT2Qhcf7aVFImjq_s5CwjynGXYAOgI7yf8w,8059
137
137
  khoj/interface/compiled/send.svg,sha256=VdavOWkVddcwcGcld6pdfmwfz7S91M-9O28cfeiKJkM,635
138
138
  khoj/interface/compiled/share.svg,sha256=91lwo75PvMDrgocuZQab6EQ62CxRbubh9Bhw7CWMKbg,1221
139
139
  khoj/interface/compiled/thumbs-down.svg,sha256=JGNl-DwoRmH2XFMPWwFFklmoYtKxaQbkLE3nuYKe8ZY,1019
140
140
  khoj/interface/compiled/thumbs-up.svg,sha256=yS1wxTRtiztkN-6nZciLoYQUB_KTYNPV8xFRwH2TQFw,1036
141
- khoj/interface/compiled/404/index.html,sha256=ZWTSKl6rLMcoHRXBhLRP7SzXdXJQjivUQrV3gWAbH7M,17097
142
- khoj/interface/compiled/_next/static/Dzg_ViqMwQEjqMgetZPRc/_buildManifest.js,sha256=f2_nYnw25hHWQJ-39Lf5OH1u6kgdbOInyfplqgjvAV4,224
143
- khoj/interface/compiled/_next/static/Dzg_ViqMwQEjqMgetZPRc/_ssgManifest.js,sha256=Z49s4suAsf5y_GfnQSvm4qtq2ggxEbZPfEDTXjy6XgA,80
141
+ khoj/interface/compiled/404/index.html,sha256=OW0u3uPhY6UkUQemPzsUXcs5WfWXXFunnKmC3oaH2u4,17097
144
142
  khoj/interface/compiled/_next/static/chunks/1243.ea2826fb35adb15a.js,sha256=Y6ceAwyTH4HSGDvBRoBB-RVXRCzGGr8NSPcspYF5OM8,182
145
143
  khoj/interface/compiled/_next/static/chunks/133.392ae90c3b2a67f2.js,sha256=IK-mb9ZlF6uJUdU8AuXsppc99tFL8svJvZtKNZGNtcY,411
146
144
  khoj/interface/compiled/_next/static/chunks/1592.b069bdb7aaddd2eb.js,sha256=VUaP2gjX3W9tA9pOH_VIPG_2BIg7Wk1AICrfU5iHgrk,71096
147
- khoj/interface/compiled/_next/static/chunks/1915-ab4353eaca76f690.js,sha256=qArqL3leavWRcZkX4ZuWgemtKnmV6c-_yrNtMu_8SeY,11277
145
+ khoj/interface/compiled/_next/static/chunks/1915-1943ee8a628b893c.js,sha256=qArqL3leavWRcZkX4ZuWgemtKnmV6c-_yrNtMu_8SeY,11277
148
146
  khoj/interface/compiled/_next/static/chunks/2069.f060659791c0c484.js,sha256=C_oat_BkZcLOHsyJlNN_5I55fB7ee1zkkZ9FT5zOzn4,186
149
- khoj/interface/compiled/_next/static/chunks/2117-1c18aa2098982bf9.js,sha256=3KtUs1Aeno0OfsXZ2ymJ0d5HXwO2_Osq2uGIIGiDagI,123994
147
+ khoj/interface/compiled/_next/static/chunks/2117-056a00add390772b.js,sha256=lTuiCOTU8XMmlt22c10pK0DmvUgmNwebKYEeobCK56A,123994
150
148
  khoj/interface/compiled/_next/static/chunks/2170.45431769330fa5b7.js,sha256=C7Puu9x18DhdR5Sh8XXvTzPdP_HTK6WhsJDNW-NoB7o,24019
151
- khoj/interface/compiled/_next/static/chunks/2327-f03b2a77f67b8f8c.js,sha256=BHzRbOlxEws0fe7aVtBtUEFbm2GNzgR-K3UoSQspN_Y,127496
149
+ khoj/interface/compiled/_next/static/chunks/2327-aa22697ed9c8d54a.js,sha256=vfsI4C3PymQROGRo1xU6iMUjLlw_xT6gUTzmq5BSdnk,127496
152
150
  khoj/interface/compiled/_next/static/chunks/3237.c4754f02f1a388cb.js,sha256=Z5iOEX0mPj-5tuoU4Bq_IjpAlyc4MURKlBoaExsULTk,177
153
151
  khoj/interface/compiled/_next/static/chunks/3305.1fc7297ba154ee95.js,sha256=mfrpv-asuYmBmbqIh1p3UnPMAxg2pKlxE3Rzmth8O6s,37266
154
152
  khoj/interface/compiled/_next/static/chunks/3332.6313db5217bb1b67.js,sha256=4lNF9JhPQdTX2xDojGOvvanM0Y0VScwM3kmF4p0RHFg,3776
@@ -157,16 +155,15 @@ khoj/interface/compiled/_next/static/chunks/3460.39c2b9b6a3898384.js,sha256=gehY
157
155
  khoj/interface/compiled/_next/static/chunks/4299.2aaa569416cfc208.js,sha256=3HJ8OvB9BDJW0-qCBd1eUmChoBAxaCX6R81ftWZ1CHw,21659
158
156
  khoj/interface/compiled/_next/static/chunks/4327.238d15c09a039b8b.js,sha256=mZa4Oyltc9JrokqnalRTjzcvWgX4S3i3REXiHzRYH1o,296536
159
157
  khoj/interface/compiled/_next/static/chunks/4357-d86d3401f6f6f802.js,sha256=KDM1m01Fz-vcAMfxQfYPO6SEZJVK7z4241JOCEvou6Y,45442
160
- khoj/interface/compiled/_next/static/chunks/4363-4efaf12abe696251.js,sha256=YFO-i3X2LrX9c4MgYY1kPsoRBaqVUkmfAKI62Rz2BVI,468054
158
+ khoj/interface/compiled/_next/static/chunks/4363-e6ac2203564d1a3b.js,sha256=YFO-i3X2LrX9c4MgYY1kPsoRBaqVUkmfAKI62Rz2BVI,468054
161
159
  khoj/interface/compiled/_next/static/chunks/4415.e0c0da5eedae4dd7.js,sha256=DEf8HPEstDFvBflOU0j0ilYHlVJilGcGsLgUx524FZQ,25544
162
- khoj/interface/compiled/_next/static/chunks/4447-5d44807c40355b1a.js,sha256=Uw8IrcKmVR3wba-FB9maP9i9l_kAYg59r8PN1T_ipQE,19621
160
+ khoj/interface/compiled/_next/static/chunks/4447-e038b251d626c340.js,sha256=Uw8IrcKmVR3wba-FB9maP9i9l_kAYg59r8PN1T_ipQE,19621
163
161
  khoj/interface/compiled/_next/static/chunks/4609-33aa487dff03a9fd.js,sha256=1M6QAfVZa2g2Q4jXRdSI1wjrZ4G9yKjINJt8qyTKm1A,24698
164
162
  khoj/interface/compiled/_next/static/chunks/4610.a1e7f40a759ed2aa.js,sha256=b5JDRPyQv2MsibYoK2TDT76LMAoDTRzFM-fa81mJxow,14102
165
163
  khoj/interface/compiled/_next/static/chunks/4650.41f041da0ad365ad.js,sha256=EZeckNrMc3ZUX_LexPgaeusEq-dGBNEPm7nc5nvb4OM,33902
166
164
  khoj/interface/compiled/_next/static/chunks/479.a7e0c9cfc376a695.js,sha256=IMtRORJyc8TGABlltunJ1si_GUwBMK9bCSeyr7RDdw8,7379
167
165
  khoj/interface/compiled/_next/static/chunks/4872.5422e8324272ab40.js,sha256=fXqb_gUYEnKRgeI3AJuAG6kKAOlVkVXyndmNkhetCyo,11176
168
166
  khoj/interface/compiled/_next/static/chunks/5061.79a660faed0e16a9.js,sha256=EJDyOblv9Po4UPs6ylIKVspSnRQehMXKXuLlW2NVCzo,11215
169
- khoj/interface/compiled/_next/static/chunks/5138-81457f7f59956b56.js,sha256=Y-1Qe5v_jvM1QPcP2qdZH5DMBL8rJlMzsbhAKv5mFiA,1629261
170
167
  khoj/interface/compiled/_next/static/chunks/5279.85d537880b8041ae.js,sha256=3VvdW0sZ8Abfq-qXFvBinh3n65XkjWJBUrFMcRMHIXw,3878
171
168
  khoj/interface/compiled/_next/static/chunks/5402.b9460f1b16b57e92.js,sha256=TFB5N1RYbKelRJXW70T4tT0lEjB3u7RS5lItHOfX-TU,24369
172
169
  khoj/interface/compiled/_next/static/chunks/5427-442f34b514b9fc26.js,sha256=QaxSADflROkzhUDs3OPtt8mpaFIc_3UtBjSS8aTWpzE,31914
@@ -179,21 +176,22 @@ khoj/interface/compiled/_next/static/chunks/5854-745bea90ea77a1c7.js,sha256=ZxxH
179
176
  khoj/interface/compiled/_next/static/chunks/5978.ddc72cd73130aadc.js,sha256=G2kFfcVjqIA6Rqf3BdZUU6E1TJTcb0wRaJd4pSgFsY8,178
180
177
  khoj/interface/compiled/_next/static/chunks/6434.7afea9648e238ad5.js,sha256=kx0Emzxp_59WehJjGu7yS7vbgtHZhBKZgyiAg7dC0As,36261
181
178
  khoj/interface/compiled/_next/static/chunks/6663-133d5db72d2d5f24.js,sha256=XIWY3DhytwBlgJNrryOTTcTtmzYJU93_P5kwifLJV9Q,86271
182
- khoj/interface/compiled/_next/static/chunks/7127-d3199617463d45f0.js,sha256=pzDG715_JjfRd7uFas0TKdGnkC4CZd-x_LuYS2M5O2U,41801
179
+ khoj/interface/compiled/_next/static/chunks/7127-79a3af5138960272.js,sha256=7pkrrH4qxZlJRl5ZeSg8N_Zm4UziW8i8AESa61Tmuug,42840
183
180
  khoj/interface/compiled/_next/static/chunks/7140.4be689873f6a2d1f.js,sha256=-77DqIa_YjhKPwY8UvYjH11SaQpSO6FGa6kOvfnnSY8,76618
184
181
  khoj/interface/compiled/_next/static/chunks/7200-cabc57d26c4b32da.js,sha256=xrBbOYRHGcox-mh5cLLDZd1Mj9Qtqq4oeJlnWVFthAU,11380
182
+ khoj/interface/compiled/_next/static/chunks/7211-7fedd2ee3655239c.js,sha256=3JC88Dq5U23hOoGTfoW-wc0JlARo29My_XioYz9Lzqg,1631697
185
183
  khoj/interface/compiled/_next/static/chunks/7647-2aa4cf0e69b7a84d.js,sha256=5F507Hwv8Rs_p8b8VHraNOC6SpYcLFtn7gyZHm9IWWc,24433
186
184
  khoj/interface/compiled/_next/static/chunks/7836.86884157d53d23a1.js,sha256=3_-E1PqyVC-Lp-iwqIDIkiTMWqU_bYXiqi2PzN-ffFk,89887
187
185
  khoj/interface/compiled/_next/static/chunks/7890.f681eb1d1f83bea2.js,sha256=xd1qCSKkEUfSpKWgqUA-iAj4o5Nl-rEhbgvim5fkUKU,33661
188
186
  khoj/interface/compiled/_next/static/chunks/7953.f6fc335a23efb959.js,sha256=8XInVs3uzJAMGBndN2k4BeJNHmgZOembNuoyPe9Z7Oo,412
189
187
  khoj/interface/compiled/_next/static/chunks/8254.3145a4fbdcfdca46.js,sha256=sur8InabGfvh1HqNQhwBssc1tCPae_WKQ-efoYU1Q8A,412
190
188
  khoj/interface/compiled/_next/static/chunks/8400.c95e4e79bcd79a56.js,sha256=3SlFozKtF4DYQYPT3hB5M7VEm3e_W71kC19JgADz-3k,19864
191
- khoj/interface/compiled/_next/static/chunks/8667-adbe6017a66cef10.js,sha256=kyiAVJTylsiOPFTb63uZn_pMlk4pYhDYt_N7xL76PTM,7214
189
+ khoj/interface/compiled/_next/static/chunks/8667-8136f74e9a086fca.js,sha256=kyiAVJTylsiOPFTb63uZn_pMlk4pYhDYt_N7xL76PTM,7214
192
190
  khoj/interface/compiled/_next/static/chunks/8673.be44c4d9e4f1d084.js,sha256=jiE4xU-TbkVC4R60SIgxwdo31T9mbdVBVuhP4H60i94,18629
193
191
  khoj/interface/compiled/_next/static/chunks/8698.a088118fef40d302.js,sha256=mrK-3ZahVSF7sZij3l-PyXKxp-ccXU9orykXDc7YzsM,180
194
192
  khoj/interface/compiled/_next/static/chunks/9022.33974a513a281fd2.js,sha256=6NmDzRbI0NyTisUT04sq9M0czUqvlwZoV4E7Onp-55Q,57192
195
193
  khoj/interface/compiled/_next/static/chunks/90542734.9e6e44b1b45b30fe.js,sha256=5Ivye3p3HC-Ekf-bIPdnvmg_JtYLkCqyRPWtciOmuuo,413716
196
- khoj/interface/compiled/_next/static/chunks/9259-d8bcd9da9e80c81e.js,sha256=lZJF9qq4_MeSRsHeNPNcxkqh2vhBfag5iAxg6krHA9g,34848
194
+ khoj/interface/compiled/_next/static/chunks/9259-640fdd77408475df.js,sha256=lZJF9qq4_MeSRsHeNPNcxkqh2vhBfag5iAxg6krHA9g,34848
197
195
  khoj/interface/compiled/_next/static/chunks/9334-b22127fe2d39bc60.js,sha256=_TPWqSCbf86Ig1vIEDRLXzloZujDoxpoEWhRPUf6b5U,29065
198
196
  khoj/interface/compiled/_next/static/chunks/9433.b1b5f5d050c43e3c.js,sha256=kMVC0Gg95UqjfQXpGvi-WUSg_kYp0SN7CTPTHxHxDBk,144858
199
197
  khoj/interface/compiled/_next/static/chunks/94ca1967.1b3402358e0e1255.js,sha256=WJXEIy24FD6PNQePg-uahendJMNc03GgnVveitFeshI,1174524
@@ -203,35 +201,35 @@ khoj/interface/compiled/_next/static/chunks/d3ac728e-07f1976c92cfb109.js,sha256=
203
201
  khoj/interface/compiled/_next/static/chunks/ebbfb5c1-a73c51b6a41a5ff6.js,sha256=KWCCB4d3hTJ2OVXDThrHLjlbcgsckoG9UpBKRvbHPIk,83853
204
202
  khoj/interface/compiled/_next/static/chunks/fd9d1056-7454f5bbfcf5bd5b.js,sha256=hlytZKRKDEm1va3Ww-mpo2P2lD-5pw78G2KS66tnJ28,172837
205
203
  khoj/interface/compiled/_next/static/chunks/framework-8e0e0f4a6b83a956.js,sha256=sFFnSyDnFoOc61lP-EtTzTyf-zGA78ejDyMgPFMDw2Q,140001
206
- khoj/interface/compiled/_next/static/chunks/main-876327ac335776ab.js,sha256=JkQUmA9vh1B4VVGF5dbZ8Kun0AnIVUbZr5IBK90T4Zs,111290
204
+ khoj/interface/compiled/_next/static/chunks/main-63d6432f34cdf74b.js,sha256=bXVce22CrDNgnPypCNcoRkRMzcxj0OXFhFE1ZTZDgjo,111290
207
205
  khoj/interface/compiled/_next/static/chunks/main-app-de1f09df97a3cfc7.js,sha256=bqnztujKItXfFBzQlaBmDZyfJpQt_M93CXOuchJfpD0,471
208
206
  khoj/interface/compiled/_next/static/chunks/polyfills-42372ed130431b0a.js,sha256=CXPB1kyIrcjjyVBBDLWLKI9yEY1ZZbeASUON648vloM,112594
209
- khoj/interface/compiled/_next/static/chunks/webpack-1c900156837baf90.js,sha256=3oFQe8pa7Vq3d5sUWd1RhsImK2kNu8sGUfs7nz4Kv2k,4891
207
+ khoj/interface/compiled/_next/static/chunks/webpack-f39eedae8f597e56.js,sha256=DE4X-iAaTTTLIiRHZCmvnPIcw6diML1NcVKUPMJPYkA,4891
210
208
  khoj/interface/compiled/_next/static/chunks/app/layout-baa6e7974e560a7a.js,sha256=7JZS2Pr995Lwu3FeQpAvheLS1Bn5w5HOFsecV2_kyQA,3880
211
- khoj/interface/compiled/_next/static/chunks/app/page-45ae5e99e8a61821.js,sha256=ZDK-miJC4A1jLRIqhS-v7mXdalHRyY0Eizo22f7xsUg,31218
209
+ khoj/interface/compiled/_next/static/chunks/app/page-f7a0286dfc31ad6b.js,sha256=2IVko37SGOhH4OO1_TL5k8xdulAbDTnJwqVyZjXRfMY,31218
212
210
  khoj/interface/compiled/_next/static/chunks/app/_not-found/page-0ec97c4970898f2d.js,sha256=zElhiTkdu2JqrEvJ8Lrxh4HCyfLmPllBHHWOuDtrVlw,1755
213
211
  khoj/interface/compiled/_next/static/chunks/app/agents/layout-e00fb81dca656a10.js,sha256=Prg_1BSPDnJDTXEx-Ai9RtlK0nesPWDFIVFFCMuVUiw,180
214
- khoj/interface/compiled/_next/static/chunks/app/agents/page-2fac1d5ac7192e73.js,sha256=pATgYmEwvudjV7rOL1P6t-KSk5dpq5hw-MenPZ7017Y,18314
212
+ khoj/interface/compiled/_next/static/chunks/app/agents/page-774c78ff0f55a228.js,sha256=lnKW5X-xvNpxPv3-KoHm5P9Dmkrl-9qd88Xfq4ipBL4,18314
215
213
  khoj/interface/compiled/_next/static/chunks/app/automations/layout-7f5c33a70e46b3af.js,sha256=s2wHeQ-ai9rKyU9EjOGY1Yo51L4ZEkjLtML85BqN3Zc,5143
216
- khoj/interface/compiled/_next/static/chunks/app/automations/page-465741d9149dfd48.js,sha256=L85SghN4TR0qgnIUwsjUpZasnVBhHPCJkzvwEZgsuO0,34831
214
+ khoj/interface/compiled/_next/static/chunks/app/automations/page-fc4f5a3ca7201154.js,sha256=i-8Y6748e7BLKjGNEkfRmtJ_uMS9ZHumdAsUZ6Hk9bY,34830
217
215
  khoj/interface/compiled/_next/static/chunks/app/chat/layout-33934fc2d6ae6838.js,sha256=zKdgnv4zZCkeNWFODWPJKYB3VjkTq4X5LtTCs0sqxaQ,180
218
- khoj/interface/compiled/_next/static/chunks/app/chat/page-1726184cf1c1b86e.js,sha256=aUASi-sNExOu_Hgfq5lpE-v-6hr-KPdGhgGS3Cxxi5c,28640
219
- khoj/interface/compiled/_next/static/chunks/app/search/layout-c02531d586972d7d.js,sha256=VQACqzXZcJUaa3W_0wHsrdLP22pj8yqeAOGBQfVnQxw,180
220
- khoj/interface/compiled/_next/static/chunks/app/search/page-afb5e7ed13d221c1.js,sha256=y7Fap-jyzRv5j9diCscAi-E5bQaGh5OFlma1OeaJ5c4,32714
216
+ khoj/interface/compiled/_next/static/chunks/app/chat/page-14cf05b18e3c00ad.js,sha256=OC5QOZooWI4ZgmQP3qdbjUzx8dsAiPS3CmjbPMLC5ug,29016
217
+ khoj/interface/compiled/_next/static/chunks/app/search/layout-f5881c7ae3ba0795.js,sha256=Bm4Y73ylR-j9_LdKXVUjgLppZJ6JRdLTUgYAsZCOBkQ,180
218
+ khoj/interface/compiled/_next/static/chunks/app/search/page-f1a7f278c89e09b6.js,sha256=KnZkmDhLxwikGTsG3voC5ks8LvoO0iRCWQLimf2r2KQ,32714
221
219
  khoj/interface/compiled/_next/static/chunks/app/settings/layout-8a22f370d3eaeed3.js,sha256=dIfmM5C_Al-Zh_uqaJmniSxjXbu3LqPzrEw4SQ7vs0I,6132
222
- khoj/interface/compiled/_next/static/chunks/app/settings/page-8fb6cc97be8774a7.js,sha256=7IV60Rd8kMXB_8yjU6vvpmxIUaJtW-on3uC-SGeP-tc,27893
223
- khoj/interface/compiled/_next/static/chunks/app/share/chat/layout-e8e5db7830bf3f47.js,sha256=rcoit2AQboqPwZMTVlVhz1AbyHRJOs-xNMTdYonejCU,180
224
- khoj/interface/compiled/_next/static/chunks/app/share/chat/page-9a167dc9b5fcd464.js,sha256=YaqV-H2tOQGTuBdFzCnAvaXVg03ncbukE-rGtrZjtU0,5563
220
+ khoj/interface/compiled/_next/static/chunks/app/settings/page-5d9134d4a97f8834.js,sha256=Kn02UECOHZ3VWMJDmsck_e698P-iXOw_4VtDKMNL-oc,27893
221
+ khoj/interface/compiled/_next/static/chunks/app/share/chat/layout-abb6c5f4239ad7be.js,sha256=_HdxnZ70IoB5eHZ5e__Z0jt-2ElBo_BsNPboM-2SMLg,180
222
+ khoj/interface/compiled/_next/static/chunks/app/share/chat/page-bcc8f41edcfbcb6c.js,sha256=8a5VPQzxgjTup7hHROiwC2e1EVSzCD9Fu7dQGDVC3Ls,5563
225
223
  khoj/interface/compiled/_next/static/chunks/pages/_app-3c9ca398d360b709.js,sha256=UqtikLsCsOWtDUJOW6Tuk9P-bV1V3MhYd3ghrQuEmfs,286
226
224
  khoj/interface/compiled/_next/static/chunks/pages/_error-cf5ca766ac8f493f.js,sha256=w_It3VzKT8O1M3CrJ_hZHsaU7M7dq3EAaVG8KvJ-fhU,253
227
225
  khoj/interface/compiled/_next/static/css/37a73b87f02df402.css,sha256=hp0vlekKu0K2eITR5YIqFmLHQPqV3JETFnRd_-Uh0mk,165
226
+ khoj/interface/compiled/_next/static/css/4398afc6d5a37666.css,sha256=L3JiJFYwMoIydyJcNoSLzGwlPxZ_ckAbyL6vnzWlPus,9736
227
+ khoj/interface/compiled/_next/static/css/7017ee76c2f2cd87.css,sha256=crgwDRN7r35lT_QXQDaW3_i48PPhIekfbPdHBz3IIv4,3075782
228
228
  khoj/interface/compiled/_next/static/css/76c658ee459140a9.css,sha256=7tI24VB66ZUsAPUxRdQhboopun0AXLUnF64uv9RkC08,1833
229
229
  khoj/interface/compiled/_next/static/css/7889a30fe9c83846.css,sha256=IUkZhkx4GpYOIhN-EJw9T1DqGMO3Wa3mNpUwaOBuZoY,7204
230
- khoj/interface/compiled/_next/static/css/9c223d337a984468.css,sha256=F5o-qiwJl16uCWiDADWkkIIk5PNxKjvHz5068EptHps,3075687
231
- khoj/interface/compiled/_next/static/css/c34713c98384ee87.css,sha256=uypGqyDrKf-9vcU_Rf9as1XLvMSMDDfKQjmHnLaixfM,9831
230
+ khoj/interface/compiled/_next/static/css/e1bf03aa79521f86.css,sha256=9xq6l9J50f_3jqvzx6WKCa3rh2Oc79thkurRHujLUNM,30589
232
231
  khoj/interface/compiled/_next/static/css/e4eb883b5265d372.css,sha256=6LaW-lQ_ZpgOJNWYwU1Q1egXZ1aqJDEuRj66oRCIU_E,17748
233
232
  khoj/interface/compiled/_next/static/css/ea5485b3f3859a5a.css,sha256=tn6qi2xSLTWhtzDUE8UlC8iipH9QGV6A9oGj1ap-Sk4,1659
234
- khoj/interface/compiled/_next/static/css/fca983d49c3dd1a3.css,sha256=3F1qPtz6PQG-gIpo8h3rAfxreAc2Uvxy8F_G2e78EsM,30452
235
233
  khoj/interface/compiled/_next/static/media/1d8a05b60287ae6c-s.p.woff2,sha256=IzKBwB_bpSGvO7C9aRv29Js-jAbZPRDI-D-P4H2P918,14508
236
234
  khoj/interface/compiled/_next/static/media/2aa11a72f7f24b58-s.woff2,sha256=QjuuSKmViymmy-itXLB1UbSARxFNHWuMiPpCrYqClFI,22728
237
235
  khoj/interface/compiled/_next/static/media/383a65b63658737d-s.woff2,sha256=VH1XkI87HdFVhsurH5D5ekEjG_ZORTVBVg6xz7p87C8,16704
@@ -309,8 +307,10 @@ khoj/interface/compiled/_next/static/media/flags.3afdda2f.webp,sha256=M2AW_HLpBn
309
307
  khoj/interface/compiled/_next/static/media/flags@2x.5fbe9fc1.webp,sha256=BBeRPBZkxY3-aKkMnYv5TSkxmbeMbyUH4VRIPfrWg1E,137406
310
308
  khoj/interface/compiled/_next/static/media/globe.98e105ca.webp,sha256=g3ofb8-W9GM75zIhlvQhaS8I2py9TtrovOKR3_7Jf04,514
311
309
  khoj/interface/compiled/_next/static/media/globe@2x.974df6f8.webp,sha256=I_N7Yke3IOoS-0CC6XD8o0IUWG8PdPbrHmf6lpgWlZY,1380
312
- khoj/interface/compiled/agents/index.html,sha256=TN0LOip5j0Rp_OXBxTWJR4o72s6sTed1U4lf0JQd2nM,16224
313
- khoj/interface/compiled/agents/index.txt,sha256=pz2QKiu-3SmZFm5MSla8rphF55aP168jhxhcfPy64cc,7220
310
+ khoj/interface/compiled/_next/static/oXUhXGFp7bJNGngoyQu8D/_buildManifest.js,sha256=f2_nYnw25hHWQJ-39Lf5OH1u6kgdbOInyfplqgjvAV4,224
311
+ khoj/interface/compiled/_next/static/oXUhXGFp7bJNGngoyQu8D/_ssgManifest.js,sha256=Z49s4suAsf5y_GfnQSvm4qtq2ggxEbZPfEDTXjy6XgA,80
312
+ khoj/interface/compiled/agents/index.html,sha256=B3KXFaqW_Tl1wvjrNFPzj8g69P6LeYpnpgINvBuP0uA,16224
313
+ khoj/interface/compiled/agents/index.txt,sha256=lyuEvZmUnqjcgwqMljQnrGt_dHQdBLNAh3rcT2M9bM4,7220
314
314
  khoj/interface/compiled/assets/icons/khoj_lantern.ico,sha256=eggu-B_v3z1R53EjOFhIqqPnICBGdoaw1xnc0NrzHck,174144
315
315
  khoj/interface/compiled/assets/icons/khoj_lantern.svg,sha256=I_8XP5X84gEOoCRhCRKOQn_GKZrz3SUBXct7WxHvY7c,8767
316
316
  khoj/interface/compiled/assets/icons/khoj_lantern_1200x1200.png,sha256=xDx0bbD-WMflgg8zck9oPIIuTIvywtuED2k7CjSQS4w,66194
@@ -325,16 +325,16 @@ khoj/interface/compiled/assets/samples/desktop-remember-plan-sample.png,sha256=i
325
325
  khoj/interface/compiled/assets/samples/phone-browse-draw-sample.png,sha256=Dd4fPwtFl6BWqnHjeb1mCK_ND0hhHsWtx8sNE7EiMuE,406179
326
326
  khoj/interface/compiled/assets/samples/phone-plain-chat-sample.png,sha256=DEDaNRCkfEWUeh3kYZWIQDTVK1a6KKnYdwj5ZWisN_Q,82985
327
327
  khoj/interface/compiled/assets/samples/phone-remember-plan-sample.png,sha256=Ma3blirRmq3X4oYSsDbbT7MDn29rymDrjwmUfA9BMuM,236285
328
- khoj/interface/compiled/automations/index.html,sha256=NhUt4SB58aeIB912AJp-Zb_pYNkP68SLGMrzHezxlZk,54094
329
- khoj/interface/compiled/automations/index.txt,sha256=NQP3lxIaoDQtiAhj62EjXqTYRG0oe4UBptM9p8HOQVY,7449
330
- khoj/interface/compiled/chat/index.html,sha256=T4pda5BcY8KBJv7aRrIH8X25GnziTWNYTcj63PWjBRI,53222
331
- khoj/interface/compiled/chat/index.txt,sha256=4-9pCM5RpHBEWtoHfO6eSiBFjz1DRQsWqpkMd1AnHcI,7858
332
- khoj/interface/compiled/search/index.html,sha256=Rf8Mvv08blqkIUM8RXLf5AdEZAxuKDiiGZq9-I3b1HU,55304
333
- khoj/interface/compiled/search/index.txt,sha256=NAXeojWcPZ_lSEQFX6aCMTrT6xeIOASzIolrQGkke_Q,6567
334
- khoj/interface/compiled/settings/index.html,sha256=qOkvEnEuHd8YBWn6PFZnCO-qy5IiUmz0eof4oXj-yu4,52743
335
- khoj/interface/compiled/settings/index.txt,sha256=gxOYbd_ULsDdYkYi_9KKCkHjyD2ilFvwPsTDqJeYUvo,7703
336
- khoj/interface/compiled/share/chat/index.html,sha256=GYpFW4yhmYQOBH-xBq8Fp3fcRcvR2qaXlGKVt45vY8E,53802
337
- khoj/interface/compiled/share/chat/index.txt,sha256=htTilErXEgjMopMPDUNrkAJpepS3KPub6884AnvDLdA,8320
328
+ khoj/interface/compiled/automations/index.html,sha256=65ty6rYkW6neFmn5Q8Qxk60vOsXy3tEUpqbWRFKuVXA,54094
329
+ khoj/interface/compiled/automations/index.txt,sha256=_F6MpA8QH537m4psHZIKRdWHYp3W_xeZ6gmFyQQPEow,7449
330
+ khoj/interface/compiled/chat/index.html,sha256=8b0fH49GtnMxp7rs1tZ0uJ0qMWIgx9b1XatqQf093Fs,53222
331
+ khoj/interface/compiled/chat/index.txt,sha256=BUrdMtEKlpJD6Ky3USQqAiK-ZL6IudhxuvmKjOU2aCs,7858
332
+ khoj/interface/compiled/search/index.html,sha256=cLwm0e9bxy6o63DrnfXSRG8d7NgUkZCmvsKU1lzEV7I,55304
333
+ khoj/interface/compiled/search/index.txt,sha256=swDBKeOrtv6M8kXNcCYpYRXjTKQbKHB7TaFlpWyBsFA,6567
334
+ khoj/interface/compiled/settings/index.html,sha256=XFTiFTvoYxDjPfGI-t8o2QEhNdJdesKcfB0AuKSD_o8,52743
335
+ khoj/interface/compiled/settings/index.txt,sha256=7SmmKSUtLKZ2sfHNHsZFVCfZw3kafzIQzHZEDVbYfwo,7703
336
+ khoj/interface/compiled/share/chat/index.html,sha256=wGDS-UAaqmpq1xTljDAopq3gHf4wmeK8F3LcmCJWQZI,53802
337
+ khoj/interface/compiled/share/chat/index.txt,sha256=t7x43gJi3FJ6ltG85b-9_gQUOGAY6k04Gf6QbvPExw4,8320
338
338
  khoj/interface/email/feedback.html,sha256=xksuPFamx4hGWyTTxZKRgX_eiYQQEuv-eK9Xmkt-nwU,1216
339
339
  khoj/interface/email/magic_link.html,sha256=372ESbTPKM9acekuZcOIKOw6kBl-KikFg_L9MOHqJkg,2094
340
340
  khoj/interface/email/task.html,sha256=tY7a0gzVeQ2lSQNu7WyXR_s7VYeWTrxWEj1iHVuoVE4,2813
@@ -386,20 +386,20 @@ khoj/processor/content/pdf/pdf_to_entries.py,sha256=GQUvab61okhV9_DK0g2MCrMq8wKp
386
386
  khoj/processor/content/plaintext/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
387
387
  khoj/processor/content/plaintext/plaintext_to_entries.py,sha256=wFZwK_zIc7gWbRtO9sOHo9KvfhGAzL9psX_nKWYFduo,4975
388
388
  khoj/processor/conversation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
389
- khoj/processor/conversation/prompts.py,sha256=78EVB1f3E9O5DQ0t2vnrvJHik_8BOdJHZVL9Vd1A3G8,57907
389
+ khoj/processor/conversation/prompts.py,sha256=XkLuA8npw4gdfXQqBJqn-13uJd1xoGtnzOsnobFrw5g,54523
390
390
  khoj/processor/conversation/utils.py,sha256=L5jtIkKLG6Tx7JZC8faDT4b2zAA1ZIxN2NQV7rAYOE0,43799
391
391
  khoj/processor/conversation/anthropic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
392
- khoj/processor/conversation/anthropic/anthropic_chat.py,sha256=bH-hQvTWaFwBAjW8VzWILzNklRRRu_WkEIKvA8f3w60,9806
393
- khoj/processor/conversation/anthropic/utils.py,sha256=ZFUj1cuRs7PCznHBjSvga19N9HUARx64mt1CyrVrVKA,16415
392
+ khoj/processor/conversation/anthropic/anthropic_chat.py,sha256=7QnT5no46slRahe3UlCEmPMVb7LrIcth0pkjVneaq0g,5290
393
+ khoj/processor/conversation/anthropic/utils.py,sha256=P5xBr2VaqEgp5LJbgY0o9_C6z_nuHQYwsgYpYaY7l7I,16452
394
394
  khoj/processor/conversation/google/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
395
- khoj/processor/conversation/google/gemini_chat.py,sha256=OjRhlYvFiJvBdAIsfOB-gh1pLEOuPIbUEEN2VmcMhVk,10293
395
+ khoj/processor/conversation/google/gemini_chat.py,sha256=L8a4NYstCGQlax_HHaeaqlu_qs6pITeCX7sD5BDeEC0,5659
396
396
  khoj/processor/conversation/google/utils.py,sha256=FmK09N4zp0uGv2AVdHnJBzKKb9kr6wG1cJOelI9zraY,16269
397
397
  khoj/processor/conversation/offline/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
398
- khoj/processor/conversation/offline/chat_model.py,sha256=mwzOokR_TKO2O3wwEMjNfEsvFO46jgbkF5SdJiX0JEg,13475
398
+ khoj/processor/conversation/offline/chat_model.py,sha256=lD2sIGEKBuF9AZSyU2UUHAZHeTyE6v1B2-qUoVoSiXg,8579
399
399
  khoj/processor/conversation/offline/utils.py,sha256=51McImxl6u1qgRYvMt7uzsgLGSLq5SMFy74ymlNjIcc,3033
400
400
  khoj/processor/conversation/offline/whisper.py,sha256=DJI-8y8DULO2cQ49m2VOvRyIZ2TxBypc15gM8O3HuMI,470
401
401
  khoj/processor/conversation/openai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
402
- khoj/processor/conversation/openai/gpt.py,sha256=L3fCy5fi_2zPybOKzCLblXv92O2G8kxsQedxkZA7lwE,11324
402
+ khoj/processor/conversation/openai/gpt.py,sha256=_i0greQTSxLL5wOCqBot6cIPtdhtBL_y8fZsn8lRmYc,7174
403
403
  khoj/processor/conversation/openai/utils.py,sha256=Q8QrFdTD34QSdJRiLTdhvqeZfmpgM_F7L6R2DMB8DZQ,25419
404
404
  khoj/processor/conversation/openai/whisper.py,sha256=zoEeK1LNCg_tzP4xzYi5vRPzNPGuDGzpkrkG7d1LUn4,447
405
405
  khoj/processor/image/generate.py,sha256=4Hzq-rl3ZavnWml5Q6bjRfw1Y-ybDSRQTDs7sCrsXIA,10606
@@ -421,18 +421,19 @@ khoj/processor/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS
421
421
  khoj/processor/tools/online_search.py,sha256=MjTkD9gbf9iRWkzcbP5ZRBGKX9ppBXIk7LEKQ0zDvXQ,24881
422
422
  khoj/processor/tools/run_code.py,sha256=S1HJcV5zA-n1Ue2a5A7cY3gzsSfYHy3KdLkjkZu3aro,12555
423
423
  khoj/routers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
424
- khoj/routers/api.py,sha256=P3AbJOZwgwOoulNA64NVpMaGj2c-7u_awfv_Jae6BOg,29463
424
+ khoj/routers/api.py,sha256=BFiKwdYjkR-4aHBumM7Hu4XdN2RvQ0Z9V4_2Wd8aPiM,8633
425
425
  khoj/routers/api_agents.py,sha256=aEJJnQe1yogSkKO6W3Q8Ukl-xHMnqIAx3jB4M-kGNdY,17043
426
- khoj/routers/api_chat.py,sha256=argabMafm12Zn0Is1tECqDykz7m8tHvJwd7sFWMo0zc,62568
426
+ khoj/routers/api_automation.py,sha256=SwQGsVcZmtf8g3w8Xz220YhTIT6D4mLwUp_YCYLpbCY,9389
427
+ khoj/routers/api_chat.py,sha256=kL7Ug8Zzs6K2Y-tZHXcrtt_dp28QhoyJjsDcSgNCZ3M,58516
427
428
  khoj/routers/api_content.py,sha256=uLO3eir36rERkhhKU1HOdEv8KTi_z_edT9cHMCZP1W8,24578
428
429
  khoj/routers/api_model.py,sha256=trYi5ZrG7OfkSvXmsVu8Dtzzm0n0B8XCqvaGuuJ5wSA,5255
429
430
  khoj/routers/api_phone.py,sha256=p9yfc4WeMHDC0hg3aQk60a2VBy8rZPdEnz9wdJ7DzkU,2208
430
431
  khoj/routers/api_subscription.py,sha256=qnbKwA6N1TWK8Aiu1FFLka_JhbPOuwqT262NSHGZDiQ,5569
431
432
  khoj/routers/auth.py,sha256=jk2lqAS_650lQsoaOFTlZd9W_LL8HbN5zhHTZza_lqs,11258
432
433
  khoj/routers/email.py,sha256=wvr6_fpk0RuKcTPC6suI8JDZPLYzJ9hAhz_G41yZytc,3923
433
- khoj/routers/helpers.py,sha256=xRKnqj8VI9kkWBh0-Ko-Mun5wbH1tyaWxMTgbZn8OR4,97191
434
+ khoj/routers/helpers.py,sha256=7Ouj3XDSriQ-QV9VJ05sK1OyDDBXVa4pJSthVY3KFkk,106127
434
435
  khoj/routers/notion.py,sha256=g53xyYFmjr2JnuIrTW2vytbfkiK_UkoRTxqnnLSmD5o,2802
435
- khoj/routers/research.py,sha256=_MTMJcD1E_7N7WJhDIPFksqkza4RhVOOnZvisMxxaRk,24021
436
+ khoj/routers/research.py,sha256=cqTVLnQ74UwVgtGJqOWagN25S13hsUfVHTp4bPgjeWU,22672
436
437
  khoj/routers/storage.py,sha256=lao0DvsF49QleZvOdjKM98RU2cGfCJDBb7WeoI7Rr3I,2172
437
438
  khoj/routers/twilio.py,sha256=MLsuCm4--ETvr3sLxbF0CL_ehlg_l2rKBSLR2Qh2Xls,1081
438
439
  khoj/routers/web_client.py,sha256=_vyfDaHZZjNoI2LwGNQFRiFmGLkNcgYJe7dOr3mrxH8,4386
@@ -448,15 +449,15 @@ khoj/utils/cli.py,sha256=fI1XQYMtJzLGOKQZQ5XxFOrC8sGjK3Alnteg5U62rWI,3882
448
449
  khoj/utils/config.py,sha256=aiOkH0je8A30DAGYTHMRePrgJonFv_i07_7CdhhhcdA,1805
449
450
  khoj/utils/constants.py,sha256=hh4C7At_N0da3P0Dn2OJXKpbdpeZGfY5M1FFuDRI7qg,4226
450
451
  khoj/utils/fs_syncer.py,sha256=5nqwAZqRk3Nwhkwd8y4IomTPZQmW32GwAqyMzal5KyY,9996
451
- khoj/utils/helpers.py,sha256=sEXCzctAL5SzBN8usWHPn6r7fpryen18XM5XNKOIEVA,32374
452
+ khoj/utils/helpers.py,sha256=h-H3ioGB5PIYLBr-SmUjmNBIkN5-YDXsoK5B1DvI3i4,32005
452
453
  khoj/utils/initialization.py,sha256=5eULsvGQv_Kp9bMfrHP8T_QFPjurIFyfq3-rVMWiGa4,15066
453
454
  khoj/utils/jsonl.py,sha256=0Ac_COqr8sLCXntzZtquxuCEVRM2c3yKeDRGhgOBRpQ,1192
454
455
  khoj/utils/models.py,sha256=Q5tcC9-z25sCiub048fLnvZ6_IIO1bcPNxt5payekk0,2009
455
456
  khoj/utils/rawconfig.py,sha256=ASl_h3Ivaa_4lD4kCA0uZsMRgSYCjrgGUPm-Hw1jkLk,5083
456
457
  khoj/utils/state.py,sha256=s_GFWOqRzpEDx0eCPStuzBTK2VEw-qgRpH0aiEdGnDo,1791
457
458
  khoj/utils/yaml.py,sha256=qy1Tkc61rDMesBw_Cyx2vOR6H-Hngcsm5kYfjwQBwkE,1543
458
- khoj-1.42.2.dev1.dist-info/METADATA,sha256=8vIJmVcLedKHJsxu3vD0aIbboC0EZsHlGOyJQqRh6o4,8965
459
- khoj-1.42.2.dev1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
460
- khoj-1.42.2.dev1.dist-info/entry_points.txt,sha256=KBIcez5N_jCgq_ER4Uxf-e1lxTBMTE_BBjMwwfeZyAg,39
461
- khoj-1.42.2.dev1.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
462
- khoj-1.42.2.dev1.dist-info/RECORD,,
459
+ khoj-1.42.2.dev19.dist-info/METADATA,sha256=7ybidyiCKaRZtUEgArzzLn-74wn8t7NUPG9keaepmDM,8967
460
+ khoj-1.42.2.dev19.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
461
+ khoj-1.42.2.dev19.dist-info/entry_points.txt,sha256=KBIcez5N_jCgq_ER4Uxf-e1lxTBMTE_BBjMwwfeZyAg,39
462
+ khoj-1.42.2.dev19.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
463
+ khoj-1.42.2.dev19.dist-info/RECORD,,
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7127],{27127:function(e,t,a){"use strict";a.d(t,{Z:function(){return eO}});var n=a(57437),s=a(42501),o=a.n(s),l=a(2265),r=a(48614),c=a(99597),i=a(91499),d=a.n(i),h=a(19983),u=a(13506),g=a.n(u),m=a(34040);a(2446);var f=a(5147),p=a(86018),x=a(38525),v=a(45178),j=a(66070),w=a(69304),y=a(57054),b=a(18848),C=a(42225),N=a(27648);let _=new h.Z({html:!0,linkify:!0,typographer:!0});function M(e){let t=(0,C.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?b.Z.sanitize(_.render(t)):b.Z.sanitize(t)}(e),[o,r]=(0,l.useState)(!1);return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(y.J2,{open:o&&!e.showFullContent,onOpenChange:r,children:[(0,n.jsx)(y.xo,{asChild:!0,children:(0,n.jsx)(j.Zb,{onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),className:"".concat(e.showFullContent?"w-auto bg-muted":"w-auto"," overflow-hidden break-words text-balance rounded-lg border-none p-2 shadow-none"),children:e.showFullContent?(0,n.jsxs)(n.Fragment,{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 overflow-x-auto block",dangerouslySetInnerHTML:{__html:s}})]}):(0,n.jsx)(O,{type:"notes"},"".concat(e.title))})}),(0,n.jsx)(y.yk,{className:"w-[400px] mx-2",children:(0,n.jsxs)(j.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 k(e){var t,a,s,o,r,c;let i=(0,C.Le)(".py","!w-4 h-4 text-muted-foreground flex-shrink-0"),d=b.Z.sanitize(e.code),[h,u]=(0,l.useState)(!1),[g,m]=(0,l.useState)(!1),p=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)},x=(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(),p(t)},onMouseEnter:()=>m(!0),onMouseLeave:()=>m(!1),title:"Download file: ".concat(t.filename),children:(0,n.jsx)(f.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)(y.J2,{open:h&&!e.showFullContent,onOpenChange:u,children:[(0,n.jsx)(y.xo,{asChild:!0,children:(0,n.jsx)(j.Zb,{onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),className:"".concat(e.showFullContent?"w-auto bg-muted":"w-auto"," overflow-hidden break-words text-balance rounded-lg border-none p-2 shadow-none"),children:e.showFullContent?(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&&x(e.output_files,!1)]}):(0,n.jsx)(O,{type:"code"},"code-".concat(e.code))})}),(0,n.jsx)(y.yk,{className:"w-[400px] mx-2",children:(0,n.jsxs)(j.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&&x(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 overflow-hidden line-clamp-10",children:d})]})})]})})}function T(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)(y.J2,{open:t&&!e.showFullContent,onOpenChange:a,children:[(0,n.jsx)(y.xo,{asChild:!0,children:(0,n.jsx)(j.Zb,{onMouseEnter:()=>{a(!0)},onMouseLeave:()=>{a(!1)},className:"".concat(e.showFullContent?"w-auto bg-muted":"w-auto"," overflow-hidden break-words text-balance rounded-lg border-none p-2 shadow-none"),children:e.showFullContent?(0,n.jsxs)("div",{className:"flex flex-col",children:[(0,n.jsx)(N.default,{href:e.link,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)(O,{type:"online",link:e.link},e.title)})}),(0,n.jsx)(y.yk,{className:"w-[400px] mx-2",children:(0,n.jsx)(j.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 O(e){let t="",a="unknown";if(e.link)try{a=new URL(e.link).hostname,t="https://www.google.com/s2/favicons?domain=".concat(a)}catch(t){return console.warn("Error parsing domain from link: ".concat(e.link)),null}let s=null,o="!w-4 !h-4 text-muted-foreground inline-flex mr-2 rounded-lg";switch(e.type){case"code":s=(0,n.jsx)(p.E,{className:"".concat(o)});break;case"online":s=(0,n.jsx)("img",{src:t,alt:"",className:"".concat(o)});break;case"notes":s=(0,n.jsx)(x.j,{className:"".concat(o)});break;default:s=null}return s?(0,n.jsx)("div",{className:"flex items-center gap-2",children:s}):null}function E(e){let t=e.notesReferenceCardData.length>0||e.codeReferenceCardData.length>0||e.onlineReferenceCardData.length>0,a=e.notesReferenceCardData.length+e.codeReferenceCardData.length+e.onlineReferenceCardData.length;return 0===a?null:(0,n.jsx)("div",{className:"pt-0 px-4 pb-4",children:(0,n.jsxs)("h3",{className:"inline-flex items-center",children:[(0,n.jsxs)("div",{className:"text-gray-400 m-2",children:[a," sources"]}),(0,n.jsx)("div",{className:"flex flex-wrap gap-2 w-auto m-2",children:t&&(0,n.jsx)(I,{notesReferenceCardData:e.notesReferenceCardData,onlineReferenceCardData:e.onlineReferenceCardData,codeReferenceCardData:e.codeReferenceCardData,isMobileWidth:e.isMobileWidth})})]})})}function I(e){let[t,a]=(0,l.useState)(3);if((0,l.useEffect)(()=>{a(e.isMobileWidth?3:5)},[e.isMobileWidth]),!e.notesReferenceCardData&&!e.onlineReferenceCardData)return null;let s=e.codeReferenceCardData.slice(0,t),o=e.notesReferenceCardData.slice(0,t-s.length),r=o.length+s.length<t?e.onlineReferenceCardData.filter(e=>e.link).slice(0,t-s.length-o.length):[];return(0,n.jsxs)(w.yo,{children:[(0,n.jsxs)(w.aM,{className:"text-balance w-auto justify-start overflow-hidden break-words p-0 bg-transparent border-none text-gray-400 align-middle items-center m-0 inline-flex",children:[s.map((e,t)=>(0,l.createElement)(k,{showFullContent:!1,...e,key:"code-".concat(t)})),o.map((e,t)=>(0,l.createElement)(M,{showFullContent:!1,...e,key:"".concat(e.title,"-").concat(t)})),r.map((e,t)=>(0,l.createElement)(T,{showFullContent:!1,...e,key:"".concat(e.title,"-").concat(t)})),(0,n.jsx)(v.o,{className:"m-0"})]}),(0,n.jsxs)(w.ue,{className:"overflow-y-scroll",children:[(0,n.jsxs)(w.Tu,{children:[(0,n.jsx)(w.bC,{children:"References"}),(0,n.jsx)(w.Ei,{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)(k,{showFullContent:!0,...e,key:"code-".concat(t)})),e.notesReferenceCardData.map((e,t)=>(0,l.createElement)(M,{showFullContent:!0,...e,key:"".concat(e.title,"-").concat(t)})),e.onlineReferenceCardData.map((e,t)=>(0,l.createElement)(T,{showFullContent:!0,...e,key:"".concat(e.title,"-").concat(t)}))]})]})]})}var R=a(59199),S=a(62467),F=a(93893),L=a(2452),D=a(22105),B=a(52938),P=a(68950),z=a(63329),A=a(35099),q=a(46561),H=a(33758),U=a(58717),W=a(33511),Z=a(51059),V=a(38513),G=a(46732),J=a(47924),$=a(19841),Q=a(88435),K=a(14308),Y=a(84671),X=a(36663);let ee=(0,a(30166).default)(()=>Promise.all([a.e(6555),a.e(7293),a.e(4609),a.e(479)]).then(a.bind(a,60479)).then(e=>e.default),{loadableGenerated:{webpack:()=>[60479]},ssr:!1});function et(e){return(0,n.jsx)(l.Suspense,{fallback:(0,n.jsx)(K.Z,{}),children:(0,n.jsx)(ee,{data:e.data})})}var ea=a(26110),en=a(49027),es=a(7436),eo=a(19378),el=a(50656),er=a(75419),ec=a(41648),ei=a(62869),ed=e=>{let{chart:t}=e,[a,s]=(0,l.useState)(null),[o]=(0,l.useState)("mermaid-chart-".concat(Math.random().toString(12).substring(7))),r=(0,l.useRef)(null);(0,l.useEffect)(()=>{el.Z.initialize({startOnLoad:!1}),el.Z.parseError=e=>{let t;console.error("Mermaid errors:",e);try{t="string"==typeof e?JSON.parse(e):e}catch(a){t=(null==e?void 0:e.toString())||"Unknown error"}console.log("Mermaid error message:",t),"element is null"!==t.str?s("Something went wrong while rendering the diagram. Please try again later or downvote the message if the issue persists."):s(null)},el.Z.contentLoaded()},[]);let c=async()=>{if(r.current)try{var e;let t=r.current.querySelector("svg");if(!t)throw Error("No SVG found");let[,,a,n]=(null===(e=t.getAttribute("viewBox"))||void 0===e?void 0:e.split(" ").map(Number))||[0,0,0,0],s=document.createElement("canvas");s.width=2*a,s.height=2*n;let o=s.getContext("2d");if(!o)throw Error("Failed to get canvas context");let l=new XMLSerializer().serializeToString(t),c=new Blob([l],{type:"image/svg+xml;charset=utf-8"}),i=URL.createObjectURL(c),d=new Image;d.src=i,await new Promise((e,t)=>{d.onload=()=>{o.scale(2,2),o.drawImage(d,0,0,a,n),s.toBlob(a=>{if(!a){t(Error("Failed to create blob"));return}let n=URL.createObjectURL(a),s=document.createElement("a");s.href=n,s.download="mermaid-diagram-".concat(Date.now(),".png"),s.click(),URL.revokeObjectURL(n),URL.revokeObjectURL(i),e(!0)},"image/png")},d.onerror=()=>t(Error("Failed to load SVG"))})}catch(e){console.error("Error exporting diagram:",e),s("Failed to export diagram")}};return(0,l.useEffect)(()=>{r.current&&(r.current.removeAttribute("data-processed"),el.Z.run({nodes:[r.current]}).then(()=>{s(null)}).catch(e=>{let t;try{t="string"==typeof e?JSON.parse(e):e}catch(a){t=(null==e?void 0:e.toString())||"Unknown error"}console.log("Mermaid error message:",t),"element is null"!==t.str?s("Something went wrong while rendering the diagram. Please try again later or downvote the message if the issue persists."):s(null)}))},[t]),(0,n.jsxs)("div",{children:[a?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 bg-red-100 border border-red-500 rounded-md p-1 mt-3 text-red-900 text-sm",children:[(0,n.jsx)(er.k,{className:"w-12 h-12"}),(0,n.jsx)("span",{children:a})]}),(0,n.jsx)("code",{className:"block bg-secondary text-secondary-foreground p-4 mt-3 rounded-lg font-mono text-sm whitespace-pre-wrap overflow-x-auto max-h-[400px] border border-gray-200",children:t})]}):(0,n.jsx)("div",{id:o,ref:r,className:"mermaid",style:{width:"auto",height:"auto",boxSizing:"border-box",overflow:"auto"},children:t}),!a&&(0,n.jsxs)(ei.z,{onClick:c,variant:"secondary",className:"mt-3",children:[(0,n.jsx)(ec.U,{className:"w-5 h-5"}),"Export as PNG"]})]})};let eh=new h.Z({html:!0,linkify:!0,typographer:!0});function eu(e,t,a){fetch("/api/chat/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({uquery:e,kquery:t,sentiment:a})})}function eg(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(d().feedbackButtons," flex align-middle justify-center items-center"),children:[(0,n.jsx)("button",{title:"Like",className:d().thumbsUpButton,disabled:null!==s,onClick:()=>{eu(t,a,"positive"),o(!0)},children:!0===s?(0,n.jsx)(S.V,{alt:"Liked Message",className:"text-green-500",weight:"fill"}):(0,n.jsx)(S.V,{alt:"Like Message",className:"hsl(var(--muted-foreground)) hover:text-green-500"})}),(0,n.jsx)("button",{title:"Dislike",className:d().thumbsDownButton,disabled:null!==s,onClick:()=>{eu(t,a,"negative"),o(!1)},children:!1===s?(0,n.jsx)(F.L,{alt:"Disliked Message",className:"text-red-500",weight:"fill"}):(0,n.jsx)(F.L,{alt:"Dislike Message",className:"hsl(var(--muted-foreground)) hover:text-red-500"})})]})}function em(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)(L.a,{className:"".concat(s)}):a.includes("generating")?(0,n.jsx)(D.Z,{className:"".concat(s)}):a.includes("tools")?(0,n.jsx)(B.v,{className:"".concat(s)}):a.includes("notes")?(0,n.jsx)(P.g,{className:"".concat(s)}):a.includes("read")?(0,n.jsx)(z.f,{className:"".concat(s)}):a.includes("search")?(0,n.jsx)(A.Y,{className:"".concat(s)}):a.includes("summary")||a.includes("summarize")||a.includes("enhanc")?(0,n.jsx)(q.u,{className:"".concat(s)}):a.includes("diagram")?(0,n.jsx)(H.j,{className:"".concat(s)}):a.includes("paint")?(0,n.jsx)(U.Y,{className:"".concat(s)}):a.includes("code")?(0,n.jsx)(p.E,{className:"".concat(s)}):a.includes("operating")?(0,n.jsx)(W.A,{className:"".concat(s)}):(0,n.jsx)(L.a,{className:"".concat(s)})}(t?t[1]:"",e.primary?(0,Y.oz)(e.agentColor):"text-gray-500"),s=e.message,o=null;try{let e=s.match(/\{.*("action": "screenshot"|"type": "screenshot"|"image": "data:image\/.*").*\}/);if(e){o=JSON.parse(e[0]);let t='<img src="'.concat(o.image,'" alt="State of environment" class="max-w-full" />');s=s.replace(":\n**Action**: ".concat(e[0]),"\n\n- ".concat(o.text,"\n").concat(t))}}catch(e){console.error("Failed to parse screenshot data",e)}let l=b.Z.sanitize(eh.render(s));return l=l.replace(/<h[1-6].*?<\/h[1-6]>/g,""),(0,n.jsxs)("div",{className:"".concat(d().trainOfThoughtElement," break-words items-center ").concat(e.primary?"text-gray-400":"text-gray-300"," ").concat(d().trainOfThought," ").concat(e.primary?d().primary:""),children:[a,(0,n.jsx)("div",{dangerouslySetInnerHTML:{__html:l},className:"break-words"})]})}eh.use(g(),{inline:!0,code:!0});let ef=(0,l.forwardRef)((e,t)=>{var a,s;let o,r,c,i,h;let[u,g]=(0,l.useState)(!1),[f,p]=(0,l.useState)(!1),[x,v]=(0,l.useState)(""),[j,w]=(0,l.useState)(""),[y,N]=(0,l.useState)(!1),[_,M]=(0,l.useState)(!1),[k,T]=(0,l.useState)(""),[O,I]=(0,l.useState)(""),S=(0,l.useRef)(!1),F=(0,l.useRef)(null);async function L(){let t=e.chatMessage.message.match(/[^.!?]+[.!?]*/g)||[];if(!t||0===t.length||!t[0])return;N(!0);let a=D(t[0]);for(let e=0;e<t.length&&!S.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}}N(!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)(()=>{S.current=_},[_]),(0,l.useEffect)(()=>{let e=new MutationObserver((e,t)=>{if(F.current)for(let t of e)"childList"===t.type&&t.addedNodes.length>0&&(0,X.Z)(F.current,{delimiters:[{left:"$$",right:"$$",display:!0},{left:"\\[",right:"\\]",display:!0},{left:"\\(",right:"\\)",display:!1}]})});return F.current&&e.observe(F.current,{childList:!0}),()=>e.disconnect()},[F.current]),(0,l.useEffect)(()=>{let t=e.chatMessage.message;e.chatMessage.excalidrawDiagram&&T(e.chatMessage.excalidrawDiagram),e.chatMessage.mermaidjsDiagram&&I(e.chatMessage.mermaidjsDiagram),t=t.replace(/\\\(/g,"LEFTPAREN").replace(/\\\)/g,"RIGHTPAREN").replace(/\\\[/g,"LEFTBRACKET").replace(/\\\]/g,"RIGHTBRACKET"),t=(0,R.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 a=t,n=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 b.Z.sanitize(t)}),s=t.map((e,t)=>"![uploaded image ".concat(t+1,"](").concat(e,")")).join("\n"),o=t.map((e,t)=>'<div class="'.concat(d().imageWrapper,'"><img src="').concat(e,'" alt="uploaded image ').concat(t+1,'" /></div>')).join(""),l='<div class="'.concat(d().imagesContainer,'">').concat(o,"</div>");a="".concat(s,"\n\n").concat(a),n="".concat(l).concat(n)}v(a);let s=eh.render(n);s=s.replace(/LEFTPAREN/g,"\\(").replace(/RIGHTPAREN/g,"\\)").replace(/LEFTBRACKET/g,"\\[").replace(/RIGHTBRACKET/g,"\\]"),w(b.Z.sanitize(s))},[e.chatMessage.message,e.chatMessage.images,e.chatMessage.intent]),(0,l.useEffect)(()=>{u&&setTimeout(()=>{g(!1)},2e3)},[u]),(0,l.useEffect)(()=>{F.current&&(F.current.querySelectorAll("pre > .hljs").forEach(e=>{if(!e.querySelector("".concat(d().codeCopyButton))){let t=document.createElement("button"),a=(0,n.jsx)(Z.w,{size:24});(0,m.createRoot)(t).render(a),t.className="hljs ".concat(d().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)(V.J,{size:24});(0,m.createRoot)(t).render(s)}),e.prepend(t)}}),(0,X.Z)(F.current,{delimiters:[{left:"$$",right:"$$",display:!0},{left:"\\[",right:"\\]",display:!0},{left:"\\(",right:"\\)",display:!1}]}))},[j,f,F]);let B=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")},P=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=[d().chatMessageContainer],"khoj"===a.by&&o.push("shadow-md"),o.push(d()[a.by]),a.message||o.push(d().emptyChatMessage),e.customClassName&&o.push(d()["".concat(a.by).concat(e.customClassName)]),o.join(" ")),onMouseLeave:e=>p(!1),onMouseEnter:e=>p(!0),children:[(0,n.jsxs)("div",{className:(s=e.chatMessage,(r=[d().chatMessageWrapper]).push(d()[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)(ea.Vq,{children:[(0,n.jsx)(ea.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,C.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,es.xq)(e.size),")"]})]})}),(0,n.jsxs)(ea.cZ,{children:[(0,n.jsx)(ea.fK,{children:(0,n.jsx)(en.$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)(ea.Be,{children:(0,n.jsx)(eo.x,{className:"h-72 w-full rounded-md break-words break-all text-wrap",children:e.content})})]})]},t))}),(0,n.jsx)("div",{ref:F,className:d().chatMessage,dangerouslySetInnerHTML:{__html:j}}),k&&(0,n.jsx)(et,{data:k}),O&&(0,n.jsx)(ed,{chart:O})]}),(0,n.jsx)("div",{className:d().teaserReferencesContainer,children:(0,n.jsx)(E,{isMobileWidth:e.isMobileWidth,notesReferenceCardData:P.notesReferenceCardData,onlineReferenceCardData:P.onlineReferenceCardData,codeReferenceCardData:P.codeReferenceCardData})}),(0,n.jsx)("div",{className:d().chatFooter,children:(f||e.isMobileWidth||e.isLastMessage||y)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{title:(i=(c=new Date(e.chatMessage.created+"Z")).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0}).toUpperCase(),h=c.toLocaleString("en-US",{year:"numeric",month:"short",day:"2-digit"}).replaceAll("-"," "),"".concat(i," on ").concat(h)),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(d().chatButtons," shadow-sm"),children:["khoj"===e.chatMessage.by&&(y?_?(0,n.jsx)(K.l,{iconClassName:"p-0",className:"m-0"}):(0,n.jsx)("button",{title:"Pause Speech",onClick:e=>M(!0),children:(0,n.jsx)(G.d,{alt:"Pause Message",className:"hsl(var(--muted-foreground))"})}):(0,n.jsx)("button",{title:"Speak",onClick:e=>L(),children:(0,n.jsx)(J.j,{alt:"Speak Message",className:"hsl(var(--muted-foreground)) hover:text-green-500"})})),e.chatMessage.turnId&&(0,n.jsx)("button",{title:"Delete",className:"".concat(d().deleteButton),onClick:()=>B(e.chatMessage),children:(0,n.jsx)($.r,{alt:"Delete Message",className:"hsl(var(--muted-foreground)) hover:text-red-500"})}),(0,n.jsx)("button",{title:"Copy",className:"".concat(d().copyButton),onClick:()=>{navigator.clipboard.writeText(x),g(!0)},children:u?(0,n.jsx)(Q.C,{alt:"Copied Message",weight:"fill",className:"text-green-500"}):(0,n.jsx)(Q.C,{alt:"Copy Message",className:"hsl(var(--muted-foreground)) hover:text-green-500"})}),"khoj"===e.chatMessage.by&&(e.chatMessage.intent?(0,n.jsx)(eg,{uquery:e.chatMessage.intent.query,kquery:e.chatMessage.message}):(0,n.jsx)(eg,{uquery:e.chatMessage.rawQuery||e.chatMessage.message,kquery:e.chatMessage.message}))]})]})})]})});ef.displayName="ChatMessage";var ep=a(46843),ex=a(87332),ev=a(91832),ej=a(44849),ew=a.n(ej);function ey(e){let{frames:t,autoPlay:a=!0,playbackSpeed:s=1e3}=e,[o,r]=(0,l.useState)(0),[c,i]=(0,l.useState)(a),[d,h]=(0,l.useState)(!0),u=(0,l.useRef)(null);(0,l.useEffect)(()=>{d&&t.length>0&&r(t.length-1)},[t.length,d]),(0,l.useEffect)(()=>(c&&t.length>1?u.current=setInterval(()=>{r(e=>{let a=e+1;return a>=t.length?(i(!1),e):a})},s):u.current&&(clearInterval(u.current),u.current=null),()=>{u.current&&clearInterval(u.current)}),[c,t.length,s]);let g=t[o],m=e=>{r(e),h(!1),i(!1)};return t.length?(0,n.jsxs)("div",{className:ew().videoPlayer,children:[(0,n.jsxs)("div",{className:ew().screen,children:[(null==g?void 0:g.image)&&(0,n.jsx)("img",{src:g.image,alt:"Train of thought frame ".concat(o+1),className:ew().screenImage}),(0,n.jsx)("div",{className:ew().textOverlay,children:(0,n.jsx)("div",{className:ew().thoughtText,children:null==g?void 0:g.text})})]}),(0,n.jsxs)("div",{className:ew().controls,children:[(0,n.jsxs)("div",{className:ew().timeline,children:[(0,n.jsx)("input",{type:"range",min:0,max:Math.max(0,t.length-1),value:o,onChange:e=>m(parseInt(e.target.value)),className:ew().timelineSlider}),(0,n.jsx)("div",{className:ew().frameMarkers,children:t.map((e,t)=>(0,n.jsx)("div",{className:"".concat(ew().frameMarker," ").concat(e.image?ew().hasImage:ew().textOnly," ").concat(t===o?ew().active:""),onClick:()=>m(t),title:"Frame ".concat(t+1,": ").concat(e.text.slice(0,50),"...")},t))})]}),(0,n.jsxs)("div",{className:ew().controlButtons,children:[(0,n.jsx)("button",{onClick:()=>{o>0&&(r(o-1),h(!1),i(!1))},disabled:0===o,title:"Previous frame",className:ew().controlButton,children:(0,n.jsx)(ep.F,{size:16})}),(0,n.jsx)("button",{onClick:()=>{i(!c),h(!1)},disabled:t.length<=1,title:c?"Pause":"Play",className:ew().controlButton,children:c?(0,n.jsx)(G.d,{size:16}):(0,n.jsx)(ex.s,{size:16})}),(0,n.jsx)("button",{onClick:()=>{o<t.length-1&&(r(o+1),h(!1),i(!1))},disabled:o===t.length-1,title:"Next frame",className:ew().controlButton,children:(0,n.jsx)(ev.N,{size:16})}),(0,n.jsx)("button",{onClick:()=>{h(!0),r(t.length-1),i(!1)},className:"".concat(ew().controlButton," ").concat(d?ew().active:""),title:"Auto-track latest",children:"Live"})]}),(0,n.jsx)("div",{className:ew().frameInfo,children:(0,n.jsxs)("span",{children:[o+1," / ",t.length]})})]})]}):null}var eb=a(3894),eC=a(20461),eN=a(77168),e_=a(15483),eM=a(81103),ek=e=>{let{name:t,avatar:a,link:s,description:o}=e;return(0,n.jsx)("div",{className:"relative group flex",children:(0,n.jsx)(eM.pn,{children:(0,n.jsxs)(eM.u,{delayDuration:0,children:[(0,n.jsx)(eM.aJ,{asChild:!0,children:(0,n.jsxs)(ei.z,{variant:"ghost",className:"flex items-center justify-center",children:[a,(0,n.jsx)("div",{children:t})]})}),(0,n.jsx)(eM._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)(v.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 eT(e){let[t,a]=(0,l.useState)(e.completed),[s,i]=(0,l.useState)([]);return(0,l.useEffect)(()=>{e.completed&&a(!0)},[e.completed]),(0,l.useEffect)(()=>{if(!e.trainOfThought||0===e.trainOfThought.length){i([]);return}i(function(e){if(!e)return[];let t=[],a=[],n=[];return e.forEach((e,s)=>{let o=e.data,l=!1;try{let e=o.match(/\{.*(\"action\": \"screenshot\"|\"type\": \"screenshot\"|\"image\": \"data:image\/.*\").*\}/);if(e){let r=JSON.parse(e[0]);r.image&&(l=!0,o=o.replace(":\n**Action**: ".concat(e[0]),""),r.text&&(o+="\n\n".concat(r.text)),n.length>0&&(t.push({type:"text",textEntries:[...n]}),n=[]),a.push({text:o,image:r.image,timestamp:s}))}}catch(e){console.error("Failed to parse screenshot data",e)}l||(a.length>0&&(t.push({type:"video",frames:[...a]}),a=[]),n.push(e))}),a.length>0&&t.push({type:"video",frames:a}),n.length>0&&t.push({type:"text",textEntries:n}),t}("string"==typeof e.trainOfThought[0]?e.trainOfThought.map((e,t)=>({type:"text",data:e})):e.trainOfThought))},[e.trainOfThought]),(0,n.jsxs)("div",{className:"".concat(t?"":o().trainOfThought+" border"," rounded-lg"),children:[!e.completed&&(0,n.jsx)(K.l,{className:"float-right"}),e.completed&&(t?(0,n.jsxs)(ei.z,{className:"w-fit text-left justify-start content-start text-xs",onClick:()=>a(!1),variant:"ghost",size:"sm",children:["Thought Process ",(0,n.jsx)(eb.p,{size:16,className:"ml-1"})]}):(0,n.jsxs)(ei.z,{className:"w-fit text-left justify-start content-start text-xs p-0 h-fit",onClick:()=>a(!0),variant:"ghost",size:"sm",children:["Close ",(0,n.jsx)(eC.U,{size:16,className:"ml-1"})]})),(0,n.jsx)(r.M,{initial:!1,children:!t&&(0,n.jsx)(c.E.div,{initial:"closed",animate:"open",exit:"closed",variants:{open:{height:"auto",opacity:1,transition:{duration:.3,ease:"easeOut"}},closed:{height:0,opacity:0,transition:{duration:.3,ease:"easeIn"}}},children:s.map((t,a)=>(0,n.jsxs)("div",{children:["video"===t.type&&t.frames&&t.frames.length>0&&(0,n.jsx)(ey,{frames:t.frames,autoPlay:!1,playbackSpeed:1500}),"text"===t.type&&t.textEntries&&t.textEntries.map((o,l)=>{let r=s.length-1,c=l===t.textEntries.length-1,i=a===r&&c&&e.lastMessage&&!e.completed;return(0,n.jsx)(em,{message:o.data,primary:i,agentColor:e.agentColor},"train-text-".concat(a,"-").concat(l,"-").concat(o.data.length))})]},"train-group-".concat(a)))})})]},e.keyId)}function eO(e){var t,a,s,r,c,i,d,h,u;let[g,m]=(0,l.useState)(null),[f,p]=(0,l.useState)(0),[x,v]=(0,l.useState)(!0),[j,w]=(0,l.useState)(null),y=(0,l.useRef)(null),b=(0,l.useRef)(null),N=(0,l.useRef)(null),_=(0,l.useRef)(null),M=(0,l.useRef)(null),[k,T]=(0,l.useState)(null),[O,E]=(0,l.useState)(!1),[I,R]=(0,l.useState)(!0),S=(0,es.IC)(),F="[data-radix-scroll-area-viewport]",L=localStorage.getItem("message");(0,l.useEffect)(()=>{var e;let t=null===(e=b.current)||void 0===e?void 0:e.querySelector(F);if(!t)return;let a=()=>{let{scrollTop:e,scrollHeight:a,clientHeight:n}=t;R(a-(e+n)<=50)};return t.addEventListener("scroll",a),a(),()=>t.removeEventListener("scroll",a)},[b]),(0,l.useEffect)(()=>{e.incomingMessages&&e.incomingMessages.length>0&&I&&B(!0)},[e.incomingMessages,I]),(0,l.useEffect)(()=>{var t;let a=N.current,n=null===(t=b.current)||void 0===t?void 0:t.querySelector(F);if(!a||!n)return;let s=new ResizeObserver(()=>{let{scrollTop:t,scrollHeight:a,clientHeight:s}=n;if(a-(t+s)<=50&&e.incomingMessages&&e.incomingMessages.length>0){let t=e.incomingMessages[e.incomingMessages.length-1];(!t.completed||t.completed&&null!==k)&&B(!0)}});return s.observe(a),()=>s.disconnect()},[e.incomingMessages,k,b]),(0,l.useEffect)(()=>{g&&g.chat&&g.chat.length>0&&f<2&&requestAnimationFrame(()=>{var e;null===(e=_.current)||void 0===e||e.scrollIntoView({behavior:"auto",block:"start"})})},[g,f]),(0,l.useEffect)(()=>{if(!x||O)return;let t=new IntersectionObserver(t=>{t[0].isIntersecting&&x&&(E(!0),function(t){if(!x||O)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=>{var n;if(e.setTitle(a.response.slug),e.setIsOwner&&e.setIsOwner(null==a?void 0:null===(n=a.response)||void 0===n?void 0:n.is_owner),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==g?void 0:g.chat.length)){v(!1),E(!1);return}e.setAgent(a.response.agent),m(a.response),E(!1),0===t?B(!0):D()}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,is_owner:a.response.is_owner};e.setAgent(a.response.agent),m(t),e.setIsChatSideBarOpen&&!L&&e.setIsChatSideBarOpen(!0)}v(!1),E(!1)}}).catch(e=>{console.error(e),window.location.href="/"})}(f))},{threshold:1});return y.current&&t.observe(y.current),()=>t.disconnect()},[x,f,O]),(0,l.useEffect)(()=>{v(!0),E(!1),p(0),m(null)},[e.conversationId]),(0,l.useEffect)(()=>{if(e.incomingMessages){let t=e.incomingMessages[e.incomingMessages.length-1];t&&!t.completed&&(T(e.incomingMessages.length-1),e.setTitle(t.rawQuery),t.turnId&&w(t.turnId))}},[e.incomingMessages]);let D=()=>{var e;let t=null===(e=b.current)||void 0===e?void 0:e.querySelector(F);requestAnimationFrame(()=>{var e;null===(e=M.current)||void 0===e||e.scrollIntoView({behavior:"auto",block:"start"}),null==t||t.scrollBy({behavior:"smooth",top:-150})})},B=function(){var e;let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=null===(e=b.current)||void 0===e?void 0:e.querySelector(F);requestAnimationFrame(()=>{null==a||a.scrollTo({top:a.scrollHeight,behavior:t?"auto":"smooth"})}),(t||a&&a.scrollHeight-(a.scrollTop+a.clientHeight)<5)&&R(!0)},P=t=>{t&&(m(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)(eo.x,{className:"\n h-[calc(100svh-theme(spacing.44))]\n sm:h-[calc(100svh-theme(spacing.44))]\n md:h-[calc(100svh-theme(spacing.44))]\n lg:h-[calc(100svh-theme(spacing.72))]\n ",ref:b,children:(0,n.jsxs)("div",{ref:N,children:[(0,n.jsxs)("div",{className:"".concat(o().chatHistory," ").concat(e.customClassName),children:[(0,n.jsx)("div",{ref:y,style:{height:"1px"},children:O&&(0,n.jsx)(K.l,{className:"opacity-50"})}),g&&g.chat&&g.chat.map((t,a)=>{var s,o;return(0,n.jsxs)(l.Fragment,{children:[t.trainOfThought&&"khoj"===t.by&&(0,n.jsx)(eT,{trainOfThought:t.trainOfThought,lastMessage:!1,agentColor:(null==g?void 0:null===(s=g.agent)||void 0===s?void 0:s.color)||"orange",keyId:"".concat(a,"trainOfThought"),completed:!0},"".concat(a,"trainOfThought")),(0,n.jsx)(ef,{ref:a===g.chat.length-2?_:a===g.chat.length-(f-1)*10?M:null,isMobileWidth:S,chatMessage:t,customClassName:"fullHistory",borderLeftColor:"".concat(null==g?void 0:null===(o=g.agent)||void 0===o?void 0:o.color,"-500"),isLastMessage:a===g.chat.length-1,onDeleteMessage:P,conversationId:e.conversationId},"".concat(a,"fullHistory"))]},"chatMessage-".concat(a))}),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:S,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==g?void 0:null===(s=g.agent)||void 0===s?void 0:s.color,"-500"),onDeleteMessage:P,conversationId:e.conversationId,turnId:d},"".concat(a,"outgoing")),t.trainOfThought&&t.trainOfThought.length>0&&(0,n.jsx)(eT,{trainOfThought:t.trainOfThought,lastMessage:a===k,agentColor:(null==g?void 0:null===(o=g.agent)||void 0===o?void 0:o.color)||"orange",keyId:"".concat(a,"trainOfThought"),completed:t.completed},"".concat(a,"trainOfThought-").concat(t.trainOfThought.length,"-").concat(t.trainOfThought.map(e=>e.length).join("-"))),(0,n.jsx)(ef,{isMobileWidth:S,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,images:t.generatedImages,queryFiles:t.generatedFiles,mermaidjsDiagram:t.generatedMermaidjsDiagram,turnId:d},conversationId:e.conversationId,turnId:d,onDeleteMessage:P,customClassName:"fullHistory",borderLeftColor:"".concat(null==g?void 0:null===(r=g.agent)||void 0===r?void 0:r.color,"-500"),isLastMessage:a===e.incomingMessages.length-1},"".concat(a,"incoming"))]},"incomingMessage".concat(a))}),e.pendingMessage&&(0,n.jsx)(ef,{isMobileWidth:S,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:P,customClassName:"fullHistory",borderLeftColor:"".concat(null==g?void 0:null===(t=g.agent)||void 0===t?void 0:t.color,"-500"),isLastMessage:!0},"pendingMessage-".concat(e.pendingMessage.length)),g&&(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)(ek,{name:g&&g.agent&&(null===(r=g.agent)||void 0===r?void 0:r.name)?g.agent.is_hidden?"Khoj":null===(c=g.agent)||void 0===c?void 0:c.name:"Agent",link:g&&g.agent&&(null===(i=g.agent)||void 0===i?void 0:i.slug)?"/agents?agent=".concat(null===(d=g.agent)||void 0===d?void 0:d.slug):"/agents",avatar:(0,C.TI)(null===(a=g.agent)||void 0===a?void 0:a.icon,null===(s=g.agent)||void 0===s?void 0:s.color)||(0,n.jsx)(eN.v,{}),description:g&&g.agent?(null===(h=g.agent)||void 0===h?void 0:h.persona)?null===(u=g.agent)||void 0===u?void 0:u.persona:"You can set a persona for your agent in the Chat Options side panel.":"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:()=>{B()},children:(0,n.jsx)(e_.K,{size:24})})})]})}):null}},42501:function(e){e.exports={chatHistory:"chatHistory_chatHistory__CoaVT",agentIndicator:"chatHistory_agentIndicator__wOU1f",trainOfThought:"chatHistory_trainOfThought__mMWSR"}},91499: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"}},44849:function(e){e.exports={videoPlayer:"trainOfThoughtVideoPlayer_videoPlayer__Dz3mA",screen:"trainOfThoughtVideoPlayer_screen__dvEVh",screenImage:"trainOfThoughtVideoPlayer_screenImage__3SgOQ",textOverlay:"trainOfThoughtVideoPlayer_textOverlay__BGbhO",thoughtText:"trainOfThoughtVideoPlayer_thoughtText__zn_vT",controls:"trainOfThoughtVideoPlayer_controls__HDkO_",timeline:"trainOfThoughtVideoPlayer_timeline__hSpWu",timelineSlider:"trainOfThoughtVideoPlayer_timelineSlider__GQ8dx",frameMarkers:"trainOfThoughtVideoPlayer_frameMarkers__5y3He",frameMarker:"trainOfThoughtVideoPlayer_frameMarker__DBO9Y",hasImage:"trainOfThoughtVideoPlayer_hasImage__GFGAk",textOnly:"trainOfThoughtVideoPlayer_textOnly__okufk",active:"trainOfThoughtVideoPlayer_active__zp6u9",controlButtons:"trainOfThoughtVideoPlayer_controlButtons__rqfIH",controlButton:"trainOfThoughtVideoPlayer_controlButton___RdE_",frameInfo:"trainOfThoughtVideoPlayer_frameInfo__u5nwA"}}}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4371],{2743:function(e,t,a){Promise.resolve().then(a.bind(a,77837))},77837:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return eg}});var s=a(57437),n=a(17200),r=a(14308),o=a(66070),i=a(62869),l=a(53647),c=a(47107),d=a.n(c),u=a(13590),m=a(29501),h=a(31229),x=a(2265),f=a(15681),p=a(95186),g=a(26110),j=a(49027),y=a(76818),w=a(7436),v=a(30190),N=a.n(v),b=a(97673),k=a(99376),D=a(57054),S=a(41317),C=a(87332),_=a(19841),M=a(3634),I=a(97822),A=a(93435),T=a(27484),R=a(39353),z=a(66594),P=a(12443),L=a(89203),O=a(78527),W=a(56937),q=a(39535),E=a(77992),U=a(89534),V=a(65613),F=a(17814),B=a(60729),G=a(34124),Z=a(6512),J=a(37104);let Q=()=>window.fetch("/api/automations").then(e=>e.json()).catch(e=>console.log(e));function X(e){let t=e.split(" "),a=t[2],s=t[4];return"*"===a&&"*"===s?"Day":"*"!==s?"Week":"*"!==a?"Month":"Day"}function H(e){let t=e.split(" ");if("*"===t[3]&&"*"!==t[4])return Number(t[4])}function Y(e){let t=e.split(" "),a=t[1],s=t[0],n=Number(a)>=12?"PM":"AM",r=Number(a)>12?Number(a)-12:a;"00"===r&&(r="12");let o=s;return 10>Number(o)&&"00"!==o&&(o="0".concat(o)),"".concat(r,":").concat(o," ").concat(n)}function $(e){return String(e.split(" ")[2])}function K(e){return d().toString(e)}let ee=["Day","Week","Month"],et=Array.from({length:31},(e,t)=>String(t+1)),ea=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],es=[],en=["AM","PM"];for(var er=0;er<en.length;er++)for(var eo=0;eo<12;eo++)for(var ei=0;ei<60;ei+=15){let e=String(ei).padStart(2,"0"),t=0===eo?12:eo;es.push("".concat(t,":").concat(e," ").concat(en[er]))}let el=Date.now(),ec=[{subject:"Weekly Newsletter",scheduling_request:"/research Compile a message including: 1. A recap of news from last week 2. An at-home workout I can do before work 3. A quote to inspire me for the week ahead",schedule:"9AM every Monday",next:"Next run at 9AM on Monday",crontime:"0 9 * * 1",id:el,query_to_run:""},{subject:"Front Page of Hacker News",scheduling_request:"/research Summarize the top 5 posts from https://news.ycombinator.com/best and share them with me, including links",schedule:"9PM on every Wednesday",next:"Next run at 9PM on Wednesday",crontime:"0 21 * * 3",id:el+2,query_to_run:""},{subject:"Market Summary",scheduling_request:"/research Get the market summary for today and share it with me. Focus on tech stocks and the S&P 500.",schedule:"9AM on every weekday",next:"Next run at 9AM on Monday",crontime:"0 9 * * *",id:el+3,query_to_run:""},{subject:"Market Crash Notification",scheduling_request:"Notify me if the stock market fell by more than 5% today.",schedule:"5PM every evening",next:"Next run at 5PM today",crontime:"0 17 * * *",id:el+5,query_to_run:""},{subject:"Round-up of research papers about AI in healthcare",scheduling_request:"/research Summarize the top 3 research papers about AI in healthcare that were published in the last week. Include links to the full papers.",schedule:"9AM every Friday",next:"Next run at 9AM on Friday",crontime:"0 9 * * 5",id:el+4,query_to_run:""},{subject:"Daily Bedtime Story",scheduling_request:"Compose a bedtime story that a five-year-old might enjoy. It should not exceed five paragraphs. Appeal to the imagination, but weave in learnings.",schedule:"9PM every night",next:"Next run at 9PM today",crontime:"0 21 * * *",id:el+1,query_to_run:""}];function ed(e){let t=encodeURIComponent(e.subject),a=encodeURIComponent(e.scheduling_request),s=encodeURIComponent(e.crontime);return"".concat(window.location.origin,"/automations?subject=").concat(t,"&query=").concat(a,"&crontime=").concat(s)}function eu(e){let[t,a]=(0,x.useState)(!1),[n,r]=(0,x.useState)(null),[l,c]=(0,x.useState)(!1),d=e.automation,[u,m]=(0,x.useState)(""),[h,f]=(0,x.useState)("");return((0,x.useEffect)(()=>{let e=n||d;m(Y(e.crontime));let t=X(e.crontime);if("Day"===t)f("Daily");else if("Week"===t){let t=H(e.crontime);void 0===t?f("Weekly"):f("".concat(ea[t]))}else if("Month"===t){let t=$(e.crontime);f("Monthly on the ".concat(t))}},[n,d]),l)?null:(0,s.jsxs)(o.Zb,{className:"h-full shadow-md rounded-lg dark:bg-muted ".concat(N().automationCard),children:[(0,s.jsx)(o.Ol,{children:(0,s.jsxs)(o.ll,{className:"line-clamp-2 leading-normal flex justify-between",children:[(null==n?void 0:n.subject)||d.subject,(0,s.jsxs)(D.J2,{children:[(0,s.jsx)(D.xo,{asChild:!0,children:(0,s.jsx)(i.z,{className:"bg-background",variant:"ghost",children:(0,s.jsx)(S.F,{className:"h-4 w-4"})})}),(0,s.jsxs)(D.yk,{className:"w-auto grid gap-2 text-left bg-secondary",children:[!e.suggestedCard&&e.locationData&&(0,s.jsx)(ep,{isMobileWidth:e.isMobileWidth,callToAction:"Edit",createNew:!1,setIsCreating:a,setShowLoginPrompt:e.setShowLoginPrompt,setNewAutomationData:r,authenticatedData:e.authenticatedData,isCreating:t,automation:n||d,ipLocationData:e.locationData,setToastMessage:e.setToastMessage}),(0,s.jsx)(b.Z,{buttonTitle:"Share",includeIcon:!0,buttonClassName:"justify-start px-4 py-2 h-10",buttonVariant:"outline",title:"Share Automation",description:"Copy the link below and share it with your coworkers or friends.",url:ed(d),onShare:()=>{navigator.clipboard.writeText(ed(d))}}),!e.suggestedCard&&(0,s.jsxs)(i.z,{variant:"outline",className:"justify-start",onClick:()=>{!function(e,t){fetch("/api/trigger/automation?automation_id=".concat(e),{method:"POST"}).then(e=>{if(!e.ok)throw Error("Network response was not ok");return e}).then(e=>{t("Automation triggered. Check your inbox in a few minutes!")}).catch(e=>{t("Sorry, something went wrong. Try again later.")})}(d.id.toString(),e.setToastMessage)},children:[(0,s.jsx)(C.s,{className:"h-4 w-4 mr-2"}),"Run Now"]}),(0,s.jsxs)(i.z,{variant:"destructive",className:"justify-start",onClick:()=>{if(e.suggestedCard){c(!0);return}!function(e,t){fetch("/api/automation?automation_id=".concat(e),{method:"DELETE"}).then(e=>e.json()).then(e=>{t(!0)})}(d.id.toString(),c)},children:[(0,s.jsx)(_.r,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]})}),(0,s.jsx)(o.aY,{className:"text-secondary-foreground break-all",children:(null==n?void 0:n.scheduling_request)||d.scheduling_request}),(0,s.jsxs)(o.eW,{className:"flex flex-col items-start md:flex-row md:justify-between md:items-center gap-2",children:[(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsxs)("div",{className:"flex items-center rounded-lg p-1.5 border-blue-200 border dark:border-blue-500",children:[(0,s.jsx)(M.T,{className:"h-4 w-4 mr-2 text-blue-700 dark:text-blue-300"}),(0,s.jsx)("div",{className:"text-s text-blue-700 dark:text-blue-300",children:u})]}),(0,s.jsxs)("div",{className:"flex items-center rounded-lg p-1.5 border-purple-200 border dark:border-purple-500",children:[(0,s.jsx)(I.u,{className:"h-4 w-4 mr-2 text-purple-700 dark:text-purple-300"}),(0,s.jsx)("div",{className:"text-s text-purple-700 dark:text-purple-300",children:h})]})]}),e.suggestedCard&&e.setNewAutomationData&&(0,s.jsx)(ep,{isMobileWidth:e.isMobileWidth,callToAction:"Add",createNew:!0,setIsCreating:a,setShowLoginPrompt:e.setShowLoginPrompt,setNewAutomationData:e.setNewAutomationData,authenticatedData:e.authenticatedData,isCreating:t,automation:d,ipLocationData:e.locationData,setToastMessage:e.setToastMessage})]})]})}function em(e){let t=(0,k.useSearchParams)(),[a,n]=(0,x.useState)(!0),r=t.get("subject"),o=t.get("query"),i=t.get("crontime");if(!r||!o||!i)return null;let l={id:0,subject:decodeURIComponent(r),scheduling_request:decodeURIComponent(o),query_to_run:"",schedule:K(decodeURIComponent(i)),crontime:decodeURIComponent(i),next:""};return a?(0,s.jsx)(ep,{isMobileWidth:e.isMobileWidth,callToAction:"Shared",createNew:!0,setIsCreating:n,setShowLoginPrompt:e.setShowLoginPrompt,setNewAutomationData:e.setNewAutomationData,authenticatedData:e.authenticatedData,isCreating:a,automation:l,ipLocationData:e.locationData,setToastMessage:e.setToastMessage}):null}let eh=h.z.object({subject:h.z.optional(h.z.string()),everyBlah:h.z.string({required_error:"Every is required"}),dayOfWeek:h.z.optional(h.z.number()),dayOfMonth:h.z.optional(h.z.string()),timeRecurrence:h.z.string({required_error:"Time Recurrence is required"}),schedulingRequest:h.z.string({required_error:"Query to Run is required"})});function ex(e){let t=e.automation,a=(0,m.cI)({resolver:(0,u.F)(eh),defaultValues:{subject:null==t?void 0:t.subject,everyBlah:(null==t?void 0:t.crontime)?X(t.crontime):"Day",dayOfWeek:(null==t?void 0:t.crontime)?H(t.crontime):void 0,timeRecurrence:(null==t?void 0:t.crontime)?Y(t.crontime):"12:00 PM",dayOfMonth:(null==t?void 0:t.crontime)?$(t.crontime):"1",schedulingRequest:null==t?void 0:t.scheduling_request}});return(0,s.jsx)(ef,{authenticatedData:e.authenticatedData,locationData:e.locationData||null,form:a,onSubmit:a=>{let s=function(e,t,a,s){let n="",r=t.split(":")[1].split(" ")[0],o=t.split(":")[1].split(" ")[1],i=Number(t.split(":")[0]),l="PM"===o&&i<12?String(i+12):i;switch(e){case"Day":n="".concat(r," ").concat(l," * * *");break;case"Week":n="".concat(r," ").concat(l," * * ").concat(void 0!==a?7===a?0:a:"*");break;case"Month":n="".concat(r," ").concat(l," ").concat(s," * *")}return n}(a.everyBlah,a.timeRecurrence,a.dayOfWeek,a.dayOfMonth),n="/api/automation?";n+="q=".concat(encodeURIComponent(a.schedulingRequest)),(null==t?void 0:t.id)&&!e.createNew&&(n+="&automation_id=".concat(encodeURIComponent(t.id))),a.subject&&(n+="&subject=".concat(encodeURIComponent(a.subject))),n+="&crontime=".concat(encodeURIComponent(s)),e.locationData&&e.locationData.city&&(n+="&city=".concat(encodeURIComponent(e.locationData.city))),e.locationData&&e.locationData.region&&(n+="&region=".concat(encodeURIComponent(e.locationData.region))),e.locationData&&e.locationData.country&&(n+="&country=".concat(encodeURIComponent(e.locationData.country))),e.locationData&&e.locationData.timezone&&(n+="&timezone=".concat(encodeURIComponent(e.locationData.timezone))),fetch(n,{method:e.createNew?"POST":"PUT"}).then(e=>e.json()).then(t=>{e.setIsEditing(!1),e.setUpdatedAutomationData({id:t.id,subject:t.subject||"",query_to_run:t.query_to_run,scheduling_request:t.scheduling_request,schedule:K(t.crontime),crontime:t.crontime,next:t.next})}).catch(t=>{console.error("Error saving automation:",t),e.setIsEditing(!1),e.setToastMessage("Sorry, something went wrong. Try again or contact team@khoj.dev.")})},create:e.createNew,isLoggedIn:e.isLoggedIn,setShowLoginPrompt:e.setShowLoginPrompt})}function ef(e){var t,a;let[n,r]=(0,x.useState)(!1),{errors:o}=e.form.formState,c=["Make a picture of","Generate a summary of","Create a newsletter of","Notify me when"];return(0,s.jsx)(f.l0,{...e.form,children:(0,s.jsxs)("form",{onSubmit:e.form.handleSubmit(t=>{e.onSubmit(t),r(!0)}),className:"space-y-6",children:[(0,s.jsx)(f.xJ,{className:"space-y-1",children:(0,s.jsxs)(f.pf,{children:["Emails will be sent to this address. Timezone and location data will be used to schedule automations.",e.locationData&&(t=e.locationData,a=e.authenticatedData,(0,s.jsxs)("div",{className:"flex flex-wrap gap-2 items-center justify-start",children:[a?(0,s.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm dark:bg-muted",children:[(0,s.jsx)(R.w,{className:"h-4 w-4 mr-2 inline text-orange-500 shadow-sm"}),a.email]}):null,t&&(0,s.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm dark:bg-muted",children:[(0,s.jsx)(z.x,{className:"h-4 w-4 mr-2 inline text-purple-500"}),t?"".concat(t.city,", ").concat(t.country):"Unknown"]}),t&&(0,s.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm dark:bg-muted",children:[(0,s.jsx)(P.S,{className:"h-4 w-4 mr-2 inline text-green-500"}),t?"".concat(t.timezone):"Unknown"]})]}))]})}),!e.create&&(0,s.jsx)(f.Wi,{control:e.form.control,name:"subject",render:e=>{var t;let{field:a}=e;return(0,s.jsxs)(f.xJ,{className:"space-y-1",children:[(0,s.jsx)(f.lX,{children:"Subject"}),(0,s.jsx)(f.pf,{children:"This is the subject of the email you will receive."}),(0,s.jsx)(f.NI,{children:(0,s.jsx)(p.I,{placeholder:"Digest of Healthcare AI trends",...a})}),(0,s.jsx)(f.zG,{}),o.subject&&(0,s.jsx)(f.zG,{children:null===(t=o.subject)||void 0===t?void 0:t.message})]})}}),(0,s.jsx)(f.Wi,{control:e.form.control,name:"everyBlah",render:e=>{var t;let{field:a}=e;return(0,s.jsxs)(f.xJ,{className:"w-full space-y-1",children:[(0,s.jsx)(f.lX,{children:"Frequency"}),(0,s.jsx)(f.pf,{children:"How often should this automation run?"}),(0,s.jsxs)(l.Ph,{onValueChange:a.onChange,defaultValue:a.value,children:[(0,s.jsx)(f.NI,{children:(0,s.jsxs)(l.i4,{className:"w-[200px]",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(A.W,{className:"h-4 w-4 mr-2 inline"}),"Every"]}),(0,s.jsx)(l.ki,{placeholder:""})]})}),(0,s.jsx)(l.Bw,{children:ee.map(e=>(0,s.jsx)(l.Ql,{value:e,children:e},e))})]}),(0,s.jsx)(f.zG,{}),o.subject&&(0,s.jsx)(f.zG,{children:null===(t=o.everyBlah)||void 0===t?void 0:t.message})]})}}),"Week"===e.form.watch("everyBlah")&&(0,s.jsx)(f.Wi,{control:e.form.control,name:"dayOfWeek",render:e=>{var t;let{field:a}=e;return(0,s.jsxs)(f.xJ,{className:"w-full space-y-1",children:[(0,s.jsx)(f.pf,{children:"Every week, on which day should this automation run?"}),(0,s.jsxs)(l.Ph,{onValueChange:e=>a.onChange(Number(e)),defaultValue:String(a.value),children:[(0,s.jsx)(f.NI,{children:(0,s.jsxs)(l.i4,{className:"w-[200px]",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(T.n,{className:"h-4 w-4 mr-2 inline"}),"On"]}),(0,s.jsx)(l.ki,{placeholder:""})]})}),(0,s.jsx)(l.Bw,{children:ea.map((e,t)=>(0,s.jsx)(l.Ql,{value:String(t),children:e},e))})]}),(0,s.jsx)(f.zG,{}),o.subject&&(0,s.jsx)(f.zG,{children:null===(t=o.dayOfWeek)||void 0===t?void 0:t.message})]})}}),"Month"===e.form.watch("everyBlah")&&(0,s.jsx)(f.Wi,{control:e.form.control,name:"dayOfMonth",render:e=>{var t;let{field:a}=e;return(0,s.jsxs)(f.xJ,{className:"w-full space-y-1",children:[(0,s.jsx)(f.pf,{children:"Every month, on which day should the automation run?"}),(0,s.jsxs)(l.Ph,{onValueChange:a.onChange,defaultValue:a.value,children:[(0,s.jsx)(f.NI,{children:(0,s.jsxs)(l.i4,{className:"w-[200px]",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(T.n,{className:"h-4 w-4 mr-2 inline"}),"On the"]}),(0,s.jsx)(l.ki,{placeholder:""})]})}),(0,s.jsx)(l.Bw,{children:et.map(e=>(0,s.jsx)(l.Ql,{value:e,children:e},e))})]}),(0,s.jsx)(f.zG,{}),o.subject&&(0,s.jsx)(f.zG,{children:null===(t=o.dayOfMonth)||void 0===t?void 0:t.message})]})}}),("Day"===e.form.watch("everyBlah")||"Week"==e.form.watch("everyBlah")||"Month"==e.form.watch("everyBlah"))&&(0,s.jsx)(f.Wi,{control:e.form.control,name:"timeRecurrence",render:e=>{var t;let{field:a}=e;return(0,s.jsxs)(f.xJ,{className:"w-full space-y-1",children:[(0,s.jsx)(f.lX,{children:"Time"}),(0,s.jsx)(f.pf,{children:"On the days this automation runs, at what time should it run?"}),(0,s.jsxs)(l.Ph,{onValueChange:a.onChange,defaultValue:a.value,children:[(0,s.jsx)(f.NI,{children:(0,s.jsxs)(l.i4,{className:"w-[200px]",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(I.u,{className:"h-4 w-4 mr-2 inline"}),"At"]}),(0,s.jsx)(l.ki,{placeholder:""})]})}),(0,s.jsx)(l.Bw,{children:es.map(e=>(0,s.jsx)(l.Ql,{value:e,children:e},e))})]}),(0,s.jsx)(f.zG,{}),o.subject&&(0,s.jsx)(f.zG,{children:null===(t=o.timeRecurrence)||void 0===t?void 0:t.message})]})}}),(0,s.jsx)(f.Wi,{control:e.form.control,name:"schedulingRequest",render:t=>{var a;let{field:n}=t;return(0,s.jsxs)(f.xJ,{className:"space-y-1",children:[(0,s.jsx)(f.lX,{children:"Instructions"}),(0,s.jsx)(f.pf,{children:"What do you want Khoj to do?"}),e.create&&(0,s.jsx)("div",{children:c.map(e=>{var t;return t=n.onChange,(0,s.jsxs)(i.z,{className:"text-xs bg-slate-50 dark:bg-slate-950 h-auto p-1.5 m-1 rounded-full",variant:"ghost",onClick:a=>{a.preventDefault(),t({target:{value:e}},a)},children:[e,"..."]},e)})}),(0,s.jsx)(f.NI,{children:(0,s.jsx)(y.g,{placeholder:"Create a summary of the latest news about AI in healthcare.",value:n.value,onChange:n.onChange})}),(0,s.jsx)(f.zG,{}),o.subject&&(0,s.jsx)(f.zG,{children:null===(a=o.schedulingRequest)||void 0===a?void 0:a.message})]})}}),(0,s.jsx)("fieldset",{disabled:n,children:e.isLoggedIn?n?(0,s.jsx)(i.z,{type:"submit",disabled:!0,children:"Saving..."}):(0,s.jsx)(i.z,{type:"submit",children:"Save"}):(0,s.jsx)(i.z,{onClick:t=>{t.preventDefault(),e.setShowLoginPrompt(!0)},variant:"default",children:"Login to Save"})})]})})}function ep(e){return e.isMobileWidth?(0,s.jsxs)(F.dy,{open:e.isCreating,onOpenChange:t=>{e.setIsCreating(t)},children:[(0,s.jsx)(F.Qz,{asChild:!0,children:(0,s.jsxs)(i.z,{className:"shadow-sm justify-start",variant:"outline",children:[(0,s.jsx)(L.v,{className:"h-4 w-4 mr-2"}),e.callToAction]})}),(0,s.jsxs)(F.sc,{className:"p-2",children:[(0,s.jsx)(F.iI,{children:"Automation"}),(0,s.jsx)(ex,{createNew:e.createNew,automation:e.automation,setIsEditing:e.setIsCreating,isLoggedIn:!!e.authenticatedData,authenticatedData:e.authenticatedData,setShowLoginPrompt:e.setShowLoginPrompt,setUpdatedAutomationData:e.setNewAutomationData,locationData:e.ipLocationData,setToastMessage:e.setToastMessage})]})]}):(0,s.jsxs)(g.Vq,{open:e.isCreating,onOpenChange:t=>{e.setIsCreating(t)},children:[(0,s.jsx)(g.hg,{asChild:!0,children:(0,s.jsxs)(i.z,{className:"shadow-sm justify-start",variant:"outline",children:[(0,s.jsx)(L.v,{className:"h-4 w-4 mr-2"}),e.callToAction]})}),(0,s.jsxs)(g.cZ,{className:"max-h-[98vh] overflow-y-auto",children:[(0,s.jsx)(j.$N,{children:"Automation"}),(0,s.jsx)(ex,{automation:e.automation,createNew:e.createNew,setIsEditing:e.setIsCreating,isLoggedIn:!!e.authenticatedData,authenticatedData:e.authenticatedData,setShowLoginPrompt:e.setShowLoginPrompt,setUpdatedAutomationData:e.setNewAutomationData,locationData:e.ipLocationData,setToastMessage:e.setToastMessage})]})]})}function eg(){let{data:e,error:t,isLoading:a}=(0,W.GW)(),{data:o,error:l,isLoading:c}=(0,n.ZP)(e?"automations":null,Q,{revalidateOnFocus:!1}),[d,u]=(0,x.useState)(!1),[m,h]=(0,x.useState)(null),[f,p]=(0,x.useState)([]),[g,j]=(0,x.useState)([]),[y,v]=(0,x.useState)(!1),b=(0,w.IC)(),{locationData:k,locationDataError:D,locationDataLoading:S}=(0,w.k6)(),[C,_]=(0,x.useState)(""),{toast:M}=(0,E.pm)();return((0,x.useEffect)(()=>{m&&(p([...f,m]),h(null))},[m,f]),(0,x.useEffect)(()=>{let e=o?o.concat(f):f;e&&j(ec.filter(t=>void 0===e.find(e=>t.subject===e.subject)))},[o,f]),(0,x.useEffect)(()=>{C&&(M({title:"Automation",description:C,action:(0,s.jsx)(U.gD,{altText:"Dismiss",children:"Ok"}),variant:C.includes("Sorry")?"destructive":"default"}),_(""))},[C]),l)?(0,s.jsx)(r.l,{message:"Oops, something went wrong. Please refresh the page."}):(0,s.jsxs)(B.Hn,{children:[(0,s.jsx)(G.S,{conversationId:""}),(0,s.jsxs)(B.kV,{children:[(0,s.jsxs)("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:[(0,s.jsx)(B.vP,{className:"-ml-1"}),(0,s.jsx)(Z.Z,{orientation:"vertical",className:"mr-2 h-4"}),b?(0,s.jsx)("a",{className:"p-0 no-underline",href:"/",children:(0,s.jsx)(J.VO,{className:"h-auto w-16"})}):(0,s.jsx)("h2",{className:"text-lg",children:"Automations"})]}),(0,s.jsx)("main",{className:"w-full mx-auto",children:(0,s.jsx)("div",{className:"grid w-full mx-auto",children:(0,s.jsxs)("div",{className:"".concat(N().pageLayout," w-full"),children:[(0,s.jsxs)("div",{className:"pt-6 md:pt-8 grid gap-1 md:flex md:justify-between",children:[(0,s.jsx)("h1",{className:"text-3xl flex items-center",children:"Automations"}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2 items-center justify-start",children:[e?(0,s.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm dark:bg-muted",children:[(0,s.jsx)(R.w,{className:"h-4 w-4 mr-2 inline text-orange-500 shadow-sm"}),e.email]}):null,k&&(0,s.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm dark:bg-muted",children:[(0,s.jsx)(z.x,{className:"h-4 w-4 mr-2 inline text-purple-500"}),k?"".concat(k.city,", ").concat(k.country):"Unknown"]}),k&&(0,s.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm dark:bg-muted",children:[(0,s.jsx)(P.S,{className:"h-4 w-4 mr-2 inline text-green-500"}),k?"".concat(k.timezone):"Unknown"]})]})]}),y&&(0,s.jsx)(q.Z,{onOpenChange:v,isMobileWidth:b}),(0,s.jsx)(V.bZ,{className:"bg-secondary border-none my-4",children:(0,s.jsxs)(V.X,{children:[(0,s.jsx)(O.B,{weight:"fill",className:"h-4 w-4 text-purple-400 inline"}),(0,s.jsx)("span",{className:"font-bold",children:"How it works"})," Automations help you structure your time by automating tasks you do regularly. Build your own, or try out our presets. Get results straight to your inbox."]})}),(0,s.jsx)("div",{className:"flex justify-between items-center py-4",children:e?(0,s.jsx)(ep,{isMobileWidth:b,callToAction:"Create Automation",createNew:!0,setIsCreating:u,setShowLoginPrompt:v,setNewAutomationData:h,authenticatedData:e,isCreating:d,ipLocationData:k,setToastMessage:_}):(0,s.jsxs)(i.z,{className:"shadow-sm",onClick:()=>v(!0),variant:"outline",children:[(0,s.jsx)(L.v,{className:"h-4 w-4 mr-2"}),"Create Automation"]})}),(0,s.jsx)(x.Suspense,{children:(0,s.jsx)(em,{isMobileWidth:b,authenticatedData:e||null,locationData:k,isLoggedIn:!!e,setShowLoginPrompt:v,setNewAutomationData:h,setToastMessage:_})}),c&&(0,s.jsx)(r.l,{message:"booting up your automations"}),(0,s.jsxs)("div",{className:"".concat(N().automationsLayout),children:[e&&o&&o.map(t=>(0,s.jsx)(eu,{isMobileWidth:b,authenticatedData:e,automation:t,locationData:k,isLoggedIn:!!e,setShowLoginPrompt:v,setToastMessage:_},t.id)),e&&f.map(t=>(0,s.jsx)(eu,{isMobileWidth:b,authenticatedData:e,automation:t,locationData:k,isLoggedIn:!!e,setShowLoginPrompt:v,setToastMessage:_},t.id))]}),(0,s.jsx)("h3",{className:"text-xl py-4",children:"Explore"}),(0,s.jsx)("div",{className:"".concat(N().automationsLayout),children:g.map(t=>(0,s.jsx)(eu,{isMobileWidth:b,setNewAutomationData:h,authenticatedData:e||null,automation:t,locationData:k,isLoggedIn:!!e,setShowLoginPrompt:v,suggestedCard:!0,setToastMessage:_},t.id))})]})})})]})]})}},97673:function(e,t,a){"use strict";a.d(t,{Z:function(){return c}});var s=a(57437),n=a(26110),r=a(62869),o=a(95186),i=a(26815),l=a(92457);function c(e){var t;return(0,s.jsxs)(n.Vq,{children:[(0,s.jsx)(n.hg,{asChild:!0,onClick:e.onShare,children:(0,s.jsxs)(r.z,{size:"sm",className:"".concat(e.buttonClassName||"px-3"),variant:null!==(t=e.buttonVariant)&&void 0!==t?t:"default",children:[e.includeIcon&&(0,s.jsx)(l.m,{className:"w-4 h-4 mr-2"}),e.buttonTitle]})}),(0,s.jsxs)(n.cZ,{children:[(0,s.jsxs)(n.fK,{children:[(0,s.jsx)(n.$N,{children:e.title}),(0,s.jsx)(n.Be,{children:e.description})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsxs)("div",{className:"grid flex-1 gap-2",children:[(0,s.jsx)(i._,{htmlFor:"link",className:"sr-only",children:"Link"}),(0,s.jsx)(o.I,{id:"link",defaultValue:e.url,readOnly:!0})]}),(0,s.jsx)(r.z,{type:"submit",size:"sm",className:"px-3",onClick:()=>(function(e){let t=navigator.clipboard;t&&t.writeText(e)})(e.url),children:(0,s.jsx)("span",{children:"Copy"})})]})]})]})}},65613:function(e,t,a){"use strict";a.d(t,{X:function(){return c},bZ:function(){return l}});var s=a(57437),n=a(2265),r=a(90535),o=a(94508);let i=(0,r.j)("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),l=n.forwardRef((e,t)=>{let{className:a,variant:n,...r}=e;return(0,s.jsx)("div",{ref:t,role:"alert",className:(0,o.cn)(i({variant:n}),a),...r})});l.displayName="Alert",n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)("h5",{ref:t,className:(0,o.cn)("mb-1 font-medium leading-none tracking-tight",a),...n})}).displayName="AlertTitle";let c=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)("div",{ref:t,className:(0,o.cn)("text-sm [&_p]:leading-relaxed",a),...n})});c.displayName="AlertDescription"},15681:function(e,t,a){"use strict";a.d(t,{NI:function(){return p},Wi:function(){return u},l0:function(){return c},lX:function(){return f},pf:function(){return g},xJ:function(){return x},zG:function(){return j}});var s=a(57437),n=a(2265),r=a(37053),o=a(29501),i=a(94508),l=a(26815);let c=o.RV,d=n.createContext({}),u=e=>{let{...t}=e;return(0,s.jsx)(d.Provider,{value:{name:t.name},children:(0,s.jsx)(o.Qr,{...t})})},m=()=>{let e=n.useContext(d),t=n.useContext(h),{getFieldState:a,formState:s}=(0,o.Gc)(),r=a(e.name,s);if(!e)throw Error("useFormField should be used within <FormField>");let{id:i}=t;return{id:i,name:e.name,formItemId:"".concat(i,"-form-item"),formDescriptionId:"".concat(i,"-form-item-description"),formMessageId:"".concat(i,"-form-item-message"),...r}},h=n.createContext({}),x=n.forwardRef((e,t)=>{let{className:a,...r}=e,o=n.useId();return(0,s.jsx)(h.Provider,{value:{id:o},children:(0,s.jsx)("div",{ref:t,className:(0,i.cn)("space-y-2",a),...r})})});x.displayName="FormItem";let f=n.forwardRef((e,t)=>{let{className:a,...n}=e,{error:r,formItemId:o}=m();return(0,s.jsx)(l._,{ref:t,className:(0,i.cn)(r&&"text-destructive",a),htmlFor:o,...n})});f.displayName="FormLabel";let p=n.forwardRef((e,t)=>{let{...a}=e,{error:n,formItemId:o,formDescriptionId:i,formMessageId:l}=m();return(0,s.jsx)(r.g7,{ref:t,id:o,"aria-describedby":n?"".concat(i," ").concat(l):"".concat(i),"aria-invalid":!!n,...a})});p.displayName="FormControl";let g=n.forwardRef((e,t)=>{let{className:a,...n}=e,{formDescriptionId:r}=m();return(0,s.jsx)("p",{ref:t,id:r,className:(0,i.cn)("text-sm text-muted-foreground",a),...n})});g.displayName="FormDescription";let j=n.forwardRef((e,t)=>{let{className:a,children:n,...r}=e,{error:o,formMessageId:l}=m(),c=o?String(null==o?void 0:o.message):n;return c?(0,s.jsx)("p",{ref:t,id:l,className:(0,i.cn)("text-sm font-medium text-destructive",a),...r,children:c}):null});j.displayName="FormMessage"},26815:function(e,t,a){"use strict";a.d(t,{_:function(){return c}});var s=a(57437),n=a(2265),r=a(6394),o=a(90535),i=a(94508);let l=(0,o.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),c=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.f,{ref:t,className:(0,i.cn)(l(),a),...n})});c.displayName=r.f.displayName},53647:function(e,t,a){"use strict";a.d(t,{Bw:function(){return f},Ph:function(){return d},Ql:function(){return p},i4:function(){return m},ki:function(){return u}});var s=a(57437),n=a(2265),r=a(56873),o=a(40875),i=a(22135),l=a(30401),c=a(94508);let d=r.fC;r.ZA;let u=r.B4,m=n.forwardRef((e,t)=>{let{className:a,children:n,...i}=e;return(0,s.jsxs)(r.xz,{ref:t,className:(0,c.cn)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",a),...i,children:[n,(0,s.jsx)(r.JO,{asChild:!0,children:(0,s.jsx)(o.Z,{className:"h-4 w-4 opacity-50"})})]})});m.displayName=r.xz.displayName;let h=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.u_,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",a),...n,children:(0,s.jsx)(i.Z,{className:"h-4 w-4"})})});h.displayName=r.u_.displayName;let x=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.$G,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",a),...n,children:(0,s.jsx)(o.Z,{className:"h-4 w-4"})})});x.displayName=r.$G.displayName;let f=n.forwardRef((e,t)=>{let{className:a,children:n,position:o="popper",...i}=e;return(0,s.jsx)(r.h_,{children:(0,s.jsxs)(r.VY,{ref:t,className:(0,c.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===o&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",a),position:o,...i,children:[(0,s.jsx)(h,{}),(0,s.jsx)(r.l_,{className:(0,c.cn)("p-1","popper"===o&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:n}),(0,s.jsx)(x,{})]})})});f.displayName=r.VY.displayName,n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.__,{ref:t,className:(0,c.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",a),...n})}).displayName=r.__.displayName;let p=n.forwardRef((e,t)=>{let{className:a,children:n,...o}=e;return(0,s.jsxs)(r.ck,{ref:t,className:(0,c.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),...o,children:[(0,s.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,s.jsx)(r.wU,{children:(0,s.jsx)(l.Z,{className:"h-4 w-4"})})}),(0,s.jsx)(r.eT,{children:n})]})});p.displayName=r.ck.displayName,n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.Z0,{ref:t,className:(0,c.cn)("-mx-1 my-1 h-px bg-muted",a),...n})}).displayName=r.Z0.displayName},76818:function(e,t,a){"use strict";a.d(t,{g:function(){return o}});var s=a(57437),n=a(2265),r=a(94508);let o=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)("textarea",{className:(0,r.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",a),ref:t,...n})});o.displayName="Textarea"},89534:function(e,t,a){"use strict";a.d(t,{FN:function(){return m},Mi:function(){return f},VW:function(){return c},_i:function(){return d},gD:function(){return h},lj:function(){return p},sA:function(){return x}});var s=a(57437),n=a(2265),r=a(41915),o=a(90535),i=a(32489),l=a(94508);let c=r.zt,d=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.l_,{ref:t,className:(0,l.cn)("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",a),...n})});d.displayName=r.l_.displayName;let u=(0,o.j)("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),m=n.forwardRef((e,t)=>{let{className:a,variant:n,...o}=e;return(0,s.jsx)(r.fC,{ref:t,className:(0,l.cn)(u({variant:n}),a),...o})});m.displayName=r.fC.displayName;let h=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.aU,{ref:t,className:(0,l.cn)("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",a),...n})});h.displayName=r.aU.displayName;let x=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.x8,{ref:t,className:(0,l.cn)("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",a),"toast-close":"",...n,children:(0,s.jsx)(i.Z,{className:"h-4 w-4"})})});x.displayName=r.x8.displayName;let f=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.Dx,{ref:t,className:(0,l.cn)("text-sm font-semibold",a),...n})});f.displayName=r.Dx.displayName;let p=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.dk,{ref:t,className:(0,l.cn)("text-sm opacity-90",a),...n})});p.displayName=r.dk.displayName},77992:function(e,t,a){"use strict";a.d(t,{pm:function(){return m}});var s=a(2265);let n=0,r=new Map,o=e=>{if(r.has(e))return;let t=setTimeout(()=>{r.delete(e),d({type:"REMOVE_TOAST",toastId:e})},1e6);r.set(e,t)},i=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case"DISMISS_TOAST":{let{toastId:a}=t;return a?o(a):e.toasts.forEach(e=>{o(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===a||void 0===a?{...e,open:!1}:e)}}case"REMOVE_TOAST":if(void 0===t.toastId)return{...e,toasts:[]};return{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},l=[],c={toasts:[]};function d(e){c=i(c,e),l.forEach(e=>{e(c)})}function u(e){let{...t}=e,a=(n=(n+1)%Number.MAX_SAFE_INTEGER).toString(),s=()=>d({type:"DISMISS_TOAST",toastId:a});return d({type:"ADD_TOAST",toast:{...t,id:a,open:!0,onOpenChange:e=>{e||s()}}}),{id:a,dismiss:s,update:e=>d({type:"UPDATE_TOAST",toast:{...e,id:a}})}}function m(){let[e,t]=s.useState(c);return s.useEffect(()=>(l.push(t),()=>{let e=l.indexOf(t);e>-1&&l.splice(e,1)}),[e]),{...e,toast:u,dismiss:e=>d({type:"DISMISS_TOAST",toastId:e})}}},30190:function(e){e.exports={automationsLayout:"automations_automationsLayout__Atoh_",automationCard:"automations_automationCard__BKidA",pageLayout:"automations_pageLayout__OaoYA"}}},function(e){e.O(0,[5638,9259,7200,8667,4363,4447,6663,1915,5473,2327,2971,2117,1744],function(){return e(e.s=2743)}),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1929],{39929:function(e,s,t){Promise.resolve().then(t.bind(t,42780))},42780:function(e,s,t){"use strict";t.r(s),t.d(s,{default:function(){return er}});var a=t(57437),n=t(63136),i=t.n(n),l=t(2265),o=t(27127),r=t(99376),d=t(14308),c=t(59199);t(2446);var u=t(7436),m=t(5477),h=t(56937),x=t(55287),f=t(60729),p=t(34124),g=t(6512),j=t(37104),v=t(62869),N=t(632),b=t(47615),y=t(96108),w=t(36360),_=t(60906),S=t(36720),C=t(61563),O=t(82123),k=t(76818),I=t(78299),M=t(38513),E=t(94508),T=t(23518),z=t(57054),B=t(16605);let R=B.fC,L=B.xz,A=l.forwardRef((e,s)=>{let{className:t,align:n="center",sideOffset:i=4,...l}=e;return(0,a.jsx)(B.VY,{ref:s,align:n,sideOffset:i,className:(0,E.cn)("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...l})});A.displayName=B.VY.displayName;var F=t(54036);function P(e){var s;let{...t}=e,[n,i]=l.useState(!1),[o,r]=(0,l.useState)(void 0),[d,c]=(0,l.useState)(void 0),{data:m,error:x,isLoading:f}=(0,h.h2)(!0),[p,g]=(0,l.useState)([]),j=(0,u.IC)();return((0,l.useEffect)(()=>{if(!f&&m){if(g(m.chat_model_options),t.initialModel)c(m.chat_model_options.find(e=>e.name===t.initialModel));else{let e=m.chat_model_options.find(e=>e.id===m.selected_chat_model_config);!e&&m.chat_model_options.length>0?c(m.chat_model_options[0]):c(e)}}},[m,t.initialModel,f]),(0,l.useEffect)(()=>{d&&m&&t.onSelect(d)},[d,m,t.onSelect]),f)?(0,a.jsx)(F.O,{className:"w-full h-10"}):x?(0,a.jsx)("div",{className:"text-sm text-error",children:x.message}):(0,a.jsx)("div",{className:"grid gap-2 w-[250px]",children:(0,a.jsxs)(z.J2,{open:n,onOpenChange:i,...t,children:[(0,a.jsx)(z.xo,{asChild:!0,children:(0,a.jsxs)(v.z,{variant:"outline",role:"combobox","aria-expanded":n,"aria-label":"Select a model",className:"w-full justify-between text-left",disabled:null!==(s=t.disabled)&&void 0!==s&&s,children:[(0,a.jsx)("p",{className:"truncate",children:d?d.name.substring(0,20):"Select a model..."}),(0,a.jsx)(I.K,{className:"opacity-50"})]})}),(0,a.jsx)(z.yk,{align:"end",className:"w-[250px] p-0",children:j?(0,a.jsx)("div",{children:(0,a.jsx)(T.mY,{loop:!0,children:(0,a.jsxs)(T.e8,{className:"h-[var(--cmdk-list-height)]",children:[(0,a.jsx)(T.sZ,{placeholder:"Search Models..."}),(0,a.jsx)(T.rb,{children:"No Models found."}),(0,a.jsx)(T.fu,{heading:"Models",children:p&&p.length>0&&p.map(e=>(0,a.jsx)(Z,{model:e,isSelected:(null==d?void 0:d.id)===e.id,onPeek:e=>r(e),onSelect:()=>{c(e),i(!1)},isActive:t.isActive},e.id))},"models")]})})}):(0,a.jsxs)(R,{children:[(0,a.jsx)(A,{side:"left",align:"start",forceMount:!0,className:"min-h-[280px]",children:(0,a.jsxs)("div",{className:"grid gap-2",children:[(0,a.jsx)("h4",{className:"font-medium leading-none",children:null==o?void 0:o.name}),(0,a.jsx)("div",{className:"text-sm text-muted-foreground",children:null==o?void 0:o.description}),(null==o?void 0:o.strengths)?(0,a.jsxs)("div",{className:"mt-4 grid gap-2",children:[(0,a.jsx)("h5",{className:"text-sm font-medium leading-none",children:"Strengths"}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:o.strengths})]}):null]})}),(0,a.jsxs)("div",{children:[(0,a.jsx)(L,{}),(0,a.jsx)(T.mY,{loop:!0,children:(0,a.jsxs)(T.e8,{className:"h-[var(--cmdk-list-height)]",children:[(0,a.jsx)(T.sZ,{placeholder:"Search Models..."}),(0,a.jsx)(T.rb,{children:"No Models found."}),(0,a.jsx)(T.fu,{heading:"Models",children:p&&p.length>0&&p.map(e=>(0,a.jsx)(Z,{model:e,isSelected:(null==d?void 0:d.id)===e.id,onPeek:e=>r(e),onSelect:()=>{c(e),i(!1)},isActive:t.isActive},e.id))},"models")]})})]})]})})]})})}function Z(e){let{model:s,isSelected:t,onSelect:n,onPeek:i,isActive:o}=e,r=l.useRef(null);return(0,u.Iy)(r,e=>{e.forEach(e=>{var t;"attributes"===e.type&&"aria-selected"===e.attributeName&&(null===(t=r.current)||void 0===t?void 0:t.getAttribute("aria-selected"))==="true"&&i(s)})}),(0,a.jsxs)(T.di,{onSelect:n,ref:r,className:"data-[selected=true]:bg-muted data-[selected=true]:text-secondary-foreground",disabled:!o&&"free"!==s.tier,children:[s.name," ","standard"===s.tier&&(0,a.jsx)("span",{className:"text-green-500 ml-2",children:"(Futurist)"}),(0,a.jsx)(M.J,{className:(0,E.cn)("ml-auto",t?"opacity-100":"opacity-0")})]},s.id)}var J=t(17200),W=t(2602),D=t(69304),K=t(42225),U=t(26815),V=t(9270),G=t(30401);let H=l.forwardRef((e,s)=>{let{className:t,...n}=e;return(0,a.jsx)(V.fC,{ref:s,className:(0,E.cn)("peer h-4 w-4 shrink-0 rounded-sm border border-secondary-foreground ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-gray-500 data-[state=checked]:text-primary-foreground",t),...n,children:(0,a.jsx)(V.z$,{className:(0,E.cn)("flex items-center justify-center text-current"),children:(0,a.jsx)(G.Z,{className:"h-4 w-4"})})})});H.displayName=V.fC.displayName;var Q=t(81103),Y=t(61312),$=t(26110),q=t(53647),X=t(84671),ee=t(95186),es=t(27648),et=t(99597);let ea=e=>fetch(e).then(e=>e.json());function en(e){let{...s}=e;return s.isMobileWidth?(0,a.jsx)(D.yo,{open:s.isOpen,onOpenChange:s.onOpenChange,children:(0,a.jsx)(D.ue,{className:"w-[300px] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",children:(0,a.jsx)(el,{...s})})}):(0,a.jsx)("div",{className:"relative",children:(0,a.jsx)(el,{...s})})}function ei(e){let s=(0,K.BI)(),t=X.xF,[n,i]=(0,l.useState)(!1),[o,r]=(0,l.useState)(),[d,c]=(0,l.useState)(),[u,m]=(0,l.useState)(),[h,x]=(0,l.useState)(!1),[f,p]=(0,l.useState)(),[g,j]=(0,l.useState)(!1),[N,S]=(0,l.useState)();return(0,l.useEffect)(()=>{o&&d&&u?j(!0):j(!1)},[o,d,u]),(0,a.jsxs)($.Vq,{children:[(0,a.jsx)($.hg,{asChild:!0,children:(0,a.jsx)(v.z,{className:"w-full",variant:"secondary",children:"Create Agent"})}),(0,a.jsxs)($.cZ,{children:[(0,a.jsxs)($.fK,{children:[h&&f?(0,a.jsxs)($.$N,{children:["Created ",o]}):(0,a.jsx)($.$N,{children:"Create a New Agent"}),(0,a.jsx)($.GG,{}),(0,a.jsx)($.Be,{children:"If these settings have been helpful, create a dedicated agent you can re-use across conversations."})]}),(0,a.jsx)("div",{className:"py-4",children:h&&f?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center gap-4 py-8",children:[(0,a.jsx)(et.E.div,{initial:{scale:0},animate:{scale:1},transition:{type:"spring",stiffness:260,damping:20},children:(0,a.jsx)(b.f,{className:"w-16 h-16 text-green-500",weight:"fill"})}),(0,a.jsx)(et.E.p,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.2},className:"text-center text-lg font-medium text-accent-foreground",children:"Created successfully!"}),(0,a.jsx)(et.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.4},children:(0,a.jsx)(es.default,{href:"/agents?agent=".concat(f),children:(0,a.jsx)(v.z,{variant:"secondary",className:"mt-2",children:"Manage Agent"})})})]}):(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(U._,{htmlFor:"agent_name",children:"Name"}),(0,a.jsx)(ee.I,{id:"agent_name",className:"w-full p-2 border mt-4 border-slate-500 rounded-lg",disabled:n,value:o,onChange:e=>r(e.target.value)})]}),(0,a.jsxs)("div",{className:"flex gap-4",children:[(0,a.jsx)("div",{className:"flex-1",children:(0,a.jsxs)(q.Ph,{onValueChange:m,defaultValue:u,children:[(0,a.jsx)(q.i4,{className:"w-full dark:bg-muted",disabled:n,children:(0,a.jsx)(q.ki,{placeholder:"Color"})}),(0,a.jsx)(q.Bw,{className:"items-center space-y-1 inline-flex flex-col",children:t.map(e=>(0,a.jsx)(q.Ql,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(y.C,{className:"w-6 h-6 mr-2 ".concat((0,X.oz)(e)),weight:"fill"}),e]})},e))})]})}),(0,a.jsx)("div",{className:"flex-1",children:(0,a.jsxs)(q.Ph,{onValueChange:c,defaultValue:d,children:[(0,a.jsx)(q.i4,{className:"w-full dark:bg-muted",disabled:n,children:(0,a.jsx)(q.ki,{placeholder:"Icon"})}),(0,a.jsx)(q.Bw,{className:"items-center space-y-1 inline-flex flex-col",children:s.map(e=>(0,a.jsx)(q.Ql,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,K.TI)(e,null!=u?u:"gray","w-6","h-6"),e]})},e))})]})})]})]})}),(0,a.jsxs)($.cN,{children:[N&&(0,a.jsx)("div",{className:"text-red-500 text-sm",children:N}),!h&&(0,a.jsxs)(v.z,{type:"submit",onClick:()=>void(!n&&(i(!0),fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:o,icon:d,color:u,persona:e.customPrompt,chat_model:e.selectedModel,input_tools:e.inputTools,output_modes:e.outputModes,privacy_level:"private"})}).then(e=>e.json()).then(e=>{if(console.log("Success:",e),"detail"in e){S("Error creating agent: ".concat(e.detail)),i(!1);return}x(!0),p(e.slug),i(!1)}).catch(e=>{console.error("Error:",e),S("Error creating agent: ".concat(e)),i(!1)}))),disabled:n||!g,children:[n?(0,a.jsx)(w.U,{className:"animate-spin"}):(0,a.jsx)(_.R,{}),"Create"]}),(0,a.jsx)($.GG,{})]})]})]})}function el(e){var s,t,n,i;let{...o}=e,[r,d]=(0,l.useState)(!1),{data:c,error:u}=(0,J.ZP)("/api/agents/options",ea),{data:m,isLoading:p,error:g}=(0,J.ZP)("/api/agents/conversation?conversation_id=".concat(o.conversationId),ea),{data:j,error:N,isLoading:b}=(0,h.GW)(),[y,_]=(0,l.useState)(),[I,M]=(0,l.useState)(),[E,T]=(0,l.useState)(),[B,R]=(0,l.useState)(),[L,A]=(0,l.useState)(!1),[F,Z]=(0,l.useState)(!m||(null==m?void 0:m.slug.toLowerCase())==="khoj"),[D,V]=(0,l.useState)(),[G,$]=(0,l.useState)(),[q,X]=(0,l.useState)(!1),ee=null!==(s=null==j?void 0:j.is_active)&&void 0!==s&&s;function es(){m&&(T(m.input_tools),V(m.input_tools),(void 0===m.input_tools||0===m.input_tools.length)&&V((null==c?void 0:c.input_tools)?Object.keys(c.input_tools):[]),R(m.output_modes),$(m.output_modes),(void 0===m.output_modes||0===m.output_modes.length)&&$((null==c?void 0:c.output_modes)?Object.keys(c.output_modes):[]),("khoj"===m.name.toLowerCase()||!0===m.is_hidden)&&d(!0),"khoj"===m.slug.toLowerCase()?(M(void 0),_(void 0),Z(!0)):(Z(!1),_(m.persona),M(m.chat_model)))}function et(e,s){return s.includes(e)?s.filter(s=>s!==e):[...s,e]}return(0,l.useEffect)(()=>{es(),A(!1)},[m]),(0,l.useEffect)(()=>{var e,s;if(!m||p)return;let t=!!I&&I!==m.chat_model,a=!!y&&y!==m.persona,n=JSON.stringify((null==E?void 0:E.sort())||[])!==JSON.stringify(null===(e=m.input_tools)||void 0===e?void 0:e.sort()),i=JSON.stringify((null==B?void 0:B.sort())||[])!==JSON.stringify(null===(s=m.output_modes)||void 0===s?void 0:s.sort());A(t||a||n||i)},[I,y,E,B,m,p]),(0,a.jsxs)(f.DD,{collapsible:"none",className:"ml-auto opacity-30 rounded-lg p-2 transition-all transform duration-300 ease-in-out\n ".concat(o.isOpen?"translate-x-0 opacity-100 w-[300px] relative":"translate-x-full opacity-100 w-0 p-0 m-0","\n "),variant:"floating",children:[(0,a.jsxs)(f.TZ,{children:[(0,a.jsx)(f.$l,{children:m&&!r?(0,a.jsx)("div",{className:"flex items-center relative text-sm",children:(0,a.jsxs)("a",{className:"text-lg font-bold flex flex-row items-center",href:"/agents?agent=".concat(m.slug),children:[(0,K.TI)(m.icon,m.color),m.name]})}):(0,a.jsx)("div",{className:"flex items-center relative text-sm justify-between",children:(0,a.jsx)("p",{children:"Chat Options"})})}),(0,a.jsx)(f.Hz,{className:"border-b last:border-none",children:(0,a.jsx)(f.Ks,{className:"gap-0",children:(0,a.jsx)(f.w3,{className:"p-0 m-0",children:m&&m.has_files?(0,a.jsx)(f.LO,{className:"list-none",children:(0,a.jsxs)("div",{className:"flex items-center space-x-2 rounded-full",children:[(0,a.jsx)("div",{className:"text-muted-foreground",children:(0,a.jsx)(S.J,{})}),(0,a.jsx)("div",{className:"text-muted-foreground text-sm",children:"Using custom knowledge base"})]})},"agent_knowledge"):null})})},"knowledge"),(0,a.jsx)(f.Hz,{children:(0,a.jsxs)(f.Ks,{children:[(0,a.jsx)(f.nO,{children:"Instructions"}),(0,a.jsx)(f.w3,{className:"p-0 m-0",children:(0,a.jsx)(f.LO,{className:"list-none",children:(0,a.jsx)(k.g,{className:"w-full h-32 resize-none hover:resize-y",value:y||"",onChange:e=>{_(e.target.value)},readOnly:!r,disabled:!r})})})]})},"instructions"),!p&&m&&(0,a.jsx)(f.Hz,{children:(0,a.jsxs)(f.Ks,{children:[(0,a.jsxs)(f.nO,{children:["Model",!ee&&(0,a.jsx)("a",{href:"/settings",className:"hover:font-bold text-accent-foreground m-2 bg-accent bg-opacity-10 p-1 rounded-lg",children:"Upgrade"})]}),(0,a.jsx)(f.w3,{className:"p-0 m-0",children:(0,a.jsx)(f.LO,{className:"list-none",children:(0,a.jsx)(P,{disabled:!r,onSelect:e=>{M(e.name)},initialModel:F?void 0:null==m?void 0:m.chat_model,isActive:o.isActive})},"model")})]})},"model"),(0,a.jsx)(z.J2,{defaultOpen:!1,children:(0,a.jsxs)(f.Hz,{children:[(0,a.jsx)(f.nO,{asChild:!0,children:(0,a.jsxs)(z.xo,{children:["Tools",(0,a.jsx)(C._,{className:"ml-auto transition-transform group-data-[state=open]/collapsible:rotate-180"})]})}),(0,a.jsx)(z.yk,{children:(0,a.jsx)(f.Ks,{children:(0,a.jsxs)(f.w3,{className:"p-1 m-0",children:[Object.entries(null!==(t=null==c?void 0:c.input_tools)&&void 0!==t?t:{}).map(e=>{let[s,t]=e;return(0,a.jsx)(f.LO,{className:"list-none",children:(0,a.jsxs)(Q.u,{children:[(0,a.jsx)(Q.aJ,{asChild:!0,children:(0,a.jsxs)("div",{className:"flex items-center space-x-2 py-1 justify-between",children:[(0,a.jsxs)(U._,{htmlFor:s,className:"flex items-center gap-2 text-accent-foreground p-1 cursor-pointer",children:[(0,K.vH)(s),(0,a.jsx)("p",{className:"text-sm my-auto flex items-center",children:s})]}),(0,a.jsx)(H,{id:s,className:"".concat(r?"cursor-pointer":""),checked:(null!=D?D:[]).includes(s),onCheckedChange:()=>{let e=et(s,null!=D?D:[]);T(e),V(e)},disabled:!r,children:s})]})},s),(0,a.jsx)(Y._v,{sideOffset:5,side:"left",align:"start",className:"text-sm bg-background text-foreground shadow-sm border border-slate-500 border-opacity-20 p-2 rounded-lg",children:t})]})},s)}),Object.entries(null!==(n=null==c?void 0:c.output_modes)&&void 0!==n?n:{}).map(e=>{let[s,t]=e;return(0,a.jsx)(f.LO,{className:"list-none",children:(0,a.jsxs)(Q.u,{children:[(0,a.jsx)(Q.aJ,{asChild:!0,children:(0,a.jsxs)("div",{className:"flex items-center space-x-2 py-1 justify-between",children:[(0,a.jsxs)(U._,{htmlFor:s,className:"flex items-center gap-2 p-1 rounded-lg cursor-pointer",children:[(0,K.vH)(s),(0,a.jsx)("p",{className:"text-sm my-auto flex items-center",children:s})]}),(0,a.jsx)(H,{id:s,className:"".concat(r?"cursor-pointer":""),checked:(null!=G?G:[]).includes(s),onCheckedChange:()=>{let e=et(s,null!=G?G:[]);R(e),$(e)},disabled:!r,children:s})]})},s),(0,a.jsx)(Y._v,{sideOffset:5,side:"left",align:"start",className:"text-sm bg-background text-foreground shadow-sm border border-slate-500 border-opacity-20 p-2 rounded-lg",children:t})]})},s)})]})})})]})}),(0,a.jsx)(f.Hz,{children:(0,a.jsxs)(f.Ks,{children:[(0,a.jsx)(f.nO,{children:"Files"}),(0,a.jsx)(f.w3,{className:"p-0 m-0",children:(0,a.jsx)(f.LO,{className:"list-none",children:(0,a.jsx)(x.J_,{conversationId:o.conversationId,uploadedFiles:[],isMobileWidth:null!==(i=o.isMobileWidth)&&void 0!==i&&i})},"files-conversation")})]})},"files")]}),o.isOpen&&(0,a.jsx)(f.ZW,{children:(0,a.jsx)(f.w3,{className:"p-0 m-0",children:m&&!r&&m.is_creator?(0,a.jsx)(f.LO,{children:(0,a.jsx)(f.bb,{asChild:!0,children:(0,a.jsx)(v.z,{className:"w-full",variant:"ghost",onClick:()=>window.location.href="/agents?agent=".concat(null==m?void 0:m.slug),children:"Manage"})})}):(0,a.jsxs)(a.Fragment,{children:[!L&&r&&y&&!F&&I&&(0,a.jsx)(f.LO,{children:(0,a.jsx)(f.bb,{asChild:!0,children:(0,a.jsx)(ei,{customPrompt:y,selectedModel:I,inputTools:null!=D?D:[],outputModes:null!=G?G:[]})})}),(0,a.jsx)(f.LO,{children:(0,a.jsx)(f.bb,{asChild:!0,children:(0,a.jsx)(v.z,{className:"w-full",onClick:()=>void(es(),A(!1)),variant:"ghost",disabled:!r||!L,children:"Reset"})})}),(0,a.jsx)(f.LO,{children:(0,a.jsx)(f.bb,{asChild:!0,children:(0,a.jsxs)(v.z,{className:"w-full ".concat(L?"bg-accent-foreground text-accent":""),variant:"secondary",onClick:()=>(function(){if(L){if(!F&&(null==m?void 0:m.is_hidden)===!1){alert("This agent is not a hidden agent. It cannot be modified from this interface.");return}let e="PATCH";F&&(e="POST");let s={persona:y,chat_model:I,input_tools:E,output_modes:B,...F?{}:{slug:null==m?void 0:m.slug}};X(!0),fetch(F?"/api/agents/hidden?conversation_id=".concat(o.conversationId):"/api/agents/hidden",{method:e,headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}).then(e=>{X(!1),e.json()}).then(e=>{(0,W.j)("/api/agents/conversation?conversation_id=".concat(o.conversationId)),A(!1)}).catch(e=>{console.error("Error:",e),X(!1)})}})(),disabled:!r||!L||q,children:[q?(0,a.jsx)(w.U,{className:"animate-spin"}):(0,a.jsx)(O.Z,{}),q?"Saving":"Save"]})})})]})})},"actions")]})}function eo(e){let s=(0,r.useSearchParams)().get("conversationId"),[t,n]=(0,l.useState)(""),[d,c]=(0,l.useState)([]),[u,h]=(0,l.useState)(!1),[x,f]=(0,l.useState)(null),[p,g]=(0,l.useState)(!1),j=(0,l.useRef)(null),v=e.setQueryToProcess,N=e.onConversationIdChange,b=e.isMobileWidth?"w-full":"w-4/6";if((0,l.useEffect)(()=>{if(d.length>0){let s=d.map(e=>encodeURIComponent(e));e.setImages(s)}},[d,e.setImages]),(0,l.useEffect)(()=>{let s=localStorage.getItem("images");if(s){let t=JSON.parse(s);c(t);let a=t.map(e=>encodeURIComponent(e));e.setImages(a),localStorage.removeItem("images")}let t=localStorage.getItem("message");t&&(h(!0),v(t),t.trim().startsWith("/research")&&g(!0));let a=localStorage.getItem("uploadedFiles");if(a){let s=a?JSON.parse(a):[],t=[];for(let e of s)t.push({name:e.name,file_type:e.file_type,content:e.content,size:e.size});localStorage.removeItem("uploadedFiles"),e.setUploadedFiles(t)}},[v,e.setImages,s]),(0,l.useEffect)(()=>{t&&(h(!0),v(t))},[t,v]),(0,l.useEffect)(()=>{s&&(null==N||N(s))},[s,N]),(0,l.useEffect)(()=>{e.streamedMessages&&e.streamedMessages.length>0&&e.streamedMessages[e.streamedMessages.length-1].completed?(h(!1),c([]),e.setUploadedFiles(void 0)):n("")},[e.streamedMessages]),!s){window.location.href="/";return}return(0,a.jsxs)("div",{className:"flex flex-row h-full w-full",children:[(0,a.jsxs)("div",{className:"flex flex-col h-full w-full",children:[(0,a.jsx)("div",{className:i().chatBodyFull,children:(0,a.jsx)(o.Z,{conversationId:s,setTitle:e.setTitle,setAgent:f,pendingMessage:u?t:"",incomingMessages:e.streamedMessages,setIncomingMessages:e.setStreamedMessages,customClassName:b,setIsChatSideBarOpen:e.setIsChatSideBarOpen})}),(0,a.jsx)("div",{className:"".concat(i().inputBox," p-1 md:px-2 shadow-md bg-background align-middle items-center justify-center dark:bg-neutral-700 dark:border-0 dark:shadow-sm rounded-2xl md:rounded-xl h-fit ").concat(b," mr-auto ml-auto mt-auto"),children:(0,a.jsx)(m.a,{agentColor:null==x?void 0:x.color,isLoggedIn:e.isLoggedIn,sendMessage:e=>n(e),sendImage:e=>c(s=>[...s,e]),sendDisabled:e.isParentProcessing||!1,chatOptionsData:e.chatOptionsData,conversationId:s,isMobileWidth:e.isMobileWidth,setUploadedFiles:e.setUploadedFiles,ref:j,isResearchModeEnabled:p,setTriggeredAbort:e.setTriggeredAbort})})]}),(0,a.jsx)(en,{conversationId:s,isActive:e.isActive,isOpen:e.isChatSideBarOpen,onOpenChange:e.setIsChatSideBarOpen,isMobileWidth:e.isMobileWidth})]})}function er(){let e="Khoj AI - Chat",[s,t]=(0,l.useState)(null),[n,o]=(0,l.useState)(!0),[r,m]=(0,l.useState)(e),[b,y]=(0,l.useState)(null),[w,_]=(0,l.useState)([]),[S,C]=(0,l.useState)(""),[O,k]=(0,l.useState)(!1),[I,M]=(0,l.useState)(void 0),[E,T]=(0,l.useState)([]),[z,B]=(0,l.useState)(null),[R,L]=(0,l.useState)(!1),[A,F]=(0,l.useState)(!1),{locationData:P,locationDataError:Z,locationDataLoading:J}=(0,u.k6)()||{locationData:{timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}},{data:W,error:D,isLoading:K}=(0,h.GW)(),U=(0,u.IC)(),[V,G]=(0,l.useState)(!1);async function H(e){if(!e.ok)throw Error(e.statusText);if(!e.body)throw Error("Response body is null");let s=e.body.getReader(),t=new TextDecoder,a="␃\uD83D\uDD1A␗",n="",i=[],l={},o={};for(;;){let e;let{done:r,value:d}=await s.read();if(r){C(""),k(!1),T([]),b&&(0,c.tQ)(b,m);break}for(n+=t.decode(d,{stream:!0});-1!==(e=n.indexOf(a));){let s=n.slice(0,e);if(n=n.slice(e+a.length),s){let e=w.find(e=>!e.completed);if(!e){console.error("No current message found");return}({context:i,onlineContext:l,codeContext:o}=(0,c.VK)(s,e,i,l,o)),_([...w])}}}}async function Q(){if(localStorage.removeItem("message"),!S||!b){k(!1);return}let e={q:S,conversation_id:b,stream:!0,interrupt:A,...P&&{city:P.city,region:P.region,country:P.country,country_code:P.countryCode,timezone:P.timezone},...E.length>0&&{images:E},...I&&{files:I}};F(!1);let s=await fetch("/api/chat?client=web",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:null==z?void 0:z.signal});try{await H(s)}catch(i){let e;try{e=await s.json()}catch(s){e={streamError:"Error reading API error response stream. Expected JSON response."}}console.error(e);let t=w.find(e=>!e.completed);if(!t)return;let a=i.message,n=i.name;a.includes("Error in input stream")?t.rawResponse="Woops! The connection broke while I was writing my thoughts down. Maybe try again in a bit or dislike this message if the issue persists?":e.streamError?t.rawResponse="Umm, not sure what just happened but I lost my train of thought. Could you try again or ask my developers to look into this if the issue persists? They can be contacted at the Khoj Github, Discord or team@khoj.dev.":429===s.status?"detail"in e?t.rawResponse="".concat(e.detail):t.rawResponse="I'm a bit overwhelmed at the moment. Could you try again in a bit or dislike this message if the issue persists?":"AbortError"===n?t.rawResponse="I've stopped processing this message. If you'd like to continue, please send the message again.":t.rawResponse="Umm, not sure what just happened. I see this error message: ".concat(a,". Could you try again or dislike this message if the issue persists?"),t.completed=!0,_([...w]),C(""),k(!1)}}return(0,l.useEffect)(()=>{fetch("/api/chat/options").then(e=>e.json()).then(e=>{o(!1),e&&t(e)}).catch(e=>{console.error(e)}),(0,u.EK)()},[]),(0,l.useEffect)(()=>{R&&(null==z||z.abort(),function(){let e=w.find(e=>!e.completed);e&&(e.completed=!0,_([...w]),k(!1))}(),F(!0),L(!1))},[R]),(0,l.useEffect)(()=>{if(S){let e={rawResponse:"",trainOfThought:[],context:[],onlineContext:{},codeContext:{},completed:!1,timestamp:new Date().toISOString(),rawQuery:S||"",images:E,queryFiles:I};_(s=>[...s,e]),k(!0),B(new AbortController)}},[S]),(0,l.useEffect)(()=>{O&&!J&&Q()},[O,J]),n?(0,a.jsx)(d.Z,{}):(0,a.jsxs)(f.Hn,{children:[(0,a.jsx)(p.S,{conversationId:b||""}),(0,a.jsxs)(f.kV,{children:[(0,a.jsxs)("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:[(0,a.jsx)(f.vP,{className:"-ml-1"}),(0,a.jsx)(g.Z,{orientation:"vertical",className:"mr-2 h-4"}),b&&(0,a.jsx)("div",{className:"".concat(i().chatTitleWrapper," text-nowrap text-ellipsis overflow-hidden max-w-screen-md grid items-top font-bold mx-2 md:mr-8 col-auto h-fit"),children:U?(0,a.jsx)("a",{className:"p-0 no-underline",href:"/",children:(0,a.jsx)(j.VO,{className:"h-auto w-16"})}):r&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h2",{className:"text-lg text-ellipsis whitespace-nowrap overflow-x-hidden mr-4",children:r}),(0,a.jsx)(x.En,{conversationId:b,setTitle:m,sizing:"md"})]})}),(0,a.jsx)("div",{className:"flex justify-end items-start gap-2 text-sm ml-auto",children:(0,a.jsx)(v.z,{variant:"ghost",size:"icon",className:"h-12 w-12 data-[state=open]:bg-accent",onClick:()=>G(!V),children:(0,a.jsx)(N.T,{className:"w-6 h-6"})})})]}),(0,a.jsxs)("div",{className:"".concat(i().main," ").concat(i().chatLayout),children:[(0,a.jsx)("title",{children:"".concat(e).concat(r&&r!==e?": ".concat(r):"")}),(0,a.jsx)("div",{className:i().chatBox,children:(0,a.jsx)("div",{className:i().chatBoxBody,children:(0,a.jsx)(l.Suspense,{fallback:(0,a.jsx)(d.Z,{}),children:(0,a.jsx)(eo,{isLoggedIn:!!W,streamedMessages:w,setStreamedMessages:_,chatOptionsData:s,setTitle:m,setQueryToProcess:C,setUploadedFiles:M,isMobileWidth:U,onConversationIdChange:e=>{y(e)},setImages:T,setTriggeredAbort:L,isChatSideBarOpen:V,setIsChatSideBarOpen:G,isActive:null==W?void 0:W.is_active,isParentProcessing:O})})})})]})]})]})}},26815:function(e,s,t){"use strict";t.d(s,{_:function(){return d}});var a=t(57437),n=t(2265),i=t(6394),l=t(90535),o=t(94508);let r=(0,l.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),d=n.forwardRef((e,s)=>{let{className:t,...n}=e;return(0,a.jsx)(i.f,{ref:s,className:(0,o.cn)(r(),t),...n})});d.displayName=i.f.displayName},53647:function(e,s,t){"use strict";t.d(s,{Bw:function(){return f},Ph:function(){return c},Ql:function(){return p},i4:function(){return m},ki:function(){return u}});var a=t(57437),n=t(2265),i=t(56873),l=t(40875),o=t(22135),r=t(30401),d=t(94508);let c=i.fC;i.ZA;let u=i.B4,m=n.forwardRef((e,s)=>{let{className:t,children:n,...o}=e;return(0,a.jsxs)(i.xz,{ref:s,className:(0,d.cn)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...o,children:[n,(0,a.jsx)(i.JO,{asChild:!0,children:(0,a.jsx)(l.Z,{className:"h-4 w-4 opacity-50"})})]})});m.displayName=i.xz.displayName;let h=n.forwardRef((e,s)=>{let{className:t,...n}=e;return(0,a.jsx)(i.u_,{ref:s,className:(0,d.cn)("flex cursor-default items-center justify-center py-1",t),...n,children:(0,a.jsx)(o.Z,{className:"h-4 w-4"})})});h.displayName=i.u_.displayName;let x=n.forwardRef((e,s)=>{let{className:t,...n}=e;return(0,a.jsx)(i.$G,{ref:s,className:(0,d.cn)("flex cursor-default items-center justify-center py-1",t),...n,children:(0,a.jsx)(l.Z,{className:"h-4 w-4"})})});x.displayName=i.$G.displayName;let f=n.forwardRef((e,s)=>{let{className:t,children:n,position:l="popper",...o}=e;return(0,a.jsx)(i.h_,{children:(0,a.jsxs)(i.VY,{ref:s,className:(0,d.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===l&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:l,...o,children:[(0,a.jsx)(h,{}),(0,a.jsx)(i.l_,{className:(0,d.cn)("p-1","popper"===l&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:n}),(0,a.jsx)(x,{})]})})});f.displayName=i.VY.displayName,n.forwardRef((e,s)=>{let{className:t,...n}=e;return(0,a.jsx)(i.__,{ref:s,className:(0,d.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...n})}).displayName=i.__.displayName;let p=n.forwardRef((e,s)=>{let{className:t,children:n,...l}=e;return(0,a.jsxs)(i.ck,{ref:s,className:(0,d.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...l,children:[(0,a.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,a.jsx)(i.wU,{children:(0,a.jsx)(r.Z,{className:"h-4 w-4"})})}),(0,a.jsx)(i.eT,{children:n})]})});p.displayName=i.ck.displayName,n.forwardRef((e,s)=>{let{className:t,...n}=e;return(0,a.jsx)(i.Z0,{ref:s,className:(0,d.cn)("-mx-1 my-1 h-px bg-muted",t),...n})}).displayName=i.Z0.displayName},63136:function(e){e.exports={main:"chat_main__8xQu5",suggestions:"chat_suggestions__m8n2t",inputBox:"chat_inputBox__LOFws",chatBodyFull:"chat_chatBodyFull__FfKEK",chatBody:"chat_chatBody__sS1LX",chatLayout:"chat_chatLayout__pR203",chatBox:"chat_chatBox__FBct_",titleBar:"chat_titleBar__R5QlK",chatBoxBody:"chat_chatBoxBody__qT_SC",agentIndicator:"chat_agentIndicator__8V55w",chatTitleWrapper:"chat_chatTitleWrapper__6ChWq"}}},function(e){e.O(0,[4842,5638,3954,1919,9259,7200,8667,4363,4447,4357,5138,9334,2327,5477,7127,2971,2117,1744],function(){return e(e.s=39929)}),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[244,8459,3317,7138],{63521:function(){}},function(n){n.O(0,[2971,2117,1744],function(){return n(n.s=63521)}),_N_E=n.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7138,8459,3317,244],{63521:function(){}},function(n){n.O(0,[2971,2117,1744],function(){return n(n.s=63521)}),_N_E=n.O()}]);