khoj 1.26.4.dev2__py3-none-any.whl → 1.26.5.dev29__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. khoj/interface/compiled/404/index.html +1 -1
  2. khoj/interface/compiled/_next/static/chunks/1210.132a7e1910006bbb.js +1 -0
  3. khoj/interface/compiled/_next/static/chunks/1279-f37ee4a388ebf544.js +1 -0
  4. khoj/interface/compiled/_next/static/chunks/1459.690bf20e7d7b7090.js +1 -0
  5. khoj/interface/compiled/_next/static/chunks/1603-b9d95833e0e025e8.js +1 -0
  6. khoj/interface/compiled/_next/static/chunks/1970-1d6d0c1b00b4f343.js +1 -0
  7. khoj/interface/compiled/_next/static/chunks/2697-61fcba89fd87eab4.js +1 -0
  8. khoj/interface/compiled/_next/static/chunks/3423-aad88d6c1f029135.js +1 -0
  9. khoj/interface/compiled/_next/static/chunks/394-6bcb8c429f168f21.js +3 -0
  10. khoj/interface/compiled/_next/static/chunks/4602-8eeb4b76385ad159.js +1 -0
  11. khoj/interface/compiled/_next/static/chunks/5512-94c7c2bbcf58c19d.js +1 -0
  12. khoj/interface/compiled/_next/static/chunks/7113-f2e114d7034a0835.js +1 -0
  13. khoj/interface/compiled/_next/static/chunks/{4086-2c74808ba38a5a0f.js → 8840-b8d7b9f0923c6651.js} +1 -1
  14. khoj/interface/compiled/_next/static/chunks/9417-759984ad62caa3dc.js +1 -0
  15. khoj/interface/compiled/_next/static/chunks/9479-4b443fdcc99141c9.js +1 -0
  16. khoj/interface/compiled/_next/static/chunks/94ca1967.5584df65931cfe83.js +1 -0
  17. khoj/interface/compiled/_next/static/chunks/964ecbae.ea4eab2a3a835ffe.js +1 -0
  18. khoj/interface/compiled/_next/static/chunks/app/agents/page-5ae1e540bb5be8a9.js +1 -0
  19. khoj/interface/compiled/_next/static/chunks/app/automations/{page-5480731341f34450.js → page-774ae3e033f938cd.js} +1 -1
  20. khoj/interface/compiled/_next/static/chunks/app/chat/page-97f5b61aaf46d364.js +1 -0
  21. khoj/interface/compiled/_next/static/chunks/app/factchecker/{page-e7b34316ec6f44de.js → page-d82403db2866bad8.js} +1 -1
  22. khoj/interface/compiled/_next/static/chunks/app/{page-10a5aad6e04f3cf8.js → page-75bbfb564884054b.js} +1 -1
  23. khoj/interface/compiled/_next/static/chunks/app/search/{page-d56541c746fded7d.js → page-9b64f61caa5bd7f9.js} +1 -1
  24. khoj/interface/compiled/_next/static/chunks/app/settings/{page-e044a999468a7c5d.js → page-989cf38b87b19427.js} +1 -1
  25. khoj/interface/compiled/_next/static/chunks/app/share/chat/page-eb9e282691858f2e.js +1 -0
  26. khoj/interface/compiled/_next/static/chunks/webpack-8f4afe09848e24e1.js +1 -0
  27. khoj/interface/compiled/_next/static/css/{c808691c459e3887.css → 3cf13271869a4aeb.css} +1 -1
  28. khoj/interface/compiled/_next/static/css/4cae6c0e5c72fb2d.css +1 -0
  29. khoj/interface/compiled/_next/static/css/76d55eb435962b19.css +25 -0
  30. khoj/interface/compiled/_next/static/css/{3e1f1fdd70775091.css → 80bd6301fc657983.css} +1 -1
  31. khoj/interface/compiled/_next/static/css/ddcc0cf73e062476.css +1 -0
  32. khoj/interface/compiled/agents/index.html +1 -1
  33. khoj/interface/compiled/agents/index.txt +2 -2
  34. khoj/interface/compiled/automations/index.html +1 -1
  35. khoj/interface/compiled/automations/index.txt +2 -2
  36. khoj/interface/compiled/chat/index.html +1 -1
  37. khoj/interface/compiled/chat/index.txt +2 -2
  38. khoj/interface/compiled/factchecker/index.html +1 -1
  39. khoj/interface/compiled/factchecker/index.txt +2 -2
  40. khoj/interface/compiled/index.html +1 -1
  41. khoj/interface/compiled/index.txt +2 -2
  42. khoj/interface/compiled/search/index.html +1 -1
  43. khoj/interface/compiled/search/index.txt +2 -2
  44. khoj/interface/compiled/settings/index.html +1 -1
  45. khoj/interface/compiled/settings/index.txt +2 -2
  46. khoj/interface/compiled/share/chat/index.html +1 -1
  47. khoj/interface/compiled/share/chat/index.txt +2 -2
  48. khoj/processor/conversation/google/gemini_chat.py +28 -13
  49. khoj/processor/conversation/google/utils.py +34 -12
  50. khoj/processor/conversation/openai/gpt.py +4 -4
  51. khoj/processor/conversation/prompts.py +144 -0
  52. khoj/processor/conversation/utils.py +22 -13
  53. khoj/processor/image/generate.py +5 -5
  54. khoj/processor/tools/online_search.py +4 -4
  55. khoj/routers/api.py +4 -2
  56. khoj/routers/api_agents.py +41 -20
  57. khoj/routers/api_chat.py +85 -46
  58. khoj/routers/helpers.py +225 -29
  59. khoj/routers/web_client.py +0 -11
  60. khoj/utils/helpers.py +7 -3
  61. {khoj-1.26.4.dev2.dist-info → khoj-1.26.5.dev29.dist-info}/METADATA +1 -1
  62. {khoj-1.26.4.dev2.dist-info → khoj-1.26.5.dev29.dist-info}/RECORD +67 -62
  63. khoj/interface/compiled/_next/static/chunks/121-7024f479c297aef0.js +0 -1
  64. khoj/interface/compiled/_next/static/chunks/1603-fa3ee48860b9dc5c.js +0 -1
  65. khoj/interface/compiled/_next/static/chunks/2697-a38d01981ad3bdf8.js +0 -1
  66. khoj/interface/compiled/_next/static/chunks/4051-2cf66369d6ca0f1d.js +0 -3
  67. khoj/interface/compiled/_next/static/chunks/477-ec86e93db10571c1.js +0 -1
  68. khoj/interface/compiled/_next/static/chunks/51-e8f5bdb69b5ea421.js +0 -1
  69. khoj/interface/compiled/_next/static/chunks/7762-79f2205740622b5c.js +0 -1
  70. khoj/interface/compiled/_next/static/chunks/9178-899fe9a6b754ecfe.js +0 -1
  71. khoj/interface/compiled/_next/static/chunks/9417-46ed3aaa639c85ef.js +0 -1
  72. khoj/interface/compiled/_next/static/chunks/9479-ea776e73f549090c.js +0 -1
  73. khoj/interface/compiled/_next/static/chunks/app/agents/page-88aa3042711107b7.js +0 -1
  74. khoj/interface/compiled/_next/static/chunks/app/chat/page-702057ccbcf27881.js +0 -1
  75. khoj/interface/compiled/_next/static/chunks/app/share/chat/page-fbbd66a4d4633438.js +0 -1
  76. khoj/interface/compiled/_next/static/chunks/webpack-2651a68f46ac3cb7.js +0 -1
  77. khoj/interface/compiled/_next/static/css/2de69f0be774c768.css +0 -1
  78. khoj/interface/compiled/_next/static/css/592ca99f5122e75a.css +0 -1
  79. khoj/interface/compiled/_next/static/css/b9a6bf04305d98d7.css +0 -25
  80. /khoj/interface/compiled/_next/static/{wyjqS7cuSX-u62BTNYqhU → ZLHCGFLxZSUj0jEJSc99T}/_buildManifest.js +0 -0
  81. /khoj/interface/compiled/_next/static/{wyjqS7cuSX-u62BTNYqhU → ZLHCGFLxZSUj0jEJSc99T}/_ssgManifest.js +0 -0
  82. {khoj-1.26.4.dev2.dist-info → khoj-1.26.5.dev29.dist-info}/WHEEL +0 -0
  83. {khoj-1.26.4.dev2.dist-info → khoj-1.26.5.dev29.dist-info}/entry_points.txt +0 -0
  84. {khoj-1.26.4.dev2.dist-info → khoj-1.26.5.dev29.dist-info}/licenses/LICENSE +0 -0
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9479],{59479:function(e,t,a){"use strict";a.d(t,{Z:function(){return eL}});var r=a(57437),n=a(37649),l=a.n(n),o=a(2265),s=a(11838),i=a.n(s);a(7395);var c=a(52195);let d=new Map([["bold",o.createElement(o.Fragment,null,o.createElement("path",{d:"M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"}))],["duotone",o.createElement(o.Fragment,null,o.createElement("path",{d:"M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z",opacity:"0.2"}),o.createElement("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["fill",o.createElement(o.Fragment,null,o.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM181.66,170.34a8,8,0,0,1-11.32,11.32L128,139.31,85.66,181.66a8,8,0,0,1-11.32-11.32L116.69,128,74.34,85.66A8,8,0,0,1,85.66,74.34L128,116.69l42.34-42.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["light",o.createElement(o.Fragment,null,o.createElement("path",{d:"M204.24,195.76a6,6,0,1,1-8.48,8.48L128,136.49,60.24,204.24a6,6,0,0,1-8.48-8.48L119.51,128,51.76,60.24a6,6,0,0,1,8.48-8.48L128,119.51l67.76-67.75a6,6,0,0,1,8.48,8.48L136.49,128Z"}))],["regular",o.createElement(o.Fragment,null,o.createElement("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["thin",o.createElement(o.Fragment,null,o.createElement("path",{d:"M202.83,197.17a4,4,0,0,1-5.66,5.66L128,133.66,58.83,202.83a4,4,0,0,1-5.66-5.66L122.34,128,53.17,58.83a4,4,0,0,1,5.66-5.66L128,122.34l69.17-69.17a4,4,0,1,1,5.66,5.66L133.66,128Z"}))]]);var u=Object.defineProperty,m=Object.defineProperties,h=Object.getOwnPropertyDescriptors,p=Object.getOwnPropertySymbols,f=Object.prototype.hasOwnProperty,g=Object.prototype.propertyIsEnumerable,b=(e,t,a)=>t in e?u(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,x=(e,t)=>{for(var a in t||(t={}))f.call(t,a)&&b(e,a,t[a]);if(p)for(var a of p(t))g.call(t,a)&&b(e,a,t[a]);return e},j=(e,t)=>m(e,h(t));let v=(0,o.forwardRef)((e,t)=>o.createElement(c.Z,j(x({ref:t},e),{weights:d})));v.displayName="X";let y=new Map([["bold",o.createElement(o.Fragment,null,o.createElement("path",{d:"M212.48,136.49l-82.06,82a60,60,0,0,1-84.85-84.88l98.16-97.89a40,40,0,0,1,56.56,56.59l-.17.16-95.8,92.22a12,12,0,1,1-16.64-17.3l95.71-92.12a16,16,0,0,0-22.7-22.56L62.53,150.57a36,36,0,0,0,50.93,50.91l82.06-82a12,12,0,0,1,17,17Z"}))],["duotone",o.createElement(o.Fragment,null,o.createElement("path",{d:"M180.75,104.75,204,128l-82.06,81.94a48,48,0,0,1-67.88-67.88L153.37,41.37a32,32,0,0,1,45.26,45.26Z",opacity:"0.2"}),o.createElement("path",{d:"M209.66,122.34a8,8,0,0,1,0,11.32l-82.05,82a56,56,0,0,1-79.2-79.21L147.67,35.73a40,40,0,1,1,56.61,56.55L105,193A24,24,0,1,1,71,159L154.3,74.38A8,8,0,1,1,165.7,85.6L82.39,170.31a8,8,0,1,0,11.27,11.36L192.93,81A24,24,0,1,0,159,47L59.76,147.68a40,40,0,1,0,56.53,56.62l82.06-82A8,8,0,0,1,209.66,122.34Z"}))],["fill",o.createElement(o.Fragment,null,o.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm37.66,50.34a8,8,0,0,0-11.32,0L87.09,143A24,24,0,1,0,121,177l49.32-50.32a8,8,0,1,1,11.42,11.2l-49.37,50.38a40,40,0,1,1-56.62-56.51L143,63.09A24,24,0,1,1,177,97L109.71,165.6a8,8,0,1,1-11.42-11.2L165.6,85.71a8,8,0,0,0,.06-11.37Z"}))],["light",o.createElement(o.Fragment,null,o.createElement("path",{d:"M208.25,123.76a6,6,0,0,1,0,8.49l-82.06,82a54,54,0,0,1-76.36-76.39L149.1,37.14a38,38,0,1,1,53.77,53.72L103.59,191.54a22,22,0,1,1-31.15-31.09l83.28-84.67a6,6,0,0,1,8.56,8.42L81,168.91a10,10,0,1,0,14.11,14.18L194.35,82.4a26,26,0,1,0-36.74-36.8L58.33,146.28a42,42,0,1,0,59.37,59.44l82.06-82A6,6,0,0,1,208.25,123.76Z"}))],["regular",o.createElement(o.Fragment,null,o.createElement("path",{d:"M209.66,122.34a8,8,0,0,1,0,11.32l-82.05,82a56,56,0,0,1-79.2-79.21L147.67,35.73a40,40,0,1,1,56.61,56.55L105,193A24,24,0,1,1,71,159L154.3,74.38A8,8,0,1,1,165.7,85.6L82.39,170.31a8,8,0,1,0,11.27,11.36L192.93,81A24,24,0,1,0,159,47L59.76,147.68a40,40,0,1,0,56.53,56.62l82.06-82A8,8,0,0,1,209.66,122.34Z"}))],["thin",o.createElement(o.Fragment,null,o.createElement("path",{d:"M206.83,125.17a4,4,0,0,1,0,5.66l-82.06,82a52,52,0,0,1-73.54-73.55L150.52,38.55a36,36,0,1,1,50.94,50.9l-99.3,100.69a20,20,0,1,1-28.3-28.27l83.29-84.68a4,4,0,1,1,5.7,5.61L79.54,167.5a12,12,0,1,0,16.95,17L195.78,83.81A28,28,0,1,0,156.2,44.18L56.91,144.87a44,44,0,1,0,62.21,62.26l82-82A4,4,0,0,1,206.83,125.17Z"}))]]);var w=Object.defineProperty,E=Object.defineProperties,L=Object.getOwnPropertyDescriptors,A=Object.getOwnPropertySymbols,Z=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable,M=(e,t,a)=>t in e?w(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,V=(e,t)=>{for(var a in t||(t={}))Z.call(t,a)&&M(e,a,t[a]);if(A)for(var a of A(t))O.call(t,a)&&M(e,a,t[a]);return e},N=(e,t)=>E(e,L(t));let F=(0,o.forwardRef)((e,t)=>o.createElement(c.Z,N(V({ref:t},e),{weights:y})));F.displayName="Paperclip";let k=new Map([["bold",o.createElement(o.Fragment,null,o.createElement("path",{d:"M200,36H56A20,20,0,0,0,36,56V200a20,20,0,0,0,20,20H200a20,20,0,0,0,20-20V56A20,20,0,0,0,200,36Zm-4,160H60V60H196Z"}))],["duotone",o.createElement(o.Fragment,null,o.createElement("path",{d:"M208,56V200a8,8,0,0,1-8,8H56a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H200A8,8,0,0,1,208,56Z",opacity:"0.2"}),o.createElement("path",{d:"M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,160H56V56H200V200Z"}))],["fill",o.createElement(o.Fragment,null,o.createElement("path",{d:"M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z"}))],["light",o.createElement(o.Fragment,null,o.createElement("path",{d:"M200,42H56A14,14,0,0,0,42,56V200a14,14,0,0,0,14,14H200a14,14,0,0,0,14-14V56A14,14,0,0,0,200,42Zm2,158a2,2,0,0,1-2,2H56a2,2,0,0,1-2-2V56a2,2,0,0,1,2-2H200a2,2,0,0,1,2,2Z"}))],["regular",o.createElement(o.Fragment,null,o.createElement("path",{d:"M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,160H56V56H200V200Z"}))],["thin",o.createElement(o.Fragment,null,o.createElement("path",{d:"M200,44H56A12,12,0,0,0,44,56V200a12,12,0,0,0,12,12H200a12,12,0,0,0,12-12V56A12,12,0,0,0,200,44Zm4,156a4,4,0,0,1-4,4H56a4,4,0,0,1-4-4V56a4,4,0,0,1,4-4H200a4,4,0,0,1,4,4Z"}))]]);var H=Object.defineProperty,C=Object.defineProperties,P=Object.getOwnPropertyDescriptors,D=Object.getOwnPropertySymbols,S=Object.prototype.hasOwnProperty,R=Object.prototype.propertyIsEnumerable,T=(e,t,a)=>t in e?H(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,I=(e,t)=>{for(var a in t||(t={}))S.call(t,a)&&T(e,a,t[a]);if(D)for(var a of D(t))R.call(t,a)&&T(e,a,t[a]);return e},z=(e,t)=>C(e,P(t));let _=(0,o.forwardRef)((e,t)=>o.createElement(c.Z,z(I({ref:t},e),{weights:k})));_.displayName="Stop";let U=new Map([["bold",o.createElement(o.Fragment,null,o.createElement("path",{d:"M128,180a52.06,52.06,0,0,0,52-52V64A52,52,0,0,0,76,64v64A52.06,52.06,0,0,0,128,180ZM100,64a28,28,0,0,1,56,0v64a28,28,0,0,1-56,0Zm40,155.22V240a12,12,0,0,1-24,0V219.22A92.14,92.14,0,0,1,36,128a12,12,0,0,1,24,0,68,68,0,0,0,136,0,12,12,0,0,1,24,0A92.14,92.14,0,0,1,140,219.22Z"}))],["duotone",o.createElement(o.Fragment,null,o.createElement("path",{d:"M168,64v64a40,40,0,0,1-40,40h0a40,40,0,0,1-40-40V64a40,40,0,0,1,40-40h0A40,40,0,0,1,168,64Z",opacity:"0.2"}),o.createElement("path",{d:"M128,176a48.05,48.05,0,0,0,48-48V64a48,48,0,0,0-96,0v64A48.05,48.05,0,0,0,128,176ZM96,64a32,32,0,0,1,64,0v64a32,32,0,0,1-64,0Zm40,143.6V240a8,8,0,0,1-16,0V207.6A80.11,80.11,0,0,1,48,128a8,8,0,0,1,16,0,64,64,0,0,0,128,0,8,8,0,0,1,16,0A80.11,80.11,0,0,1,136,207.6Z"}))],["fill",o.createElement(o.Fragment,null,o.createElement("path",{d:"M80,128V64a48,48,0,0,1,96,0v64a48,48,0,0,1-96,0Zm128,0a8,8,0,0,0-16,0,64,64,0,0,1-128,0,8,8,0,0,0-16,0,80.11,80.11,0,0,0,72,79.6V240a8,8,0,0,0,16,0V207.6A80.11,80.11,0,0,0,208,128Z"}))],["light",o.createElement(o.Fragment,null,o.createElement("path",{d:"M128,174a46.06,46.06,0,0,0,46-46V64a46,46,0,0,0-92,0v64A46.06,46.06,0,0,0,128,174ZM94,64a34,34,0,0,1,68,0v64a34,34,0,0,1-68,0Zm40,141.75V240a6,6,0,0,1-12,0V205.75A78.09,78.09,0,0,1,50,128a6,6,0,0,1,12,0,66,66,0,0,0,132,0,6,6,0,0,1,12,0A78.09,78.09,0,0,1,134,205.75Z"}))],["regular",o.createElement(o.Fragment,null,o.createElement("path",{d:"M128,176a48.05,48.05,0,0,0,48-48V64a48,48,0,0,0-96,0v64A48.05,48.05,0,0,0,128,176ZM96,64a32,32,0,0,1,64,0v64a32,32,0,0,1-64,0Zm40,143.6V240a8,8,0,0,1-16,0V207.6A80.11,80.11,0,0,1,48,128a8,8,0,0,1,16,0,64,64,0,0,0,128,0,8,8,0,0,1,16,0A80.11,80.11,0,0,1,136,207.6Z"}))],["thin",o.createElement(o.Fragment,null,o.createElement("path",{d:"M128,172a44.05,44.05,0,0,0,44-44V64a44,44,0,0,0-88,0v64A44.05,44.05,0,0,0,128,172ZM92,64a36,36,0,0,1,72,0v64a36,36,0,0,1-72,0Zm40,139.89V240a4,4,0,0,1-8,0V203.89A76.09,76.09,0,0,1,52,128a4,4,0,0,1,8,0,68,68,0,0,0,136,0,4,4,0,0,1,8,0A76.09,76.09,0,0,1,132,203.89Z"}))]]);var Y=Object.defineProperty,W=Object.defineProperties,$=Object.getOwnPropertyDescriptors,J=Object.getOwnPropertySymbols,K=Object.prototype.hasOwnProperty,B=Object.prototype.propertyIsEnumerable,X=(e,t,a)=>t in e?Y(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,q=(e,t)=>{for(var a in t||(t={}))K.call(t,a)&&X(e,a,t[a]);if(J)for(var a of J(t))B.call(t,a)&&X(e,a,t[a]);return e},G=(e,t)=>W(e,$(t));let Q=(0,o.forwardRef)((e,t)=>o.createElement(c.Z,G(q({ref:t},e),{weights:U})));Q.displayName="Microphone";let ee=new Map([["bold",o.createElement(o.Fragment,null,o.createElement("path",{d:"M208.49,120.49a12,12,0,0,1-17,0L140,69V216a12,12,0,0,1-24,0V69L64.49,120.49a12,12,0,0,1-17-17l72-72a12,12,0,0,1,17,0l72,72A12,12,0,0,1,208.49,120.49Z"}))],["duotone",o.createElement(o.Fragment,null,o.createElement("path",{d:"M200,112H56l72-72Z",opacity:"0.2"}),o.createElement("path",{d:"M205.66,106.34l-72-72a8,8,0,0,0-11.32,0l-72,72A8,8,0,0,0,56,120h64v96a8,8,0,0,0,16,0V120h64a8,8,0,0,0,5.66-13.66ZM75.31,104,128,51.31,180.69,104Z"}))],["fill",o.createElement(o.Fragment,null,o.createElement("path",{d:"M207.39,115.06A8,8,0,0,1,200,120H136v96a8,8,0,0,1-16,0V120H56a8,8,0,0,1-5.66-13.66l72-72a8,8,0,0,1,11.32,0l72,72A8,8,0,0,1,207.39,115.06Z"}))],["light",o.createElement(o.Fragment,null,o.createElement("path",{d:"M204.24,116.24a6,6,0,0,1-8.48,0L134,54.49V216a6,6,0,0,1-12,0V54.49L60.24,116.24a6,6,0,0,1-8.48-8.48l72-72a6,6,0,0,1,8.48,0l72,72A6,6,0,0,1,204.24,116.24Z"}))],["regular",o.createElement(o.Fragment,null,o.createElement("path",{d:"M205.66,117.66a8,8,0,0,1-11.32,0L136,59.31V216a8,8,0,0,1-16,0V59.31L61.66,117.66a8,8,0,0,1-11.32-11.32l72-72a8,8,0,0,1,11.32,0l72,72A8,8,0,0,1,205.66,117.66Z"}))],["thin",o.createElement(o.Fragment,null,o.createElement("path",{d:"M202.83,114.83a4,4,0,0,1-5.66,0L132,49.66V216a4,4,0,0,1-8,0V49.66L58.83,114.83a4,4,0,0,1-5.66-5.66l72-72a4,4,0,0,1,5.66,0l72,72A4,4,0,0,1,202.83,114.83Z"}))]]);var et=Object.defineProperty,ea=Object.defineProperties,er=Object.getOwnPropertyDescriptors,en=Object.getOwnPropertySymbols,el=Object.prototype.hasOwnProperty,eo=Object.prototype.propertyIsEnumerable,es=(e,t,a)=>t in e?et(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,ei=(e,t)=>{for(var a in t||(t={}))el.call(t,a)&&es(e,a,t[a]);if(en)for(var a of en(t))eo.call(t,a)&&es(e,a,t[a]);return e},ec=(e,t)=>ea(e,er(t));let ed=(0,o.forwardRef)((e,t)=>o.createElement(c.Z,ec(ei({ref:t},e),{weights:ee})));ed.displayName="ArrowUp";var eu=a(42491),em=a(6780),eh=a(50495),ep=a(70571),ef=a(19573),eg=a(61485),eb=a(93146),ex=a(19666),ej=a(58575),ev=a(66820),ey=a(9557),ew=a(58485),eE=a(89417);function eL(e){let[t,a]=(0,o.useState)(""),n=(0,o.useRef)(null),[s,c]=(0,o.useState)(null),[d,u]=(0,o.useState)(null),[m,h]=(0,o.useState)(!1),[p,f]=(0,o.useState)(null),[g,b]=(0,o.useState)(!1),[x,j]=(0,o.useState)(!1),[y,w]=(0,o.useState)(!1),[E,L]=(0,o.useState)(""),[A,Z]=(0,o.useState)(null),[O,M]=(0,o.useState)(null),[V,N]=(0,o.useState)(0),[k,H]=(0,o.useState)(!1);function C(){if(y&&(w(!1),L(""),e.sendImage(A||"")),t.trim()){if(!e.isLoggedIn){f("Hey there, you need to be signed in to send messages to Khoj AI"),b(!0);return}e.sendMessage(t.trim()),a("")}}function P(t){if(!e.isLoggedIn){f("Please login to chat with your files"),b(!0);return}let a=["jpg","jpeg","png","webp"];for(let e=0;e<t.length;e++){let r=t[e],n=r.name.split(".").pop();if(a.includes(n||"")){w(!0),L(i().sanitize(URL.createObjectURL(r)));return}}(0,ey.ko)(t,c,h,u,e.setUploadedFiles,e.conversationId)}async function D(){try{let e=await navigator.mediaDevices.getUserMedia({audio:!0}),t=new MediaRecorder(e,{mimeType:"audio/webm"}),r=[];t.ondataavailable=async e=>{r.push(e.data);let t=new Blob(r,{type:"audio/webm"}),n=new FormData;n.append("file",t);try{let e=await fetch("/api/transcribe",{method:"POST",body:n});if(!e.ok)throw Error("Network response was not ok");let t=await e.json();a(t.text.trim())}catch(e){console.error("Error sending audio to server:",e)}},t.start(1500),t.onstop=async()=>{let e=new Blob(r,{type:"audio/webm"}),n=new FormData;n.append("file",e);try{let e=await fetch("/api/transcribe",{method:"POST",body:n});if(!e.ok)throw Error("Network response was not ok");let r=await e.json();t.stream.getTracks().forEach(e=>e.stop()),M(null),a(r.text.trim())}catch(e){console.error("Error sending audio to server:",e)}},M(t)}catch(e){console.error("Error getting microphone",e)}}(0,o.useEffect)(()=>{if(m||N(0),m){let e=setInterval(()=>{N(e=>{let t=e+(Math.floor(5*Math.random())+1);return t<100?t:100})},800);return()=>clearInterval(e)}},[m]),(0,o.useEffect)(()=>{async function e(){if(E){let e=await fetch(E),t=await e.blob(),a=new FileReader;a.onload=function(){Z(a.result)},a.readAsDataURL(t)}h(!1)}h(!0),e()},[E]),(0,o.useEffect)(()=>{!x&&O&&O.stop(),x&&!O&&D()},[x,O]);let S=(0,o.useRef)(null);return(0,o.useEffect)(()=>{S.current&&(S.current.style.height="auto",S.current.style.height=Math.max(S.current.scrollHeight-24,64)+"px")},[t]),(0,r.jsxs)(r.Fragment,{children:[g&&p&&(0,r.jsx)(ev.Z,{onOpenChange:b,loginRedirectMessage:p}),m&&(0,r.jsx)(em.aR,{open:m,children:(0,r.jsxs)(em._T,{children:[(0,r.jsx)(em.fY,{children:(0,r.jsx)(em.f$,{children:"Uploading data. Please wait."})}),(0,r.jsx)(em.yT,{children:(0,r.jsx)(ep.E,{indicatorColor:"bg-slate-500",className:"w-full h-2 rounded-full",value:V})}),(0,r.jsx)(em.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>h(!1),children:"Dismiss"})]})}),s&&(0,r.jsx)(em.aR,{open:null!==s,children:(0,r.jsxs)(em._T,{children:[(0,r.jsx)(em.fY,{children:(0,r.jsx)(em.f$,{children:"Data Upload Warning"})}),(0,r.jsx)(em.yT,{children:s}),(0,r.jsx)(em.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>c(null),children:"Close"})]})}),d&&(0,r.jsx)(em.aR,{open:null!==d,children:(0,r.jsxs)(em._T,{children:[(0,r.jsxs)(em.fY,{children:[(0,r.jsx)(em.f$,{children:"Oh no!"}),(0,r.jsx)(em.yT,{children:"Something went wrong while uploading your data"})]}),(0,r.jsx)(em.yT,{children:d}),(0,r.jsx)(em.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>u(null),children:"Close"})]})}),t.startsWith("/")&&1===t.split(" ").length&&(0,r.jsx)("div",{className:"flex justify-center text-center",children:(0,r.jsxs)(ef.J2,{open:t.startsWith("/"),children:[(0,r.jsx)(eg.xo,{className:"flex justify-center text-center"}),(0,r.jsx)(ef.yk,{onOpenAutoFocus:e=>e.preventDefault(),className:"".concat(e.isMobileWidth?"w-[100vw]":"w-full"," rounded-md"),children:(0,r.jsxs)(eu.mY,{className:"max-w-full",children:[(0,r.jsx)(eu.sZ,{placeholder:"Type a command or search...",value:t,className:"hidden"}),(0,r.jsxs)(eu.e8,{children:[(0,r.jsx)(eu.rb,{children:"No matching commands."}),(0,r.jsx)(eu.fu,{heading:"Agent Tools",children:e.chatOptionsData&&Object.entries(e.chatOptionsData).map(e=>{let[t,n]=e;return(0,r.jsx)(eu.di,{className:"text-md",onSelect:()=>{a("/".concat(t," "))},children:(0,r.jsxs)("div",{className:"grid grid-cols-1 gap-1",children:[(0,r.jsxs)("div",{className:"font-bold flex items-center",children:[(0,eE.vH)(t,"h-4 w-4 mr-2"),"/",t]}),(0,r.jsx)("div",{children:n})]})},t)})}),(0,r.jsx)(eu.zz,{})]})]})})]})}),(0,r.jsxs)("div",{className:"".concat(l().actualInputArea," items-center justify-between dark:bg-neutral-700 relative ").concat(k&&"animate-pulse"),onDragOver:function(e){e.preventDefault(),H(!0)},onDragLeave:function(e){e.preventDefault(),H(!1)},onDrop:function(e){e.preventDefault(),H(!1),e.dataTransfer.files&&P(e.dataTransfer.files)},children:[y&&(0,r.jsxs)("div",{className:"absolute bottom-[80px] left-0 right-0 dark:bg-neutral-700 bg-white pt-5 pb-5 w-full rounded-lg border dark:border-none grid grid-cols-2",children:[(0,r.jsx)("div",{className:"pl-4 pr-4",children:(0,r.jsx)("img",{src:E,alt:"img",className:"w-auto max-h-[100px]"})}),(0,r.jsx)("div",{className:"pl-4 pr-4",children:(0,r.jsx)(v,{className:"w-6 h-6 float-right dark:hover:bg-[hsl(var(--background))] hover:bg-neutral-100 rounded-sm",onClick:function(){w(!1),L("")}})})]}),(0,r.jsx)("input",{type:"file",multiple:!0,ref:n,onChange:function(e){e.target.files&&P(e.target.files)},style:{display:"none"}}),(0,r.jsx)(eh.z,{variant:"ghost",className:"!bg-none p-0 m-2 h-auto text-3xl rounded-full text-gray-300 hover:text-gray-500",disabled:e.sendDisabled,onClick:function(){n.current&&n.current.click()},children:(0,r.jsx)(F,{className:"w-8 h-8"})}),(0,r.jsx)("div",{className:"grid w-full gap-1.5 relative",children:(0,r.jsx)(eb.g,{ref:S,className:"border-none w-full h-16 min-h-16 max-h-[128px] md:py-4 rounded-lg resize-none dark:bg-neutral-700 ".concat(e.isMobileWidth?"text-md":"text-lg"),placeholder:"Type / to see a list of commands",id:"message",autoFocus:!0,value:t,onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(w(!1),L(""),e.preventDefault(),C())},onChange:e=>a(e.target.value),disabled:e.sendDisabled||x})}),x?(0,r.jsx)(ex.pn,{children:(0,r.jsxs)(ex.u,{children:[(0,r.jsx)(ex.aJ,{asChild:!0,children:(0,r.jsx)(eh.z,{variant:"default",className:"".concat(!x&&"hidden"," ").concat(e.agentColor?(0,ej.tp)(e.agentColor):"bg-orange-300 hover:bg-orange-500"," rounded-full p-1 m-2 h-auto text-3xl transition transform md:hover:-translate-y-1"),onClick:()=>{j(!x)},disabled:e.sendDisabled,children:(0,r.jsx)(_,{weight:"fill",className:"w-6 h-6"})})}),(0,r.jsx)(ex._v,{children:"Click to stop recording and transcribe your voice."})]})}):O?(0,r.jsx)(ew.l,{}):(0,r.jsx)(ex.pn,{children:(0,r.jsxs)(ex.u,{children:[(0,r.jsx)(ex.aJ,{asChild:!0,children:(0,r.jsx)(eh.z,{variant:"default",className:"".concat(!t||x||"hidden"," ").concat(e.agentColor?(0,ej.tp)(e.agentColor):"bg-orange-300 hover:bg-orange-500"," rounded-full p-1 m-2 h-auto text-3xl transition transform md:hover:-translate-y-1"),onClick:()=>{a("Listening..."),j(!x)},disabled:e.sendDisabled,children:(0,r.jsx)(Q,{weight:"fill",className:"w-6 h-6"})})}),(0,r.jsx)(ex._v,{children:"Click to transcribe your message with voice."})]})}),(0,r.jsx)(eh.z,{className:"".concat((!t||x)&&"hidden"," ").concat(e.agentColor?(0,ej.tp)(e.agentColor):"bg-orange-300 hover:bg-orange-500"," rounded-full p-1 m-2 h-auto text-3xl transition transform md:hover:-translate-y-1"),onClick:C,disabled:e.sendDisabled,children:(0,r.jsx)(ed,{className:"w-6 h-6",weight:"bold"})})]})]})}},66820:function(e,t,a){"use strict";a.d(t,{Z:function(){return o}});var r=a(57437),n=a(6780),l=a(87138);function o(e){return(0,r.jsx)(n.aR,{open:!0,onOpenChange:e.onOpenChange,children:(0,r.jsxs)(n._T,{children:[(0,r.jsx)(n.fY,{children:(0,r.jsx)(n.f$,{children:"Sign in to Khoj to continue"})}),(0,r.jsxs)(n.yT,{children:[e.loginRedirectMessage,". By logging in, you agree to our"," ",(0,r.jsx)(l.default,{href:"https://khoj.dev/terms-of-service",children:"Terms of Service."})]}),(0,r.jsxs)(n.xo,{children:[(0,r.jsx)(n.le,{children:"Dismiss"}),(0,r.jsx)(n.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>{window.location.href="/login?next=".concat(encodeURIComponent(window.location.pathname))},children:(0,r.jsxs)(l.default,{href:"/login?next=".concat(encodeURIComponent(window.location.pathname)),children:[" ","Login"]})})]})]})})}},70571:function(e,t,a){"use strict";a.d(t,{E:function(){return s}});var r=a(57437),n=a(2265),l=a(52431),o=a(37440);let s=n.forwardRef((e,t)=>{let{className:a,value:n,indicatorColor:s,...i}=e;return(0,r.jsx)(l.fC,{ref:t,className:(0,o.cn)("relative h-4 w-full overflow-hidden rounded-full bg-secondary",a),...i,children:(0,r.jsx)(l.z$,{className:"h-full w-full flex-1 bg-primary transition-all ".concat(s),style:{transform:"translateX(-".concat(100-(n||0),"%)")}})})});s.displayName=l.fC.displayName},93146:function(e,t,a){"use strict";a.d(t,{g:function(){return o}});var r=a(57437),n=a(2265),l=a(37440);let o=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,r.jsx)("textarea",{className:(0,l.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",a),ref:t,...n})});o.displayName="Textarea"},19666:function(e,t,a){"use strict";a.d(t,{_v:function(){return d},aJ:function(){return c},pn:function(){return s},u:function(){return i}});var r=a(57437),n=a(2265),l=a(27071),o=a(37440);let s=l.zt,i=l.fC,c=l.xz,d=n.forwardRef((e,t)=>{let{className:a,sideOffset:n=4,...s}=e;return(0,r.jsx)(l.VY,{ref:t,sideOffset:n,className:(0,o.cn)("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",a),...s})});d.displayName=l.VY.displayName},37649:function(e){e.exports={actualInputArea:"chatInputArea_actualInputArea__Ha6cN"}}}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9718],{1813:function(e,t,s){Promise.resolve().then(s.bind(s,45050))},45050:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return em}});var a=s(57437),l=s(15283),n=s.n(l),r=s(29039),i=s(2265),o=s(79306),c=s(50495),d=s(58284),u=s(5989),h=s(12275),m=s(18444),x=s(31784),f=s(20319),p=s(98750),g=s(55362),j=s(57691),v=s(68029),b=s(68131),N=s(83632),y=s(9950),w=s(35418),_=s(84120),C=s(95289),k=s(26100),S=s(26058),O=s(15780),z=s(64945),T=s(59772),I=s(36013),P=s(90837),R=s(66820),V=s(58485),M=s(48861),A=s(89417),E=s(58575),B=s(47412),Z=s(69591),q=s(32653),F=s(39343),L=s(83102),W=s(31014),D=s(93146),J=s(46294),X=s(13304),Y=s(40882);let G=Y.fC,U=Y.wy,K=Y.Fw;var $=s(37440),Q=s(42491),H=s(9557),ee=s(6780),et=s(70571),es=s(19573),ea=s(18642),el=s(19666);async function en(e,t){let s="/login?next=/agents?agent=".concat(e);if(!t){window.location.href=s;return}let a=await fetch("/api/chat/sessions?agent_slug=".concat(encodeURIComponent(e)),{method:"POST"}),l=await a.json();200==a.status?window.location.href="/chat?conversationId=".concat(l.conversation_id):403==a.status||401==a.status?window.location.href=s:alert("Failed to start chat session")}function er(e){var t;let s=(null===(t=e.text)||void 0===t?void 0:t.replace(/^\w/,e=>e.toUpperCase()))||"";return(0,a.jsx)(el.pn,{children:(0,a.jsxs)(el.u,{children:[(0,a.jsx)(el._v,{asChild:!0,children:(0,a.jsx)("div",{className:"text-sm",children:e.hoverText||s})}),(0,a.jsx)(el.aJ,{className:"cursor-text",children:(0,a.jsxs)("div",{className:"flex items-center space-x-2 rounded-full border-accent-500 border p-1.5",children:[(0,a.jsx)("div",{className:"text-muted-foreground",children:e.icon}),s&&s.length>0&&(0,a.jsx)("div",{className:"text-muted-foreground text-sm",children:s})]})})]})})}let ei=()=>window.fetch("/api/agents").then(e=>e.json()).catch(e=>console.log(e)),eo=e=>fetch(e).then(e=>e.json());function ec(e){let[t,s]=(0,i.useState)(e.agentSlug===e.data.slug),[l,r]=(0,i.useState)(!1),[o,v]=(0,i.useState)(null),b=(0,a.jsx)(d.H,{}),N="Private agents are only visible to you.";"public"===e.data.privacy_level?(b=(0,a.jsx)(u.T,{}),N="Public agents are visible to everyone."):"protected"===e.data.privacy_level&&(b=(0,a.jsx)(h.M,{}),N="Protected agents are visible to anyone with a direct link.");let y=e.userProfile,w=(0,F.cI)({resolver:(0,W.F)(ed),defaultValues:{name:e.data.name,persona:e.data.persona,color:e.data.color,icon:e.data.icon,privacy_level:e.data.privacy_level,chat_model:e.data.chat_model,files:e.data.files,input_tools:e.data.input_tools,output_modes:e.data.output_modes}});(0,i.useEffect)(()=>{w.reset({name:e.data.name,persona:e.data.persona,color:e.data.color,icon:e.data.icon,privacy_level:e.data.privacy_level,chat_model:e.data.chat_model,files:e.data.files,input_tools:e.data.input_tools,output_modes:e.data.output_modes})},[e.data]),t&&window.history.pushState({},"Khoj AI - Agent ".concat(e.data.slug),"/agents?agent=".concat(e.data.slug));let _=(0,E.oz)(e.data.color);function C(){return(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-1",children:[e.editCard&&(0,a.jsx)(er,{icon:b,text:e.data.privacy_level,hoverText:N}),e.data.files&&e.data.files.length>0&&(0,a.jsx)(er,{icon:(0,a.jsx)(m.f,{}),text:"knowledge",hoverText:"The agent has a custom knowledge base with ".concat(e.data.files.length," documents. It can use them to give you answers.")}),(0,a.jsx)(er,{icon:(0,a.jsx)(x.a,{}),text:e.data.chat_model,hoverText:"The agent uses the ".concat(e.data.chat_model," model to chat with you.")}),e.data.output_modes.map(t=>(0,a.jsx)(er,{icon:(0,A.vH)(t),hoverText:"".concat(t,": ").concat(e.outputModeOptions[t])},t)),e.data.input_tools.map(t=>(0,a.jsx)(er,{icon:(0,A.vH)(t),hoverText:"".concat(t,": ").concat(e.inputToolOptions[t])},t))]})}return(0,a.jsxs)(I.Zb,{className:"shadow-sm bg-gradient-to-b from-white 20% to-".concat(e.data.color?e.data.color:"gray","-100/50 dark:from-[hsl(var(--background))] dark:to-").concat(e.data.color?e.data.color:"gray","-950/50 rounded-xl hover:shadow-md"),children:[l&&(0,a.jsx)(R.Z,{loginRedirectMessage:"Sign in to start chatting with ".concat(e.data.name),onOpenChange:r}),(0,a.jsx)(I.Ol,{children:(0,a.jsx)(I.ll,{children:(0,a.jsxs)(P.Vq,{open:t,onOpenChange:()=>{s(!t),window.history.pushState({},"Khoj AI - Agents","/agents")},children:[(0,a.jsx)(P.hg,{children:(0,a.jsxs)("div",{className:"flex items-center relative top-2",children:[(0,A.TI)(e.data.icon,e.data.color),e.data.name]})}),(0,a.jsxs)("div",{className:"flex float-right",children:[e.editCard&&(0,a.jsx)("div",{className:"float-right",children:(0,a.jsxs)(es.J2,{children:[(0,a.jsx)(es.xo,{children:(0,a.jsx)(c.z,{className:"bg-[hsl(var(--background))] w-10 h-10 p-0 rounded-xl border dark:border-neutral-700 shadow-sm hover:bg-stone-100 dark:hover:bg-neutral-900",children:(0,a.jsx)(f.F,{className:"w-6 h-6 ".concat((0,E.oz)(e.data.color))})})}),(0,a.jsxs)(es.yk,{className:"w-fit grid p-1",side:"bottom",align:"end",children:[(0,a.jsxs)(c.z,{className:"items-center justify-start",variant:"ghost",onClick:()=>s(!0),children:[(0,a.jsx)(p.z,{className:"w-4 h-4 mr-2"}),"Edit"]}),e.editCard&&"private"!==e.data.privacy_level&&(0,a.jsx)(ea.Z,{buttonTitle:"Share",title:"Share Agent",description:"Share a link to this agent with others. They'll be able to chat with it, and ask questions to all of its knowledge base.",buttonVariant:"ghost",includeIcon:!0,url:"".concat(window.location.origin,"/agents?agent=").concat(e.data.slug)}),e.data.creator===(null==y?void 0:y.username)&&(0,a.jsxs)(c.z,{className:"items-center justify-start",variant:"destructive",onClick:()=>{fetch("/api/agents/".concat(e.data.slug),{method:"DELETE"}).then(()=>{e.setAgentChangeTriggered(!0)})},children:[(0,a.jsx)(g.r,{className:"w-4 h-4 mr-2"}),"Delete"]})]})]})}),(0,a.jsx)("div",{className:"float-right",children:e.userProfile?(0,a.jsx)(c.z,{className:"bg-[hsl(var(--background))] w-10 h-10 p-0 rounded-xl border dark:border-neutral-700 shadow-sm hover:bg-stone-100 dark:hover:bg-neutral-900",onClick:()=>en(e.data.slug,y),children:(0,a.jsx)(j.g,{className:"w-6 h-6 ".concat((0,E.oz)(e.data.color))})}):(0,a.jsx)(c.z,{className:"bg-[hsl(var(--background))] w-14 h-14 rounded-xl border dark:border-neutral-700 shadow-sm hover:bg-stone-100 dark:hover:bg-neutral-900",onClick:()=>r(!0),children:(0,a.jsx)(j.g,{className:"w-6 h-6 ".concat((0,E.oz)(e.data.color))})})})]}),e.editCard?(0,a.jsxs)(P.cZ,{className:"lg:max-w-screen-lg overflow-y-scroll max-h-screen",children:[(0,a.jsxs)(X.$N,{children:["Edit ",(0,a.jsx)("b",{children:e.data.name})]}),(0,a.jsx)(eu,{form:w,onSubmit:t=>{let a=e.editCard?"PATCH":"POST",l=t;e.editCard&&(l={...t,slug:e.data.slug}),fetch("/api/agents",{method:a,headers:{"Content-Type":"application/json"},body:JSON.stringify(l)}).then(t=>{200===t.status?(w.reset(),s(!1),v(null),e.setAgentChangeTriggered(!0)):t.json().then(e=>{console.error(e),w.clearErrors(),e.error&&v(e.error)})}).catch(e=>{console.error("Error:",e),v(e),w.clearErrors()})},create:!1,errors:o,filesOptions:e.filesOptions,modelOptions:e.modelOptions,slug:e.data.slug,inputToolOptions:e.inputToolOptions,isSubscribed:e.isSubscribed,outputModeOptions:e.outputModeOptions})]}):(0,a.jsxs)(P.cZ,{className:"whitespace-pre-line max-h-[80vh] max-w-[90vw] rounded-lg",children:[(0,a.jsx)(P.fK,{children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,A.TI)(e.data.icon,e.data.color),(0,a.jsx)("p",{className:"font-bold text-lg",children:e.data.name})]})}),(0,a.jsx)("div",{className:"max-h-[60vh] overflow-y-scroll text-neutral-500 dark:text-white",children:e.data.persona}),(0,a.jsx)("div",{className:"flex flex-wrap items-center gap-1",children:C()}),(0,a.jsx)(P.cN,{children:(0,a.jsxs)(c.z,{className:"pt-6 pb-6 ".concat(_," bg-white dark:bg-[hsl(var(--background))] text-neutral-500 dark:text-white border-2 border-stone-100 shadow-sm rounded-xl hover:bg-stone-100 dark:hover:bg-neutral-900 dark:border-neutral-700"),onClick:()=>{en(e.data.slug,y),s(!1)},children:[(0,a.jsx)(j.g,{className:"w-6 h-6 m-2 ".concat((0,E.oz)(e.data.color))}),"Start Chatting"]})})]})]})})}),(0,a.jsx)(I.aY,{children:(0,a.jsx)("div",{className:n().agentPersonality,children:(0,a.jsx)("button",{className:"".concat(n().infoButton," text-neutral-500 dark:text-white"),onClick:()=>s(!0),children:(0,a.jsx)("p",{children:e.data.persona})})})}),(0,a.jsx)(I.eW,{children:(0,a.jsx)("div",{className:"flex flex-wrap items-center gap-1",children:C()})})]})}let ed=T.z.object({name:T.z.string({required_error:"Name is required"}).min(1,"Name is required"),persona:T.z.string({required_error:"Personality is required"}).min(1,"Personality is required"),color:T.z.string({required_error:"Color is required"}).min(1,"Color is required"),icon:T.z.string({required_error:"Icon is required"}).min(1,"Icon is required"),privacy_level:T.z.string({required_error:"Privacy level is required"}).min(1,"Privacy level is required"),chat_model:T.z.string({required_error:"Chat model is required"}).min(1,"Chat model is required"),files:T.z.array(T.z.string()).default([]).optional(),input_tools:T.z.array(T.z.string()).default([]).optional(),output_modes:T.z.array(T.z.string()).default([]).optional()});function eu(e){let[t,s]=(0,i.useState)(!1),l=(0,A.BI)(),n=E.xF,r=(0,E.oz)(e.form.getValues("color")),[o,d]=(0,i.useState)(!1),[u,h]=(0,i.useState)(null),[m,x]=(0,i.useState)(null),[f,p]=(0,i.useState)(!1),[g,j]=(0,i.useState)(0),[z,T]=(0,i.useState)([]),[I,P]=(0,i.useState)([]),[R,V]=(0,i.useState)(0),[M,Z]=(0,i.useState)(!0),F=["public","private","protected"],W=[{fields:[{name:"name",label:"Name"},{name:"persona",label:"Personality"}],label:"Basic Settings"},{fields:[{name:"color",label:"Color"},{name:"icon",label:"Icon"},{name:"chat_model",label:"Chat Model"},{name:"privacy_level",label:"Privacy Level"}],label:"Customization & Access"},{fields:[{name:"files",label:"Knowledge Base"},{name:"input_tools",label:"Input Tools"},{name:"output_modes",label:"Output Modes"}],label:"Advanced Settings"}],X=(0,i.useRef)(null);function Y(e){e.preventDefault(),d(!0)}function ea(e){e.preventDefault(),d(!1)}function el(e){e.preventDefault(),d(!1),e.dataTransfer.files&&en(e.dataTransfer.files)}function en(e){(0,H.ko)(e,h,p,x,T)}function er(){X&&X.current&&X.current.click()}function ei(e){e.target.files&&en(e.target.files)}(0,i.useEffect)(()=>{if(f||j(0),f){let e=setInterval(()=>{j(e=>{let t=e+(Math.floor(5*Math.random())+1);return t<100?t:100})},800);return()=>clearInterval(e)}},[f]),(0,i.useEffect)(()=>{P(Array.from(new Set([...I,...e.form.getValues("files")||[],...e.filesOptions||[]])))},[]),(0,i.useEffect)(()=>{z.length>0&&(eo(z),P(e=>[...e,...z]))},[z]),(0,i.useEffect)(()=>{e.errors&&s(!1)},[e.errors]);let eo=t=>{for(let s of t){let t=e.form.getValues("files")||[],a=t.includes(s)?t.filter(e=>e!==s):[...t,s];e.form.setValue("files",a)}};if(!e.isSubscribed&&M)return(0,a.jsx)(ee.aR,{open:!0,children:(0,a.jsxs)(ee._T,{children:[(0,a.jsx)(ee.fY,{children:(0,a.jsx)(ee.f$,{children:"Upgrade to Futurist"})}),(0,a.jsxs)(ee.yT,{children:["You need to be a Futurist subscriber to create more agents."," ",(0,a.jsx)("a",{href:"/settings",children:"Upgrade now"}),"."]}),(0,a.jsxs)(ee.xo,{children:[(0,a.jsx)(ee.le,{onClick:()=>{Z(!1)},children:"Cancel"}),(0,a.jsx)(ee.OL,{onClick:()=>{window.location.href="/settings"},children:"Continue"})]})]})});let ec=t=>{switch(t){case"name":return(0,a.jsx)(q.Wi,{control:e.form.control,name:"name",render:e=>{let{field:t}=e;return(0,a.jsxs)(q.xJ,{className:"space-y-0 grid gap-2",children:[(0,a.jsx)(q.lX,{children:"Name"}),(0,a.jsx)(q.pf,{children:"What should this agent be called? Pick something descriptive & memorable."}),(0,a.jsx)(q.NI,{children:(0,a.jsx)(L.I,{placeholder:"Biologist",...t})}),(0,a.jsx)(q.zG,{})]})}},t);case"chat_model":return(0,a.jsx)(q.Wi,{control:e.form.control,name:"chat_model",render:t=>{let{field:s}=t;return(0,a.jsxs)(q.xJ,{className:"space-y-1 grid gap-2",children:[(0,a.jsx)(q.lX,{children:"Chat Model"}),(0,a.jsx)(q.pf,{children:"Which large language model should this agent use?"}),(0,a.jsxs)(J.Ph,{onValueChange:s.onChange,defaultValue:s.value,children:[(0,a.jsx)(q.NI,{children:(0,a.jsx)(J.i4,{className:"text-left",children:(0,a.jsx)(J.ki,{})})}),(0,a.jsx)(J.Bw,{className:"items-start space-y-1 inline-flex flex-col",children:e.modelOptions.map(e=>(0,a.jsx)(J.Ql,{value:e.name,children:(0,a.jsx)("div",{className:"flex items-center space-x-2",children:e.name})},e.id))})]}),(0,a.jsx)(q.zG,{})]})}},t);case"privacy_level":return(0,a.jsx)(q.Wi,{control:e.form.control,name:"privacy_level",render:e=>{let{field:t}=e;return(0,a.jsxs)(q.xJ,{className:"space-y-1 grid gap-2",children:[(0,a.jsx)(q.lX,{children:(0,a.jsx)("div",{children:"Privacy Level"})}),(0,a.jsx)(q.pf,{children:(0,a.jsxs)(es.J2,{children:[(0,a.jsx)(es.xo,{asChild:!0,children:(0,a.jsx)(c.z,{variant:"ghost",className:"p-0 h-fit",children:(0,a.jsxs)("span",{className:"items-center flex gap-1 text-sm",children:[(0,a.jsx)(v.k,{className:"inline"}),(0,a.jsx)("p",{className:"text-sm",children:"Learn more"})]})})}),(0,a.jsxs)(es.yk,{children:[(0,a.jsx)("b",{children:"Private"}),": only visible to you.",(0,a.jsx)("br",{}),(0,a.jsx)("b",{children:"Protected"}),": visible to anyone with a link.",(0,a.jsx)("br",{}),(0,a.jsx)("b",{children:"Public"}),": visible to everyone.",(0,a.jsx)("br",{}),"All public agents will be reviewed by us before they are launched."]})]})}),(0,a.jsxs)(J.Ph,{onValueChange:t.onChange,defaultValue:t.value,children:[(0,a.jsx)(q.NI,{children:(0,a.jsx)(J.i4,{className:"w-[200px]",children:(0,a.jsx)(J.ki,{placeholder:"private"})})}),(0,a.jsx)(J.Bw,{className:"items-center space-y-1 inline-flex flex-col",children:F.map(e=>(0,a.jsx)(J.Ql,{value:e,children:(0,a.jsx)("div",{className:"flex items-center space-x-2",children:e})},e))})]}),(0,a.jsx)(q.zG,{})]})}},t);case"color":return(0,a.jsx)(q.Wi,{control:e.form.control,name:"color",render:e=>{let{field:t}=e;return(0,a.jsxs)(q.xJ,{className:"space-y-3",children:[(0,a.jsx)(q.lX,{children:"Color"}),(0,a.jsx)(q.pf,{children:"Choose a color for your agent."}),(0,a.jsxs)(J.Ph,{onValueChange:t.onChange,defaultValue:t.value,children:[(0,a.jsx)(q.NI,{children:(0,a.jsx)(J.i4,{className:"w-[200px]",children:(0,a.jsx)(J.ki,{placeholder:"Color"})})}),(0,a.jsx)(J.Bw,{className:"items-center space-y-1 inline-flex flex-col",children:n.map(e=>(0,a.jsx)(J.Ql,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(b.C,{className:"w-6 h-6 mr-2 ".concat((0,E.oz)(e)),weight:"fill"}),e]})},e))})]}),(0,a.jsx)(q.zG,{})]})}},t);case"icon":return(0,a.jsx)(q.Wi,{control:e.form.control,name:"icon",render:t=>{let{field:s}=t;return(0,a.jsxs)(q.xJ,{className:"space-y-3",children:[(0,a.jsx)(q.lX,{children:"Icon"}),(0,a.jsx)(q.pf,{children:"Choose an icon for your agent."}),(0,a.jsxs)(J.Ph,{onValueChange:s.onChange,defaultValue:s.value,children:[(0,a.jsx)(q.NI,{children:(0,a.jsx)(J.i4,{className:"w-[200px]",children:(0,a.jsx)(J.ki,{placeholder:"Icon"})})}),(0,a.jsx)(J.Bw,{className:"items-center space-y-1 inline-flex flex-col",children:l.map(t=>(0,a.jsx)(J.Ql,{value:t,children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,A.TI)(t,e.form.getValues("color"),"w-6","h-6"),t]})},t))})]}),(0,a.jsx)(q.zG,{})]})}},t);case"persona":return(0,a.jsx)(q.Wi,{control:e.form.control,name:"persona",render:e=>{let{field:t}=e;return(0,a.jsxs)(q.xJ,{className:"space-y-1 grid gap-2",children:[(0,a.jsx)(q.lX,{children:"Personality"}),(0,a.jsx)(q.pf,{children:"What is the personality, thought process, or tuning of this agent? Get creative; this is how you can influence the agent constitution."}),(0,a.jsx)(q.NI,{children:(0,a.jsx)(D.g,{placeholder:"You are an excellent biologist, at the top of your field in marine biology.",...t})}),(0,a.jsx)(q.zG,{})]})}},t);case"files":return(0,a.jsx)(q.Wi,{control:e.form.control,name:"files",render:t=>{let{field:s}=t;return(0,a.jsxs)(q.xJ,{className:"flex flex-col gap-2",children:[(0,a.jsx)(q.lX,{children:"Knowledge Base"}),(0,a.jsxs)(q.pf,{children:["Which information should be part of its digital brain?"," ",(0,a.jsx)("a",{href:"/settings",children:"Manage data"}),"."]}),(0,a.jsxs)(G,{children:[(0,a.jsxs)(U,{className:"flex items-center justify-between text-sm gap-2",children:[(0,a.jsx)(N.K,{}),s.value&&s.value.length>0?"".concat(s.value.length," files selected"):"Select files"]}),(0,a.jsx)(K,{children:(0,a.jsxs)(Q.mY,{children:[(0,a.jsx)(ee.aR,{open:null!==u||null!=m,children:(0,a.jsxs)(ee._T,{children:[(0,a.jsx)(ee.fY,{children:(0,a.jsx)(ee.f$,{children:"Alert"})}),(0,a.jsx)(ee.yT,{children:u||m}),(0,a.jsx)(ee.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>{h(null),x(null),p(!1)},children:"Close"})]})}),(0,a.jsxs)("div",{className:"flex flex-col h-full cursor-pointer",onDragOver:Y,onDragLeave:ea,onDrop:el,onClick:er,children:[(0,a.jsx)("input",{type:"file",multiple:!0,ref:X,style:{display:"none"},onChange:ei}),(0,a.jsx)("div",{className:"flex-none p-4",children:f&&(0,a.jsx)(et.E,{indicatorColor:"bg-slate-500",className:"w-full h-2 rounded-full",value:g})}),(0,a.jsx)("div",{className:"flex-none p-4 bg-secondary border-b ".concat(o?"animate-pulse":""," rounded-lg"),children:(0,a.jsx)("div",{className:"flex items-center justify-center w-full h-16 border-2 border-dashed border-gray-300 rounded-lg",children:o?(0,a.jsxs)("div",{className:"flex items-center justify-center w-full h-full",children:[(0,a.jsx)(y.u,{className:"h-6 w-6 mr-2"}),(0,a.jsx)("span",{children:"Drop files to upload"})]}):(0,a.jsxs)("div",{className:"flex items-center justify-center w-full h-full",children:[(0,a.jsx)(w.v,{className:"h-6 w-6 mr-2"}),(0,a.jsx)("span",{children:"Drag and drop files here"})]})})})]}),(0,a.jsx)(Q.sZ,{placeholder:"Select files..."}),(0,a.jsxs)(Q.e8,{children:[(0,a.jsx)(Q.rb,{children:"No files found."}),(0,a.jsx)(Q.fu,{children:I.map(t=>(0,a.jsxs)(Q.di,{value:t,onSelect:()=>{let s=e.form.getValues("files")||[],a=s.includes(t)?s.filter(e=>e!==t):[...s,t];e.form.setValue("files",a)},children:[(0,a.jsx)(_.J,{className:(0,$.cn)("mr-2 h-4 w-4",s.value&&s.value.includes(t)?"opacity-100":"opacity-0")}),t]},t))})]})]})})]})]})}},t);case"input_tools":return(0,a.jsx)(q.Wi,{control:e.form.control,name:"input_tools",render:t=>{let{field:s}=t;return(0,a.jsxs)(q.xJ,{className:"flex flex-col gap-2",children:[(0,a.jsx)(q.lX,{children:"Restrict Input Tools"}),(0,a.jsxs)(q.pf,{children:["Which knowledge retrieval tools should this agent be limited to?",(0,a.jsx)("br",{}),(0,a.jsx)("b",{children:"Default:"})," No limitations."]}),(0,a.jsxs)(G,{children:[(0,a.jsxs)(U,{className:"flex items-center justify-between text-sm gap-2",children:[(0,a.jsx)(N.K,{}),s.value&&s.value.length>0?"".concat(s.value.length," tools selected"):"All tools"]}),(0,a.jsx)(K,{children:(0,a.jsx)(Q.mY,{children:(0,a.jsx)(Q.e8,{children:(0,a.jsx)(Q.fu,{children:Object.entries(e.inputToolOptions).map(t=>{let[l,n]=t;return(0,a.jsxs)(Q.di,{value:l,onSelect:()=>{let t=e.form.getValues("input_tools")||[],s=t.includes(l)?t.filter(e=>e!==l):[...t,l];e.form.setValue("input_tools",s)},children:[(0,a.jsx)(_.J,{className:(0,$.cn)("mr-2 h-4 w-4",s.value&&s.value.includes(l)?"opacity-100":"opacity-0")}),(0,a.jsxs)("div",{className:(0,$.cn)("flex items-center space-x-2"),children:[(0,a.jsx)("p",{children:(0,a.jsx)("b",{children:l})}),(0,a.jsx)("p",{children:n})]})]},l)})})})})})]})]})}},t);case"output_modes":return(0,a.jsx)(q.Wi,{control:e.form.control,name:"output_modes",render:t=>{let{field:s}=t;return(0,a.jsxs)(q.xJ,{className:"flex flex-col gap-2",children:[(0,a.jsx)(q.lX,{children:"Restrict Output Modes"}),(0,a.jsxs)(q.pf,{children:["Which output modes should this agent be limited to?",(0,a.jsx)("br",{}),(0,a.jsx)("b",{children:"Default:"})," No limitations."]}),(0,a.jsxs)(G,{children:[(0,a.jsxs)(U,{className:"flex items-center justify-between text-sm gap-2",children:[(0,a.jsx)(N.K,{}),s.value&&s.value.length>0?"".concat(s.value.length," modes selected"):"All modes"]}),(0,a.jsx)(K,{children:(0,a.jsx)(Q.mY,{children:(0,a.jsx)(Q.e8,{children:(0,a.jsx)(Q.fu,{children:Object.entries(e.outputModeOptions).map(t=>{let[l,n]=t;return(0,a.jsxs)(Q.di,{value:l,onSelect:()=>{let t=e.form.getValues("output_modes")||[],s=t.includes(l)?t.filter(e=>e!==l):[...t,l];e.form.setValue("output_modes",s)},children:[(0,a.jsx)(_.J,{className:(0,$.cn)("mr-2 h-4 w-4",s.value&&s.value.includes(l)?"opacity-100":"opacity-0")}),(0,a.jsxs)("div",{className:(0,$.cn)("flex items-center space-x-2"),children:[(0,a.jsx)("p",{children:(0,a.jsx)("b",{children:l})}),(0,a.jsx)("p",{children:n})]})]},l)})})})})})]})]})}},t);default:return null}};return(0,a.jsx)(q.l0,{...e.form,children:(0,a.jsxs)("form",{onSubmit:e.form.handleSubmit(t=>{e.onSubmit(t),s(!0)}),className:"space-y-6",children:[(0,a.jsx)("div",{className:"space-y-6",children:W[R].label}),R<W.length&&W[R].fields.map(e=>ec(e.name)),(0,a.jsxs)("div",{className:"flex justify-between mt-4",children:[(0,a.jsxs)(c.z,{type:"button",variant:"outline",onClick:e=>{e.preventDefault(),R>0&&V(R-1)},disabled:0===R,className:"items-center ".concat(t?"bg-stone-100 dark:bg-neutral-900":""," text-white ").concat(r),children:[(0,a.jsx)(C.X,{className:"mr-2 h-4 w-4"}),"Previous"]}),R<W.length-1?(0,a.jsxs)(c.z,{type:"button",variant:"outline",onClick:e=>{e.preventDefault(),R<W.length-1&&V(R+1)},disabled:!(t=>{try{return ed.parse(e.form.getValues()),!0}catch(s){let e=s.errors.reduce((e,t)=>(e[t.path[0]]=t.message,e),{});for(let s of t.fields)if(e[s.name])return!1;return!0}})(W[R]),className:"items-center ".concat(t?"bg-stone-100 dark:bg-neutral-900":""," text-white ").concat(r),children:["Next",(0,a.jsx)(k.o,{className:"ml-2 h-4 w-4"})]}):(0,a.jsxs)(c.z,{type:"submit",variant:"outline",disabled:t||!e.isSubscribed,className:"items-center ".concat(t?"bg-stone-100 dark:bg-neutral-900":""," text-white ").concat(r),children:[(0,a.jsx)(S.B,{className:"h-4 w-4 mr-2"}),t?"Booting...":"Save"]})]}),e.errors&&(0,a.jsx)(B.bZ,{className:"bg-secondary border-none my-4",children:(0,a.jsxs)(B.X,{className:"flex items-center gap-1",children:[(0,a.jsx)(O.f,{weight:"fill",className:"h-4 w-4 text-yellow-400 inline"}),(0,a.jsx)("span",{children:e.errors})]})})]})})}function eh(e){let[t,s]=(0,i.useState)(!1),[l,n]=(0,i.useState)(null),[r,o]=(0,i.useState)(!0),c=(0,F.cI)({resolver:(0,W.F)(ed),defaultValues:{name:e.data.name,persona:e.data.persona,color:e.data.color,icon:e.data.icon,privacy_level:e.data.privacy_level,chat_model:e.selectedChatModelOption,files:[]}});return(0,i.useEffect)(()=>{c.reset({name:e.data.name,persona:e.data.persona,color:e.data.color,icon:e.data.icon,privacy_level:e.data.privacy_level,chat_model:e.selectedChatModelOption,files:[]})},[e.selectedChatModelOption,e.data]),(0,a.jsxs)(P.Vq,{open:t,onOpenChange:s,children:[(0,a.jsx)(P.hg,{children:(0,a.jsxs)("div",{className:"flex items-center text-md gap-2",children:[(0,a.jsx)(w.v,{}),"Create Agent"]})}),(0,a.jsxs)(P.cZ,{className:"lg:max-w-screen-lg overflow-y-scroll max-h-screen",children:[(0,a.jsx)(P.fK,{children:"Create Agent"}),!e.userProfile&&r&&(0,a.jsx)(R.Z,{loginRedirectMessage:"Sign in to start chatting with a specialized agent",onOpenChange:o}),(0,a.jsx)(eu,{form:c,onSubmit:t=>{fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then(t=>{200===t.status?(c.reset(),s(!1),n(null),e.setAgentChangeTriggered(!0)):t.json().then(e=>{console.error(e),e.error&&n(e.error)})}).catch(e=>{console.error("Error:",e),n(e)})},create:!0,errors:l,filesOptions:e.filesOptions,modelOptions:e.modelOptions,inputToolOptions:e.inputToolOptions,outputModeOptions:e.outputModeOptions,isSubscribed:e.isSubscribed})]})]})}function em(){let{data:e,error:t,mutate:s}=(0,r.ZP)("agents",ei,{revalidateOnFocus:!1}),l=(0,o.GW)(),{userConfig:c}=(0,o.h2)(!0),[d,u]=(0,i.useState)(!1),h=(0,Z.IC)(),[m,x]=(0,i.useState)([]),[f,p]=(0,i.useState)([]),[g,j]=(0,i.useState)(null),{data:v,error:b}=(0,r.ZP)(c?"/api/content/computer":null,eo),{data:N,error:y}=(0,r.ZP)("/api/agents/options",eo),[w,_]=(0,i.useState)(!1);if((0,i.useEffect)(()=>{w&&(s(),_(!1))},[w]),(0,i.useEffect)(()=>{if(e){x(e.filter(e=>e.creator===(null==l?void 0:l.username)));let t=e.filter(e=>"private"!==e.privacy_level&&e.creator!==(null==l?void 0:l.username));p(t);{let s=new URLSearchParams(window.location.search).get("agent");if(s){j(s);let a=e.find(e=>e.slug===s);a||(a=t.find(e=>e.slug===s)),a||fetch("/api/agents/".concat(s)).then(e=>{if(404===e.status)throw Error("Agent not found");return e.json()}).then(e=>{"protected"===e.privacy_level&&p(t=>[...t,e])})}}}},[e,l]),t)return(0,a.jsxs)("main",{className:n().main,children:[(0,a.jsx)("div",{className:"".concat(n().titleBar," text-5xl"),children:"Agents"}),(0,a.jsx)("div",{className:n().agentList,children:"Error loading agents"})]});if(!e)return(0,a.jsx)("main",{className:n().main,children:(0,a.jsxs)("div",{className:n().agentList,children:[(0,a.jsx)(V.l,{})," booting up your agents"]})});let C=(null==c?void 0:c.chat_model_options)||[],k=(null==c?void 0:c.selected_chat_model_config)||0,S=(null==c?void 0:c.subscription_state)&&[o.o9.SUBSCRIBED.valueOf(),o.o9.TRIAL.valueOf(),o.o9.UNSUBSCRIBED.valueOf()].includes(c.subscription_state)||!1,O=C.find(e=>e.id===k);return(0,a.jsx)("main",{className:"w-full mx-auto",children:(0,a.jsxs)("div",{className:"grid w-full mx-auto",children:[(0,a.jsx)("div",{className:"".concat(n().sidePanel," top-0"),children:(0,a.jsx)(M.ZP,{conversationId:null,uploadedFiles:[],isMobileWidth:h})}),(0,a.jsxs)("div",{className:"".concat(n().pageLayout," w-full"),children:[(0,a.jsxs)("div",{className:"pt-6 md:pt-8 flex justify-between",children:[(0,a.jsx)("h1",{className:"text-3xl flex items-center",children:"Agents"}),(0,a.jsx)("div",{className:"ml-auto float-right border p-2 pt-3 rounded-xl font-bold hover:bg-stone-100 dark:hover:bg-neutral-900",children:(0,a.jsx)(eh,{data:{slug:"",name:"",persona:"",color:"",icon:"",privacy_level:"private",managed_by_admin:!1,chat_model:"",input_tools:[],output_modes:[]},userProfile:l,isMobileWidth:h,filesOptions:v||[],modelOptions:(null==c?void 0:c.chat_model_options)||[],selectedChatModelOption:(null==O?void 0:O.name)||"",isSubscribed:S,setAgentChangeTriggered:_,inputToolOptions:(null==N?void 0:N.input_tools)||{},outputModeOptions:(null==N?void 0:N.output_modes)||{}})})]}),d&&(0,a.jsx)(R.Z,{loginRedirectMessage:"Sign in to start chatting with a specialized agent",onOpenChange:u}),(0,a.jsx)(B.bZ,{className:"bg-secondary border-none my-4",children:(0,a.jsxs)(B.X,{children:[(0,a.jsx)(z.B,{weight:"fill",className:"h-4 w-4 text-purple-400 inline"}),(0,a.jsx)("span",{className:"font-bold",children:"How it works"})," Use any of these specialized personas to tune your conversation to your needs."]})}),(0,a.jsx)("div",{className:"pt-6 md:pt-8",children:(0,a.jsx)("div",{className:"".concat(n().agentList),children:m.map(e=>(0,a.jsx)(ec,{data:e,userProfile:l,isMobileWidth:h,filesOptions:null!=v?v:[],selectedChatModelOption:(null==O?void 0:O.name)||"",isSubscribed:S,setAgentChangeTriggered:_,modelOptions:(null==c?void 0:c.chat_model_options)||[],editCard:!0,agentSlug:g||"",inputToolOptions:(null==N?void 0:N.input_tools)||{},outputModeOptions:(null==N?void 0:N.output_modes)||{}},e.slug))})}),(0,a.jsxs)("div",{className:"pt-6 md:pt-8",children:[(0,a.jsx)("h2",{className:"text-2xl",children:"Explore"}),(0,a.jsx)("div",{className:"".concat(n().agentList),children:f.map(e=>(0,a.jsx)(ec,{data:e,userProfile:l,isMobileWidth:h,editCard:!1,filesOptions:null!=v?v:[],selectedChatModelOption:(null==O?void 0:O.name)||"",isSubscribed:S,setAgentChangeTriggered:_,modelOptions:(null==c?void 0:c.chat_model_options)||[],agentSlug:g||"",inputToolOptions:(null==N?void 0:N.input_tools)||{},outputModeOptions:(null==N?void 0:N.output_modes)||{}},e.slug))})]})]})]})})}},66820:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});var a=s(57437),l=s(6780),n=s(87138);function r(e){return(0,a.jsx)(l.aR,{open:!0,onOpenChange:e.onOpenChange,children:(0,a.jsxs)(l._T,{children:[(0,a.jsx)(l.fY,{children:(0,a.jsx)(l.f$,{children:"Sign in to Khoj to continue"})}),(0,a.jsxs)(l.yT,{children:[e.loginRedirectMessage,". By logging in, you agree to our"," ",(0,a.jsx)(n.default,{href:"https://khoj.dev/terms-of-service",children:"Terms of Service."})]}),(0,a.jsxs)(l.xo,{children:[(0,a.jsx)(l.le,{children:"Dismiss"}),(0,a.jsx)(l.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>{window.location.href="/login?next=".concat(encodeURIComponent(window.location.pathname))},children:(0,a.jsxs)(n.default,{href:"/login?next=".concat(encodeURIComponent(window.location.pathname)),children:[" ","Login"]})})]})]})})}},18642:function(e,t,s){"use strict";s.d(t,{Z:function(){return c}});var a=s(57437),l=s(90837),n=s(50495),r=s(83102),i=s(67135),o=s(34797);function c(e){var t;return(0,a.jsxs)(l.Vq,{children:[(0,a.jsx)(l.hg,{asChild:!0,onClick:e.onShare,children:(0,a.jsxs)(n.z,{size:"sm",className:"".concat(e.buttonClassName||"px-3"),variant:null!==(t=e.buttonVariant)&&void 0!==t?t:"default",children:[e.includeIcon&&(0,a.jsx)(o.m,{className:"w-4 h-4 mr-2"}),e.buttonTitle]})}),(0,a.jsxs)(l.cZ,{children:[(0,a.jsxs)(l.fK,{children:[(0,a.jsx)(l.$N,{children:e.title}),(0,a.jsx)(l.Be,{children:e.description})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsxs)("div",{className:"grid flex-1 gap-2",children:[(0,a.jsx)(i._,{htmlFor:"link",className:"sr-only",children:"Link"}),(0,a.jsx)(r.I,{id:"link",defaultValue:e.url,readOnly:!0})]}),(0,a.jsx)(n.z,{type:"submit",size:"sm",className:"px-3",onClick:()=>(function(e){let t=navigator.clipboard;t&&t.writeText(e)})(e.url),children:(0,a.jsx)("span",{children:"Copy"})})]})]})]})}},47412:function(e,t,s){"use strict";s.d(t,{X:function(){return c},bZ:function(){return o}});var a=s(57437),l=s(2265),n=s(12218),r=s(37440);let i=(0,n.j)("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),o=l.forwardRef((e,t)=>{let{className:s,variant:l,...n}=e;return(0,a.jsx)("div",{ref:t,role:"alert",className:(0,r.cn)(i({variant:l}),s),...n})});o.displayName="Alert",l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)("h5",{ref:t,className:(0,r.cn)("mb-1 font-medium leading-none tracking-tight",s),...l})}).displayName="AlertTitle";let c=l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)("div",{ref:t,className:(0,r.cn)("text-sm [&_p]:leading-relaxed",s),...l})});c.displayName="AlertDescription"},32653:function(e,t,s){"use strict";s.d(t,{NI:function(){return p},Wi:function(){return u},l0:function(){return c},lX:function(){return f},pf:function(){return g},xJ:function(){return x},zG:function(){return j}});var a=s(57437),l=s(2265),n=s(71538),r=s(39343),i=s(37440),o=s(67135);let c=r.RV,d=l.createContext({}),u=e=>{let{...t}=e;return(0,a.jsx)(d.Provider,{value:{name:t.name},children:(0,a.jsx)(r.Qr,{...t})})},h=()=>{let e=l.useContext(d),t=l.useContext(m),{getFieldState:s,formState:a}=(0,r.Gc)(),n=s(e.name,a);if(!e)throw Error("useFormField should be used within <FormField>");let{id:i}=t;return{id:i,name:e.name,formItemId:"".concat(i,"-form-item"),formDescriptionId:"".concat(i,"-form-item-description"),formMessageId:"".concat(i,"-form-item-message"),...n}},m=l.createContext({}),x=l.forwardRef((e,t)=>{let{className:s,...n}=e,r=l.useId();return(0,a.jsx)(m.Provider,{value:{id:r},children:(0,a.jsx)("div",{ref:t,className:(0,i.cn)("space-y-2",s),...n})})});x.displayName="FormItem";let f=l.forwardRef((e,t)=>{let{className:s,...l}=e,{error:n,formItemId:r}=h();return(0,a.jsx)(o._,{ref:t,className:(0,i.cn)(n&&"text-destructive",s),htmlFor:r,...l})});f.displayName="FormLabel";let p=l.forwardRef((e,t)=>{let{...s}=e,{error:l,formItemId:r,formDescriptionId:i,formMessageId:o}=h();return(0,a.jsx)(n.g7,{ref:t,id:r,"aria-describedby":l?"".concat(i," ").concat(o):"".concat(i),"aria-invalid":!!l,...s})});p.displayName="FormControl";let g=l.forwardRef((e,t)=>{let{className:s,...l}=e,{formDescriptionId:n}=h();return(0,a.jsx)("p",{ref:t,id:n,className:(0,i.cn)("text-sm text-muted-foreground",s),...l})});g.displayName="FormDescription";let j=l.forwardRef((e,t)=>{let{className:s,children:l,...n}=e,{error:r,formMessageId:o}=h(),c=r?String(null==r?void 0:r.message):l;return c?(0,a.jsx)("p",{ref:t,id:o,className:(0,i.cn)("text-sm font-medium text-destructive",s),...n,children:c}):null});j.displayName="FormMessage"},67135:function(e,t,s){"use strict";s.d(t,{_:function(){return c}});var a=s(57437),l=s(2265),n=s(38364),r=s(12218),i=s(37440);let o=(0,r.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),c=l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)(n.f,{ref:t,className:(0,i.cn)(o(),s),...l})});c.displayName=n.f.displayName},70571:function(e,t,s){"use strict";s.d(t,{E:function(){return i}});var a=s(57437),l=s(2265),n=s(52431),r=s(37440);let i=l.forwardRef((e,t)=>{let{className:s,value:l,indicatorColor:i,...o}=e;return(0,a.jsx)(n.fC,{ref:t,className:(0,r.cn)("relative h-4 w-full overflow-hidden rounded-full bg-secondary",s),...o,children:(0,a.jsx)(n.z$,{className:"h-full w-full flex-1 bg-primary transition-all ".concat(i),style:{transform:"translateX(-".concat(100-(l||0),"%)")}})})});i.displayName=n.fC.displayName},46294:function(e,t,s){"use strict";s.d(t,{Bw:function(){return f},Ph:function(){return d},Ql:function(){return p},i4:function(){return h},ki:function(){return u}});var a=s(57437),l=s(2265),n=s(77539),r=s(42421),i=s(14392),o=s(22468),c=s(37440);let d=n.fC;n.ZA;let u=n.B4,h=l.forwardRef((e,t)=>{let{className:s,children:l,...i}=e;return(0,a.jsxs)(n.xz,{ref:t,className:(0,c.cn)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",s),...i,children:[l,(0,a.jsx)(n.JO,{asChild:!0,children:(0,a.jsx)(r.Z,{className:"h-4 w-4 opacity-50"})})]})});h.displayName=n.xz.displayName;let m=l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)(n.u_,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",s),...l,children:(0,a.jsx)(i.Z,{className:"h-4 w-4"})})});m.displayName=n.u_.displayName;let x=l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)(n.$G,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",s),...l,children:(0,a.jsx)(r.Z,{className:"h-4 w-4"})})});x.displayName=n.$G.displayName;let f=l.forwardRef((e,t)=>{let{className:s,children:l,position:r="popper",...i}=e;return(0,a.jsx)(n.h_,{children:(0,a.jsxs)(n.VY,{ref:t,className:(0,c.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===r&&"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:r,...i,children:[(0,a.jsx)(m,{}),(0,a.jsx)(n.l_,{className:(0,c.cn)("p-1","popper"===r&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:l}),(0,a.jsx)(x,{})]})})});f.displayName=n.VY.displayName,l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)(n.__,{ref:t,className:(0,c.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",s),...l})}).displayName=n.__.displayName;let p=l.forwardRef((e,t)=>{let{className:s,children:l,...r}=e;return(0,a.jsxs)(n.ck,{ref:t,className:(0,c.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),...r,children:[(0,a.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,a.jsx)(n.wU,{children:(0,a.jsx)(o.Z,{className:"h-4 w-4"})})}),(0,a.jsx)(n.eT,{children:l})]})});p.displayName=n.ck.displayName,l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)(n.Z0,{ref:t,className:(0,c.cn)("-mx-1 my-1 h-px bg-muted",s),...l})}).displayName=n.Z0.displayName},93146:function(e,t,s){"use strict";s.d(t,{g:function(){return r}});var a=s(57437),l=s(2265),n=s(37440);let r=l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)("textarea",{className:(0,n.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",s),ref:t,...l})});r.displayName="Textarea"},19666:function(e,t,s){"use strict";s.d(t,{_v:function(){return d},aJ:function(){return c},pn:function(){return i},u:function(){return o}});var a=s(57437),l=s(2265),n=s(27071),r=s(37440);let i=n.zt,o=n.fC,c=n.xz,d=l.forwardRef((e,t)=>{let{className:s,sideOffset:l=4,...i}=e;return(0,a.jsx)(n.VY,{ref:t,sideOffset:l,className:(0,r.cn)("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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),...i})});d.displayName=n.VY.displayName},15283:function(e){e.exports={titleBar:"agents_titleBar__FzYbY",agentPersonality:"agents_agentPersonality__o0Ysz",pageLayout:"agents_pageLayout__gR3S3",sidePanel:"agents_sidePanel__wGVGc",infoButton:"agents_infoButton__NqI7E",agentList:"agents_agentList__XVx4A"}}},function(e){e.O(0,[9460,9427,9001,3062,4086,3110,51,7762,1603,9417,2971,7023,1744],function(){return e(e.s=1813)}),_N_E=e.O()}]);
@@ -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,38874))},38874:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return p}});var a=s(57437),o=s(65104),n=s.n(o),i=s(2265),r=s(48861),c=s(82697),l=s(16463),d=s(58485),u=s(9557);s(7395);var h=s(69591),m=s(59479),g=s(79306);function f(e){let t=(0,l.useSearchParams)().get("conversationId"),[s,o]=(0,i.useState)(""),[r,d]=(0,i.useState)(null),[u,h]=(0,i.useState)(!1),[g,f]=(0,i.useState)(null),p=e.setQueryToProcess,x=e.onConversationIdChange;if((0,i.useEffect)(()=>{r&&e.setImage64(encodeURIComponent(r))},[r,e.setImage64]),(0,i.useEffect)(()=>{let t=localStorage.getItem("image");t&&(d(t),e.setImage64(encodeURIComponent(t)),localStorage.removeItem("image"));let s=localStorage.getItem("message");s&&(h(!0),p(s))},[p]),(0,i.useEffect)(()=>{s&&(h(!0),p(s))},[s,p]),(0,i.useEffect)(()=>{t&&(null==x||x(t))},[t,x]),(0,i.useEffect)(()=>{e.streamedMessages&&e.streamedMessages.length>0&&e.streamedMessages[e.streamedMessages.length-1].completed?h(!1):o("")},[e.streamedMessages]),!t){window.location.href="/";return}return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:n().chatBodyFull,children:(0,a.jsx)(c.Z,{conversationId:t,setTitle:e.setTitle,setAgent:f,pendingMessage:u?s:"",incomingMessages:e.streamedMessages})}),(0,a.jsx)("div",{className:"".concat(n().inputBox," p-1 md:px-2 shadow-md bg-background align-middle items-center justify-center dark:bg-neutral-700 dark:border-0 dark:shadow-sm rounded-t-2xl rounded-b-none md:rounded-xl h-fit"),children:(0,a.jsx)(m.Z,{agentColor:null==g?void 0:g.color,isLoggedIn:e.isLoggedIn,sendMessage:e=>o(e),sendImage:e=>d(e),sendDisabled:u,chatOptionsData:e.chatOptionsData,conversationId:t,isMobileWidth:e.isMobileWidth,setUploadedFiles:e.setUploadedFiles})})]})}function p(){let e="Khoj AI - Chat",[t,s]=(0,i.useState)(null),[o,c]=(0,i.useState)(!0),[l,m]=(0,i.useState)(e),[p,x]=(0,i.useState)(null),[_,y]=(0,i.useState)([]),[w,I]=(0,i.useState)(""),[S,v]=(0,i.useState)(!1),[b,j]=(0,i.useState)([]),[B,C]=(0,i.useState)(""),E=(0,h.k6)()||{timezone:Intl.DateTimeFormat().resolvedOptions().timeZone},T=(0,g.GW)(),k=(0,h.IC)();async function M(e){if(!e.ok)throw Error(e.statusText);if(!e.body)throw Error("Response body is null");let t=e.body.getReader(),s=new TextDecoder,a="␃\uD83D\uDD1A␗",o="",n=[],i={};for(;;){let e;let{done:r,value:c}=await t.read();if(r){I(""),v(!1),C("");break}for(o+=s.decode(c,{stream:!0});-1!==(e=o.indexOf(a));){let t=o.slice(0,e);if(o=o.slice(e+a.length),t){let e=_.find(e=>!e.completed);if(!e){console.error("No current message found");return}({context:n,onlineContext:i}=(0,u.VK)(t,e,n,i)),y([..._])}}}}async function D(){if(localStorage.removeItem("message"),!w||!p)return;let e={q:w,conversation_id:p,stream:!0,...E&&{city:E.city,region:E.region,country:E.country,country_code:E.countryCode,timezone:E.timezone},...B&&{image:B}},t=await fetch("/api/chat?client=web",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});try{await M(t)}catch(s){console.error(s);let e=_.find(e=>!e.completed);if(!e)return;let t=s.message;t.includes("Error in input stream")?e.rawResponse="Woops! The connection broke while I was writing my thoughts down. Maybe try again in a bit or dislike this message if the issue persists?":e.rawResponse="Umm, not sure what just happened. I see this error message: ".concat(t,". Could you try again or dislike this message if the issue persists?"),e.completed=!0,y([..._]),I(""),v(!1)}}return((0,i.useEffect)(()=>{fetch("/api/chat/options").then(e=>e.json()).then(e=>{c(!1),e&&s(e)}).catch(e=>{console.error(e)}),(0,h.EK)()},[]),(0,i.useEffect)(()=>{if(w){let e={rawResponse:"",trainOfThought:[],context:[],onlineContext:{},completed:!1,timestamp:new Date().toISOString(),rawQuery:w||"",uploadedImageData:decodeURIComponent(B)};y(t=>[...t,e]),v(!0)}},[w]),(0,i.useEffect)(()=>{S&&D()},[S]),o)?(0,a.jsx)(d.Z,{}):(0,a.jsxs)("div",{className:"".concat(n().main," ").concat(n().chatLayout),children:[(0,a.jsx)("title",{children:"".concat(e).concat(l&&l!==e?": ".concat(l):"")}),(0,a.jsx)("div",{children:(0,a.jsx)(r.ZP,{conversationId:p,uploadedFiles:b,isMobileWidth:k})}),(0,a.jsx)("div",{className:n().chatBox,children:(0,a.jsxs)("div",{className:n().chatBoxBody,children:[!k&&p&&(0,a.jsxs)("div",{className:"".concat(n().chatTitleWrapper," text-nowrap text-ellipsis overflow-hidden max-w-screen-md grid items-top font-bold mr-8 pt-6 col-auto h-fit"),children:[l&&(0,a.jsx)("h2",{className:"text-lg text-ellipsis whitespace-nowrap overflow-x-hidden",children:l}),(0,a.jsx)(r.En,{conversationId:p,setTitle:m,sizing:"md"})]}),(0,a.jsx)(i.Suspense,{fallback:(0,a.jsx)(d.Z,{}),children:(0,a.jsx)(f,{isLoggedIn:null!==T,streamedMessages:_,chatOptionsData:t,setTitle:m,setQueryToProcess:I,setUploadedFiles:j,isMobileWidth:k,onConversationIdChange:e=>{x(e)},setImage64:C})})]})})]})}},16463:function(e,t,s){"use strict";var a=s(71169);s.o(a,"useSearchParams")&&s.d(t,{useSearchParams:function(){return a.useSearchParams}})},65104:function(e){e.exports={main:"chat_main__8xQu5",suggestions:"chat_suggestions__m8n2t",inputBox:"chat_inputBox__LOFws",chatBodyFull:"chat_chatBodyFull__FfKEK",chatBody:"chat_chatBody__sS1LX",chatLayout:"chat_chatLayout__pR203",chatBox:"chat_chatBox__FBct_",titleBar:"chat_titleBar__R5QlK",chatBoxBody:"chat_chatBoxBody__qT_SC",agentIndicator:"chat_agentIndicator__8V55w",chatTitleWrapper:"chat_chatTitleWrapper__6ChWq"}}},function(e){e.O(0,[7812,9427,929,3954,9001,3062,4086,121,3110,4051,1603,9417,9178,9479,2697,2971,7023,1744],function(){return e(e.s=39929)}),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3111],{91955:function(e,t,s){Promise.resolve().then(s.bind(s,5506))},5506:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return m}});var n=s(57437),o=s(11930),a=s.n(o),i=s(2265),r=s(48861),c=s(82697),d=s(58485);s(7395);var l=s(69591),u=s(79306),h=s(59479),g=s(9557);function p(e){let[t,s]=(0,i.useState)(""),[o,r]=(0,i.useState)(null),[d,l]=(0,i.useState)(!1),[u,g]=(0,i.useState)(null),p=e.setQueryToProcess,m=e.streamedMessages;return((0,i.useEffect)(()=>{o&&e.setImage64(encodeURIComponent(o))},[o,e.setImage64]),(0,i.useEffect)(()=>{t&&(l(!0),p(t))},[t,p]),(0,i.useEffect)(()=>{m&&m.length>0&&m[m.length-1].completed?l(!1):s("")},[m]),e.publicConversationSlug||e.conversationId)?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:a().chatBodyFull,children:(0,n.jsx)(c.Z,{publicConversationSlug:e.publicConversationSlug,conversationId:e.conversationId||"",setAgent:g,setTitle:e.setTitle,pendingMessage:d?t:"",incomingMessages:e.streamedMessages})}),(0,n.jsx)("div",{className:"".concat(a().inputBox," p-1 md:px-2 shadow-md bg-background align-middle items-center justify-center dark:bg-neutral-700 dark:border-0 dark:shadow-sm rounded-t-2xl rounded-b-none md:rounded-xl"),children:(0,n.jsx)(h.Z,{isLoggedIn:e.isLoggedIn,sendMessage:e=>s(e),sendImage:e=>r(e),sendDisabled:d,chatOptionsData:e.chatOptionsData,conversationId:e.conversationId,agentColor:null==u?void 0:u.color,isMobileWidth:e.isMobileWidth,setUploadedFiles:e.setUploadedFiles})})]}):(0,n.jsx)("div",{className:a().suggestions,children:"Whoops, nothing to see here!"})}function m(){let[e,t]=(0,i.useState)(null),[s,o]=(0,i.useState)(!0),[c,h]=(0,i.useState)("Khoj AI - Chat"),[m,f]=(0,i.useState)(void 0),[_,x]=(0,i.useState)([]),[y,v]=(0,i.useState)(""),[C,b]=(0,i.useState)(!1),[S,j]=(0,i.useState)([]),[I,B]=(0,i.useState)(void 0),[w,O]=(0,i.useState)(""),N=(0,l.k6)()||{timezone:Intl.DateTimeFormat().resolvedOptions().timeZone},k=(0,u.GW)(),D=(0,l.IC)();async function T(e){if(!e.ok)throw Error(e.statusText);if(!e.body)throw Error("Response body is null");let t=e.body.getReader(),s=new TextDecoder,n="␃\uD83D\uDD1A␗",o="";for(;;){let e;let{done:a,value:i}=await t.read();if(a){v(""),b(!1),O("");break}for(o+=s.decode(i,{stream:!0});-1!==(e=o.indexOf(n));){let t=o.slice(0,e);if(o=o.slice(e+n.length),t){let e=_.find(e=>!e.completed);if(!e){console.error("No current message found");return}(0,g.VK)(t,e),x([..._])}}}}async function E(){if(!y||!m)return;let e={q:y,conversation_id:m,stream:!0,...N&&{region:N.region,country:N.country,city:N.city,country_code:N.countryCode,timezone:N.timezone},...w&&{image:w}},t=await fetch("/api/chat?client=web",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});try{await T(t)}catch(e){console.error(e)}}return((0,i.useEffect)(()=>{fetch("/api/chat/options").then(e=>e.json()).then(e=>{o(!1),e&&t(e)}).catch(e=>{console.error(e)}),(0,l.EK)(),B(window.location.pathname.split("/").pop()||"")},[]),(0,i.useEffect)(()=>{if(y&&!m){fetch("/api/chat/share/fork?public_conversation_slug=".concat(I),{method:"POST",headers:{"Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{f(e.conversation_id)}).catch(e=>{console.error(e)});return}if(y){let e={rawResponse:"",trainOfThought:[],context:[],onlineContext:{},completed:!1,timestamp:new Date().toISOString(),rawQuery:y||"",uploadedImageData:decodeURIComponent(w)};x(t=>[...t,e]),b(!0)}},[y,m,I]),(0,i.useEffect)(()=>{C&&E()},[C]),s)?(0,n.jsx)(d.Z,{}):I?(0,n.jsxs)("div",{className:"".concat(a().main," ").concat(a().chatLayout),children:[(0,n.jsx)("title",{children:c}),(0,n.jsx)("div",{className:a().sidePanel,children:(0,n.jsx)(r.ZP,{conversationId:null!=m?m:null,uploadedFiles:S,isMobileWidth:D})}),(0,n.jsx)("div",{className:a().chatBox,children:(0,n.jsx)("div",{className:a().chatBoxBody,children:(0,n.jsx)(i.Suspense,{fallback:(0,n.jsx)(d.Z,{}),children:(0,n.jsx)(p,{conversationId:m,streamedMessages:_,setQueryToProcess:v,isLoggedIn:null!==k,publicConversationSlug:I,chatOptionsData:e,setTitle:h,setUploadedFiles:j,isMobileWidth:D,setImage64:O})})})})]}):(0,n.jsx)("div",{className:a().suggestions,children:"Whoops, nothing to see here!"})}},11930:function(e){e.exports={main:"sharedChat_main__7Nayy",suggestions:"sharedChat_suggestions__V8kr_",inputBox:"sharedChat_inputBox__wRW5A",chatBodyFull:"sharedChat_chatBodyFull__O1MOv",chatBody:"sharedChat_chatBody__OnHDL",chatLayout:"sharedChat_chatLayout__gutlc",chatBox:"sharedChat_chatBox__PmAPg",titleBar:"sharedChat_titleBar__vOHp_",chatBoxBody:"sharedChat_chatBoxBody__ef2Nl",agentIndicator:"sharedChat_agentIndicator__ORCl4"}}},function(e){e.O(0,[7849,9427,929,3954,9001,3062,4086,121,3110,4051,1603,9417,9178,9479,2697,2971,7023,1744],function(){return e(e.s=91955)}),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- !function(){"use strict";var e,t,n,r,o,u,i,c,f,a={},l={};function d(e){var t=l[e];if(void 0!==t)return t.exports;var n=l[e]={exports:{}},r=!0;try{a[e].call(n.exports,n,n.exports,d),r=!1}finally{r&&delete l[e]}return n.exports}d.m=a,e=[],d.O=function(t,n,r,o){if(n){o=o||0;for(var u=e.length;u>0&&e[u-1][2]>o;u--)e[u]=e[u-1];e[u]=[n,r,o];return}for(var i=1/0,u=0;u<e.length;u++){for(var n=e[u][0],r=e[u][1],o=e[u][2],c=!0,f=0;f<n.length;f++)i>=o&&Object.keys(d.O).every(function(e){return d.O[e](n[f])})?n.splice(f--,1):(c=!1,o<i&&(i=o));if(c){e.splice(u--,1);var a=r();void 0!==a&&(t=a)}}return t},d.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return d.d(t,{a:t}),t},n=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},d.t=function(e,r){if(1&r&&(e=this(e)),8&r||"object"==typeof e&&e&&(4&r&&e.__esModule||16&r&&"function"==typeof e.then))return e;var o=Object.create(null);d.r(o);var u={};t=t||[null,n({}),n([]),n(n)];for(var i=2&r&&e;"object"==typeof i&&!~t.indexOf(i);i=n(i))Object.getOwnPropertyNames(i).forEach(function(t){u[t]=function(){return e[t]}});return u.default=function(){return e},d.d(o,u),o},d.d=function(e,t){for(var n in t)d.o(t,n)&&!d.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},d.f={},d.e=function(e){return Promise.all(Object.keys(d.f).reduce(function(t,n){return d.f[n](e,t),t},[]))},d.u=function(e){},d.miniCssF=function(e){},d.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r={},o="_N_E:",d.l=function(e,t,n,u){if(r[e]){r[e].push(t);return}if(void 0!==n)for(var i,c,f=document.getElementsByTagName("script"),a=0;a<f.length;a++){var l=f[a];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")==o+n){i=l;break}}i||(c=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,d.nc&&i.setAttribute("nonce",d.nc),i.setAttribute("data-webpack",o+n),i.src=d.tu(e)),r[e]=[t];var s=function(t,n){i.onerror=i.onload=null,clearTimeout(p);var o=r[e];if(delete r[e],i.parentNode&&i.parentNode.removeChild(i),o&&o.forEach(function(e){return e(n)}),t)return t(n)},p=setTimeout(s.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=s.bind(null,i.onerror),i.onload=s.bind(null,i.onload),c&&document.head.appendChild(i)},d.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.tt=function(){return void 0===u&&(u={createScriptURL:function(e){return e}},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(u=trustedTypes.createPolicy("nextjs#bundler",u))),u},d.tu=function(e){return d.tt().createScriptURL(e)},d.p="/_next/",i={2272:0,8942:0,404:0,929:0,9427:0,7812:0,4003:0,6129:0,9460:0,3729:0,4229:0,9092:0,7849:0,492:0},d.f.j=function(e,t){var n=d.o(i,e)?i[e]:void 0;if(0!==n){if(n)t.push(n[2]);else if(/^(4(003|04|229|92)|78(12|49)|9(092|29|427|460)|(37|61)29|2272|8942)$/.test(e))i[e]=0;else{var r=new Promise(function(t,r){n=i[e]=[t,r]});t.push(n[2]=r);var o=d.p+d.u(e),u=Error();d.l(o,function(t){if(d.o(i,e)&&(0!==(n=i[e])&&(i[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;u.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",u.name="ChunkLoadError",u.type=r,u.request=o,n[1](u)}},"chunk-"+e,e)}}},d.O.j=function(e){return 0===i[e]},c=function(e,t){var n,r,o=t[0],u=t[1],c=t[2],f=0;if(o.some(function(e){return 0!==i[e]})){for(n in u)d.o(u,n)&&(d.m[n]=u[n]);if(c)var a=c(d)}for(e&&e(t);f<o.length;f++)r=o[f],d.o(i,r)&&i[r]&&i[r][0](),i[r]=0;return d.O(a)},(f=self.webpackChunk_N_E=self.webpackChunk_N_E||[]).forEach(c.bind(null,0)),f.push=c.bind(null,f.push.bind(f)),d.nc=void 0}();
@@ -1 +0,0 @@
1
- div.automations_automationsLayout__Atoh_{display:grid;grid-template-columns:1fr 1fr;gap:1rem}div.automations_automationCard__BKidA{display:grid;grid-template-rows:auto 1fr auto}div.automations_pageLayout__OaoYA{max-width:60vw;margin:auto auto 2rem}div.automations_sidePanel__MPciO{position:fixed;height:100%;z-index:1}@media screen and (max-width:768px){div.automations_automationsLayout__Atoh_{grid-template-columns:1fr}div.automations_pageLayout__OaoYA{max-width:90vw}div.automations_sidePanel__MPciO{position:relative;height:100%}}div.sidePanel_session__R9wgH{padding:.5rem;margin-bottom:.25rem;border-radius:.5rem;cursor:pointer;max-width:14rem;font-size:medium;display:grid;grid-template-columns:minmax(auto,400px) 1fr;gap:0}div.sidePanel_compressed__YBPtM{grid-template-columns:minmax(12rem,100%) 1fr 1fr}div.sidePanel_sessionHover__iwfo8,div.sidePanel_session__R9wgH:hover{background-color:hsla(var(--popover))}div.sidePanel_session__R9wgH:hover{color:hsla(var(--popover-foreground))}div.sidePanel_session__R9wgH a{text-decoration:none}button.sidePanel_button__ihOfG{border:none;outline:none;background-color:transparent;cursor:pointer;color:var(--main-text-color);width:24px}button.sidePanel_showMoreButton__dt9Zw{border-radius:.5rem;padding:8px}div.sidePanel_panel__VZ8ye{display:flex;flex-direction:column;padding:1rem;overflow-y:auto;max-width:auto;transition:background-color .5s}div.sidePanel_expanded__ZjTHo{gap:1rem;background-color:hsla(var(--muted));height:100%}div.sidePanel_collapsed__OjVmG{display:grid;grid-template-columns:1fr;height:-moz-fit-content;height:fit-content;padding:1rem 0 0 1rem}p.sidePanel_session__R9wgH{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;text-align:left;font-size:small}div.sidePanel_header__d5cGA{display:grid;grid-template-columns:1fr auto}div.sidePanel_profile__x0w58{display:grid;grid-template-columns:auto 1fr;gap:1rem;align-items:center;margin-top:auto}div.sidePanel_panelWrapper__k_lal{display:grid;grid-template-rows:1fr auto auto;height:100%}div.sidePanel_modalSessionsList__nKe2n{position:fixed;top:0;left:0;width:100%;height:100%;background-color:hsla(var(--frosted-background-color));z-index:1;display:flex;justify-content:center;align-items:center;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}div.sidePanel_modalSessionsList__nKe2n div.sidePanel_content__Wq20_{max-width:80%;max-height:80%;background-color:hsla(var(--frosted-background-color));overflow:auto;padding:20px;border-radius:10px}div.sidePanel_modalSessionsList__nKe2n div.sidePanel_session__R9wgH{max-width:100%;text-overflow:ellipsis}@media screen and (max-width:768px){div.sidePanel_panel__VZ8ye{padding:.25rem;width:100%}div.sidePanel_expanded__ZjTHo{z-index:1}div.sidePanel_singleReference__r9z1n{padding:4px}div.sidePanel_panelWrapper__k_lal{width:100%;padding:0 1rem}div.sidePanel_session__R9wgH.sidePanel_compressed__YBPtM{max-width:100%;display:grid;grid-template-columns:70vw auto;justify-content:space-between}div.sidePanel_session__R9wgH{max-width:100%;grid-template-columns:minmax(auto,70vw) 1fr}}menu.navMenu_menu__fqlFF a{text-decoration:none;font-size:medium;font-weight:400;padding:0 4px;border-radius:4px;display:flex;justify-self:center;margin:0;align-items:center;gap:4px}a.navMenu_selected__A__aP{background-color:hsl(var(--accent))}div.navMenu_titleBar__HJoio{display:flex;justify-content:space-between;align-content:space-evenly;align-items:start}div.navMenu_titleBar__HJoio menu{padding:0;margin:0;border-radius:.5rem;display:grid;grid-auto-flow:column;gap:32px}div.navMenu_settingsMenuProfile__3npiK img{border-radius:50%;width:32px;height:32px;margin:0}div.navMenu_settingsMenu__X2i2U{padding:0 4px;border-radius:4px;display:flex;justify-self:center;margin:0;align-items:center}div.navMenu_settingsMenuOptions__KWnLv{display:block;grid-auto-flow:row;position:absolute;background-color:var(--background-color);box-shadow:0 8px 16px 0 rgba(0,0,0,.2);top:64px;text-align:left;padding:8px;border-radius:8px}@media screen and (max-width:600px){menu.navMenu_menu__fqlFF span{display:none}div.navMenu_settingsMenuOptions__KWnLv{right:4px}div.navMenu_titleBar__HJoio{padding:8px}}div.chatHistory_chatHistory__CoaVT{display:flex;flex-direction:column;height:100%}div.chatHistory_chatLayout__ABli_{height:80vh;overflow-y:auto;margin:0 auto}div.chatHistory_agentIndicator__wOU1f a{display:flex;text-align:center;align-content:center;align-items:center}div.chatHistory_trainOfThought__mMWSR{border:1px solid var(--border-color);border-radius:16px;padding:8px 16px;margin:12px}div.chatMessage_chatMessageContainer__sAivf{display:flex;flex-direction:column;margin:12px;border-radius:16px;padding:8px 16px 0}div.chatMessage_chatMessageWrapper__u5m8A{padding-left:1rem;padding-bottom:1rem;max-width:80vw}div.chatMessage_chatMessageWrapper__u5m8A ol,div.chatMessage_chatMessageWrapper__u5m8A p:not(:last-child),div.chatMessage_chatMessageWrapper__u5m8A ul{margin-bottom:16px}div.chatMessage_chatMessageWrapper__u5m8A a span{display:revert!important}div.chatMessage_khojfullHistory__NPu2l{border-width:1px;padding-left:4px}div.chatMessage_youfullHistory__ioyfH{max-width:100%}div.chatMessage_chatMessageContainer__sAivf.chatMessage_youfullHistory__ioyfH{padding-left:0}div.chatMessage_you__6GUC4{background-color:hsla(var(--secondary));align-self:flex-end;border-radius:16px}div.chatMessage_khoj__cjWON{background-color:transparent;color:hsl(var(--accent-foreground));align-self:flex-start}div.chatMessage_khojChatMessage__BabQz{padding-top:8px;padding-left:16px}div.chatMessage_emptyChatMessage__J9JRn{display:none}div.chatMessage_chatMessageContainer__sAivf img{width:auto;height:auto;max-width:100%;max-height:80vh;-o-object-fit:contain;object-fit:contain;display:block;margin-top:.25rem;margin-right:auto}div.chatMessage_chatMessageContainer__sAivf h3 img{width:24px}div.chatMessage_you__6GUC4{color:hsla(var(--secondary-foreground))}div.chatMessage_author__muRtC{font-size:.75rem;color:grey;text-align:right}div.chatMessage_chatFooter__0vR8s{display:flex;justify-content:space-between;min-height:28px}div.chatMessage_chatButtons__Lbk8T{display:flex;justify-content:flex-end;width:-moz-min-content;width:min-content;border:1px solid var(--border-color);border-radius:16px;position:relative;bottom:-12px;background-color:hsla(var(--secondary))}div.chatMessage_chatFooter__0vR8s button{cursor:pointer;color:hsl(var(--muted-foreground));border:none;border-radius:16px;padding:4px;margin-left:4px;margin-right:4px}div.chatMessage_chatFooter__0vR8s button:hover{background-color:hsla(var(--frosted-background-color))}button.chatMessage_codeCopyButton__Y_Ujv{cursor:pointer;float:right;border-radius:8px}button.chatMessage_codeCopyButton__Y_Ujv:hover{color:hsla(var(--frosted-background-color))}button.chatMessage_codeCopyButton__Y_Ujv img,button.chatMessage_copyButton__jd7q7 img,div.chatMessage_feedbackButtons___Brdy img{width:24px}div.chatMessage_trainOfThought__mR2Gg strong{font-weight:500}div.chatMessage_trainOfThought__mR2Gg.chatMessage_primary__WYPEb strong{font-weight:500;color:hsla(var(--secondary-foreground))}div.chatMessage_trainOfThought__mR2Gg.chatMessage_primary__WYPEb p{color:inherit}div.chatMessage_trainOfThoughtElement__le_bC{display:grid;grid-template-columns:auto 1fr;align-items:start}div.chatMessage_trainOfThoughtElement__le_bC ol,div.chatMessage_trainOfThoughtElement__le_bC ul{margin:auto}@media screen and (max-width:768px){div.chatMessage_youfullHistory__ioyfH{max-width:90%}}div.chatInputArea_actualInputArea__Ha6cN{display:grid;grid-template-columns:auto 1fr auto auto}div.search_searchLayout__fP3m0{display:grid;grid-template-columns:1fr;gap:1rem;height:100vh}div.search_sidePanel__myfc9{position:fixed;height:100%;z-index:1}@media screen and (max-width:768px){div.search_searchLayout__fP3m0{gap:0}div.search_sidePanel__myfc9{position:relative;height:100%}}
@@ -1 +0,0 @@
1
- div.agents_titleBar__FzYbY{padding:16px 0;text-align:left}.agents_agentPersonality__o0Ysz p{white-space:inherit;overflow:hidden;height:77px;line-height:1.5}div.agents_agentPersonality__o0Ysz{text-align:left;grid-column:span 3;overflow:hidden}div.agents_pageLayout__gR3S3{max-width:60vw;margin:auto auto 2rem}div.agents_sidePanel__wGVGc{position:fixed;height:100%;z-index:1}button.agents_infoButton__NqI7E{border:none;background-color:transparent!important;text-align:left;font-family:inherit;font-size:medium}div.agents_agentList__XVx4A{display:grid;gap:20px;padding-top:30px;margin-right:auto;grid-auto-flow:row;grid-template-columns:1fr 1fr;margin-left:auto}@media only screen and (max-width:768px){div.agents_agentList__XVx4A{width:100%;padding:0;margin-right:auto;margin-left:auto;grid-template-columns:1fr}div.agents_pageLayout__gR3S3{max-width:90vw}div.agents_sidePanel__wGVGc{position:relative;height:100%}}