khoj 2.0.0b14.dev32__py3-none-any.whl → 2.0.0b14.dev51__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- khoj/database/admin.py +2 -2
- khoj/interface/compiled/404/index.html +2 -2
- khoj/interface/compiled/_next/static/chunks/9808-0ae18d938933fea3.js +1 -0
- khoj/interface/compiled/_next/static/chunks/app/chat/page-ac7ed0a1aff1b145.js +1 -0
- khoj/interface/compiled/_next/static/chunks/app/share/chat/{page-e0dcb1762f8c8f88.js → page-819c6536c15e3d31.js} +1 -1
- khoj/interface/compiled/_next/static/css/2945c4a857922f3b.css +1 -0
- khoj/interface/compiled/_next/static/css/5c7a72bad47e50b3.css +25 -0
- khoj/interface/compiled/_next/static/css/ecea704005ba630c.css +1 -0
- khoj/interface/compiled/agents/index.html +2 -2
- khoj/interface/compiled/agents/index.txt +2 -2
- khoj/interface/compiled/automations/index.html +2 -2
- khoj/interface/compiled/automations/index.txt +3 -3
- khoj/interface/compiled/chat/index.html +2 -2
- khoj/interface/compiled/chat/index.txt +3 -3
- khoj/interface/compiled/index.html +2 -2
- khoj/interface/compiled/index.txt +2 -2
- khoj/interface/compiled/search/index.html +2 -2
- khoj/interface/compiled/search/index.txt +2 -2
- khoj/interface/compiled/settings/index.html +2 -2
- khoj/interface/compiled/settings/index.txt +4 -4
- khoj/interface/compiled/share/chat/index.html +2 -2
- khoj/interface/compiled/share/chat/index.txt +2 -2
- khoj/processor/conversation/google/gemini_chat.py +1 -1
- khoj/processor/conversation/google/utils.py +2 -6
- khoj/processor/conversation/openai/utils.py +22 -15
- khoj/processor/conversation/utils.py +1 -0
- khoj/routers/helpers.py +10 -6
- khoj/utils/constants.py +3 -1
- {khoj-2.0.0b14.dev32.dist-info → khoj-2.0.0b14.dev51.dist-info}/METADATA +1 -1
- {khoj-2.0.0b14.dev32.dist-info → khoj-2.0.0b14.dev51.dist-info}/RECORD +43 -43
- khoj/interface/compiled/_next/static/chunks/7127-9273a602fbda737e.js +0 -1
- khoj/interface/compiled/_next/static/chunks/app/chat/page-6297545f8e9ee5f9.js +0 -1
- khoj/interface/compiled/_next/static/css/3090706713c12a32.css +0 -25
- khoj/interface/compiled/_next/static/css/579820a104ee7d1d.css +0 -1
- khoj/interface/compiled/_next/static/css/821d0d60b0b6871d.css +0 -1
- /khoj/interface/compiled/_next/static/chunks/{1327-e254819a9172cfa7.js → 1327-511bb0a862efce80.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/{1915-5c6508f6ebb62a30.js → 1915-fbfe167c84ad60c5.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/{2117-080746c8e170c81a.js → 2117-e78b6902ad6f75ec.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/{2939-4af3fd24b8ffc9ad.js → 2939-4d4084c5b888b960.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/{4447-cd95608f8e93e711.js → 4447-d6cf93724d57e34b.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/{8667-50b03a89e82e0ba7.js → 8667-4b7790573b08c50d.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/{9139-8ac4d9feb10f8869.js → 9139-ce1ae935dac9c871.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/{webpack-5393aad3d824e0cb.js → webpack-e572645654c4335e.js} +0 -0
- /khoj/interface/compiled/_next/static/{X5-FmIFHozaGjC6_c98DL → yBzbL9kxl5BudSA9F4Gr6}/_buildManifest.js +0 -0
- /khoj/interface/compiled/_next/static/{X5-FmIFHozaGjC6_c98DL → yBzbL9kxl5BudSA9F4Gr6}/_ssgManifest.js +0 -0
- {khoj-2.0.0b14.dev32.dist-info → khoj-2.0.0b14.dev51.dist-info}/WHEEL +0 -0
- {khoj-2.0.0b14.dev32.dist-info → khoj-2.0.0b14.dev51.dist-info}/entry_points.txt +0 -0
- {khoj-2.0.0b14.dev32.dist-info → khoj-2.0.0b14.dev51.dist-info}/licenses/LICENSE +0 -0
@@ -8,7 +8,7 @@ khoj/app/asgi.py,sha256=soh3C1xazlgHt_bDgKzrfzo2TKXbNYJsckcXNEgTip8,388
|
|
8
8
|
khoj/app/settings.py,sha256=8ESyAioroVUEVYR--8vEJUJf0X8TtVtrk-0ZSohij1k,9005
|
9
9
|
khoj/app/urls.py,sha256=CcIcBEUB6gGUp4lmTCzX2kHLZ7WiinCXmFBIoRV0eyk,870
|
10
10
|
khoj/database/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
|
-
khoj/database/admin.py,sha256=
|
11
|
+
khoj/database/admin.py,sha256=cZl1yE9gu2YjHkB1iB1qubylOAa9KHbyGtwPcjR4ERg,13256
|
12
12
|
khoj/database/apps.py,sha256=pM4tkX5Odw4YW_hLLKK8Nd5kqGddf1en0oMCea44RZw,153
|
13
13
|
khoj/database/tests.py,sha256=qWDvA9ZhVCQ1rPbkoFify7o_fDirXMUdYMxF12q3WIM,26
|
14
14
|
khoj/database/adapters/__init__.py,sha256=7umgKmnh-h91YjOEjCCcfMq-pdvZmEFr8PiN5qQCM8Y,82631
|
@@ -133,29 +133,27 @@ khoj/interface/compiled/chat.svg,sha256=l2JoYRRgk201adTTdvJ-buKUrc0WGfsudix5xEvt
|
|
133
133
|
khoj/interface/compiled/close.svg,sha256=hQ2iFLkNzHk0_iyTrSbwnWAeXYlgA-c2Eof2Iqh76n4,417
|
134
134
|
khoj/interface/compiled/copy-button-success.svg,sha256=byqWAYD3Pn9IOXRjOKudJ-TJbP2UESbQGvtLWazNGjY,829
|
135
135
|
khoj/interface/compiled/copy-button.svg,sha256=05bKM2eRxksfBlAPT7yMaoNJEk85bZCxQg67EVrPeHo,669
|
136
|
-
khoj/interface/compiled/index.html,sha256=
|
137
|
-
khoj/interface/compiled/index.txt,sha256=
|
136
|
+
khoj/interface/compiled/index.html,sha256=9k9CxS3MK35cojtst4uclH-isk7WIPdKm-M1vTJwT3A,53353
|
137
|
+
khoj/interface/compiled/index.txt,sha256=lPsoajVEOL_2rK5NVr9-gpumTlJMQKB8eBzB1XOE4KQ,7749
|
138
138
|
khoj/interface/compiled/khoj.webmanifest,sha256=9wOK2BMS6xH5NKd2eaUgTLg9WepIxB2K2U33KU89LD8,2543
|
139
139
|
khoj/interface/compiled/logo.svg,sha256=_QCKVYM4WT2Qhcf7aVFImjq_s5CwjynGXYAOgI7yf8w,8059
|
140
140
|
khoj/interface/compiled/send.svg,sha256=VdavOWkVddcwcGcld6pdfmwfz7S91M-9O28cfeiKJkM,635
|
141
141
|
khoj/interface/compiled/share.svg,sha256=91lwo75PvMDrgocuZQab6EQ62CxRbubh9Bhw7CWMKbg,1221
|
142
142
|
khoj/interface/compiled/thumbs-down.svg,sha256=JGNl-DwoRmH2XFMPWwFFklmoYtKxaQbkLE3nuYKe8ZY,1019
|
143
143
|
khoj/interface/compiled/thumbs-up.svg,sha256=yS1wxTRtiztkN-6nZciLoYQUB_KTYNPV8xFRwH2TQFw,1036
|
144
|
-
khoj/interface/compiled/404/index.html,sha256=
|
145
|
-
khoj/interface/compiled/_next/static/X5-FmIFHozaGjC6_c98DL/_buildManifest.js,sha256=f2_nYnw25hHWQJ-39Lf5OH1u6kgdbOInyfplqgjvAV4,224
|
146
|
-
khoj/interface/compiled/_next/static/X5-FmIFHozaGjC6_c98DL/_ssgManifest.js,sha256=Z49s4suAsf5y_GfnQSvm4qtq2ggxEbZPfEDTXjy6XgA,80
|
144
|
+
khoj/interface/compiled/404/index.html,sha256=m9XIvDMjUF6Njr2APBS13Tta0APYpMP19Zd9JRFySAk,17407
|
147
145
|
khoj/interface/compiled/_next/static/chunks/1225.ecac11e7421504c4.js,sha256=h7OGlQyJHNblfAxjh9NxeF2TfA5R-44W7kq30la-tWA,145739
|
148
146
|
khoj/interface/compiled/_next/static/chunks/1320.ae930ad00affe685.js,sha256=_7Rr2YFKkuvZINMyuBk6HxVzmwtsMh7bHpPeWLZeVyc,71098
|
149
|
-
khoj/interface/compiled/_next/static/chunks/1327-
|
147
|
+
khoj/interface/compiled/_next/static/chunks/1327-511bb0a862efce80.js,sha256=gF0GGZk14_JkuoTQHtktiq2fxMAjnU8hxETqmL67nV0,443139
|
150
148
|
khoj/interface/compiled/_next/static/chunks/1626.15a8acc0d6639ec6.js,sha256=2XrQqLoRGixUdpd-y43MSx5IvGZoBFewS6Jpa537ObA,186
|
151
|
-
khoj/interface/compiled/_next/static/chunks/1915-
|
149
|
+
khoj/interface/compiled/_next/static/chunks/1915-fbfe167c84ad60c5.js,sha256=qP_naVeN_Vqu4o2bOYGBoDEYCFVDphWwLqa_3_WeYjU,11294
|
152
150
|
khoj/interface/compiled/_next/static/chunks/1940.d082758bd04e08ae.js,sha256=J7kJooZjJ8Ez5ca_wtUn22HQv1NljO7BjysOYHQu8Nw,21715
|
153
|
-
khoj/interface/compiled/_next/static/chunks/2117-
|
151
|
+
khoj/interface/compiled/_next/static/chunks/2117-e78b6902ad6f75ec.js,sha256=yOBtQrL5NRMjI60r4pmZRRTHZv8_xwZm4DQp-RI8H9M,123994
|
154
152
|
khoj/interface/compiled/_next/static/chunks/2242.9a07e19f1a3a8b16.js,sha256=gE2wenv7eMCWo8FlC8uOffniVrbcSyi2BfpoDygPJbQ,6535
|
155
153
|
khoj/interface/compiled/_next/static/chunks/2327-438aaec1657c5ada.js,sha256=NC9BlX61K2ZOUJNSVeJKivdbu3cTEIEi_xKmk_uFY_8,127516
|
156
154
|
khoj/interface/compiled/_next/static/chunks/2475.57a0d0fd93d07af0.js,sha256=rcF8gL_mn3N98WkP3xiFZ8gnCeqntUnbCcU_O7N0yPw,20265
|
157
155
|
khoj/interface/compiled/_next/static/chunks/2481.5ce6524ba0a73f90.js,sha256=UPXoJb1TBOwJRiEijKaL9_rmHizAA18qsSi3BXdevOw,25635
|
158
|
-
khoj/interface/compiled/_next/static/chunks/2939-
|
156
|
+
khoj/interface/compiled/_next/static/chunks/2939-4d4084c5b888b960.js,sha256=8BI0oAQSZQj37UZX_igaTvuTgW0nGvVtvyG9G9byr_k,35749
|
159
157
|
khoj/interface/compiled/_next/static/chunks/297.4c4c823ff6e3255b.js,sha256=N3uQRvmg4U54io0EUT3n7ryeZPM2k586EXB-u3M_Rvc,45849
|
160
158
|
khoj/interface/compiled/_next/static/chunks/3260-82d2521fab032ff1.js,sha256=pKZoO7NyUEqDgLEA2cF1NzMF19_2tletHFRO3p1rwRs,1643416
|
161
159
|
khoj/interface/compiled/_next/static/chunks/3353.1c6d553216a1acae.js,sha256=-FHSub1NvXb-bLyOsETXWtexNq02lICpwW0ZH3tVeFg,177
|
@@ -165,7 +163,7 @@ khoj/interface/compiled/_next/static/chunks/3855.f7b8131f78af046e.js,sha256=a2-n
|
|
165
163
|
khoj/interface/compiled/_next/static/chunks/3973.dc54a39586ab48be.js,sha256=XtBpaSFqz5bcp2ZJ4Y-wK_Xv9k0WWLRKwN4RRQe66es,431
|
166
164
|
khoj/interface/compiled/_next/static/chunks/4241.c1cd170f7f37ac59.js,sha256=bLEgvCIt3ga4FeJ13snFn7Z8uXgkYLUdTvmmhbYhPyk,4208
|
167
165
|
khoj/interface/compiled/_next/static/chunks/4327.f3704dc398c67113.js,sha256=0b4KsfUmI1ygMhSIznFkcfMHrKBqeCEO9puyw28tnPM,334087
|
168
|
-
khoj/interface/compiled/_next/static/chunks/4447-
|
166
|
+
khoj/interface/compiled/_next/static/chunks/4447-d6cf93724d57e34b.js,sha256=PUldPCrWRAgi5rxqTzWS1boopyuyAQpzzBg-p4TQnNw,19716
|
169
167
|
khoj/interface/compiled/_next/static/chunks/4505.f09454a346269c3f.js,sha256=io-LxpYmrl-v3FKylmu-DSjtIBZy97nqaZJ5isTmkyI,89862
|
170
168
|
khoj/interface/compiled/_next/static/chunks/4609-33aa487dff03a9fd.js,sha256=1M6QAfVZa2g2Q4jXRdSI1wjrZ4G9yKjINJt8qyTKm1A,24698
|
171
169
|
khoj/interface/compiled/_next/static/chunks/4610.196691887afb7fea.js,sha256=YztgMQx24P3fpNHTPBIcNUhMuP4ycmJjakV0r0whNCQ,14102
|
@@ -179,7 +177,6 @@ khoj/interface/compiled/_next/static/chunks/584.d7ce3505f169b706.js,sha256=CDrxO
|
|
179
177
|
khoj/interface/compiled/_next/static/chunks/6240.34f7c1fa692edd61.js,sha256=pBbYPG21QsQ6UjMev_R0E2MlgI4HpX0VVAbGD5qJPbI,11499
|
180
178
|
khoj/interface/compiled/_next/static/chunks/6434.e6cd986d690f2cef.js,sha256=fVR1V4ENz1Qeebsoe8N8XNVbcwGBBhdnTJY-157Y0sg,36261
|
181
179
|
khoj/interface/compiled/_next/static/chunks/6d3fe5a5-f9f3c16e0bc0cdf9.js,sha256=D5Zwf2k8bdsZHdA_rHYb1AkjPEzChzE2ikfYjdEcoCw,89810
|
182
|
-
khoj/interface/compiled/_next/static/chunks/7127-9273a602fbda737e.js,sha256=GQnEiCuImCPlT6BUrkFCxDSCPqjUXZWJPL9ji0JNWRo,43592
|
183
180
|
khoj/interface/compiled/_next/static/chunks/7200-93ab0072359b8028.js,sha256=TjO7mJfoHX12ZVRPYbZMnEh_t8hlM-h-gukzuMFXuKg,11416
|
184
181
|
khoj/interface/compiled/_next/static/chunks/7553.f5ad54b1f6e92c49.js,sha256=RG6sFOVYxfl2MvzwJfvTdGQceQ0DNMppZKkywZoeiPk,76986
|
185
182
|
khoj/interface/compiled/_next/static/chunks/7626-1b630f1654172341.js,sha256=b3P38z7c7HhEATw0zwOJsGB7r1rTeLehksMGjgyrK2I,83511
|
@@ -191,12 +188,12 @@ khoj/interface/compiled/_next/static/chunks/8086.8d39887215807fcd.js,sha256=-tV-
|
|
191
188
|
khoj/interface/compiled/_next/static/chunks/8168.f074ab8c7c16d82d.js,sha256=EKpxOr9jgSn3lj9Q-ofRolQieO-lSdBftRKxO_zDKuY,30676
|
192
189
|
khoj/interface/compiled/_next/static/chunks/8223.1705878fa7a09292.js,sha256=FS0vp7AwNpzzdKEmD3xCnAm-shrn4EZ5fyBW8DK5izU,33661
|
193
190
|
khoj/interface/compiled/_next/static/chunks/8483.94f6c9e2bee86f50.js,sha256=s3Z9HRC8vQ7gCODsvniGzpMjSkaPB1GxPJ45yoioteI,36376
|
194
|
-
khoj/interface/compiled/_next/static/chunks/8667-
|
191
|
+
khoj/interface/compiled/_next/static/chunks/8667-4b7790573b08c50d.js,sha256=kyiAVJTylsiOPFTb63uZn_pMlk4pYhDYt_N7xL76PTM,7214
|
195
192
|
khoj/interface/compiled/_next/static/chunks/8810.fc0e479de78c7c61.js,sha256=6I2vv-7FZ5HUhfRrS1trT1NW6a-c1yfj30sn1eZWgBI,3776
|
196
193
|
khoj/interface/compiled/_next/static/chunks/8828.bc74dc4ce94e78f6.js,sha256=G324sooCqpt0xjC6qpAKUPS3gBAGHHFPXmrNl_WZwsM,181
|
197
194
|
khoj/interface/compiled/_next/static/chunks/8909.14ac3f43d0070cf1.js,sha256=j4Qis2fXJfHiRlzHs8hnVrXy_APjk-rAMCAMW_hQKb8,100743
|
198
195
|
khoj/interface/compiled/_next/static/chunks/90542734.b1a1629065ba199b.js,sha256=jFYaTpebn1BZ-ofV5QZZElYHqMBSZ_V_xruTBDgh9A4,429750
|
199
|
-
khoj/interface/compiled/_next/static/chunks/9139-
|
196
|
+
khoj/interface/compiled/_next/static/chunks/9139-ce1ae935dac9c871.js,sha256=uwVs14McY01hs1lkHG2t8Z_z2EC11NConM1NJPuMXbc,48934
|
200
197
|
khoj/interface/compiled/_next/static/chunks/9167.098534184f03fe92.js,sha256=gWVQW7WtMM-3fOPWhaHr1Xmud3Jq2suLKYLX_1OC3dA,18695
|
201
198
|
khoj/interface/compiled/_next/static/chunks/945-74376499b067d28e.js,sha256=e_lXzW9hrp9GkwVQ72Mt4z7i4Q9DdAyGi_w1pgqvTUE,21583
|
202
199
|
khoj/interface/compiled/_next/static/chunks/94ca1967.1b3402358e0e1255.js,sha256=WJXEIy24FD6PNQePg-uahendJMNc03GgnVveitFeshI,1174524
|
@@ -206,6 +203,7 @@ khoj/interface/compiled/_next/static/chunks/9599.ec50b5296c27dae9.js,sha256=s-el
|
|
206
203
|
khoj/interface/compiled/_next/static/chunks/9643.b34248df52ffc77c.js,sha256=nARYR9WXzmfbTlJvd5yq06ebrFYsSgpgSmGZsfV1loo,42177
|
207
204
|
khoj/interface/compiled/_next/static/chunks/964ecbae.d5be7c49c320d695.js,sha256=Dp7-5a_bYiET4lBiy1sTrb1cQnE3_TC0f1EQCD2Coko,1175124
|
208
205
|
khoj/interface/compiled/_next/static/chunks/9747.2fd9065b1435abb1.js,sha256=VJfnI0aioXeyDBCXy4gKNqaA6oz5t4ZfKHGENsqamdM,38655
|
206
|
+
khoj/interface/compiled/_next/static/chunks/9808-0ae18d938933fea3.js,sha256=lzERUGUIjh82oBCOFujsqNrhVbsK_kxyThAGFxX3f-c,50100
|
209
207
|
khoj/interface/compiled/_next/static/chunks/9922.98f2b2a9959b4ebe.js,sha256=1rS3hAPdeawf4Q7Zucz8_IKypZzFeAyTOE7yT5KRxaM,11264
|
210
208
|
khoj/interface/compiled/_next/static/chunks/d3ac728e-4c56e7f41db266b7.js,sha256=KH2S98yagVOcqDG836x8mxIFFjrq11AdYodjBurPvmg,268514
|
211
209
|
khoj/interface/compiled/_next/static/chunks/fd9d1056-aa94101ec5388dba.js,sha256=hlytZKRKDEm1va3Ww-mpo2P2lD-5pw78G2KS66tnJ28,172837
|
@@ -213,7 +211,7 @@ khoj/interface/compiled/_next/static/chunks/framework-8e0e0f4a6b83a956.js,sha256
|
|
213
211
|
khoj/interface/compiled/_next/static/chunks/main-app-de1f09df97a3cfc7.js,sha256=bqnztujKItXfFBzQlaBmDZyfJpQt_M93CXOuchJfpD0,471
|
214
212
|
khoj/interface/compiled/_next/static/chunks/main-fc8e0fefa2ef3d8c.js,sha256=t9FZIByh6V52m41LQ2yyAReF1CAuY7gLMBuWBeKCX2g,116793
|
215
213
|
khoj/interface/compiled/_next/static/chunks/polyfills-42372ed130431b0a.js,sha256=CXPB1kyIrcjjyVBBDLWLKI9yEY1ZZbeASUON648vloM,112594
|
216
|
-
khoj/interface/compiled/_next/static/chunks/webpack-
|
214
|
+
khoj/interface/compiled/_next/static/chunks/webpack-e572645654c4335e.js,sha256=lveg2ZZH06aQueHvy-P5GybLr0d4lhdaV3E50GKZY_s,4996
|
217
215
|
khoj/interface/compiled/_next/static/chunks/app/layout-c2de87a25fededbb.js,sha256=jcU3C37p73V24B118uVRQffNaQES9jihsTGYF4fZ_8o,3949
|
218
216
|
khoj/interface/compiled/_next/static/chunks/app/page-1567cac7b79a7c59.js,sha256=6NPvd5JerCoemwVeQyz7yVhvyEi6g4O62SgkhWhYi-g,29931
|
219
217
|
khoj/interface/compiled/_next/static/chunks/app/_not-found/page-84f94d15b2da4eac.js,sha256=zElhiTkdu2JqrEvJ8Lrxh4HCyfLmPllBHHWOuDtrVlw,1755
|
@@ -222,24 +220,24 @@ khoj/interface/compiled/_next/static/chunks/app/agents/page-e291b49977f43880.js,
|
|
222
220
|
khoj/interface/compiled/_next/static/chunks/app/automations/layout-8639ff99d6c2fec6.js,sha256=YyyuDO2d-3qEy6jBrihuQKxFAV9ki-mENrHq1XTzhvM,5148
|
223
221
|
khoj/interface/compiled/_next/static/chunks/app/automations/page-1047097af99d31c7.js,sha256=suOoMhVLJwWMjMWNmYwfQ-ZYr66777tMrpQHeKEeBvc,34764
|
224
222
|
khoj/interface/compiled/_next/static/chunks/app/chat/layout-2ff3e18a6feae92a.js,sha256=o4b4VL_8nN3WbUJ43qnXmgCTgnnGK8nBMRMu3VdCn38,5148
|
225
|
-
khoj/interface/compiled/_next/static/chunks/app/chat/page-
|
223
|
+
khoj/interface/compiled/_next/static/chunks/app/chat/page-ac7ed0a1aff1b145.js,sha256=-jmQIdaqtUU0yXLqaxAWNftI9kaNEA0VKyNKm73dmKk,31512
|
226
224
|
khoj/interface/compiled/_next/static/chunks/app/search/layout-78dd7cdd97510485.js,sha256=V8eklRDWZZFNY8FDN_wdlACutXubhyt8DlpK8zzDS04,175
|
227
225
|
khoj/interface/compiled/_next/static/chunks/app/search/page-3639e50ec3e9acfd.js,sha256=DFDpUem-27PpUEfqc72xv3zo7TcZpTFjvyXszZSGrNM,30929
|
228
226
|
khoj/interface/compiled/_next/static/chunks/app/settings/layout-f88cedfe9ad4df7c.js,sha256=aFBEgUCsKnoeyULmh7g-DmaznQ0ztcq6y2pj4bSMCIY,6132
|
229
227
|
khoj/interface/compiled/_next/static/chunks/app/settings/page-6081362437c82470.js,sha256=uRj3Vu_cQgTTagYpgVXuFUNA8RJnsnFdZWO5tolqUpo,27895
|
230
228
|
khoj/interface/compiled/_next/static/chunks/app/share/chat/layout-8addeb8079c3215b.js,sha256=9HNhAipADSO-NswdNEFpxeejr_iAPRxmaxWNkRu-Lio,175
|
231
|
-
khoj/interface/compiled/_next/static/chunks/app/share/chat/page-
|
229
|
+
khoj/interface/compiled/_next/static/chunks/app/share/chat/page-819c6536c15e3d31.js,sha256=m57T44OudNlebzaSmVHLpkrDxiCPw2CY4zpzBNSVvtY,5563
|
232
230
|
khoj/interface/compiled/_next/static/chunks/pages/_app-3c9ca398d360b709.js,sha256=UqtikLsCsOWtDUJOW6Tuk9P-bV1V3MhYd3ghrQuEmfs,286
|
233
231
|
khoj/interface/compiled/_next/static/chunks/pages/_error-cf5ca766ac8f493f.js,sha256=w_It3VzKT8O1M3CrJ_hZHsaU7M7dq3EAaVG8KvJ-fhU,253
|
234
|
-
khoj/interface/compiled/_next/static/css/
|
232
|
+
khoj/interface/compiled/_next/static/css/2945c4a857922f3b.css,sha256=ARp32IQvPZk88JXcPUb7fkM6WuvAEL1EqqGwhdnR2T8,9831
|
235
233
|
khoj/interface/compiled/_next/static/css/37a73b87f02df402.css,sha256=hp0vlekKu0K2eITR5YIqFmLHQPqV3JETFnRd_-Uh0mk,165
|
236
|
-
khoj/interface/compiled/_next/static/css/579820a104ee7d1d.css,sha256=w_hUafSMWFBgL0bN47w7UY-EsotgfcxXaZU3zBrKg3I,34833
|
237
234
|
khoj/interface/compiled/_next/static/css/5b28ced915454767.css,sha256=Bk56AIRHovIWNUw8QWvMbXIxxPiyWEiObkMA7RwpMrs,4842
|
235
|
+
khoj/interface/compiled/_next/static/css/5c7a72bad47e50b3.css,sha256=ZMNMhAG3iGhP67OKF9UDm2UF2eyyjtDDEN94lZSXVqM,3076179
|
238
236
|
khoj/interface/compiled/_next/static/css/76c658ee459140a9.css,sha256=7tI24VB66ZUsAPUxRdQhboopun0AXLUnF64uv9RkC08,1833
|
239
237
|
khoj/interface/compiled/_next/static/css/7889a30fe9c83846.css,sha256=IUkZhkx4GpYOIhN-EJw9T1DqGMO3Wa3mNpUwaOBuZoY,7204
|
240
|
-
khoj/interface/compiled/_next/static/css/821d0d60b0b6871d.css,sha256=340fHdvynnjkHvFJSnn04hPiqt7zUmLvse1uAwLoxXQ,9831
|
241
238
|
khoj/interface/compiled/_next/static/css/db7d90554f3ab82b.css,sha256=A3ZAf0StEG3sr_LxAIizczSTYRe1NbtNUpfslvmkqgk,17713
|
242
239
|
khoj/interface/compiled/_next/static/css/ea5485b3f3859a5a.css,sha256=tn6qi2xSLTWhtzDUE8UlC8iipH9QGV6A9oGj1ap-Sk4,1659
|
240
|
+
khoj/interface/compiled/_next/static/css/ecea704005ba630c.css,sha256=HnPHNgGRpsf5vMeaWDKyHdc5gywndymOt-RdB2BOtHE,35898
|
243
241
|
khoj/interface/compiled/_next/static/media/1d8a05b60287ae6c-s.p.woff2,sha256=IzKBwB_bpSGvO7C9aRv29Js-jAbZPRDI-D-P4H2P918,14508
|
244
242
|
khoj/interface/compiled/_next/static/media/2aa11a72f7f24b58-s.woff2,sha256=QjuuSKmViymmy-itXLB1UbSARxFNHWuMiPpCrYqClFI,22728
|
245
243
|
khoj/interface/compiled/_next/static/media/383a65b63658737d-s.woff2,sha256=VH1XkI87HdFVhsurH5D5ekEjG_ZORTVBVg6xz7p87C8,16704
|
@@ -317,8 +315,10 @@ khoj/interface/compiled/_next/static/media/flags.3afdda2f.webp,sha256=M2AW_HLpBn
|
|
317
315
|
khoj/interface/compiled/_next/static/media/flags@2x.5fbe9fc1.webp,sha256=BBeRPBZkxY3-aKkMnYv5TSkxmbeMbyUH4VRIPfrWg1E,137406
|
318
316
|
khoj/interface/compiled/_next/static/media/globe.98e105ca.webp,sha256=g3ofb8-W9GM75zIhlvQhaS8I2py9TtrovOKR3_7Jf04,514
|
319
317
|
khoj/interface/compiled/_next/static/media/globe@2x.974df6f8.webp,sha256=I_N7Yke3IOoS-0CC6XD8o0IUWG8PdPbrHmf6lpgWlZY,1380
|
320
|
-
khoj/interface/compiled/
|
321
|
-
khoj/interface/compiled/
|
318
|
+
khoj/interface/compiled/_next/static/yBzbL9kxl5BudSA9F4Gr6/_buildManifest.js,sha256=f2_nYnw25hHWQJ-39Lf5OH1u6kgdbOInyfplqgjvAV4,224
|
319
|
+
khoj/interface/compiled/_next/static/yBzbL9kxl5BudSA9F4Gr6/_ssgManifest.js,sha256=Z49s4suAsf5y_GfnQSvm4qtq2ggxEbZPfEDTXjy6XgA,80
|
320
|
+
khoj/interface/compiled/agents/index.html,sha256=tvJ-0OArXweAz4h_R6RRHFjB6YpCv2uVNmVoI9XKS_s,16535
|
321
|
+
khoj/interface/compiled/agents/index.txt,sha256=nrtjddeGqzR2gqmCOzKE8nD7pEAAO8QZDTyLindNubw,7353
|
322
322
|
khoj/interface/compiled/assets/icons/khoj_lantern.ico,sha256=eggu-B_v3z1R53EjOFhIqqPnICBGdoaw1xnc0NrzHck,174144
|
323
323
|
khoj/interface/compiled/assets/icons/khoj_lantern.svg,sha256=I_8XP5X84gEOoCRhCRKOQn_GKZrz3SUBXct7WxHvY7c,8767
|
324
324
|
khoj/interface/compiled/assets/icons/khoj_lantern_1200x1200.png,sha256=xDx0bbD-WMflgg8zck9oPIIuTIvywtuED2k7CjSQS4w,66194
|
@@ -333,16 +333,16 @@ khoj/interface/compiled/assets/samples/desktop-remember-plan-sample.png,sha256=i
|
|
333
333
|
khoj/interface/compiled/assets/samples/phone-browse-draw-sample.png,sha256=Dd4fPwtFl6BWqnHjeb1mCK_ND0hhHsWtx8sNE7EiMuE,406179
|
334
334
|
khoj/interface/compiled/assets/samples/phone-plain-chat-sample.png,sha256=DEDaNRCkfEWUeh3kYZWIQDTVK1a6KKnYdwj5ZWisN_Q,82985
|
335
335
|
khoj/interface/compiled/assets/samples/phone-remember-plan-sample.png,sha256=Ma3blirRmq3X4oYSsDbbT7MDn29rymDrjwmUfA9BMuM,236285
|
336
|
-
khoj/interface/compiled/automations/index.html,sha256=
|
337
|
-
khoj/interface/compiled/automations/index.txt,sha256=
|
338
|
-
khoj/interface/compiled/chat/index.html,sha256=
|
339
|
-
khoj/interface/compiled/chat/index.txt,sha256=
|
340
|
-
khoj/interface/compiled/search/index.html,sha256=
|
341
|
-
khoj/interface/compiled/search/index.txt,sha256=
|
342
|
-
khoj/interface/compiled/settings/index.html,sha256=
|
343
|
-
khoj/interface/compiled/settings/index.txt,sha256=
|
344
|
-
khoj/interface/compiled/share/chat/index.html,sha256=
|
345
|
-
khoj/interface/compiled/share/chat/index.txt,sha256=
|
336
|
+
khoj/interface/compiled/automations/index.html,sha256=O4q7mct5SxteeY_qR0Mo1bRp0tuObOZ5zbhiuuxoGPE,54405
|
337
|
+
khoj/interface/compiled/automations/index.txt,sha256=KCW-yN9hcoT4AXxyzba5tz4U-ukAucTO9FaabEYnRkg,7582
|
338
|
+
khoj/interface/compiled/chat/index.html,sha256=93HT0LChlRjKJq1LYZoHamkk5XDfI9HQSkOiEOG4VMI,54178
|
339
|
+
khoj/interface/compiled/chat/index.txt,sha256=jhYuPTCtQkGsZYrety3_iYAP57oGlSIKObUCwMpG_Bg,8189
|
340
|
+
khoj/interface/compiled/search/index.html,sha256=SXzTuNz8QMBnu5kEmcwwzQvZBZTxXSylNLf4Z5eQm6g,55611
|
341
|
+
khoj/interface/compiled/search/index.txt,sha256=wSbOSxKe69GhDcSM0QxYmM_NODiSSvMmqG3Y5NshGAA,6698
|
342
|
+
khoj/interface/compiled/settings/index.html,sha256=5HYtVqmMT8fAum2mKOBuCV_F4xKHTInraSauRTiX2LQ,53050
|
343
|
+
khoj/interface/compiled/settings/index.txt,sha256=af-vMKVP7SB_B5dJb-oJ2XmlR_zDFKXRdV33bakEe5I,7834
|
344
|
+
khoj/interface/compiled/share/chat/index.html,sha256=BSgwta_96CeVFOitj8ws_jdjStyZF-txhwyH1gxo7tg,54112
|
345
|
+
khoj/interface/compiled/share/chat/index.txt,sha256=14A7qVTfICFXkC64AvqhE7xhK7PpbjiCny8xrQjAaZ0,8453
|
346
346
|
khoj/interface/email/feedback.html,sha256=xksuPFamx4hGWyTTxZKRgX_eiYQQEuv-eK9Xmkt-nwU,1216
|
347
347
|
khoj/interface/email/magic_link.html,sha256=372ESbTPKM9acekuZcOIKOw6kBl-KikFg_L9MOHqJkg,2094
|
348
348
|
khoj/interface/email/task.html,sha256=tY7a0gzVeQ2lSQNu7WyXR_s7VYeWTrxWEj1iHVuoVE4,2813
|
@@ -388,16 +388,16 @@ khoj/processor/content/plaintext/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRk
|
|
388
388
|
khoj/processor/content/plaintext/plaintext_to_entries.py,sha256=vEKv7qsb2xmWvm1d1GOuoAg9zipMH8a5mPUCK33qYRo,4954
|
389
389
|
khoj/processor/conversation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
390
390
|
khoj/processor/conversation/prompts.py,sha256=eXLzvFE9o9DWR42-LPuRBUu9CPNsC3Lo8rO7ebW0Pj4,54115
|
391
|
-
khoj/processor/conversation/utils.py,sha256=
|
391
|
+
khoj/processor/conversation/utils.py,sha256=LPDUdTylMefosYCoR9Cb2WH0y7KIltnwEFLzViQIuxA,47874
|
392
392
|
khoj/processor/conversation/anthropic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
393
393
|
khoj/processor/conversation/anthropic/anthropic_chat.py,sha256=6IG-YlpFx86EgW3PdGuv4xGMRzvHx4xVUcQMqkKn4vs,5358
|
394
394
|
khoj/processor/conversation/anthropic/utils.py,sha256=Z7mz-LnunLHubZvdzNEAozlJxukl2eNoLvYzeYzsglc,16568
|
395
395
|
khoj/processor/conversation/google/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
396
|
-
khoj/processor/conversation/google/gemini_chat.py,sha256=
|
397
|
-
khoj/processor/conversation/google/utils.py,sha256=
|
396
|
+
khoj/processor/conversation/google/gemini_chat.py,sha256=Cf2MdOfW8JZLVbabrMy9KNMF-HVOAj0b62KAw-rPb-Y,5690
|
397
|
+
khoj/processor/conversation/google/utils.py,sha256=JSL5AGZpvq44fZH6gjf23pyf_FFXNd2OKcDzxTEfOQc,25570
|
398
398
|
khoj/processor/conversation/openai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
399
399
|
khoj/processor/conversation/openai/gpt.py,sha256=2PoQMB8mEJDW-5JK-dfCXvyB2POFV2hEJWITG0s64VU,7485
|
400
|
-
khoj/processor/conversation/openai/utils.py,sha256=
|
400
|
+
khoj/processor/conversation/openai/utils.py,sha256=RclwpXkAG8SrMsBP33PXA4HrZBxDb1SjoxX5nC3uUIM,55330
|
401
401
|
khoj/processor/conversation/openai/whisper.py,sha256=zoEeK1LNCg_tzP4xzYi5vRPzNPGuDGzpkrkG7d1LUn4,447
|
402
402
|
khoj/processor/image/generate.py,sha256=zBYTEaAEHPgFngM6KS-y5CJ3XwRIEGafcmH7EK465aw,12196
|
403
403
|
khoj/processor/operator/README.md,sha256=QaV00W1IB7i8ZrvhNkpjmFMVDtORFt-OASieRQGE_UE,2308
|
@@ -428,7 +428,7 @@ khoj/routers/api_phone.py,sha256=p9yfc4WeMHDC0hg3aQk60a2VBy8rZPdEnz9wdJ7DzkU,220
|
|
428
428
|
khoj/routers/api_subscription.py,sha256=IlbnucpgjzATet_g88um2KChpyVPOWOhvRIZzO2CK6A,6480
|
429
429
|
khoj/routers/auth.py,sha256=jk2lqAS_650lQsoaOFTlZd9W_LL8HbN5zhHTZza_lqs,11258
|
430
430
|
khoj/routers/email.py,sha256=0nDwbMeon5c-9s3tvj0-fB3IOPlJEnIaoU1t7HGlNnI,3917
|
431
|
-
khoj/routers/helpers.py,sha256=
|
431
|
+
khoj/routers/helpers.py,sha256=f3BBwNNxEkWKE0H32-jI3oPY6e7e7Y6R6rRAhBMEbrA,121368
|
432
432
|
khoj/routers/notion.py,sha256=g53xyYFmjr2JnuIrTW2vytbfkiK_UkoRTxqnnLSmD5o,2802
|
433
433
|
khoj/routers/research.py,sha256=JAKmrtIViNZ8HWKZAvgOsXF2hf0riHzC6yCOE-aD6GY,26452
|
434
434
|
khoj/routers/storage.py,sha256=lao0DvsF49QleZvOdjKM98RU2cGfCJDBb7WeoI7Rr3I,2172
|
@@ -444,7 +444,7 @@ khoj/search_type/text_search.py,sha256=wbvQgEs5tFbkZwZesyHqp-gi46j3GNQa7di6swhXM
|
|
444
444
|
khoj/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
445
445
|
khoj/utils/cli.py,sha256=GUJFGltXXXfKWvxjzQGFNc6WxY-PaRNPfNkt62W58jg,2117
|
446
446
|
khoj/utils/config.py,sha256=5dGQ-RcAKZWA3nqP1-2t8mdfB_rbf6xu0bBez4KbB9Y,322
|
447
|
-
khoj/utils/constants.py,sha256=
|
447
|
+
khoj/utils/constants.py,sha256=VbtG0RTX2DFWj2akBkfDcEzOcVavJg1r7pEowso3dzE,4512
|
448
448
|
khoj/utils/helpers.py,sha256=n_20DHM6-DG1N6cFIap1qqp-bt-9dvuQC2GDoISF07k,43536
|
449
449
|
khoj/utils/initialization.py,sha256=_qCa3Nospjg2F7c6CNQAU8Su8kD7bT6kyokVQW-4BoY,13121
|
450
450
|
khoj/utils/jsonl.py,sha256=0Ac_COqr8sLCXntzZtquxuCEVRM2c3yKeDRGhgOBRpQ,1192
|
@@ -452,8 +452,8 @@ khoj/utils/models.py,sha256=_7yEVUXXG59_2p8a0nbda2jzhpLkxnfMtlBYwi34U0k,1993
|
|
452
452
|
khoj/utils/rawconfig.py,sha256=uABGqIR3pIj5h7Tn-QvYuITB2ogrmi6waSv-KBq1Qc0,3533
|
453
453
|
khoj/utils/state.py,sha256=OwoWGeuz6O7nK-Pa98ADUScLz83GsK8ruyRYex9s3lw,1527
|
454
454
|
khoj/utils/yaml.py,sha256=I8FfdcmxYLSEOjJWgkQxxl_xlrU9Wg1HIuxKj3dWJtE,264
|
455
|
-
khoj-2.0.0b14.
|
456
|
-
khoj-2.0.0b14.
|
457
|
-
khoj-2.0.0b14.
|
458
|
-
khoj-2.0.0b14.
|
459
|
-
khoj-2.0.0b14.
|
455
|
+
khoj-2.0.0b14.dev51.dist-info/METADATA,sha256=CPvWaQt2UXJnpUKWZUPRrKhl6jgFJMDGn2f0dGb6g28,8961
|
456
|
+
khoj-2.0.0b14.dev51.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
457
|
+
khoj-2.0.0b14.dev51.dist-info/entry_points.txt,sha256=KBIcez5N_jCgq_ER4Uxf-e1lxTBMTE_BBjMwwfeZyAg,39
|
458
|
+
khoj-2.0.0b14.dev51.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
|
459
|
+
khoj-2.0.0b14.dev51.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),r=a(2265),l=a(48614),i=a(98239),c=a(91499),d=a.n(c),h=a(19983),u=a(13506),g=a.n(u),m=a(34040);a(2446);var f=a(37052),p=a(19273),x=a(3244),v=a(4235),j=a(66070),y=a(69304),w=a(57054),b=a(18848),M=a(42225),N=a(27648);let C=new h.Z({html:!0,linkify:!0,typographer:!0});function _(e){let t=(0,M.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(C.render(t)):b.Z.sanitize(t)}(e),[o,l]=(0,r.useState)(!1);return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(w.J2,{open:o&&!e.showFullContent,onOpenChange:l,children:[(0,n.jsx)(w.xo,{asChild:!0,children:(0,n.jsx)(j.Zb,{onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!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)(T,{type:"notes"},"".concat(e.title))})}),(0,n.jsx)(w.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,l,i;let c=(0,M.Le)(".py","!w-4 h-4 text-muted-foreground flex-shrink-0"),d=b.Z.sanitize(e.code),[h,u]=(0,r.useState)(!1),[g,m]=(0,r.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}),r=URL.createObjectURL(o),l=document.createElement("a");l.href=r,l.download=e.filename,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(r)},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)(w.J2,{open:h&&!e.showFullContent,onOpenChange:u,children:[(0,n.jsx)(w.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:[c,(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)(T,{type:"code"},"code-".concat(e.code))})}),(0,n.jsx)(w.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:[c,(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===(l=e.output_files)||void 0===l?void 0:l.length)>0&&x(null===(i=e.output_files)||void 0===i?void 0:i.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 R(e){let[t,a]=(0,r.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)(w.J2,{open:t&&!e.showFullContent,onOpenChange:a,children:[(0,n.jsx)(w.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)(T,{type:"online",link:e.link},e.title)})}),(0,n.jsx)(w.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 T(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)(O,{notesReferenceCardData:e.notesReferenceCardData,onlineReferenceCardData:e.onlineReferenceCardData,codeReferenceCardData:e.codeReferenceCardData,isMobileWidth:e.isMobileWidth})})]})})}function O(e){let[t,a]=(0,r.useState)(3);if((0,r.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),l=o.length+s.length<t?e.onlineReferenceCardData.filter(e=>e.link).slice(0,t-s.length-o.length):[];return(0,n.jsxs)(y.yo,{children:[(0,n.jsxs)(y.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,r.createElement)(k,{showFullContent:!1,...e,key:"code-".concat(t)})),o.map((e,t)=>(0,r.createElement)(_,{showFullContent:!1,...e,key:"".concat(e.title,"-").concat(t)})),l.map((e,t)=>(0,r.createElement)(R,{showFullContent:!1,...e,key:"".concat(e.title,"-").concat(t)})),(0,n.jsx)(v.o,{className:"m-0"})]}),(0,n.jsxs)(y.ue,{className:"overflow-y-scroll",children:[(0,n.jsxs)(y.Tu,{children:[(0,n.jsx)(y.bC,{children:"References"}),(0,n.jsx)(y.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,r.createElement)(k,{showFullContent:!0,...e,key:"code-".concat(t)})),e.notesReferenceCardData.map((e,t)=>(0,r.createElement)(_,{showFullContent:!0,...e,key:"".concat(e.title,"-").concat(t)})),e.onlineReferenceCardData.map((e,t)=>(0,r.createElement)(R,{showFullContent:!0,...e,key:"".concat(e.title,"-").concat(t)}))]})]})]})}var I=a(59199),S=a(24379),F=a(58441),L=a(49807),D=a(74541),B=a(52874),P=a(5033),z=a(30655),A=a(80382),q=a(7143),H=a(2585),U=a(58905),Z=a(39966),W=a(71640),V=a(24148),G=a(68382),J=a(78582),Q=a(96620),$=a(77276),K=a(39957),Y=a(14308),X=a(84671),ee=a(36663);let et=(0,a(30166).default)(()=>Promise.all([a.e(6555),a.e(7293),a.e(4609),a.e(2242)]).then(a.bind(a,92242)).then(e=>e.default),{loadableGenerated:{webpack:()=>[92242]},ssr:!1});function ea(e){return(0,n.jsx)(r.Suspense,{fallback:(0,n.jsx)(Y.Z,{}),children:(0,n.jsx)(et,{data:e.data})})}var en=a(26110),es=a(49027),eo=a(7436),er=a(19378),el=a(50656),ei=a(45199),ec=a(25778),ed=a(62869),eh=e=>{let{chart:t}=e,[a,s]=(0,r.useState)(null),[o]=(0,r.useState)("mermaid-chart-".concat(Math.random().toString(12).substring(7))),l=(0,r.useRef)(null);(0,r.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 i=async()=>{if(l.current)try{var e;let t=l.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 r=new XMLSerializer().serializeToString(t),i=new Blob([r],{type:"image/svg+xml;charset=utf-8"}),c=URL.createObjectURL(i),d=new Image;d.src=c,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(c),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,r.useEffect)(()=>{l.current&&(l.current.removeAttribute("data-processed"),el.Z.run({nodes:[l.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)(ei.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:l,className:"mermaid",style:{width:"auto",height:"auto",boxSizing:"border-box",overflow:"auto"},children:t}),!a&&(0,n.jsxs)(ed.z,{onClick:i,variant:"secondary",className:"mt-3",children:[(0,n.jsx)(ec.U,{className:"w-5 h-5"}),"Export as PNG"]})]})};let eu=new h.Z({html:!0,linkify:!0,typographer:!0});function eg(e,t,a){fetch("/api/chat/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({uquery:e,kquery:t,sentiment:a})})}function em(e){let{uquery:t,kquery:a}=e,[s,o]=(0,r.useState)(null);return(0,r.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:()=>{eg(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:()=>{eg(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 ef(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.gt,{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)(Z.A,{className:"".concat(s)}):(0,n.jsx)(L.a,{className:"".concat(s)})}(t?t[1]:"",e.primary?(0,X.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 r=b.Z.sanitize(eu.render(s));return r=r.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:r},className:"break-words"})]})}eu.use(g(),{inline:!0,code:!0});let ep=(0,r.forwardRef)((e,t)=>{var a,s;let o,l;let[i,c]=(0,r.useState)(!1),[h,u]=(0,r.useState)(!1),[g,f]=(0,r.useState)(""),[p,x]=(0,r.useState)(""),[v,j]=(0,r.useState)(!1),[y,w]=(0,r.useState)(!1),[N,C]=(0,r.useState)(""),[_,k]=(0,r.useState)(""),R=(0,r.useRef)(!1),T=(0,r.useRef)(null);function O(e){let t=new Date(e+"Z"),a=t.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0}).toUpperCase(),n=t.toLocaleString("en-US",{year:"numeric",month:"short",day:"2-digit"}).replaceAll("-"," ");return"".concat(a," on ").concat(n)}async function S(){let t=e.chatMessage.message.match(/[^.!?]+[.!?]*/g)||[];if(!t||0===t.length||!t[0])return;j(!0);let a=F(t[0]);for(let e=0;e<t.length&&!R.current;e++){let n=a;e<t.length-1&&(a=F(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}}j(!1),w(!1)}async function F(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,r.useEffect)(()=>{R.current=y},[y]),(0,r.useEffect)(()=>{let e=new MutationObserver((e,t)=>{if(T.current)for(let t of e)"childList"===t.type&&t.addedNodes.length>0&&(0,ee.Z)(T.current,{delimiters:[{left:"$$",right:"$$",display:!0},{left:"\\[",right:"\\]",display:!0},{left:"\\(",right:"\\)",display:!1}]})});return T.current&&e.observe(T.current,{childList:!0}),()=>e.disconnect()},[T.current]),(0,r.useEffect)(()=>{let t=e.chatMessage.message;e.chatMessage.excalidrawDiagram&&C(e.chatMessage.excalidrawDiagram),e.chatMessage.mermaidjsDiagram&&k(e.chatMessage.mermaidjsDiagram),t=t.replace(/\\\(/g,"LEFTPAREN").replace(/\\\)/g,"RIGHTPAREN").replace(/\\\[/g,"LEFTBRACKET").replace(/\\\]/g,"RIGHTBRACKET"),t=(0,I.AQ)(t,e.chatMessage.codeContext),e.chatMessage.codeContext&&Object.entries(e.chatMessage.codeContext).forEach(e=>{var a,n;let[s,o]=e;null===(n=o.results)||void 0===n||null===(a=n.output_files)||void 0===a||a.forEach(e=>{(e.filename.endsWith(".png")||e.filename.endsWith(".jpg"))&&!t.includes(")&&(t+="\n\n.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)=>".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(""),r='<div class="'.concat(d().imagesContainer,'">').concat(o,"</div>");a="".concat(s,"\n\n").concat(a),n="".concat(r).concat(n)}f(a);let s=eu.render(n);s=s.replace(/LEFTPAREN/g,"\\(").replace(/RIGHTPAREN/g,"\\)").replace(/LEFTBRACKET/g,"\\[").replace(/RIGHTBRACKET/g,"\\]"),x(b.Z.sanitize(s))},[e.chatMessage.message,e.chatMessage.images,e.chatMessage.intent]),(0,r.useEffect)(()=>{i&&setTimeout(()=>{c(!1)},2e3)},[i]),(0,r.useEffect)(()=>{T.current&&(T.current.querySelectorAll("pre > .hljs").forEach(e=>{if(!e.querySelector("".concat(d().codeCopyButton))){let t=document.createElement("button"),a=(0,n.jsx)(W.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,ee.Z)(T.current,{delimiters:[{left:"$$",right:"$$",display:!0},{left:"\\[",right:"\\]",display:!0},{left:"\\(",right:"\\)",display:!1}]}))},[p,h,T]);let L=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")},D=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=>{if(!e.compiled&&""!==e.compiled){let t=("string"==typeof e?e:null==e?"":String(e)).split("\n");return{title:t[0]&&t[0].trim()?t[0]:"(untitled)",content:t.slice(1).join("\n")}}return{title:e.file,content:e.compiled}});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=>u(!1),onMouseEnter:e=>u(!0),"data-created":O(e.chatMessage.created),children:[(0,n.jsxs)("div",{className:(s=e.chatMessage,(l=[d().chatMessageWrapper]).push(d()[s.by]),"khoj"===s.by&&l.push("border-l-4 border-opacity-50 ".concat("border-l-"+e.borderLeftColor)),l.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)(en.Vq,{children:[(0,n.jsx)(en.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,M.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,eo.xq)(e.size),")"]})]})}),(0,n.jsxs)(en.cZ,{children:[(0,n.jsx)(en.fK,{children:(0,n.jsx)(es.$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)(en.Be,{children:(0,n.jsx)(er.x,{className:"h-72 w-full rounded-md break-words break-all text-wrap",children:e.content})})]})]},t))}),(0,n.jsx)("div",{ref:T,className:d().chatMessage,dangerouslySetInnerHTML:{__html:p}}),N&&(0,n.jsx)(ea,{data:N}),_&&(0,n.jsx)(eh,{chart:_})]}),(0,n.jsx)("div",{className:d().teaserReferencesContainer,children:(0,n.jsx)(E,{isMobileWidth:e.isMobileWidth,notesReferenceCardData:D.notesReferenceCardData,onlineReferenceCardData:D.onlineReferenceCardData,codeReferenceCardData:D.codeReferenceCardData})}),(0,n.jsx)("div",{className:d().chatFooter,children:(h||e.isMobileWidth||e.isLastMessage||v)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{title:O(e.chatMessage.created),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&&(v?y?(0,n.jsx)(Y.l,{iconClassName:"p-0",className:"m-0"}):(0,n.jsx)("button",{title:"Pause Speech",onClick:e=>w(!0),children:(0,n.jsx)(G.d,{alt:"Pause Message",className:"hsl(var(--muted-foreground))"})}):(0,n.jsx)("button",{title:"Speak",onClick:e=>S(),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:()=>L(e.chatMessage),children:(0,n.jsx)(Q.r,{alt:"Delete Message",className:"hsl(var(--muted-foreground)) hover:text-red-500"})}),"khoj"===e.chatMessage.by&&e.onRetryMessage&&e.isLastMessage&&(0,n.jsx)("button",{title:"Retry",className:"".concat(d().retryButton),onClick:()=>{var t,a,n;let s=e.chatMessage.turnId||e.turnId,o=e.chatMessage.rawQuery||(null===(t=e.chatMessage.intent)||void 0===t?void 0:t.query);if(console.log("Retry button clicked for turnId:",s),console.log("ChatMessage data:",{rawQuery:e.chatMessage.rawQuery,intent:e.chatMessage.intent,message:e.chatMessage.message}),console.log("Extracted query:",o),o)null===(a=e.onRetryMessage)||void 0===a||a.call(e,o,s);else{console.error("No original query found for retry");let t=prompt("Enter the original query to retry:");t&&(null===(n=e.onRetryMessage)||void 0===n||n.call(e,t,s))}},children:(0,n.jsx)($._,{alt:"Retry Message",className:"hsl(var(--muted-foreground)) hover:text-blue-500"})}),(0,n.jsx)("button",{title:"Copy",className:"".concat(d().copyButton),onClick:()=>{navigator.clipboard.writeText(g),c(!0)},children:i?(0,n.jsx)(K.C,{alt:"Copied Message",weight:"fill",className:"text-green-500"}):(0,n.jsx)(K.C,{alt:"Copy Message",className:"hsl(var(--muted-foreground)) hover:text-green-500"})}),"khoj"===e.chatMessage.by&&(e.chatMessage.intent?(0,n.jsx)(em,{uquery:e.chatMessage.intent.query,kquery:e.chatMessage.message}):(0,n.jsx)(em,{uquery:e.chatMessage.rawQuery||e.chatMessage.message,kquery:e.chatMessage.message}))]})]})})]})});ep.displayName="ChatMessage";var ex=a(17104),ev=a(66142),ej=a(25397),ey=a(44849),ew=a.n(ey);function eb(e){let{frames:t,autoPlay:a=!0,playbackSpeed:s=1e3}=e,[o,l]=(0,r.useState)(0),[i,c]=(0,r.useState)(a),[d,h]=(0,r.useState)(!0),u=(0,r.useRef)(null);(0,r.useEffect)(()=>{d&&t.length>0&&l(t.length-1)},[t.length,d]),(0,r.useEffect)(()=>(i&&t.length>1?u.current=setInterval(()=>{l(e=>{let a=e+1;return a>=t.length?(c(!1),e):a})},s):u.current&&(clearInterval(u.current),u.current=null),()=>{u.current&&clearInterval(u.current)}),[i,t.length,s]);let g=t[o],m=e=>{l(e),h(!1),c(!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&&(l(o-1),h(!1),c(!1))},disabled:0===o,title:"Previous frame",className:ew().controlButton,children:(0,n.jsx)(ex.F,{size:16})}),(0,n.jsx)("button",{onClick:()=>{c(!i),h(!1)},disabled:t.length<=1,title:i?"Pause":"Play",className:ew().controlButton,children:i?(0,n.jsx)(G.d,{size:16}):(0,n.jsx)(ev.s,{size:16})}),(0,n.jsx)("button",{onClick:()=>{o<t.length-1&&(l(o+1),h(!1),c(!1))},disabled:o===t.length-1,title:"Next frame",className:ew().controlButton,children:(0,n.jsx)(ej.N,{size:16})}),(0,n.jsx)("button",{onClick:()=>{h(!0),l(t.length-1),c(!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 eM=a(72102),eN=a(23713),eC=a(795),e_=a(935),ek=a(81103),eR=e=>{let{name:t,avatar:a,link:s,description:o}=e;return(0,n.jsx)("div",{className:"relative group flex",children:(0,n.jsx)(ek.pn,{children:(0,n.jsxs)(ek.u,{delayDuration:0,children:[(0,n.jsx)(ek.aJ,{asChild:!0,children:(0,n.jsxs)(ed.z,{variant:"ghost",className:"flex items-center justify-center",children:[a,(0,n.jsx)("div",{children:t})]})}),(0,n.jsx)(ek._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"})]})})]})})})},eT=a(37104);function eE(e){let[t,a]=(0,r.useState)(e.completed),[s,c]=(0,r.useState)([]);return(0,r.useEffect)(()=>{e.completed&&a(!0)},[e.completed]),(0,r.useEffect)(()=>{if(!e.trainOfThought||0===e.trainOfThought.length){c([]);return}c(function(e){if(!e)return[];let t=[],a=[],n=[];return e.forEach((e,s)=>{let o=e.data,r=!1;try{let e=o.match(/\{.*(\"action\": \"screenshot\"|\"type\": \"screenshot\"|\"image\": \"data:image\/.*\").*\}/);if(e){let l=JSON.parse(e[0]);l.image&&(r=!0,o=o.replace(":\n**Action**: ".concat(e[0]),""),l.text&&(o+="\n\n".concat(l.text)),n.length>0&&(t.push({type:"text",textEntries:[...n]}),n=[]),a.push({text:o,image:l.image,timestamp:s}))}}catch(e){console.error("Failed to parse screenshot data",e)}r||(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)(Y.l,{className:"float-right"}),e.completed&&(t?(0,n.jsxs)(ed.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)(eM.p,{size:16,className:"ml-1"})]}):(0,n.jsxs)(ed.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)(eN.U,{size:16,className:"ml-1"})]})),(0,n.jsx)(l.M,{initial:!1,children:!t&&(0,n.jsx)(i.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)(eb,{frames:t.frames,autoPlay:!1,playbackSpeed:1500}),"text"===t.type&&t.textEntries&&t.textEntries.map((o,r)=>{let l=s.length-1,i=r===t.textEntries.length-1,c=a===l&&i&&e.lastMessage&&!e.completed;return(0,n.jsx)(ef,{message:o.data,primary:c,agentColor:e.agentColor},"train-text-".concat(a,"-").concat(r,"-").concat(o.data.length))})]},"train-group-".concat(a)))})})]},e.keyId)}function eO(e){var t,a,s,l,i,c,d;let[h,u]=(0,r.useState)(null),[g,m]=(0,r.useState)(0),[f,p]=(0,r.useState)(!0),[x,v]=(0,r.useState)(null),j=(0,r.useRef)(null),y=(0,r.useRef)(null),w=(0,r.useRef)(null),b=(0,r.useRef)(null),N=(0,r.useRef)(null),[C,_]=(0,r.useState)(null),[k,R]=(0,r.useState)(!1),[T,E]=(0,r.useState)(!0),O=(0,eo.IC)(),I="[data-radix-scroll-area-viewport]",S=localStorage.getItem("message");(0,r.useEffect)(()=>{var e;let t=null===(e=y.current)||void 0===e?void 0:e.querySelector(I);if(!t)return;let a=()=>{let{scrollTop:e,scrollHeight:a,clientHeight:n}=t;E(a-(e+n)<=50)};return t.addEventListener("scroll",a),a(),()=>t.removeEventListener("scroll",a)},[y]),(0,r.useEffect)(()=>{e.incomingMessages&&e.incomingMessages.length>0&&T&&L(!0)},[e.incomingMessages,T]),(0,r.useEffect)(()=>{var t;let a=w.current,n=null===(t=y.current)||void 0===t?void 0:t.querySelector(I);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!==C)&&L(!0)}});return s.observe(a),()=>s.disconnect()},[e.incomingMessages,C,y]),(0,r.useEffect)(()=>{h&&h.chat&&h.chat.length>0&&g<2&&requestAnimationFrame(()=>{var e;null===(e=b.current)||void 0===e||e.scrollIntoView({behavior:"auto",block:"start"})})},[h,g]),(0,r.useEffect)(()=>{if(!f||k)return;let t=new IntersectionObserver(t=>{t[0].isIntersecting&&f&&(R(!0),function(t){if(!f||k)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(m(Math.ceil(a.response.chat.length/10)),a.response.chat.length===(null==h?void 0:h.chat.length)){p(!1),R(!1);return}e.setAgent(a.response.agent),u(a.response),R(!1),0===t?L(!0):F()}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),u(t),e.setIsChatSideBarOpen&&!S&&e.setIsChatSideBarOpen(!0)}p(!1),R(!1)}}).catch(e=>{console.error(e),window.location.href="/"})}(g))},{threshold:1});return j.current&&t.observe(j.current),()=>t.disconnect()},[f,g,k]),(0,r.useEffect)(()=>{p(!0),R(!1),m(0),u(null)},[e.conversationId]),(0,r.useEffect)(()=>{if(e.incomingMessages){let t=e.incomingMessages[e.incomingMessages.length-1];t&&!t.completed&&(_(e.incomingMessages.length-1),e.setTitle(t.rawQuery),t.turnId&&v(t.turnId))}},[e.incomingMessages]);let F=()=>{var e;let t=null===(e=y.current)||void 0===e?void 0:e.querySelector(I);requestAnimationFrame(()=>{var e;null===(e=N.current)||void 0===e||e.scrollIntoView({behavior:"auto",block:"start"}),null==t||t.scrollBy({behavior:"smooth",top:-150})})},L=function(){var e;let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=null===(e=y.current)||void 0===e?void 0:e.querySelector(I);requestAnimationFrame(()=>{null==a||a.scrollTo({top:a.scrollHeight,behavior:t?"auto":"smooth"})}),(t||a&&a.scrollHeight-(a.scrollTop+a.clientHeight)<5)&&E(!0)};function D(){var e,t;return h&&h.agent&&(null===(e=h.agent)||void 0===e?void 0:e.name)?h.agent.is_hidden?"Khoj":null===(t=h.agent)||void 0===t?void 0:t.name:"Agent"}let B=t=>{t&&(u(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)))},P=(t,a)=>{var n;t&&(a&&B(a),null===(n=e.onRetryMessage)||void 0===n||n.call(e,t,a))};return e.conversationId||e.publicConversationSlug?(0,n.jsx)(er.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.44))]\n ",ref:y,children:(0,n.jsxs)("div",{ref:w,children:[(0,n.jsxs)("div",{className:"print-only-header",children:[(0,n.jsxs)("div",{className:"print-header-content",children:[(0,n.jsx)("div",{className:"print-header-left",children:(0,n.jsx)(eT.S6,{className:"print-logo"})}),(0,n.jsxs)("div",{className:"print-header-right",children:[(0,n.jsx)("h1",{children:(null==h?void 0:h.slug)||"Conversation with Khoj"}),(0,n.jsx)("div",{className:"conversation-meta",children:(0,n.jsxs)("p",{children:[(0,n.jsx)("strong",{children:"Agent:"})," ",D()]})})]})]}),(0,n.jsx)("hr",{})]}),(0,n.jsxs)("div",{className:"".concat(o().chatHistory," ").concat(e.customClassName),children:[(0,n.jsx)("div",{ref:j,style:{height:"1px"},children:k&&(0,n.jsx)(Y.l,{className:"opacity-50"})}),h&&h.chat&&h.chat.map((t,a)=>{var s,o;return(0,n.jsxs)(r.Fragment,{children:[t.trainOfThought&&"khoj"===t.by&&(0,n.jsx)(eE,{trainOfThought:t.trainOfThought,lastMessage:!1,agentColor:(null==h?void 0:null===(s=h.agent)||void 0===s?void 0:s.color)||"orange",keyId:"".concat(a,"trainOfThought"),completed:!0},"".concat(a,"trainOfThought")),(0,n.jsx)(ep,{ref:a===h.chat.length-2?b:a===h.chat.length-(g-1)*10?N:null,isMobileWidth:O,chatMessage:t,customClassName:"fullHistory",borderLeftColor:"".concat(null==h?void 0:null===(o=h.agent)||void 0===o?void 0:o.color,"-500"),isLastMessage:a===h.chat.length-1,onDeleteMessage:B,onRetryMessage:P,conversationId:e.conversationId},"".concat(a,"fullHistory"))]},"chatMessage-".concat(a))}),e.incomingMessages&&e.incomingMessages.map((t,a)=>{var s,o,l,i,c;let d=null!==(c=null!==(i=t.turnId)&&void 0!==i?i:x)&&void 0!==c?c:void 0;return(0,n.jsxs)(r.Fragment,{children:[(0,n.jsx)(ep,{isMobileWidth:O,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==h?void 0:null===(s=h.agent)||void 0===s?void 0:s.color,"-500"),onDeleteMessage:B,onRetryMessage:P,conversationId:e.conversationId,turnId:d},"".concat(a,"outgoing")),t.trainOfThought&&t.trainOfThought.length>0&&(0,n.jsx)(eE,{trainOfThought:t.trainOfThought,lastMessage:a===C,agentColor:(null==h?void 0:null===(o=h.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)(ep,{isMobileWidth:O,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:B,onRetryMessage:P,customClassName:"fullHistory",borderLeftColor:"".concat(null==h?void 0:null===(l=h.agent)||void 0===l?void 0:l.color,"-500"),isLastMessage:a===e.incomingMessages.length-1},"".concat(a,"incoming"))]},"incomingMessage".concat(a))}),e.pendingMessage&&(0,n.jsx)(ep,{isMobileWidth:O,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:B,onRetryMessage:P,customClassName:"fullHistory",borderLeftColor:"".concat(null==h?void 0:null===(t=h.agent)||void 0===t?void 0:t.color,"-500"),isLastMessage:!0},"pendingMessage-".concat(e.pendingMessage.length)),h&&(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)(eR,{name:D(),link:h&&h.agent&&(null===(l=h.agent)||void 0===l?void 0:l.slug)?"/agents?agent=".concat(null===(i=h.agent)||void 0===i?void 0:i.slug):"/agents",avatar:(0,M.TI)(null===(a=h.agent)||void 0===a?void 0:a.icon,null===(s=h.agent)||void 0===s?void 0:s.color)||(0,n.jsx)(eC.v,{}),description:h&&h.agent?(null===(c=h.agent)||void 0===c?void 0:c.persona)?null===(d=h.agent)||void 0===d?void 0:d.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:!T&&(0,n.jsx)("button",{title:"Scroll to bottom",className:"absolute bottom-0 right-0 bg-white dark:bg-[hsl(var(--background))] text-neutral-500 dark:text-white p-2 rounded-full shadow-xl",onClick:()=>{L()},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",retryButton:"chatMessage_retryButton__Z7Pzk",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([[1929],{39929:function(e,t,s){Promise.resolve().then(s.bind(s,42780))},42780:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return ec}});var a=s(57437),n=s(63136),i=s.n(n),l=s(2265),r=s(2208),o=s(27127),d=s(99376),c=s(14308),u=s(59199);s(2446);var h=s(7436),m=s(5477),f=s(56937),x=s(55287),p=s(60729),g=s(34124),j=s(6512),v=s(37104),N=s(62869),y=s(91890),b=s(77992),w=s(68772),_=s(79603),S=s(23594),C=s(34153),O=s(43551),k=s(32046),I=s(5223),T=s(76818),M=s(75256),E=s(24148),A=s(94508),z=s(23518),B=s(57054),R=s(16605);let L=R.fC,F=R.xz,P=l.forwardRef((e,t)=>{let{className:s,align:n="center",sideOffset:i=4,...l}=e;return(0,a.jsx)(R.VY,{ref:t,align:n,sideOffset:i,className:(0,A.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",s),...l})});P.displayName=R.VY.displayName;var D=s(54036);function W(e){var t,s;let{...n}=e,[i,r]=l.useState(!1),[o,d]=(0,l.useState)(void 0),[c,u]=(0,l.useState)(void 0),{data:m,error:x,isLoading:p}=(0,f.h2)(!0),[g,j]=(0,l.useState)([]),v=(0,h.IC)();return((0,l.useEffect)(()=>{if(!p&&m){if(j(m.chat_model_options),n.initialModel)u(m.chat_model_options.find(e=>e.name===n.initialModel));else{let e=m.chat_model_options.find(e=>e.id===m.selected_chat_model_config);!e&&m.chat_model_options.length>0?u(m.chat_model_options[0]):u(e)}}},[m,n.initialModel,p]),(0,l.useEffect)(()=>{c&&m&&n.onSelect(c)},[c,m,n.onSelect]),p)?(0,a.jsx)(D.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)(B.J2,{open:i,onOpenChange:r,...n,children:[(0,a.jsx)(B.xo,{asChild:!0,children:(0,a.jsxs)(N.z,{variant:"outline",role:"combobox","aria-expanded":i,"aria-label":"Select a model",className:"w-full justify-between text-left",disabled:null!==(s=n.disabled)&&void 0!==s&&s,children:[(0,a.jsx)("p",{className:"truncate",children:c?null===(t=c.name)||void 0===t?void 0:t.substring(0,20):"Select a model..."}),(0,a.jsx)(M.K,{className:"opacity-50"})]})}),(0,a.jsx)(B.yk,{align:"end",className:"w-[250px] p-0",children:v?(0,a.jsx)("div",{children:(0,a.jsx)(z.mY,{loop:!0,children:(0,a.jsxs)(z.e8,{className:"h-[var(--cmdk-list-height)]",children:[(0,a.jsx)(z.sZ,{placeholder:"Search Models..."}),(0,a.jsx)(z.rb,{children:"No Models found."}),(0,a.jsx)(z.fu,{heading:"Models",children:g&&g.length>0&&g.map(e=>(0,a.jsx)(Z,{model:e,isSelected:(null==c?void 0:c.id)===e.id,onPeek:e=>d(e),onSelect:()=>{u(e),r(!1)},isActive:n.isActive},e.id))},"models")]})})}):(0,a.jsxs)(L,{children:[(0,a.jsx)(P,{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)(F,{}),(0,a.jsx)(z.mY,{loop:!0,children:(0,a.jsxs)(z.e8,{className:"h-[var(--cmdk-list-height)]",children:[(0,a.jsx)(z.sZ,{placeholder:"Search Models..."}),(0,a.jsx)(z.rb,{children:"No Models found."}),(0,a.jsx)(z.fu,{heading:"Models",children:g&&g.length>0&&g.map(e=>(0,a.jsx)(Z,{model:e,isSelected:(null==c?void 0:c.id)===e.id,onPeek:e=>d(e),onSelect:()=>{u(e),r(!1)},isActive:n.isActive},e.id))},"models")]})})]})]})})]})})}function Z(e){let{model:t,isSelected:s,onSelect:n,onPeek:i,isActive:r}=e,o=l.useRef(null);return(0,h.Iy)(o,e=>{e.forEach(e=>{var s;"attributes"===e.type&&"aria-selected"===e.attributeName&&(null===(s=o.current)||void 0===s?void 0:s.getAttribute("aria-selected"))==="true"&&i(t)})}),(0,a.jsxs)(z.di,{onSelect:n,ref:o,className:"data-[selected=true]:bg-muted data-[selected=true]:text-secondary-foreground",disabled:!r&&"free"!==t.tier,children:[t.name," ","standard"===t.tier&&(0,a.jsx)("span",{className:"text-green-500 ml-2",children:"(Futurist)"}),(0,a.jsx)(E.J,{className:(0,A.cn)("ml-auto",s?"opacity-100":"opacity-0")})]},t.id)}var J=s(17200),V=s(6952),U=s(69304),K=s(42225),H=s(26815),G=s(9270),Q=s(30401);let q=l.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,a.jsx)(G.fC,{ref:t,className:(0,A.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",s),...n,children:(0,a.jsx)(G.z$,{className:(0,A.cn)("flex items-center justify-center text-current"),children:(0,a.jsx)(Q.Z,{className:"h-4 w-4"})})})});q.displayName=G.fC.displayName;var Y=s(81103),$=s(61312),X=s(26110),ee=s(53647),et=s(84671),es=s(95186),ea=s(27648),en=s(98239);let ei=e=>fetch(e).then(e=>e.json());function el(e){let{...t}=e;return t.isMobileWidth?(0,a.jsx)(U.yo,{open:t.isOpen,onOpenChange:t.onOpenChange,children:(0,a.jsx)(U.ue,{className:"w-[300px] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",children:(0,a.jsx)(eo,{...t})})}):(0,a.jsx)("div",{className:"relative",children:(0,a.jsx)(eo,{...t})})}function er(e){let t=(0,K.BI)(),s=et.xF,[n,i]=(0,l.useState)(!1),[r,o]=(0,l.useState)(),[d,c]=(0,l.useState)(),[u,h]=(0,l.useState)(),[m,f]=(0,l.useState)(!1),[x,p]=(0,l.useState)(),[g,j]=(0,l.useState)(!1),[v,y]=(0,l.useState)();return(0,l.useEffect)(()=>{r&&d&&u?j(!0):j(!1)},[r,d,u]),(0,a.jsxs)(X.Vq,{children:[(0,a.jsx)(X.hg,{asChild:!0,children:(0,a.jsx)(N.z,{className:"w-full",variant:"secondary",children:"Create Agent"})}),(0,a.jsxs)(X.cZ,{children:[(0,a.jsxs)(X.fK,{children:[m&&x?(0,a.jsxs)(X.$N,{children:["Created ",r]}):(0,a.jsx)(X.$N,{children:"Create a New Agent"}),(0,a.jsx)(X.GG,{}),(0,a.jsx)(X.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:m&&x?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center gap-4 py-8",children:[(0,a.jsx)(en.E.div,{initial:{scale:0},animate:{scale:1},transition:{type:"spring",stiffness:260,damping:20},children:(0,a.jsx)(w.f,{className:"w-16 h-16 text-green-500",weight:"fill"})}),(0,a.jsx)(en.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)(en.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.4},children:(0,a.jsx)(ea.default,{href:"/agents?agent=".concat(x),children:(0,a.jsx)(N.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)(H._,{htmlFor:"agent_name",children:"Name"}),(0,a.jsx)(es.I,{id:"agent_name",className:"w-full p-2 border mt-4 border-slate-500 rounded-lg",disabled:n,value:r,onChange:e=>o(e.target.value)})]}),(0,a.jsxs)("div",{className:"flex gap-4",children:[(0,a.jsx)("div",{className:"flex-1",children:(0,a.jsxs)(ee.Ph,{onValueChange:h,defaultValue:u,children:[(0,a.jsx)(ee.i4,{className:"w-full dark:bg-muted",disabled:n,children:(0,a.jsx)(ee.ki,{placeholder:"Color"})}),(0,a.jsx)(ee.Bw,{className:"items-center space-y-1 inline-flex flex-col",children:s.map(e=>(0,a.jsx)(ee.Ql,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(_.C,{className:"w-6 h-6 mr-2 ".concat((0,et.oz)(e)),weight:"fill"}),e]})},e))})]})}),(0,a.jsx)("div",{className:"flex-1",children:(0,a.jsxs)(ee.Ph,{onValueChange:c,defaultValue:d,children:[(0,a.jsx)(ee.i4,{className:"w-full dark:bg-muted",disabled:n,children:(0,a.jsx)(ee.ki,{placeholder:"Icon"})}),(0,a.jsx)(ee.Bw,{className:"items-center space-y-1 inline-flex flex-col",children:t.map(e=>(0,a.jsx)(ee.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)(X.cN,{children:[v&&(0,a.jsx)("div",{className:"text-red-500 text-sm",children:v}),!m&&(0,a.jsxs)(N.z,{type:"submit",onClick:()=>void(!n&&(i(!0),fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:r,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){y("Error creating agent: ".concat(e.detail)),i(!1);return}f(!0),p(e.slug),i(!1)}).catch(e=>{console.error("Error:",e),y("Error creating agent: ".concat(e)),i(!1)}))),disabled:n||!g,children:[n?(0,a.jsx)(S.U,{className:"animate-spin"}):(0,a.jsx)(C.R,{}),"Create"]}),(0,a.jsx)(X.GG,{})]})]})]})}function eo(e){var t,s,n,i,r;let{...o}=e,[d,c]=(0,l.useState)(!1),{data:u,error:h}=(0,J.ZP)("/api/agents/options",ei),{data:m,isLoading:g,error:j}=(0,J.ZP)("/api/agents/conversation?conversation_id=".concat(o.conversationId),ei),{data:v,error:y,isLoading:b}=(0,f.GW)(),[w,_]=(0,l.useState)(),[C,M]=(0,l.useState)(),[E,A]=(0,l.useState)(),[z,R]=(0,l.useState)(),[L,F]=(0,l.useState)(!1),[P,D]=(0,l.useState)(!m||(null==m?void 0:null===(t=m.slug)||void 0===t?void 0:t.toLowerCase())==="khoj"),[Z,U]=(0,l.useState)(),[G,Q]=(0,l.useState)(),[X,ee]=(0,l.useState)(!1),et=null!==(s=null==v?void 0:v.is_active)&&void 0!==s&&s;function es(){if(m){var e,t;A(m.input_tools),U(m.input_tools),(void 0===m.input_tools||0===m.input_tools.length)&&U((null==u?void 0:u.input_tools)?Object.keys(u.input_tools):[]),R(m.output_modes),Q(m.output_modes),(void 0===m.output_modes||0===m.output_modes.length)&&Q((null==u?void 0:u.output_modes)?Object.keys(u.output_modes):[]),((null===(e=m.name)||void 0===e?void 0:e.toLowerCase())==="khoj"||!0===m.is_hidden)&&c(!0),(null===(t=m.slug)||void 0===t?void 0:t.toLowerCase())==="khoj"?(M(void 0),_(void 0),D(!0)):(D(!1),_(m.persona),M(m.chat_model))}}function ea(e,t){return t.includes(e)?t.filter(t=>t!==e):[...t,e]}return(0,l.useEffect)(()=>{es(),F(!1)},[m]),(0,l.useEffect)(()=>{var e,t;if(!m||g)return;let s=!!C&&C!==m.chat_model,a=!!w&&w!==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==z?void 0:z.sort())||[])!==JSON.stringify(null===(t=m.output_modes)||void 0===t?void 0:t.sort());F(s||a||n||i)},[C,w,E,z,m,g]),(0,a.jsxs)(p.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)(p.TZ,{children:[(0,a.jsx)(p.$l,{children:m&&!d?(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)(p.Hz,{className:"border-b last:border-none",children:(0,a.jsx)(p.Ks,{className:"gap-0",children:(0,a.jsx)(p.w3,{className:"p-0 m-0",children:m&&m.has_files?(0,a.jsx)(p.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)(O.J,{})}),(0,a.jsx)("div",{className:"text-muted-foreground text-sm",children:"Using custom knowledge base"})]})},"agent_knowledge"):null})})},"knowledge"),(0,a.jsx)(p.Hz,{children:(0,a.jsxs)(p.Ks,{children:[(0,a.jsx)(p.nO,{children:"Instructions"}),(0,a.jsx)(p.w3,{className:"p-0 m-0",children:(0,a.jsx)(p.LO,{className:"list-none",children:(0,a.jsx)(T.g,{className:"w-full h-32 resize-none hover:resize-y",value:w||"",onChange:e=>{_(e.target.value)},readOnly:!d,disabled:!d})})})]})},"instructions"),!g&&m&&(0,a.jsx)(p.Hz,{children:(0,a.jsxs)(p.Ks,{children:[(0,a.jsxs)(p.nO,{children:["Model",!et&&(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)(p.w3,{className:"p-0 m-0",children:(0,a.jsx)(p.LO,{className:"list-none",children:(0,a.jsx)(W,{disabled:!d,onSelect:e=>{M(e.name)},initialModel:P?void 0:null==m?void 0:m.chat_model,isActive:o.isActive})},"model")})]})},"model"),(0,a.jsx)(B.J2,{defaultOpen:!1,children:(0,a.jsxs)(p.Hz,{children:[(0,a.jsx)(p.nO,{asChild:!0,children:(0,a.jsxs)(B.xo,{children:["Tools",(0,a.jsx)(k._,{className:"ml-auto transition-transform group-data-[state=open]/collapsible:rotate-180"})]})}),(0,a.jsx)(B.yk,{children:(0,a.jsx)(p.Ks,{children:(0,a.jsxs)(p.w3,{className:"p-1 m-0",children:[Object.entries(null!==(n=null==u?void 0:u.input_tools)&&void 0!==n?n:{}).map(e=>{let[t,s]=e;return(0,a.jsx)(p.LO,{className:"list-none",children:(0,a.jsxs)(Y.u,{children:[(0,a.jsx)(Y.aJ,{asChild:!0,children:(0,a.jsxs)("div",{className:"flex items-center space-x-2 py-1 justify-between",children:[(0,a.jsxs)(H._,{htmlFor:t,className:"flex items-center gap-2 text-accent-foreground p-1 cursor-pointer",children:[(0,K.vH)(t),(0,a.jsx)("p",{className:"text-sm my-auto flex items-center",children:t})]}),(0,a.jsx)(q,{id:t,className:"".concat(d?"cursor-pointer":""),checked:(null!=Z?Z:[]).includes(t),onCheckedChange:()=>{let e=ea(t,null!=Z?Z:[]);A(e),U(e)},disabled:!d,children:t})]})},t),(0,a.jsx)($._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:s})]})},t)}),Object.entries(null!==(i=null==u?void 0:u.output_modes)&&void 0!==i?i:{}).map(e=>{let[t,s]=e;return(0,a.jsx)(p.LO,{className:"list-none",children:(0,a.jsxs)(Y.u,{children:[(0,a.jsx)(Y.aJ,{asChild:!0,children:(0,a.jsxs)("div",{className:"flex items-center space-x-2 py-1 justify-between",children:[(0,a.jsxs)(H._,{htmlFor:t,className:"flex items-center gap-2 p-1 rounded-lg cursor-pointer",children:[(0,K.vH)(t),(0,a.jsx)("p",{className:"text-sm my-auto flex items-center",children:t})]}),(0,a.jsx)(q,{id:t,className:"".concat(d?"cursor-pointer":""),checked:(null!=G?G:[]).includes(t),onCheckedChange:()=>{let e=ea(t,null!=G?G:[]);R(e),Q(e)},disabled:!d,children:t})]})},t),(0,a.jsx)($._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:s})]})},t)})]})})})]})}),(0,a.jsx)(p.Hz,{children:(0,a.jsxs)(p.Ks,{children:[(0,a.jsx)(p.nO,{children:"Files"}),(0,a.jsx)(p.w3,{className:"p-0 m-0",children:(0,a.jsx)(p.LO,{className:"list-none",children:(0,a.jsx)(x.J_,{conversationId:o.conversationId,uploadedFiles:[],isMobileWidth:null!==(r=o.isMobileWidth)&&void 0!==r&&r})},"files-conversation")})]})},"files")]}),o.isOpen&&(0,a.jsx)(p.ZW,{children:(0,a.jsx)(p.w3,{className:"p-0 m-0",children:m&&!d&&m.is_creator?(0,a.jsx)(p.LO,{children:(0,a.jsx)(p.bb,{asChild:!0,children:(0,a.jsx)(N.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&&d&&w&&!P&&C&&(0,a.jsx)(p.LO,{children:(0,a.jsx)(p.bb,{asChild:!0,children:(0,a.jsx)(er,{customPrompt:w,selectedModel:C,inputTools:null!=Z?Z:[],outputModes:null!=G?G:[]})})}),(0,a.jsx)(p.LO,{children:(0,a.jsx)(p.bb,{asChild:!0,children:(0,a.jsx)(N.z,{className:"w-full",onClick:()=>void(es(),F(!1)),variant:"ghost",disabled:!d||!L,children:"Reset"})})}),(0,a.jsx)(p.LO,{children:(0,a.jsx)(p.bb,{asChild:!0,children:(0,a.jsxs)(N.z,{className:"w-full ".concat(L?"bg-accent-foreground text-accent":""),variant:"secondary",onClick:()=>(function(){if(L){if(!P&&(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";P&&(e="POST");let t={persona:w,chat_model:C,input_tools:E,output_modes:z,...P?{}:{slug:null==m?void 0:m.slug}};ee(!0),fetch(P?"/api/agents/hidden?conversation_id=".concat(o.conversationId):"/api/agents/hidden",{method:e,headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then(e=>{ee(!1),e.json()}).then(e=>{(0,V.j)("/api/agents/conversation?conversation_id=".concat(o.conversationId)),F(!1)}).catch(e=>{console.error("Error:",e),ee(!1)})}})(),disabled:!d||!L||X,children:[X?(0,a.jsx)(S.U,{className:"animate-spin"}):(0,a.jsx)(I.Z,{}),X?"Saving":"Save"]})})})]})})},"actions")]})}function ed(e){let t=(0,d.useSearchParams)().get("conversationId"),[s,n]=(0,l.useState)(""),[r,c]=(0,l.useState)([]),[u,h]=(0,l.useState)(!1),[f,x]=(0,l.useState)(null),[p,g]=(0,l.useState)(!1),j=(0,l.useRef)(null),v=e.setQueryToProcess,N=e.onConversationIdChange,y=e.isMobileWidth?"w-full":"w-4/6";if((0,l.useEffect)(()=>{if(r.length>0){let t=r.map(e=>encodeURIComponent(e));e.setImages(t)}},[r,e.setImages]),(0,l.useEffect)(()=>{let t=localStorage.getItem("images");if(t){let s=JSON.parse(t);c(s);let a=s.map(e=>encodeURIComponent(e));e.setImages(a),localStorage.removeItem("images")}let s=localStorage.getItem("message");s&&(h(!0),v(s),s.trim().startsWith("/research")&&g(!0));let a=localStorage.getItem("uploadedFiles");if(a){let t=a?JSON.parse(a):[],s=[];for(let e of t)s.push({name:e.name,file_type:e.file_type,content:e.content,size:e.size});localStorage.removeItem("uploadedFiles"),e.setUploadedFiles(s)}},[v,e.setImages,t]),(0,l.useEffect)(()=>{s&&(h(!0),v(s))},[s,v]),(0,l.useEffect)(()=>{t&&(null==N||N(t))},[t,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]),!t){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:t,setTitle:e.setTitle,setAgent:x,pendingMessage:u?s:"",incomingMessages:e.streamedMessages,setIncomingMessages:e.setStreamedMessages,customClassName:y,setIsChatSideBarOpen:e.setIsChatSideBarOpen,onRetryMessage:e.onRetryMessage})}),(0,a.jsx)("div",{className:"".concat(i().inputBox," print-hidden 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(y," mr-auto ml-auto mt-auto"),children:(0,a.jsx)(m.a,{agentColor:null==f?void 0:f.color,isLoggedIn:e.isLoggedIn,sendMessage:e=>n(e),sendImage:e=>c(t=>[...t,e]),sendDisabled:e.isParentProcessing||!1,chatOptionsData:e.chatOptionsData,conversationId:t,isMobileWidth:e.isMobileWidth,setUploadedFiles:e.setUploadedFiles,ref:j,isResearchModeEnabled:p,setTriggeredAbort:e.setTriggeredAbort})})]}),(0,a.jsx)("div",{className:"print-hidden",children:(0,a.jsx)(el,{conversationId:t,isActive:e.isActive,isOpen:e.isChatSideBarOpen,onOpenChange:e.setIsChatSideBarOpen,isMobileWidth:e.isMobileWidth})})]})}function ec(){let e="Khoj AI - Chat",[t,s]=(0,l.useState)(null),[n,o]=(0,l.useState)(!0),[d,m]=(0,l.useState)(e),[w,_]=(0,l.useState)(null),[S,C]=(0,l.useState)([]),[O,k]=(0,l.useState)(""),[I,T]=(0,l.useState)(!1),[M,E]=(0,l.useState)(void 0),[A,z]=(0,l.useState)([]),[B,R]=(0,l.useState)(!1),[L,F]=(0,l.useState)(""),P=(0,l.useRef)(""),D=(0,l.useRef)(null),{locationData:W,locationDataError:Z,locationDataLoading:J}=(0,h.k6)()||{locationData:{timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}},{data:V,error:U,isLoading:K}=(0,f.GW)(),H=(0,h.IC)(),[G,Q]=(0,l.useState)(!1),[q,Y]=(0,l.useState)(null),$=(0,l.useRef)(!1),X=(0,l.useRef)(!1),ee=(0,l.useCallback)(()=>{D.current&&clearTimeout(D.current),X.current=!0,Y(null),console.log("WebSocket disconnected due to inactivity.")},[]),et=(0,l.useCallback)(()=>{D.current&&clearTimeout(D.current),D.current=setTimeout(ee,6e5)},[ee]),{toast:es}=(0,b.pm)(),{sendMessage:ea,lastMessage:en}=(0,r.ZP)(q,{share:!0,shouldReconnect:e=>!0,reconnectAttempts:10,reconnectInterval:e=>Math.min(1e3*Math.pow(2,e)+1e3*Math.random(),2e4),onOpen:()=>{console.log("WebSocket connection established."),et(),$.current=!1,X.current=!1},onClose:e=>{console.log("WebSocket connection closed."),D.current&&clearTimeout(D.current),X.current||(null==e?void 0:e.code)===1e3||(null==e?void 0:e.code)===1001||!O||$.current||(es({title:"Network issue",description:"Connection lost. Please check your network and try again when ready.",variant:"destructive",duration:6e3}),$.current=!0),C(e=>{if(!e||0===e.length)return e;let t=[...e],s=t[t.length-1];return s&&!s.completed&&(s.completed=!0),t}),T(!1),k("")},onError:e=>{console.error("WebSocket error",e),C(e=>{if(!e||0===e.length)return e;let t=[...e],s=t[t.length-1];return s&&!s.completed&&(s.completed=!0),t}),T(!1),k(""),X.current||$.current||(es({title:"Network error",description:"Connection lost. Please check your network and try again when ready.",variant:"destructive",duration:5e3}),$.current=!0)}});async function ei(){if(localStorage.removeItem("message"),!O||!w){T(!1);return}if(et(),!q){let e="https:"===window.location.protocol?"wss:":"ws:";Y("".concat(e,"//").concat(window.location.host,"/api/chat/ws?client=web"))}ea(JSON.stringify({q:O,conversation_id:w,stream:!0,...W&&{city:W.city,region:W.region,country:W.country,country_code:W.countryCode,timezone:W.timezone},...A.length>0&&{images:A},...M&&{files:M}}))}return(0,l.useEffect)(()=>{let e=()=>{X.current=!0};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[]),(0,l.useEffect)(()=>{if(null!==en){let e;et();try{let e=JSON.parse(en.data);if("interrupt_acknowledged"===e.type){console.log("Interrupt acknowledged by server"),T(!1);return}if("interrupt_message_acknowledged"===e.type){console.log("Interrupt message acknowledged by server"),T(!1);return}if(e.error){console.error("WebSocket error:",e.error),T(!1);return}}catch(e){}let t="␃\uD83D\uDD1A␗";for(P.current+=en.data;-1!==(e=P.current.indexOf(t));){let s=P.current.slice(0,e);P.current=P.current.slice(e+t.length),s&&C(e=>{let t=[...e],a=t[t.length-1];if(!a||a.completed)return e;let{context:n,onlineContext:i,codeContext:l}=(0,u.VK)(s,a,a.context||[],a.onlineContext||{},a.codeContext||{});return a.context=n,a.onlineContext=i,a.codeContext=l,a.completed&&(k(""),T(!1),z([]),w&&(0,u.tQ)(w,m)),t})}}},[en,C]),(0,l.useEffect)(()=>{fetch("/api/chat/options").then(e=>e.json()).then(e=>{o(!1),e&&s(e)}).catch(e=>{console.error(e)}),(0,h.EK)()},[]),((0,l.useEffect)(()=>{B&&(ea(JSON.stringify({type:"interrupt",query:L})),console.log("Sent interrupt message via WebSocket:",L),C(e=>{let t=[...e],s=t[t.length-1];return s&&(s.completed=!0),t}),k(L),R(!1),F(""))},[B,ea]),(0,l.useEffect)(()=>{if(O){let e={rawResponse:"",trainOfThought:[],context:[],onlineContext:{},codeContext:{},completed:!1,timestamp:new Date().toISOString(),rawQuery:O||"",images:A,queryFiles:M};C(t=>[...t,e]),T(!0)}},[O]),(0,l.useEffect)(()=>{I&&!J&&ei()},[I,J]),(0,l.useEffect)(()=>{if(!w)return;let e="https:"===window.location.protocol?"wss:":"ws:";return Y("".concat(e,"//").concat(window.location.host,"/api/chat/ws?client=web")),()=>{D.current&&clearTimeout(D.current)}},[w]),n)?(0,a.jsx)(c.Z,{}):(0,a.jsxs)(p.Hn,{children:[(0,a.jsx)("div",{className:"print-hidden",children:(0,a.jsx)(g.S,{conversationId:w||""})}),(0,a.jsxs)(p.kV,{children:[(0,a.jsxs)("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4 print-hidden",children:[(0,a.jsx)(p.vP,{className:"-ml-1"}),(0,a.jsx)(j.Z,{orientation:"vertical",className:"mr-2 h-4"}),w&&(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:H?(0,a.jsx)("a",{className:"p-0 no-underline",href:"/",children:(0,a.jsx)(v.VO,{className:"h-auto w-16"})}):d&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h2",{className:"text-lg text-ellipsis whitespace-nowrap overflow-x-hidden mr-4",children:d}),(0,a.jsx)(x.En,{conversationId:w,setTitle:m,sizing:"md"})]})}),(0,a.jsx)("div",{className:"flex justify-end items-start gap-2 text-sm ml-auto",children:(0,a.jsx)(N.z,{variant:"ghost",size:"icon",className:"h-12 w-12 data-[state=open]:bg-accent print-hidden",onClick:()=>Q(!G),children:(0,a.jsx)(y.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(d&&d!==e?": ".concat(d):"")}),(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)(c.Z,{}),children:(0,a.jsx)(ed,{isLoggedIn:!!V,streamedMessages:S,setStreamedMessages:C,chatOptionsData:t,setTitle:m,setQueryToProcess:k,setUploadedFiles:E,isMobileWidth:H,onConversationIdChange:e=>{_(e)},setImages:z,setTriggeredAbort:(e,t)=>{e&&F(t||""),R(e)},isChatSideBarOpen:G,setIsChatSideBarOpen:Q,isActive:null==V?void 0:V.is_active,isParentProcessing:I,onRetryMessage:(e,t)=>{if(!e){console.warn("No query provided for retry");return}t&&(C(e=>e.filter(e=>e.turnId!==t)),fetch("/api/chat/conversation/message",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({conversation_id:w,turn_id:t})}).catch(e=>{console.error("Failed to delete message for retry:",e)})),k(e)}})})})})]})]})]})}},26815:function(e,t,s){"use strict";s.d(t,{_:function(){return d}});var a=s(57437),n=s(2265),i=s(6394),l=s(90535),r=s(94508);let o=(0,l.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),d=n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,a.jsx)(i.f,{ref:t,className:(0,r.cn)(o(),s),...n})});d.displayName=i.f.displayName},53647:function(e,t,s){"use strict";s.d(t,{Bw:function(){return x},Ph:function(){return c},Ql:function(){return p},i4:function(){return h},ki:function(){return u}});var a=s(57437),n=s(2265),i=s(56873),l=s(40875),r=s(22135),o=s(30401),d=s(94508);let c=i.fC;i.ZA;let u=i.B4,h=n.forwardRef((e,t)=>{let{className:s,children:n,...r}=e;return(0,a.jsxs)(i.xz,{ref:t,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",s),...r,children:[n,(0,a.jsx)(i.JO,{asChild:!0,children:(0,a.jsx)(l.Z,{className:"h-4 w-4 opacity-50"})})]})});h.displayName=i.xz.displayName;let m=n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,a.jsx)(i.u_,{ref:t,className:(0,d.cn)("flex cursor-default items-center justify-center py-1",s),...n,children:(0,a.jsx)(r.Z,{className:"h-4 w-4"})})});m.displayName=i.u_.displayName;let f=n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,a.jsx)(i.$G,{ref:t,className:(0,d.cn)("flex cursor-default items-center justify-center py-1",s),...n,children:(0,a.jsx)(l.Z,{className:"h-4 w-4"})})});f.displayName=i.$G.displayName;let x=n.forwardRef((e,t)=>{let{className:s,children:n,position:l="popper",...r}=e;return(0,a.jsx)(i.h_,{children:(0,a.jsxs)(i.VY,{ref:t,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",s),position:l,...r,children:[(0,a.jsx)(m,{}),(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)(f,{})]})})});x.displayName=i.VY.displayName,n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,a.jsx)(i.__,{ref:t,className:(0,d.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",s),...n})}).displayName=i.__.displayName;let p=n.forwardRef((e,t)=>{let{className:s,children:n,...l}=e;return(0,a.jsxs)(i.ck,{ref:t,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",s),...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)(o.Z,{className:"h-4 w-4"})})}),(0,a.jsx)(i.eT,{children:n})]})});p.displayName=i.ck.displayName,n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,a.jsx)(i.Z0,{ref:t,className:(0,d.cn)("-mx-1 my-1 h-px bg-muted",s),...n})}).displayName=i.Z0.displayName},77992:function(e,t,s){"use strict";s.d(t,{pm:function(){return h}});var a=s(2265);let n=0,i=new Map,l=e=>{if(i.has(e))return;let t=setTimeout(()=>{i.delete(e),c({type:"REMOVE_TOAST",toastId:e})},1e6);i.set(e,t)},r=(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:s}=t;return s?l(s):e.toasts.forEach(e=>{l(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===s||void 0===s?{...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)}}},o=[],d={toasts:[]};function c(e){d=r(d,e),o.forEach(e=>{e(d)})}function u(e){let{...t}=e,s=(n=(n+1)%Number.MAX_SAFE_INTEGER).toString(),a=()=>c({type:"DISMISS_TOAST",toastId:s});return c({type:"ADD_TOAST",toast:{...t,id:s,open:!0,onOpenChange:e=>{e||a()}}}),{id:s,dismiss:a,update:e=>c({type:"UPDATE_TOAST",toast:{...e,id:s}})}}function h(){let[e,t]=a.useState(d);return a.useEffect(()=>(o.push(t),()=>{let e=o.indexOf(t);e>-1&&o.splice(e,1)}),[e]),{...e,toast:u,dismiss:e=>c({type:"DISMISS_TOAST",toastId:e})}}},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",chatHistory:"chat_chatHistory__EzBJM"}}},function(e){e.O(0,[4842,5638,3954,9183,2939,7200,8667,1327,4447,3592,3260,9139,2327,5477,7127,2971,2117,1744],function(){return e(e.s=39929)}),_N_E=e.O()}]);
|