@xpert-ai/chatkit-ui 0.3.21 → 0.4.0
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.
- package/dist/app/assets/{_baseUniq-DQYPehQ-.js → _baseUniq-DgIHlkQm.js} +1 -1
- package/dist/app/assets/{abap-BM4qSIyQ.js → abap-lB8VLppN.js} +1 -1
- package/dist/app/assets/{abnf-BX4WCoML.js → abnf-CMm-FA7V.js} +1 -1
- package/dist/app/assets/{actionscript-xl_RFBNs.js → actionscript-C44LZKx4.js} +1 -1
- package/dist/app/assets/{ada-El_ICa-x.js → ada-BL4d2yHl.js} +1 -1
- package/dist/app/assets/{agda-5bKVQpD_.js → agda-DUeBOfao.js} +1 -1
- package/dist/app/assets/{al-B1nWlmvn.js → al-r379MYUc.js} +1 -1
- package/dist/app/assets/{antlr4-pBrbyzLd.js → antlr4-BhepIW3H.js} +1 -1
- package/dist/app/assets/{apacheconf-BgknPISa.js → apacheconf-ZblTvauv.js} +1 -1
- package/dist/app/assets/{apex-ByHs-y6y.js → apex-DXCjRfej.js} +1 -1
- package/dist/app/assets/{apl-D93kE8hc.js → apl-0mvw9LXG.js} +1 -1
- package/dist/app/assets/{applescript-B-dVV5SQ.js → applescript-s8Oxmrfz.js} +1 -1
- package/dist/app/assets/{aql-BWPt2oGW.js → aql-BMN4x1O3.js} +1 -1
- package/dist/app/assets/{arc-Bf6CYxcs.js → arc-xNYJT0Sf.js} +1 -1
- package/dist/app/assets/{architectureDiagram-Q4EWVU46--o0-uftJ.js → architectureDiagram-Q4EWVU46-B3lvRgUo.js} +1 -1
- package/dist/app/assets/{arduino-CJ0e6EAb.js → arduino-daTjF253.js} +1 -1
- package/dist/app/assets/{arff-CjnLJtu2.js → arff-DxxxOwyy.js} +1 -1
- package/dist/app/assets/{asciidoc-BEGGmE4f.js → asciidoc-B0aClqCc.js} +1 -1
- package/dist/app/assets/{asm6502-DdtsBxuW.js → asm6502-BsfejLyD.js} +1 -1
- package/dist/app/assets/{asmatmel-C7bTA6ZK.js → asmatmel-BQPOdk6m.js} +1 -1
- package/dist/app/assets/{aspnet-DybXb5RV.js → aspnet-CI7Ah4u1.js} +1 -1
- package/dist/app/assets/{autohotkey-B4DFJfeq.js → autohotkey-IQAyKsEZ.js} +1 -1
- package/dist/app/assets/{autoit-BnJoVLFr.js → autoit-Cc50euDJ.js} +1 -1
- package/dist/app/assets/{avisynth-adsYdF95.js → avisynth-D_3k61Mh.js} +1 -1
- package/dist/app/assets/{avro-idl-BEEeDZ3T.js → avro-idl-Dakyv0EK.js} +1 -1
- package/dist/app/assets/{bash-HMaxYndq.js → bash-CK4ls-uk.js} +1 -1
- package/dist/app/assets/{basic-CGI_4hUJ.js → basic-sAy-3U_-.js} +1 -1
- package/dist/app/assets/{batch-C3ZkiPxH.js → batch-BULEa0VP.js} +1 -1
- package/dist/app/assets/{bbcode-BcKqPjJt.js → bbcode-mxGKgZDu.js} +1 -1
- package/dist/app/assets/{bicep-BiAeLXpL.js → bicep-DxUd9L5w.js} +1 -1
- package/dist/app/assets/{birb-BUzFWx_A.js → birb-CT9d0Hfg.js} +1 -1
- package/dist/app/assets/{bison--JmMkpGr.js → bison-CJWctWOI.js} +1 -1
- package/dist/app/assets/{blockDiagram-DXYQGD6D-DlCLRQ6D.js → blockDiagram-DXYQGD6D-D-AjcpQ4.js} +1 -1
- package/dist/app/assets/{bnf-CW9x2YuF.js → bnf-BfiH5qUl.js} +1 -1
- package/dist/app/assets/{brainfuck-JE2vVBK8.js → brainfuck-BXCfmtpc.js} +1 -1
- package/dist/app/assets/{brightscript-BFVL4OK-.js → brightscript-B8Se3L7d.js} +1 -1
- package/dist/app/assets/{bro-BFP7Vg1t.js → bro-BYNaGskD.js} +1 -1
- package/dist/app/assets/{bsl-8KT47Ocp.js → bsl-rAkCQZce.js} +1 -1
- package/dist/app/assets/{c-DjRDCv7Q.js → c-BLwhDOSO.js} +1 -1
- package/dist/app/assets/{c4Diagram-AHTNJAMY-CxOxKAvr.js → c4Diagram-AHTNJAMY-CqDIUKeo.js} +1 -1
- package/dist/app/assets/{cfscript-uYdSfHi1.js → cfscript-BEVtIJMz.js} +1 -1
- package/dist/app/assets/{chaiscript-BMJlJ5Yj.js → chaiscript-DcH2srx5.js} +1 -1
- package/dist/app/assets/channel-CI-ehimI.js +1 -0
- package/dist/app/assets/{chunk-4BX2VUAB-BlVYV2JT.js → chunk-4BX2VUAB-m_kyuUbe.js} +1 -1
- package/dist/app/assets/{chunk-4TB4RGXK-BVGwM0_B.js → chunk-4TB4RGXK-BjqYS6Yy.js} +1 -1
- package/dist/app/assets/{chunk-55IACEB6-BEUpYdGG.js → chunk-55IACEB6-oWAL2kJR.js} +1 -1
- package/dist/app/assets/{chunk-EDXVE4YY-z870kN9i.js → chunk-EDXVE4YY-BR40heM4.js} +1 -1
- package/dist/app/assets/{chunk-FMBD7UC4-DfF0T4M2.js → chunk-FMBD7UC4-Bv7-5Ls-.js} +1 -1
- package/dist/app/assets/{chunk-OYMX7WX6-CG1987mG.js → chunk-OYMX7WX6-CIKeB20i.js} +1 -1
- package/dist/app/assets/{chunk-QZHKN3VN-JIvq2t0-.js → chunk-QZHKN3VN-CBk_nqgS.js} +1 -1
- package/dist/app/assets/{chunk-YZCP3GAM-zf8sTeUU.js → chunk-YZCP3GAM-DbrAyIeM.js} +1 -1
- package/dist/app/assets/{cil-BB6bejx8.js → cil-HIWN64iA.js} +1 -1
- package/dist/app/assets/classDiagram-6PBFFD2Q-kNq98FtJ.js +1 -0
- package/dist/app/assets/classDiagram-v2-HSJHXN6E-kNq98FtJ.js +1 -0
- package/dist/app/assets/{clike-D3xMhpOD.js → clike-DWwvlcID.js} +1 -1
- package/dist/app/assets/{clojure-Chij6Ngb.js → clojure-m5aYwMVY.js} +1 -1
- package/dist/app/assets/clone-70-rkKhs.js +1 -0
- package/dist/app/assets/{cmake-CZ3QnJ3x.js → cmake-D1AphalP.js} +1 -1
- package/dist/app/assets/{cobol-piqn3l1D.js → cobol-DfRj-gRZ.js} +1 -1
- package/dist/app/assets/{coffeescript-D7pJB5Sc.js → coffeescript-DBVw6hft.js} +1 -1
- package/dist/app/assets/{concurnas-BUVBF3iU.js → concurnas-p-HBsubn.js} +1 -1
- package/dist/app/assets/{coq-DO12wGyQ.js → coq-DpEsabSd.js} +1 -1
- package/dist/app/assets/{core-wZNUERI0.js → core-Bu1sMhBI.js} +1 -1
- package/dist/app/assets/{cose-bilkent-S5V4N54A-DNcJwuP_.js → cose-bilkent-S5V4N54A-Bu1oc34k.js} +1 -1
- package/dist/app/assets/{cpp-Bn4NX0Y7.js → cpp-DWOjniRs.js} +1 -1
- package/dist/app/assets/{crystal-DH1SzjI0.js → crystal-CQJ7kmd6.js} +1 -1
- package/dist/app/assets/{csharp-DsRZVr1z.js → csharp-D7MPpOcK.js} +1 -1
- package/dist/app/assets/{cshtml-BW39Mq-n.js → cshtml-DKqAFWTy.js} +1 -1
- package/dist/app/assets/{csp-BHap8sWo.js → csp-CdccqHH0.js} +1 -1
- package/dist/app/assets/{css-pptVnNrc.js → css-CF8Mhm8t.js} +1 -1
- package/dist/app/assets/{css-extras-DNvI8BqP.js → css-extras-BzYoJo_2.js} +1 -1
- package/dist/app/assets/{csv-BGNEqqUD.js → csv-BkNUxNGN.js} +1 -1
- package/dist/app/assets/{cypher-DI9Eh2MX.js → cypher-B6Ago4_f.js} +1 -1
- package/dist/app/assets/{d-Baut6dRC.js → d-0OD8he-p.js} +1 -1
- package/dist/app/assets/{dagre-KV5264BT-Bll-N0gB.js → dagre-KV5264BT-CtnwN-Dh.js} +1 -1
- package/dist/app/assets/{dart-DwQS8J-b.js → dart-CRBezsEJ.js} +1 -1
- package/dist/app/assets/{dataweave-Bm1DfTIi.js → dataweave-C5NSsb9T.js} +1 -1
- package/dist/app/assets/{dax-DczLQrxB.js → dax-DA_08-S-.js} +1 -1
- package/dist/app/assets/{dhall-D-rQkR7U.js → dhall-B5eyKfIX.js} +1 -1
- package/dist/app/assets/{diagram-5BDNPKRD-BsqcOqjN.js → diagram-5BDNPKRD-BWMmYkfv.js} +1 -1
- package/dist/app/assets/{diagram-G4DWMVQ6-CanWPLYX.js → diagram-G4DWMVQ6-BZqIfTTc.js} +1 -1
- package/dist/app/assets/{diagram-MMDJMWI5-DtTvDmLa.js → diagram-MMDJMWI5--lVSAtvL.js} +1 -1
- package/dist/app/assets/{diagram-TYMM5635-CqAB9YcT.js → diagram-TYMM5635-CAdX-pMH.js} +1 -1
- package/dist/app/assets/{diff-DRX_aR8Q.js → diff-BcQ3lgLg.js} +1 -1
- package/dist/app/assets/{django-B70oQtEy.js → django-C_tw_AYj.js} +1 -1
- package/dist/app/assets/{dns-zone-file-UDNZJdpf.js → dns-zone-file-CyqP1EvD.js} +1 -1
- package/dist/app/assets/{docker-C5WbmVoT.js → docker-wz3Lj9Db.js} +1 -1
- package/dist/app/assets/{dot-BgOwKJXC.js → dot-B-DDY2H8.js} +1 -1
- package/dist/app/assets/{ebnf-DcbjvJF9.js → ebnf-X2ewhLUy.js} +1 -1
- package/dist/app/assets/{editorconfig-BVQjr_5n.js → editorconfig-qcUVBPkT.js} +1 -1
- package/dist/app/assets/{eiffel-NEJHOZNK.js → eiffel-BAqW7pbE.js} +1 -1
- package/dist/app/assets/{ejs-D-4dvILN.js → ejs-61WKLTYk.js} +1 -1
- package/dist/app/assets/{elixir-DylKEJ8m.js → elixir-EzFqXZk2.js} +1 -1
- package/dist/app/assets/{elm-m8oZ9wqi.js → elm-DmnpDBDa.js} +1 -1
- package/dist/app/assets/{erDiagram-SMLLAGMA-B4Kokusb.js → erDiagram-SMLLAGMA-D-t806Qt.js} +1 -1
- package/dist/app/assets/{erb-DrkAZuLY.js → erb-CcQKm2oQ.js} +1 -1
- package/dist/app/assets/{erlang-C009jUDM.js → erlang-DW-WXopd.js} +1 -1
- package/dist/app/assets/{etlua-BYR_P5ZO.js → etlua-BJxhJpxy.js} +1 -1
- package/dist/app/assets/{excel-formula-D49xhxI6.js → excel-formula-7oXshpg3.js} +1 -1
- package/dist/app/assets/{factor-QpmgGoBW.js → factor-BC8WW8Od.js} +1 -1
- package/dist/app/assets/{false-sqNVea_q.js → false-C6lXY4VC.js} +1 -1
- package/dist/app/assets/{firestore-security-rules-BigXcaq8.js → firestore-security-rules-B4dcnH7G.js} +1 -1
- package/dist/app/assets/{flow-Ci-UXkWw.js → flow-CFpX3faq.js} +1 -1
- package/dist/app/assets/{flowDiagram-DWJPFMVM-B3rfvjfL.js → flowDiagram-DWJPFMVM-BjTXVIWo.js} +1 -1
- package/dist/app/assets/{fortran-e_w_yEL9.js → fortran-RwIGxqZ9.js} +1 -1
- package/dist/app/assets/{fsharp-BquAs0nh.js → fsharp-C5S6wt_8.js} +1 -1
- package/dist/app/assets/{ftl-Djb0Hj1R.js → ftl-DXTedmzK.js} +1 -1
- package/dist/app/assets/{ganttDiagram-T4ZO3ILL-B9hQ1hJF.js → ganttDiagram-T4ZO3ILL-DPqZs20S.js} +1 -1
- package/dist/app/assets/{gap-DLc_BCjg.js → gap-C0KFM8Sn.js} +1 -1
- package/dist/app/assets/{gcode-Det6n0Ho.js → gcode-Ck54RmDV.js} +1 -1
- package/dist/app/assets/{gdscript-D-g8ZK89.js → gdscript-DX_Bezt8.js} +1 -1
- package/dist/app/assets/{gedcom-DAvnEHuX.js → gedcom-54x_GC3_.js} +1 -1
- package/dist/app/assets/{gherkin-D38X0Yb7.js → gherkin-DpY70MhW.js} +1 -1
- package/dist/app/assets/{git-DC6oOsjy.js → git-Bg40h27U.js} +1 -1
- package/dist/app/assets/{gitGraphDiagram-UUTBAWPF-DyWUrbw1.js → gitGraphDiagram-UUTBAWPF-CMuB9NDh.js} +1 -1
- package/dist/app/assets/{glsl-B3tH9uG-.js → glsl-BcqYx_6I.js} +1 -1
- package/dist/app/assets/{gml-DARPpECj.js → gml-DJePf9E6.js} +1 -1
- package/dist/app/assets/{gn-vy9FemoP.js → gn-hOkcYKt5.js} +1 -1
- package/dist/app/assets/{go-CNAfUJcn.js → go-CBdX4RKq.js} +1 -1
- package/dist/app/assets/{go-module-Rt8NBOyO.js → go-module-8CqpJAjn.js} +1 -1
- package/dist/app/assets/{graph-CWQVt5Hd.js → graph-DiXdxCpd.js} +1 -1
- package/dist/app/assets/{graphql-CxXfJNJ5.js → graphql-DzkHa_Lt.js} +1 -1
- package/dist/app/assets/{groovy-BBN8a1rT.js → groovy-CuKAytl9.js} +1 -1
- package/dist/app/assets/{haml-BOc4eex8.js → haml-BHlOO4D-.js} +1 -1
- package/dist/app/assets/{handlebars-BJffDJoW.js → handlebars-DgTuPlRj.js} +1 -1
- package/dist/app/assets/{haskell-CjIMIx7I.js → haskell-BYOS6zzQ.js} +1 -1
- package/dist/app/assets/{haxe-DWDpw8Qc.js → haxe-QCi0Miq5.js} +1 -1
- package/dist/app/assets/{hcl-BZzPeJmI.js → hcl-DCUWHECM.js} +1 -1
- package/dist/app/assets/{hlsl-DONgZjSW.js → hlsl-Bp2hwiJd.js} +1 -1
- package/dist/app/assets/{hoon-BgEGZDxn.js → hoon-BzW-9-xp.js} +1 -1
- package/dist/app/assets/{hpkp-BdhSfjgl.js → hpkp-BWPv-cBm.js} +1 -1
- package/dist/app/assets/{hsts-CzUotko0.js → hsts-CJiK6uQM.js} +1 -1
- package/dist/app/assets/{http-DZ5siSz1.js → http-DQlaEk07.js} +1 -1
- package/dist/app/assets/{ichigojam-BA6OXXoB.js → ichigojam-K2-54W_i.js} +1 -1
- package/dist/app/assets/{icon-iUz8kW3L.js → icon-DtDq4nwU.js} +1 -1
- package/dist/app/assets/{icu-message-format-CCAUs64P.js → icu-message-format-CzUzfEvD.js} +1 -1
- package/dist/app/assets/{idris-BlIDzxgn.js → idris-CZStDvUu.js} +1 -1
- package/dist/app/assets/{iecst-CMWyTEtE.js → iecst-BJn6mRZC.js} +1 -1
- package/dist/app/assets/{ignore-CXEc0RKr.js → ignore-BZ9E9rMx.js} +1 -1
- package/dist/app/assets/index-BCZfU1mO.js +756 -0
- package/dist/app/assets/index-ByruneYs.css +1 -0
- package/dist/app/assets/{infoDiagram-42DDH7IO-CvY1ChHR.js → infoDiagram-42DDH7IO-BVqN5Cf-.js} +1 -1
- package/dist/app/assets/{inform7-RKf3LSDR.js → inform7-C64PxE5P.js} +1 -1
- package/dist/app/assets/{ini-K8CLpdcD.js → ini-D6uyClxM.js} +1 -1
- package/dist/app/assets/{io-DiUzEhPs.js → io-BEddoOXw.js} +1 -1
- package/dist/app/assets/{ishikawaDiagram-UXIWVN3A-Cp5yLHei.js → ishikawaDiagram-UXIWVN3A-DMCnYQDL.js} +1 -1
- package/dist/app/assets/{j-CU5vEBSA.js → j-BZjnLaoD.js} +1 -1
- package/dist/app/assets/{java-DAzk8PaQ.js → java-C16BQXmJ.js} +1 -1
- package/dist/app/assets/{javadoc-AliyBIAx.js → javadoc-Bp_K_1w9.js} +1 -1
- package/dist/app/assets/{javadoclike-Dntcuir5.js → javadoclike-CCL57XT3.js} +1 -1
- package/dist/app/assets/{javascript-BSrBoO9h.js → javascript-UKmanPpI.js} +1 -1
- package/dist/app/assets/{javastacktrace-M0UDvHO7.js → javastacktrace-Bt6MmvHK.js} +1 -1
- package/dist/app/assets/{jexl-ChBtuGhM.js → jexl-BSIE3NAS.js} +1 -1
- package/dist/app/assets/{jolie-dVzYMXzP.js → jolie-DwAozljt.js} +1 -1
- package/dist/app/assets/{journeyDiagram-VCZTEJTY-DFUxbdY3.js → journeyDiagram-VCZTEJTY-hfkm8x7F.js} +1 -1
- package/dist/app/assets/{jq-C-FHF89g.js → jq-B6HQblEc.js} +1 -1
- package/dist/app/assets/{js-extras-CUWVDuzh.js → js-extras-C4kJ0q_P.js} +1 -1
- package/dist/app/assets/{js-templates-BsmT3aBE.js → js-templates-BF0RGSgj.js} +1 -1
- package/dist/app/assets/{jsdoc-DYd6bfCg.js → jsdoc-BaH_CjIP.js} +1 -1
- package/dist/app/assets/{json-9a0HiK8V.js → json-JpTWEtLR.js} +1 -1
- package/dist/app/assets/{json5-CHfH8hub.js → json5-DJHj-rXR.js} +1 -1
- package/dist/app/assets/{jsonp-C4H8aw-G.js → jsonp-DpjTc_na.js} +1 -1
- package/dist/app/assets/{jsstacktrace-CWLuVaQs.js → jsstacktrace-DnLa9vhb.js} +1 -1
- package/dist/app/assets/{jsx-CKSzHPGQ.js → jsx-BRHrY2BL.js} +1 -1
- package/dist/app/assets/{julia-CKCCG6Mf.js → julia-9zZ-iwP_.js} +1 -1
- package/dist/app/assets/{kanban-definition-6JOO6SKY-C3XjPZMK.js → kanban-definition-6JOO6SKY-DE3YihJJ.js} +1 -1
- package/dist/app/assets/{keepalived-CyUP2k6O.js → keepalived-Uu89aoXa.js} +1 -1
- package/dist/app/assets/{keyman-C4jw745i.js → keyman-DFGcwqDK.js} +1 -1
- package/dist/app/assets/{kotlin-k4KF32sW.js → kotlin-LTPAm-Va.js} +1 -1
- package/dist/app/assets/{kumir-DSXoU43i.js → kumir-BcPP82e-.js} +1 -1
- package/dist/app/assets/{kusto-DN4PTwp5.js → kusto-CxK7uEBf.js} +1 -1
- package/dist/app/assets/{latex-DnND8Hyr.js → latex-CJOru6Xl.js} +1 -1
- package/dist/app/assets/{latte-ZczIeK8r.js → latte-yocJ797x.js} +1 -1
- package/dist/app/assets/{layout-Co572jdY.js → layout-CXEXCcrp.js} +1 -1
- package/dist/app/assets/{less-Dj7UTsAS.js → less-BmacGfdt.js} +1 -1
- package/dist/app/assets/{lilypond-BZT4RhtW.js → lilypond-XADZqv26.js} +1 -1
- package/dist/app/assets/{linear-Bs8rswOH.js → linear-BoHhQExU.js} +1 -1
- package/dist/app/assets/{liquid-ClZynrWa.js → liquid-DrXu3I4o.js} +1 -1
- package/dist/app/assets/{lisp-BTorhS-u.js → lisp-D7GBOEAq.js} +1 -1
- package/dist/app/assets/{livescript-DoDDu5Yt.js → livescript-CYEGDtxo.js} +1 -1
- package/dist/app/assets/{llvm-CX8WmHsW.js → llvm-Cg59OFV5.js} +1 -1
- package/dist/app/assets/{log-DqX7RFDU.js → log-Dgz6RJ76.js} +1 -1
- package/dist/app/assets/{lolcode-BhqlIFHf.js → lolcode-BiaQuLMI.js} +1 -1
- package/dist/app/assets/{lua-D2PWt_yX.js → lua-A_5_hnzN.js} +1 -1
- package/dist/app/assets/{magma-BWcE3gZw.js → magma-vL3dHSsW.js} +1 -1
- package/dist/app/assets/{makefile-Bqpj3_DO.js → makefile-C1iS0HiM.js} +1 -1
- package/dist/app/assets/{markdown-CnajnEUc.js → markdown-B2oYsnLL.js} +1 -1
- package/dist/app/assets/{markup-Bo8fRV73.js → markup-DfTA_BVw.js} +1 -1
- package/dist/app/assets/{markup-templating-BVLTEf1q.js → markup-templating-Cuy4LPLx.js} +1 -1
- package/dist/app/assets/{matlab-aBhqIbY_.js → matlab-D6BnQC4u.js} +1 -1
- package/dist/app/assets/{maxscript-CsHgPBx8.js → maxscript-C6TABA1u.js} +1 -1
- package/dist/app/assets/{mel-C2Q01urV.js → mel-4rfx7Bfv.js} +1 -1
- package/dist/app/assets/{mermaid-BuMDBFL8.js → mermaid-C9zerIka.js} +1 -1
- package/dist/app/assets/{min-Byza3p1P.js → min-CYeWfD_S.js} +1 -1
- package/dist/app/assets/{mindmap-definition-QFDTVHPH-CEthcC4b.js → mindmap-definition-QFDTVHPH-DEJyZ1TS.js} +1 -1
- package/dist/app/assets/{mizar-B_i6T9OT.js → mizar-DRgDOhTN.js} +1 -1
- package/dist/app/assets/{mongodb-DvQQHyBw.js → mongodb-Bz5t1Kri.js} +1 -1
- package/dist/app/assets/{monkey-znz8nJPM.js → monkey-DmpKIE8A.js} +1 -1
- package/dist/app/assets/{moonscript-CRv3oyNU.js → moonscript-Detay_Aq.js} +1 -1
- package/dist/app/assets/{n1ql-Ut5maFqH.js → n1ql-BmgXbS-M.js} +1 -1
- package/dist/app/assets/{n4js-DhQq4607.js → n4js-DmTPdCqi.js} +1 -1
- package/dist/app/assets/{nand2tetris-hdl-C7cFsm13.js → nand2tetris-hdl-DXraXq65.js} +1 -1
- package/dist/app/assets/{naniscript-CW4orAyd.js → naniscript-B261gwHF.js} +1 -1
- package/dist/app/assets/{nasm-D12WnJXs.js → nasm-DjgP63mx.js} +1 -1
- package/dist/app/assets/{neon-CyZOMcF4.js → neon-BkyLss_j.js} +1 -1
- package/dist/app/assets/{nevod-DPER4jE8.js → nevod-D3AIDy_-.js} +1 -1
- package/dist/app/assets/{nginx-B-pd0-Ad.js → nginx-x6qaHbn6.js} +1 -1
- package/dist/app/assets/{nim-BTKCwQU5.js → nim-DEkLs6r2.js} +1 -1
- package/dist/app/assets/{nix-_E0KYcLF.js → nix-DKfH6GYJ.js} +1 -1
- package/dist/app/assets/{nsis-BV6YGEAl.js → nsis-DdaElZTp.js} +1 -1
- package/dist/app/assets/{objectivec-D7DZtg3n.js → objectivec-D-GvlelH.js} +1 -1
- package/dist/app/assets/{ocaml-jOwdJMGP.js → ocaml-Bh8mdwPO.js} +1 -1
- package/dist/app/assets/{opencl-BK8RsGvY.js → opencl-DqbqQpJ8.js} +1 -1
- package/dist/app/assets/{openqasm-CnTU765R.js → openqasm-BzHZ1geL.js} +1 -1
- package/dist/app/assets/{oz-Bj9raWAN.js → oz-CAffbl5h.js} +1 -1
- package/dist/app/assets/{parigp-CdPTMoNi.js → parigp-CKqiqq8G.js} +1 -1
- package/dist/app/assets/{parser-Cdmw5LSw.js → parser-Cg00t7Mb.js} +1 -1
- package/dist/app/assets/{pascal-nUYtHUHG.js → pascal--toS4iGX.js} +1 -1
- package/dist/app/assets/{pascaligo-Bkz6st9y.js → pascaligo-DkkGDPuY.js} +1 -1
- package/dist/app/assets/{pcaxis-iU3Ob1-f.js → pcaxis-YW2drt9P.js} +1 -1
- package/dist/app/assets/{peoplecode-B0tZE2um.js → peoplecode-DcSxF5p-.js} +1 -1
- package/dist/app/assets/{perl-CauH9Ddc.js → perl-YKp_XolM.js} +1 -1
- package/dist/app/assets/{php-nfD6bsQv.js → php-IihSyd58.js} +1 -1
- package/dist/app/assets/{php-extras-LFIs5Lee.js → php-extras-CiYXDTjg.js} +1 -1
- package/dist/app/assets/{phpdoc-CIScJtQR.js → phpdoc-CTwGmVuh.js} +1 -1
- package/dist/app/assets/{pieDiagram-DEJITSTG-yb4urrIl.js → pieDiagram-DEJITSTG-CYgrtYQD.js} +1 -1
- package/dist/app/assets/{plsql-DlL_Q0z7.js → plsql-BLbbnpCf.js} +1 -1
- package/dist/app/assets/{powerquery-CwJoieGU.js → powerquery-CW3t8EHf.js} +1 -1
- package/dist/app/assets/{powershell-Do5am0dD.js → powershell-Dy-20mWQ.js} +1 -1
- package/dist/app/assets/{processing-DrVT9fYT.js → processing-DfOUJsGU.js} +1 -1
- package/dist/app/assets/{prolog-eaGBptl-.js → prolog-Bt7umQZ_.js} +1 -1
- package/dist/app/assets/{promql-8qqnQVxn.js → promql-BsbEgNrg.js} +1 -1
- package/dist/app/assets/{properties-VjU6IVz6.js → properties-0VtNy_J8.js} +1 -1
- package/dist/app/assets/{protobuf-Dbtdjvmg.js → protobuf-CnepKVtX.js} +1 -1
- package/dist/app/assets/{psl-CiJuxJxC.js → psl-OGz4CFKI.js} +1 -1
- package/dist/app/assets/{pug-BEtm4Ype.js → pug-BUMiCGsa.js} +1 -1
- package/dist/app/assets/{puppet-C9PVG5W9.js → puppet-BpwvYCrA.js} +1 -1
- package/dist/app/assets/{pure-C_BwhjmX.js → pure-u9lIjKsQ.js} +1 -1
- package/dist/app/assets/{purebasic-I8MXUtAz.js → purebasic-BsE8kKSG.js} +1 -1
- package/dist/app/assets/{purescript-SjuuPi5a.js → purescript-D4DGIRwN.js} +1 -1
- package/dist/app/assets/{q-CBBhyRzW.js → q-Dd4Y9jTu.js} +1 -1
- package/dist/app/assets/{qml-cKrpUey0.js → qml-IZqRvexj.js} +1 -1
- package/dist/app/assets/{qore-DN78sWhO.js → qore-CVgOeY5j.js} +1 -1
- package/dist/app/assets/{qsharp-BwcPcLS6.js → qsharp-C1ibrSjI.js} +1 -1
- package/dist/app/assets/{quadrantDiagram-34T5L4WZ-Bi4Wq7z-.js → quadrantDiagram-34T5L4WZ-Hy_efLgq.js} +1 -1
- package/dist/app/assets/{r-DgNabGHz.js → r-CO3iHGES.js} +1 -1
- package/dist/app/assets/{racket-DpYHN5yN.js → racket-CDsoIwWb.js} +1 -1
- package/dist/app/assets/{reason-CEMPZwks.js → reason-BXp7TkTV.js} +1 -1
- package/dist/app/assets/{regex-CgjjXtr_.js → regex-C8d4nMD-.js} +1 -1
- package/dist/app/assets/{rego-DEAlE1Uk.js → rego-CnCdTWPv.js} +1 -1
- package/dist/app/assets/{renpy-LG8AK0je.js → renpy-BCpztAT2.js} +1 -1
- package/dist/app/assets/{requirementDiagram-MS252O5E-bxPOgxi3.js → requirementDiagram-MS252O5E-BI0Kue_K.js} +1 -1
- package/dist/app/assets/{rest-BN3tMfFJ.js → rest-DRU6Mo0N.js} +1 -1
- package/dist/app/assets/{rip-hB4F37s_.js → rip-DGcSsuJR.js} +1 -1
- package/dist/app/assets/{roboconf-BqXmHAXe.js → roboconf-D84u_D2h.js} +1 -1
- package/dist/app/assets/{robotframework-BTJ5n8fC.js → robotframework-B55NHCrN.js} +1 -1
- package/dist/app/assets/{ruby-D6Jm6sK4.js → ruby-byKCK-dY.js} +1 -1
- package/dist/app/assets/{rust-BonG09IB.js → rust-DafX95DJ.js} +1 -1
- package/dist/app/assets/{sankeyDiagram-XADWPNL6-BxYgoe8H.js → sankeyDiagram-XADWPNL6-D6MJ50Pq.js} +1 -1
- package/dist/app/assets/{sas-Cl0dGeKC.js → sas-DTVLhrey.js} +1 -1
- package/dist/app/assets/{sass-CU1QiBFM.js → sass-rDhfj9yl.js} +1 -1
- package/dist/app/assets/{scala-DoZYPVOe.js → scala-BrKTyUsE.js} +1 -1
- package/dist/app/assets/{scheme-BgIJEt42.js → scheme-B_eu29xA.js} +1 -1
- package/dist/app/assets/{scss-CjocpdLe.js → scss-kgRahDzu.js} +1 -1
- package/dist/app/assets/{sequenceDiagram-FGHM5R23-BhGC2uYj.js → sequenceDiagram-FGHM5R23-BtFJlKLA.js} +1 -1
- package/dist/app/assets/{shell-session-BHwj7Lso.js → shell-session-CF0mJgux.js} +1 -1
- package/dist/app/assets/{smali-BDeyq-QZ.js → smali-cYYyD8tY.js} +1 -1
- package/dist/app/assets/{smalltalk-BeNshzwP.js → smalltalk-C0P2MRK9.js} +1 -1
- package/dist/app/assets/{smarty-Bvxz2rnZ.js → smarty-bSAEKlze.js} +1 -1
- package/dist/app/assets/{sml-NCRXglP-.js → sml-CVkWiohq.js} +1 -1
- package/dist/app/assets/{solidity-DCRKtW7U.js → solidity-DBmi5l50.js} +1 -1
- package/dist/app/assets/{solution-file-wzmwCZ6S.js → solution-file-CnTT-bB0.js} +1 -1
- package/dist/app/assets/{soy-yGw8ki1j.js → soy-D6Pv-4-M.js} +1 -1
- package/dist/app/assets/{sparql-C6HcVk-n.js → sparql-C_FSzEBv.js} +1 -1
- package/dist/app/assets/{splunk-spl-DwN8KORu.js → splunk-spl-BY7Iqglg.js} +1 -1
- package/dist/app/assets/{sqf-Ci0DqiRT.js → sqf-CPktPAhH.js} +1 -1
- package/dist/app/assets/{sql-r0BAcikz.js → sql-o4K_-hAR.js} +1 -1
- package/dist/app/assets/{squirrel-egwbG0_Q.js → squirrel-C7nc0I9a.js} +1 -1
- package/dist/app/assets/{stan-BUl5jvft.js → stan-BaHsDAPv.js} +1 -1
- package/dist/app/assets/{stateDiagram-FHFEXIEX-CuRECirl.js → stateDiagram-FHFEXIEX-Jt84X8Km.js} +1 -1
- package/dist/app/assets/stateDiagram-v2-QKLJ7IA2-2fuYX60f.js +1 -0
- package/dist/app/assets/{stylus-DTE1MHAZ.js → stylus-LrKOfqx1.js} +1 -1
- package/dist/app/assets/{swift-Cm0dpK0e.js → swift-Du5HvL9Z.js} +1 -1
- package/dist/app/assets/{systemd-C6-mX_m2.js → systemd-B9G8EDGS.js} +1 -1
- package/dist/app/assets/{t4-cs-CbJdbn3r.js → t4-cs-Cx16HVWP.js} +1 -1
- package/dist/app/assets/{t4-templating-DUNJuP6R.js → t4-templating-8EFI9hGP.js} +1 -1
- package/dist/app/assets/{t4-vb-CGQiYNUq.js → t4-vb-DY4dRQ0Y.js} +1 -1
- package/dist/app/assets/{tap-CcP4Ra29.js → tap-CnPjcybx.js} +1 -1
- package/dist/app/assets/{tcl-DDIFCbCY.js → tcl-CyN53FjG.js} +1 -1
- package/dist/app/assets/{textile-BP9vCAsS.js → textile-CcaFbMIR.js} +1 -1
- package/dist/app/assets/{timeline-definition-GMOUNBTQ-DtpMIXn5.js → timeline-definition-GMOUNBTQ-BIX9PrwR.js} +1 -1
- package/dist/app/assets/{toml-e0sn-wYl.js → toml-Dsv-Gf-x.js} +1 -1
- package/dist/app/assets/{tremor-rx7BwOeg.js → tremor-CFgQf23a.js} +1 -1
- package/dist/app/assets/{tt2-2GtZvdz0.js → tt2-C35x8-ln.js} +1 -1
- package/dist/app/assets/{turtle-Cyl6xYSA.js → turtle-mi4wNaqz.js} +1 -1
- package/dist/app/assets/{twig-DaPREJnk.js → twig--0LWYrgK.js} +1 -1
- package/dist/app/assets/{typescript-d9uArdn6.js → typescript-TITb6K2H.js} +1 -1
- package/dist/app/assets/{typoscript-Bz5s-Nus.js → typoscript-D9-RVwIo.js} +1 -1
- package/dist/app/assets/{unrealscript--YCQVCBZ.js → unrealscript-CEl7HM5o.js} +1 -1
- package/dist/app/assets/{uorazor-BGMX0b7A.js → uorazor-D_Rffmzi.js} +1 -1
- package/dist/app/assets/{uri-IleC_XB0.js → uri-BrG_tFHQ.js} +1 -1
- package/dist/app/assets/{v-D0_WRO4z.js → v-CSrNrMZT.js} +1 -1
- package/dist/app/assets/{vala-DjAqhwAT.js → vala-lXeoxFEf.js} +1 -1
- package/dist/app/assets/{vbnet-BtQX6etM.js → vbnet-CDvW0IYg.js} +1 -1
- package/dist/app/assets/{velocity-CnKSWVwR.js → velocity-CsuMf7zZ.js} +1 -1
- package/dist/app/assets/{vennDiagram-DHZGUBPP-DoPjGYKx.js → vennDiagram-DHZGUBPP-Bd1_DGNK.js} +1 -1
- package/dist/app/assets/{verilog-UtuuV-R3.js → verilog-Ba1kXwcH.js} +1 -1
- package/dist/app/assets/{vhdl-CLqX6Jr6.js → vhdl-DC7iDUsg.js} +1 -1
- package/dist/app/assets/{vim-C2pDFZQe.js → vim-m5sIDmbL.js} +1 -1
- package/dist/app/assets/{visual-basic-BsdNM80-.js → visual-basic-CZAxZhXd.js} +1 -1
- package/dist/app/assets/{wardley-RL74JXVD-BS1u_sqm.js → wardley-RL74JXVD-Bi7eSfh4.js} +1 -1
- package/dist/app/assets/{wardleyDiagram-NUSXRM2D-BLu2tzSV.js → wardleyDiagram-NUSXRM2D-C5W1iA0y.js} +1 -1
- package/dist/app/assets/{warpscript-DS0MtVBk.js → warpscript-YqE12jpR.js} +1 -1
- package/dist/app/assets/{wasm-pdEDtE_9.js → wasm-Cqk0NwrL.js} +1 -1
- package/dist/app/assets/{web-idl-C5-NgFOA.js → web-idl-BBz8nwvE.js} +1 -1
- package/dist/app/assets/{wiki-BZJV7U3Y.js → wiki-DTaDNr2a.js} +1 -1
- package/dist/app/assets/{wolfram-Q3sCKVET.js → wolfram-D_dyKsVO.js} +1 -1
- package/dist/app/assets/{wren-BNOjakR4.js → wren-VhlSRnur.js} +1 -1
- package/dist/app/assets/{xeora-R3lkxRHE.js → xeora-C3d3uHWl.js} +1 -1
- package/dist/app/assets/{xml-doc-ZtMXrPfY.js → xml-doc-Dn8dXLkg.js} +1 -1
- package/dist/app/assets/{xojo-Bgt-B00s.js → xojo-D7cO_F-x.js} +1 -1
- package/dist/app/assets/{xquery-CYusL8ky.js → xquery-C1brqcan.js} +1 -1
- package/dist/app/assets/{xychartDiagram-5P7HB3ND-BVUDpF-g.js → xychartDiagram-5P7HB3ND-CPn62Rvn.js} +1 -1
- package/dist/app/assets/{yaml-DQRgck-g.js → yaml-CucHvpnq.js} +1 -1
- package/dist/app/assets/{yang-Cs4B2bHl.js → yang-BwF0d5Qn.js} +1 -1
- package/dist/app/assets/{zig-Dbk4oIaS.js → zig-Bi_ZcakP.js} +1 -1
- package/dist/app/index.html +2 -2
- package/dist/index.cjs +1353 -526
- package/dist/index.js +1333 -504
- package/package.json +3 -3
- package/dist/app/assets/channel-CUlFcidM.js +0 -1
- package/dist/app/assets/classDiagram-6PBFFD2Q-BM4dEt05.js +0 -1
- package/dist/app/assets/classDiagram-v2-HSJHXN6E-BM4dEt05.js +0 -1
- package/dist/app/assets/clone-uIoilXjM.js +0 -1
- package/dist/app/assets/index-D4cxmXCP.css +0 -1
- package/dist/app/assets/index-DW63cdbq.js +0 -754
- package/dist/app/assets/stateDiagram-v2-QKLJ7IA2-Bw3r7wEs.js +0 -1
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// src/components/chat.tsx
|
|
2
|
-
import * as
|
|
2
|
+
import * as React49 from "react";
|
|
3
3
|
import {
|
|
4
4
|
ArrowDown as ArrowDown2,
|
|
5
5
|
ChevronDown as ChevronDown5,
|
|
6
6
|
FileText as FileText5,
|
|
7
7
|
ImageIcon,
|
|
8
|
-
Loader2 as
|
|
8
|
+
Loader2 as Loader29,
|
|
9
9
|
Minus,
|
|
10
10
|
Pause,
|
|
11
11
|
Pencil as Pencil4,
|
|
@@ -7738,8 +7738,8 @@ function useSlashCommands({
|
|
|
7738
7738
|
}
|
|
7739
7739
|
|
|
7740
7740
|
// src/components/thread/messages/ai.tsx
|
|
7741
|
-
import * as
|
|
7742
|
-
import { ChevronDown as ChevronDown4, Clock3 as Clock32, Loader2 as
|
|
7741
|
+
import * as React36 from "react";
|
|
7742
|
+
import { ChevronDown as ChevronDown4, Clock3 as Clock32, Loader2 as Loader28 } from "lucide-react";
|
|
7743
7743
|
|
|
7744
7744
|
// src/lib/agent-run-render-tree.ts
|
|
7745
7745
|
function isTextContent(content) {
|
|
@@ -11661,8 +11661,829 @@ function hasLegacySurface(surface) {
|
|
|
11661
11661
|
return !!surface?.componentTree;
|
|
11662
11662
|
}
|
|
11663
11663
|
|
|
11664
|
-
// src/components/thread/messages/
|
|
11664
|
+
// src/components/thread/messages/mcp-app.tsx
|
|
11665
|
+
import * as React35 from "react";
|
|
11666
|
+
import {
|
|
11667
|
+
resolveLocalizedText as resolveLocalizedText3
|
|
11668
|
+
} from "@xpert-ai/chatkit-types";
|
|
11669
|
+
import { AlertCircle as AlertCircle2, Loader2 as Loader27 } from "lucide-react";
|
|
11665
11670
|
import { jsx as jsx41, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
11671
|
+
function isRecord5(value) {
|
|
11672
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
11673
|
+
}
|
|
11674
|
+
function buildXpertApiUrl(apiUrl, path) {
|
|
11675
|
+
const normalizedApiUrl = apiUrl.trim();
|
|
11676
|
+
if (!normalizedApiUrl) return path;
|
|
11677
|
+
try {
|
|
11678
|
+
const url = new URL(normalizedApiUrl);
|
|
11679
|
+
return `${url.origin}${path}`;
|
|
11680
|
+
} catch {
|
|
11681
|
+
return path;
|
|
11682
|
+
}
|
|
11683
|
+
}
|
|
11684
|
+
function appendQuery(path, params) {
|
|
11685
|
+
const query = params.toString();
|
|
11686
|
+
return query ? `${path}?${query}` : path;
|
|
11687
|
+
}
|
|
11688
|
+
function buildMcpAppReviveParams(data) {
|
|
11689
|
+
const params = new URLSearchParams();
|
|
11690
|
+
const add = (key, value) => {
|
|
11691
|
+
if (value) {
|
|
11692
|
+
params.set(key, value);
|
|
11693
|
+
}
|
|
11694
|
+
};
|
|
11695
|
+
add("toolsetId", data.toolsetId);
|
|
11696
|
+
add("serverName", data.serverName);
|
|
11697
|
+
add("toolName", data.toolName);
|
|
11698
|
+
add("toolCallId", data.toolCallId);
|
|
11699
|
+
add("resourceUri", data.resourceUri);
|
|
11700
|
+
add("title", typeof data.title === "string" ? data.title : void 0);
|
|
11701
|
+
add("token", data.appInstanceToken);
|
|
11702
|
+
return params;
|
|
11703
|
+
}
|
|
11704
|
+
function buildMcpAppEndpointPath(data, endpoint) {
|
|
11705
|
+
return appendQuery(
|
|
11706
|
+
`/api/xpert-toolset/mcp-apps/${encodeURIComponent(
|
|
11707
|
+
data.appInstanceId
|
|
11708
|
+
)}/${endpoint}`,
|
|
11709
|
+
buildMcpAppReviveParams(data)
|
|
11710
|
+
);
|
|
11711
|
+
}
|
|
11712
|
+
function escapeHtmlAttribute(value) {
|
|
11713
|
+
return value.replaceAll("&", "&").replaceAll('"', """).replaceAll("<", "<").replaceAll(">", ">");
|
|
11714
|
+
}
|
|
11715
|
+
function domains(values) {
|
|
11716
|
+
return values?.filter((value) => value.trim()).join(" ") ?? "";
|
|
11717
|
+
}
|
|
11718
|
+
function buildCsp(csp) {
|
|
11719
|
+
const resourceDomains = domains(csp?.resourceDomains);
|
|
11720
|
+
const connectDomains = domains(csp?.connectDomains) || "'none'";
|
|
11721
|
+
const frameDomains = domains(csp?.frameDomains) || "'none'";
|
|
11722
|
+
const baseUriDomains = domains(csp?.baseUriDomains) || "'self'";
|
|
11723
|
+
return [
|
|
11724
|
+
"default-src 'none'",
|
|
11725
|
+
`script-src 'unsafe-inline' ${resourceDomains}`.trim(),
|
|
11726
|
+
`style-src 'unsafe-inline' ${resourceDomains}`.trim(),
|
|
11727
|
+
`img-src data: blob: ${resourceDomains}`.trim(),
|
|
11728
|
+
`media-src data: blob: ${resourceDomains}`.trim(),
|
|
11729
|
+
`font-src data: ${resourceDomains}`.trim(),
|
|
11730
|
+
`connect-src ${connectDomains}`,
|
|
11731
|
+
`frame-src ${frameDomains}`,
|
|
11732
|
+
`base-uri ${baseUriDomains}`
|
|
11733
|
+
].join("; ");
|
|
11734
|
+
}
|
|
11735
|
+
function injectHeadContent(html, content) {
|
|
11736
|
+
if (/<head[^>]*>/i.test(html)) {
|
|
11737
|
+
return html.replace(/<head([^>]*)>/i, `<head$1>${content}`);
|
|
11738
|
+
}
|
|
11739
|
+
return `<!doctype html><html><head>${content}</head><body>${html}</body></html>`;
|
|
11740
|
+
}
|
|
11741
|
+
function injectCsp(html, csp) {
|
|
11742
|
+
const meta = `<meta http-equiv="Content-Security-Policy" content="${escapeHtmlAttribute(
|
|
11743
|
+
buildCsp(csp)
|
|
11744
|
+
)}">`;
|
|
11745
|
+
return injectHeadContent(html, meta);
|
|
11746
|
+
}
|
|
11747
|
+
function decodeResourceHtml(resource) {
|
|
11748
|
+
if (typeof resource.text === "string") {
|
|
11749
|
+
return resource.text;
|
|
11750
|
+
}
|
|
11751
|
+
if (typeof resource.blob !== "string") {
|
|
11752
|
+
return null;
|
|
11753
|
+
}
|
|
11754
|
+
try {
|
|
11755
|
+
const decoded = window.atob(resource.blob);
|
|
11756
|
+
const escaped = Array.from(decoded).map((char) => `%${char.charCodeAt(0).toString(16).padStart(2, "0")}`).join("");
|
|
11757
|
+
return decodeURIComponent(escaped);
|
|
11758
|
+
} catch {
|
|
11759
|
+
try {
|
|
11760
|
+
return window.atob(resource.blob);
|
|
11761
|
+
} catch {
|
|
11762
|
+
return null;
|
|
11763
|
+
}
|
|
11764
|
+
}
|
|
11765
|
+
}
|
|
11766
|
+
function normalizeJsonRpcMessage(value) {
|
|
11767
|
+
const data = typeof value === "string" ? (() => {
|
|
11768
|
+
try {
|
|
11769
|
+
return JSON.parse(value);
|
|
11770
|
+
} catch {
|
|
11771
|
+
return null;
|
|
11772
|
+
}
|
|
11773
|
+
})() : value;
|
|
11774
|
+
if (!isRecord5(data) || typeof data.method !== "string") {
|
|
11775
|
+
return null;
|
|
11776
|
+
}
|
|
11777
|
+
return data;
|
|
11778
|
+
}
|
|
11779
|
+
function jsonRpcResult(id, result) {
|
|
11780
|
+
return {
|
|
11781
|
+
jsonrpc: "2.0",
|
|
11782
|
+
id: id ?? null,
|
|
11783
|
+
result
|
|
11784
|
+
};
|
|
11785
|
+
}
|
|
11786
|
+
function jsonRpcError(id, message) {
|
|
11787
|
+
return {
|
|
11788
|
+
jsonrpc: "2.0",
|
|
11789
|
+
id: id ?? null,
|
|
11790
|
+
error: {
|
|
11791
|
+
code: -32e3,
|
|
11792
|
+
message
|
|
11793
|
+
}
|
|
11794
|
+
};
|
|
11795
|
+
}
|
|
11796
|
+
function getErrorMessage(error) {
|
|
11797
|
+
return error instanceof Error ? error.message : String(error);
|
|
11798
|
+
}
|
|
11799
|
+
function getContainerDimensions(element) {
|
|
11800
|
+
if (!element) return null;
|
|
11801
|
+
const rect = element.getBoundingClientRect();
|
|
11802
|
+
return {
|
|
11803
|
+
width: rect.width,
|
|
11804
|
+
height: rect.height
|
|
11805
|
+
};
|
|
11806
|
+
}
|
|
11807
|
+
function normalizeHostLocale(locale) {
|
|
11808
|
+
return locale?.trim() || navigator.language || "en-US";
|
|
11809
|
+
}
|
|
11810
|
+
function getLocaleLanguage(locale) {
|
|
11811
|
+
return locale.split(/[-_]/)[0]?.toLowerCase() || locale.toLowerCase();
|
|
11812
|
+
}
|
|
11813
|
+
function getLocaleDirection(locale) {
|
|
11814
|
+
const language = getLocaleLanguage(locale);
|
|
11815
|
+
return ["ar", "fa", "he", "ur"].includes(language) ? "rtl" : "ltr";
|
|
11816
|
+
}
|
|
11817
|
+
function setHtmlAttribute(attrs, name, value) {
|
|
11818
|
+
const escaped = escapeHtmlAttribute(value);
|
|
11819
|
+
const pattern = new RegExp(`\\s${name}=("[^"]*"|'[^']*'|[^\\s>]*)`, "i");
|
|
11820
|
+
if (pattern.test(attrs)) {
|
|
11821
|
+
return attrs.replace(pattern, ` ${name}="${escaped}"`);
|
|
11822
|
+
}
|
|
11823
|
+
return `${attrs} ${name}="${escaped}"`;
|
|
11824
|
+
}
|
|
11825
|
+
function injectMcpAppLocale(html, locale) {
|
|
11826
|
+
const normalizedLocale = normalizeHostLocale(locale);
|
|
11827
|
+
const direction = getLocaleDirection(normalizedLocale);
|
|
11828
|
+
if (/<html[\s>]/i.test(html)) {
|
|
11829
|
+
return html.replace(/<html([^>]*)>/i, (_match, attrs) => {
|
|
11830
|
+
const withLang = setHtmlAttribute(attrs, "lang", normalizedLocale);
|
|
11831
|
+
const withDirection = setHtmlAttribute(withLang, "dir", direction);
|
|
11832
|
+
return `<html${withDirection}>`;
|
|
11833
|
+
});
|
|
11834
|
+
}
|
|
11835
|
+
return `<!doctype html><html lang="${escapeHtmlAttribute(
|
|
11836
|
+
normalizedLocale
|
|
11837
|
+
)}" dir="${direction}"><head></head><body>${html}</body></html>`;
|
|
11838
|
+
}
|
|
11839
|
+
var MCP_APP_THEME_COLOR_TOKENS = [
|
|
11840
|
+
["--background", "--mcp-app-color-background", "oklch(1 0 0)"],
|
|
11841
|
+
["--foreground", "--mcp-app-color-foreground", "oklch(0.145 0 0)"],
|
|
11842
|
+
["--card", "--mcp-app-color-card", "oklch(1 0 0)"],
|
|
11843
|
+
[
|
|
11844
|
+
"--card-foreground",
|
|
11845
|
+
"--mcp-app-color-card-foreground",
|
|
11846
|
+
"oklch(0.145 0 0)"
|
|
11847
|
+
],
|
|
11848
|
+
["--popover", "--mcp-app-color-popover", "oklch(1 0 0)"],
|
|
11849
|
+
[
|
|
11850
|
+
"--popover-foreground",
|
|
11851
|
+
"--mcp-app-color-popover-foreground",
|
|
11852
|
+
"oklch(0.145 0 0)"
|
|
11853
|
+
],
|
|
11854
|
+
["--primary", "--mcp-app-color-primary", "oklch(0.205 0 0)"],
|
|
11855
|
+
[
|
|
11856
|
+
"--primary-foreground",
|
|
11857
|
+
"--mcp-app-color-primary-foreground",
|
|
11858
|
+
"oklch(0.985 0 0)"
|
|
11859
|
+
],
|
|
11860
|
+
["--secondary", "--mcp-app-color-secondary", "oklch(0.97 0 0)"],
|
|
11861
|
+
[
|
|
11862
|
+
"--secondary-foreground",
|
|
11863
|
+
"--mcp-app-color-secondary-foreground",
|
|
11864
|
+
"oklch(0.205 0 0)"
|
|
11865
|
+
],
|
|
11866
|
+
["--muted", "--mcp-app-color-muted", "oklch(0.97 0 0)"],
|
|
11867
|
+
[
|
|
11868
|
+
"--muted-foreground",
|
|
11869
|
+
"--mcp-app-color-muted-foreground",
|
|
11870
|
+
"oklch(0.556 0 0)"
|
|
11871
|
+
],
|
|
11872
|
+
["--accent", "--mcp-app-color-accent", "oklch(0.97 0 0)"],
|
|
11873
|
+
[
|
|
11874
|
+
"--accent-foreground",
|
|
11875
|
+
"--mcp-app-color-accent-foreground",
|
|
11876
|
+
"oklch(0.205 0 0)"
|
|
11877
|
+
],
|
|
11878
|
+
[
|
|
11879
|
+
"--destructive",
|
|
11880
|
+
"--mcp-app-color-destructive",
|
|
11881
|
+
"oklch(0.577 0.245 27.325)"
|
|
11882
|
+
],
|
|
11883
|
+
[
|
|
11884
|
+
"--destructive-foreground",
|
|
11885
|
+
"--mcp-app-color-destructive-foreground",
|
|
11886
|
+
"oklch(0.985 0 0)"
|
|
11887
|
+
],
|
|
11888
|
+
["--border", "--mcp-app-color-border", "oklch(0.922 0 0)"],
|
|
11889
|
+
["--input", "--mcp-app-color-input", "oklch(0.922 0 0)"],
|
|
11890
|
+
["--ring", "--mcp-app-color-ring", "oklch(0.708 0 0)"],
|
|
11891
|
+
["--chart-1", "--mcp-app-color-chart-1", "oklch(0.87 0 0)"],
|
|
11892
|
+
["--chart-2", "--mcp-app-color-chart-2", "oklch(0.556 0 0)"],
|
|
11893
|
+
["--chart-3", "--mcp-app-color-chart-3", "oklch(0.439 0 0)"],
|
|
11894
|
+
["--chart-4", "--mcp-app-color-chart-4", "oklch(0.371 0 0)"],
|
|
11895
|
+
["--chart-5", "--mcp-app-color-chart-5", "oklch(0.269 0 0)"]
|
|
11896
|
+
];
|
|
11897
|
+
function sanitizeCssValue(value) {
|
|
11898
|
+
return value.replace(/[;{}<>]/g, "").trim();
|
|
11899
|
+
}
|
|
11900
|
+
function normalizeColorCssValue(value) {
|
|
11901
|
+
const trimmed = sanitizeCssValue(value);
|
|
11902
|
+
if (!trimmed) return "";
|
|
11903
|
+
if (/^(#|rgb\(|rgba\(|hsl\(|hsla\(|oklch\(|oklab\(|color\(|var\()/i.test(
|
|
11904
|
+
trimmed
|
|
11905
|
+
)) {
|
|
11906
|
+
return trimmed;
|
|
11907
|
+
}
|
|
11908
|
+
if (/^-?\d/.test(trimmed) && /\s/.test(trimmed)) {
|
|
11909
|
+
return `hsl(${trimmed})`;
|
|
11910
|
+
}
|
|
11911
|
+
return trimmed;
|
|
11912
|
+
}
|
|
11913
|
+
function getHostThemeMode() {
|
|
11914
|
+
return document.documentElement.classList.contains("dark") ? "dark" : "light";
|
|
11915
|
+
}
|
|
11916
|
+
function readHostCssVariable(element, variableName) {
|
|
11917
|
+
const candidates = [
|
|
11918
|
+
element,
|
|
11919
|
+
element === document.documentElement ? null : document.documentElement
|
|
11920
|
+
].filter(Boolean);
|
|
11921
|
+
for (const candidate of candidates) {
|
|
11922
|
+
const value = window.getComputedStyle(candidate).getPropertyValue(variableName).trim();
|
|
11923
|
+
if (value) {
|
|
11924
|
+
return value;
|
|
11925
|
+
}
|
|
11926
|
+
}
|
|
11927
|
+
return "";
|
|
11928
|
+
}
|
|
11929
|
+
function buildMcpAppTheme(element) {
|
|
11930
|
+
const source = element ?? document.documentElement;
|
|
11931
|
+
const sourceStyles = window.getComputedStyle(source);
|
|
11932
|
+
const cssVariables = {
|
|
11933
|
+
"--mcp-app-color-scheme": getHostThemeMode(),
|
|
11934
|
+
"--mcp-app-font-sans": sanitizeCssValue(
|
|
11935
|
+
sourceStyles.fontFamily || "ui-sans-serif, system-ui, sans-serif"
|
|
11936
|
+
),
|
|
11937
|
+
"--mcp-app-font-mono": sanitizeCssValue(
|
|
11938
|
+
readHostCssVariable(source, "--font-mono") || "ui-monospace, SFMono-Regular, Menlo, monospace"
|
|
11939
|
+
),
|
|
11940
|
+
"--mcp-app-radius": sanitizeCssValue(
|
|
11941
|
+
readHostCssVariable(source, "--radius") || "0.5rem"
|
|
11942
|
+
)
|
|
11943
|
+
};
|
|
11944
|
+
for (const [
|
|
11945
|
+
hostVariable,
|
|
11946
|
+
appVariable,
|
|
11947
|
+
fallback
|
|
11948
|
+
] of MCP_APP_THEME_COLOR_TOKENS) {
|
|
11949
|
+
cssVariables[appVariable] = normalizeColorCssValue(readHostCssVariable(source, hostVariable)) || fallback;
|
|
11950
|
+
}
|
|
11951
|
+
return {
|
|
11952
|
+
mode: getHostThemeMode(),
|
|
11953
|
+
cssVariables
|
|
11954
|
+
};
|
|
11955
|
+
}
|
|
11956
|
+
function injectMcpAppTheme(html, theme) {
|
|
11957
|
+
const declarations = Object.entries(theme.cssVariables).map(([name, value]) => `${name}: ${sanitizeCssValue(value)};`).join("");
|
|
11958
|
+
const style = `<style id="mcp-app-host-theme">:root{color-scheme:${theme.mode};${declarations}}</style>`;
|
|
11959
|
+
return injectHeadContent(html, style);
|
|
11960
|
+
}
|
|
11961
|
+
function buildStandardToolInfo(data, resource) {
|
|
11962
|
+
const raw = resource?.toolInfo ?? {};
|
|
11963
|
+
const rawTitle = isRecord5(raw) && (raw.title !== void 0 || raw.name !== void 0) ? raw.title ?? raw.name : void 0;
|
|
11964
|
+
const rawDescription = isRecord5(raw) && raw.description !== void 0 ? raw.description : void 0;
|
|
11965
|
+
const rawIcon = isRecord5(raw) && raw.icon !== void 0 ? raw.icon : void 0;
|
|
11966
|
+
const originalName = isRecord5(raw) && typeof raw.originalName === "string" ? raw.originalName : data.toolName;
|
|
11967
|
+
const title = rawTitle ?? resource?.title ?? data.title ?? data.toolName;
|
|
11968
|
+
const description = rawDescription ?? resource?.description ?? data.description;
|
|
11969
|
+
const icon = rawIcon ?? resource?.icon ?? data.icon;
|
|
11970
|
+
return {
|
|
11971
|
+
...raw,
|
|
11972
|
+
id: data.toolCallId,
|
|
11973
|
+
tool: {
|
|
11974
|
+
name: originalName,
|
|
11975
|
+
title,
|
|
11976
|
+
...description ? { description } : {},
|
|
11977
|
+
...icon ? { icon } : {}
|
|
11978
|
+
}
|
|
11979
|
+
};
|
|
11980
|
+
}
|
|
11981
|
+
function hasPermissionGrant(value) {
|
|
11982
|
+
return value === true || isRecord5(value);
|
|
11983
|
+
}
|
|
11984
|
+
function buildIframeAllow(permissions) {
|
|
11985
|
+
if (!permissions) return void 0;
|
|
11986
|
+
const policies = [];
|
|
11987
|
+
if (hasPermissionGrant(permissions.camera)) {
|
|
11988
|
+
policies.push("camera *");
|
|
11989
|
+
}
|
|
11990
|
+
if (hasPermissionGrant(permissions.microphone)) {
|
|
11991
|
+
policies.push("microphone *");
|
|
11992
|
+
}
|
|
11993
|
+
if (hasPermissionGrant(permissions.geolocation)) {
|
|
11994
|
+
policies.push("geolocation *");
|
|
11995
|
+
}
|
|
11996
|
+
if (hasPermissionGrant(permissions.clipboardWrite)) {
|
|
11997
|
+
policies.push("clipboard-write *");
|
|
11998
|
+
}
|
|
11999
|
+
return policies.length ? policies.join("; ") : void 0;
|
|
12000
|
+
}
|
|
12001
|
+
function buildSandboxAttribute() {
|
|
12002
|
+
return ["allow-downloads", "allow-forms", "allow-modals", "allow-scripts"].join(
|
|
12003
|
+
" "
|
|
12004
|
+
);
|
|
12005
|
+
}
|
|
12006
|
+
function stringifyToolResult(value) {
|
|
12007
|
+
if (typeof value === "string") return value;
|
|
12008
|
+
try {
|
|
12009
|
+
return JSON.stringify(value ?? null);
|
|
12010
|
+
} catch {
|
|
12011
|
+
return String(value);
|
|
12012
|
+
}
|
|
12013
|
+
}
|
|
12014
|
+
function normalizeCallToolResult(value) {
|
|
12015
|
+
if (isRecord5(value) && Array.isArray(value.content)) {
|
|
12016
|
+
return value;
|
|
12017
|
+
}
|
|
12018
|
+
if (Array.isArray(value) && value.length >= 2) {
|
|
12019
|
+
const [content, artifact] = value;
|
|
12020
|
+
const text = typeof content === "string" ? content : stringifyToolResult(content);
|
|
12021
|
+
const normalized = {
|
|
12022
|
+
content: [
|
|
12023
|
+
{
|
|
12024
|
+
type: "text",
|
|
12025
|
+
text
|
|
12026
|
+
}
|
|
12027
|
+
]
|
|
12028
|
+
};
|
|
12029
|
+
if (isRecord5(artifact)) {
|
|
12030
|
+
normalized._meta = artifact;
|
|
12031
|
+
if (isRecord5(artifact.structuredContent)) {
|
|
12032
|
+
normalized.structuredContent = artifact.structuredContent;
|
|
12033
|
+
}
|
|
12034
|
+
} else if (Array.isArray(artifact)) {
|
|
12035
|
+
const structured = artifact.find(
|
|
12036
|
+
(item) => isRecord5(item) && isRecord5(item.structuredContent)
|
|
12037
|
+
);
|
|
12038
|
+
const meta = artifact.find(isRecord5);
|
|
12039
|
+
if (structured?.structuredContent) {
|
|
12040
|
+
normalized.structuredContent = structured.structuredContent;
|
|
12041
|
+
}
|
|
12042
|
+
if (meta) {
|
|
12043
|
+
normalized._meta = meta;
|
|
12044
|
+
}
|
|
12045
|
+
}
|
|
12046
|
+
return normalized;
|
|
12047
|
+
}
|
|
12048
|
+
return {
|
|
12049
|
+
content: [
|
|
12050
|
+
{
|
|
12051
|
+
type: "text",
|
|
12052
|
+
text: stringifyToolResult(value)
|
|
12053
|
+
}
|
|
12054
|
+
]
|
|
12055
|
+
};
|
|
12056
|
+
}
|
|
12057
|
+
function isHttpUrl(value) {
|
|
12058
|
+
try {
|
|
12059
|
+
const url = new URL(value);
|
|
12060
|
+
return url.protocol === "http:" || url.protocol === "https:";
|
|
12061
|
+
} catch {
|
|
12062
|
+
return false;
|
|
12063
|
+
}
|
|
12064
|
+
}
|
|
12065
|
+
function contentBlocksToText(content) {
|
|
12066
|
+
if (!Array.isArray(content)) return null;
|
|
12067
|
+
const parts = content.map((item) => {
|
|
12068
|
+
if (!isRecord5(item)) return "";
|
|
12069
|
+
if (item.type === "text" && typeof item.text === "string") {
|
|
12070
|
+
return item.text;
|
|
12071
|
+
}
|
|
12072
|
+
if (item.type === "resource_link" && typeof item.uri === "string") {
|
|
12073
|
+
return item.uri;
|
|
12074
|
+
}
|
|
12075
|
+
if (item.type === "image" || item.type === "audio") {
|
|
12076
|
+
return `[${item.type}]`;
|
|
12077
|
+
}
|
|
12078
|
+
return stringifyToolResult(item);
|
|
12079
|
+
}).map((part) => part.trim()).filter(Boolean);
|
|
12080
|
+
return parts.length ? parts.join("\n\n") : null;
|
|
12081
|
+
}
|
|
12082
|
+
function isMcpAppComponentData(data) {
|
|
12083
|
+
return isRecord5(data) && data.type === "McpApp" && typeof data.appInstanceId === "string" && typeof data.resourceUri === "string";
|
|
12084
|
+
}
|
|
12085
|
+
function McpAppMessage({
|
|
12086
|
+
data,
|
|
12087
|
+
className
|
|
12088
|
+
}) {
|
|
12089
|
+
const { i18n: i18n2 } = useChatkitTranslation();
|
|
12090
|
+
const {
|
|
12091
|
+
apiUrl,
|
|
12092
|
+
authenticatedFetch,
|
|
12093
|
+
isLoading: streamIsLoading,
|
|
12094
|
+
submit
|
|
12095
|
+
} = useStreamContext();
|
|
12096
|
+
const iframeRef = React35.useRef(null);
|
|
12097
|
+
const containerRef = React35.useRef(null);
|
|
12098
|
+
const initializedRef = React35.useRef(false);
|
|
12099
|
+
const sentInitialResultRef = React35.useRef(false);
|
|
12100
|
+
const modelContextRef = React35.useRef(null);
|
|
12101
|
+
const [resource, setResource] = React35.useState(
|
|
12102
|
+
null
|
|
12103
|
+
);
|
|
12104
|
+
const [srcDoc, setSrcDoc] = React35.useState(null);
|
|
12105
|
+
const [height, setHeight] = React35.useState(420);
|
|
12106
|
+
const [error, setError] = React35.useState(null);
|
|
12107
|
+
const [isLoading, setIsLoading] = React35.useState(true);
|
|
12108
|
+
const resourceUrl = React35.useMemo(
|
|
12109
|
+
() => buildXpertApiUrl(
|
|
12110
|
+
apiUrl,
|
|
12111
|
+
buildMcpAppEndpointPath(data, "resource")
|
|
12112
|
+
),
|
|
12113
|
+
[apiUrl, data]
|
|
12114
|
+
);
|
|
12115
|
+
const rpcUrl = React35.useMemo(
|
|
12116
|
+
() => buildXpertApiUrl(
|
|
12117
|
+
apiUrl,
|
|
12118
|
+
buildMcpAppEndpointPath(data, "rpc")
|
|
12119
|
+
),
|
|
12120
|
+
[apiUrl, data]
|
|
12121
|
+
);
|
|
12122
|
+
const postToApp = React35.useCallback((message) => {
|
|
12123
|
+
iframeRef.current?.contentWindow?.postMessage(message, "*");
|
|
12124
|
+
}, []);
|
|
12125
|
+
const callHostRpc = React35.useCallback(
|
|
12126
|
+
async (request) => {
|
|
12127
|
+
const response = await authenticatedFetch(rpcUrl, {
|
|
12128
|
+
method: "POST",
|
|
12129
|
+
headers: {
|
|
12130
|
+
"content-type": "application/json"
|
|
12131
|
+
},
|
|
12132
|
+
body: JSON.stringify({
|
|
12133
|
+
jsonrpc: "2.0",
|
|
12134
|
+
id: request.id ?? null,
|
|
12135
|
+
method: request.method,
|
|
12136
|
+
params: request.params
|
|
12137
|
+
})
|
|
12138
|
+
});
|
|
12139
|
+
if (!response.ok) {
|
|
12140
|
+
throw new Error(`MCP App RPC failed with ${response.status}`);
|
|
12141
|
+
}
|
|
12142
|
+
return response.json();
|
|
12143
|
+
},
|
|
12144
|
+
[authenticatedFetch, rpcUrl]
|
|
12145
|
+
);
|
|
12146
|
+
const sendInitialToolNotifications = React35.useCallback(() => {
|
|
12147
|
+
if (!initializedRef.current || sentInitialResultRef.current || !resource) {
|
|
12148
|
+
return;
|
|
12149
|
+
}
|
|
12150
|
+
sentInitialResultRef.current = true;
|
|
12151
|
+
postToApp({
|
|
12152
|
+
jsonrpc: "2.0",
|
|
12153
|
+
method: "ui/notifications/tool-input",
|
|
12154
|
+
params: {
|
|
12155
|
+
arguments: resource.toolInput ?? data.toolInput ?? {}
|
|
12156
|
+
}
|
|
12157
|
+
});
|
|
12158
|
+
postToApp({
|
|
12159
|
+
jsonrpc: "2.0",
|
|
12160
|
+
method: "ui/notifications/tool-result",
|
|
12161
|
+
params: {
|
|
12162
|
+
...normalizeCallToolResult(resource.toolResult),
|
|
12163
|
+
toolCallId: data.toolCallId,
|
|
12164
|
+
toolName: data.toolName,
|
|
12165
|
+
// Legacy compatibility for apps written before the 2026-01-26 notification shape.
|
|
12166
|
+
result: resource.toolResult
|
|
12167
|
+
}
|
|
12168
|
+
});
|
|
12169
|
+
}, [data.toolCallId, data.toolInput, data.toolName, postToApp, resource]);
|
|
12170
|
+
React35.useEffect(() => {
|
|
12171
|
+
const controller = new AbortController();
|
|
12172
|
+
initializedRef.current = false;
|
|
12173
|
+
sentInitialResultRef.current = false;
|
|
12174
|
+
setIsLoading(true);
|
|
12175
|
+
setError(null);
|
|
12176
|
+
setResource(null);
|
|
12177
|
+
setSrcDoc(null);
|
|
12178
|
+
void (async () => {
|
|
12179
|
+
try {
|
|
12180
|
+
const response = await authenticatedFetch(resourceUrl, {
|
|
12181
|
+
signal: controller.signal
|
|
12182
|
+
});
|
|
12183
|
+
if (!response.ok) {
|
|
12184
|
+
throw new Error(`MCP App resource failed with ${response.status}`);
|
|
12185
|
+
}
|
|
12186
|
+
const payload = await response.json();
|
|
12187
|
+
const html = decodeResourceHtml(payload);
|
|
12188
|
+
if (!html) {
|
|
12189
|
+
throw new Error("MCP App resource did not include HTML content");
|
|
12190
|
+
}
|
|
12191
|
+
setResource(payload);
|
|
12192
|
+
const hostLocale = normalizeHostLocale(i18n2.language);
|
|
12193
|
+
setSrcDoc(
|
|
12194
|
+
injectMcpAppTheme(
|
|
12195
|
+
injectCsp(
|
|
12196
|
+
injectMcpAppLocale(html, hostLocale),
|
|
12197
|
+
payload.csp ?? data.csp
|
|
12198
|
+
),
|
|
12199
|
+
buildMcpAppTheme(containerRef.current)
|
|
12200
|
+
)
|
|
12201
|
+
);
|
|
12202
|
+
} catch (loadError) {
|
|
12203
|
+
if (!controller.signal.aborted) {
|
|
12204
|
+
setError(getErrorMessage(loadError));
|
|
12205
|
+
}
|
|
12206
|
+
} finally {
|
|
12207
|
+
if (!controller.signal.aborted) {
|
|
12208
|
+
setIsLoading(false);
|
|
12209
|
+
}
|
|
12210
|
+
}
|
|
12211
|
+
})();
|
|
12212
|
+
return () => {
|
|
12213
|
+
controller.abort();
|
|
12214
|
+
};
|
|
12215
|
+
}, [
|
|
12216
|
+
authenticatedFetch,
|
|
12217
|
+
data.appInstanceId,
|
|
12218
|
+
data.csp,
|
|
12219
|
+
i18n2.language,
|
|
12220
|
+
resourceUrl
|
|
12221
|
+
]);
|
|
12222
|
+
React35.useEffect(() => {
|
|
12223
|
+
sendInitialToolNotifications();
|
|
12224
|
+
}, [sendInitialToolNotifications]);
|
|
12225
|
+
React35.useEffect(() => {
|
|
12226
|
+
const handleMessage = async (event) => {
|
|
12227
|
+
if (event.source !== iframeRef.current?.contentWindow) {
|
|
12228
|
+
return;
|
|
12229
|
+
}
|
|
12230
|
+
const request = normalizeJsonRpcMessage(event.data);
|
|
12231
|
+
if (!request?.method) {
|
|
12232
|
+
return;
|
|
12233
|
+
}
|
|
12234
|
+
if (request.method === "ui/notifications/initialized") {
|
|
12235
|
+
initializedRef.current = true;
|
|
12236
|
+
sendInitialToolNotifications();
|
|
12237
|
+
return;
|
|
12238
|
+
}
|
|
12239
|
+
if (request.method === "ui/notifications/size-changed") {
|
|
12240
|
+
const nextHeight = isRecord5(request.params) && typeof request.params.height === "number" ? request.params.height : null;
|
|
12241
|
+
if (nextHeight !== null) {
|
|
12242
|
+
setHeight(Math.min(900, Math.max(240, Math.round(nextHeight))));
|
|
12243
|
+
}
|
|
12244
|
+
return;
|
|
12245
|
+
}
|
|
12246
|
+
if (request.method === "ui/initialize") {
|
|
12247
|
+
initializedRef.current = true;
|
|
12248
|
+
const permissions = resource?.permissions ?? data.permissions;
|
|
12249
|
+
const csp = resource?.csp ?? data.csp;
|
|
12250
|
+
const toolInfo = buildStandardToolInfo(data, resource);
|
|
12251
|
+
const theme = buildMcpAppTheme(containerRef.current);
|
|
12252
|
+
const hostLocale = normalizeHostLocale(i18n2.language);
|
|
12253
|
+
const hostLanguage = getLocaleLanguage(hostLocale);
|
|
12254
|
+
const hostDirection = getLocaleDirection(hostLocale);
|
|
12255
|
+
postToApp(
|
|
12256
|
+
jsonRpcResult(request.id, {
|
|
12257
|
+
protocolVersion: "2026-01-26",
|
|
12258
|
+
hostInfo: {
|
|
12259
|
+
name: "xpert-chatkit",
|
|
12260
|
+
version: "1.0.0",
|
|
12261
|
+
title: "Xpert ChatKit"
|
|
12262
|
+
},
|
|
12263
|
+
hostCapabilities: {
|
|
12264
|
+
serverTools: {},
|
|
12265
|
+
serverResources: {},
|
|
12266
|
+
openLinks: {},
|
|
12267
|
+
logging: {},
|
|
12268
|
+
message: {
|
|
12269
|
+
text: {}
|
|
12270
|
+
},
|
|
12271
|
+
updateModelContext: {
|
|
12272
|
+
text: {},
|
|
12273
|
+
structuredContent: {}
|
|
12274
|
+
},
|
|
12275
|
+
sandbox: {
|
|
12276
|
+
...permissions ? { permissions } : {},
|
|
12277
|
+
...csp ? { csp } : {}
|
|
12278
|
+
}
|
|
12279
|
+
},
|
|
12280
|
+
hostContext: {
|
|
12281
|
+
toolInfo,
|
|
12282
|
+
theme: theme.mode,
|
|
12283
|
+
themeCssVariables: theme.cssVariables,
|
|
12284
|
+
locale: hostLocale,
|
|
12285
|
+
language: hostLanguage,
|
|
12286
|
+
direction: hostDirection,
|
|
12287
|
+
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
12288
|
+
displayMode: "inline",
|
|
12289
|
+
availableDisplayModes: ["inline"],
|
|
12290
|
+
containerDimensions: getContainerDimensions(containerRef.current),
|
|
12291
|
+
userAgent: "xpert-chatkit",
|
|
12292
|
+
platform: "web",
|
|
12293
|
+
deviceCapabilities: {
|
|
12294
|
+
touch: navigator.maxTouchPoints > 0,
|
|
12295
|
+
hover: window.matchMedia("(hover: hover)").matches
|
|
12296
|
+
}
|
|
12297
|
+
},
|
|
12298
|
+
// Legacy compatibility for apps written before the 2026-01-26 result shape.
|
|
12299
|
+
capabilities: {
|
|
12300
|
+
displayModes: ["inline"],
|
|
12301
|
+
serverTools: true,
|
|
12302
|
+
serverResources: true,
|
|
12303
|
+
openLinks: true
|
|
12304
|
+
},
|
|
12305
|
+
context: {
|
|
12306
|
+
toolInfo: resource?.toolInfo ?? {
|
|
12307
|
+
name: data.toolName,
|
|
12308
|
+
toolCallId: data.toolCallId
|
|
12309
|
+
},
|
|
12310
|
+
theme: theme.mode,
|
|
12311
|
+
themeCssVariables: theme.cssVariables,
|
|
12312
|
+
locale: hostLocale,
|
|
12313
|
+
language: hostLanguage,
|
|
12314
|
+
direction: hostDirection,
|
|
12315
|
+
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
12316
|
+
displayMode: "inline",
|
|
12317
|
+
availableDisplayModes: ["inline"],
|
|
12318
|
+
containerDimensions: getContainerDimensions(containerRef.current),
|
|
12319
|
+
userAgent: navigator.userAgent,
|
|
12320
|
+
platform: navigator.platform
|
|
12321
|
+
}
|
|
12322
|
+
})
|
|
12323
|
+
);
|
|
12324
|
+
sendInitialToolNotifications();
|
|
12325
|
+
return;
|
|
12326
|
+
}
|
|
12327
|
+
if (request.method === "ui/open-link") {
|
|
12328
|
+
const href = isRecord5(request.params) && typeof request.params.url === "string" ? request.params.url : isRecord5(request.params) && typeof request.params.href === "string" ? request.params.href : null;
|
|
12329
|
+
if (href && isHttpUrl(href)) {
|
|
12330
|
+
window.open(href, "_blank", "noopener,noreferrer");
|
|
12331
|
+
if (request.id !== void 0) {
|
|
12332
|
+
postToApp(jsonRpcResult(request.id, {}));
|
|
12333
|
+
}
|
|
12334
|
+
} else if (request.id !== void 0) {
|
|
12335
|
+
postToApp(jsonRpcResult(request.id, { isError: true }));
|
|
12336
|
+
}
|
|
12337
|
+
return;
|
|
12338
|
+
}
|
|
12339
|
+
if (request.method === "ui/update-model-context") {
|
|
12340
|
+
modelContextRef.current = request.params;
|
|
12341
|
+
try {
|
|
12342
|
+
postToApp(await callHostRpc(request));
|
|
12343
|
+
} catch (rpcError) {
|
|
12344
|
+
postToApp(jsonRpcError(request.id, getErrorMessage(rpcError)));
|
|
12345
|
+
}
|
|
12346
|
+
return;
|
|
12347
|
+
}
|
|
12348
|
+
if (request.method === "ui/message") {
|
|
12349
|
+
try {
|
|
12350
|
+
if (!isRecord5(request.params) || request.params.role !== "user" || !Array.isArray(request.params.content)) {
|
|
12351
|
+
throw new Error(
|
|
12352
|
+
'ui/message params must include role "user" and content blocks'
|
|
12353
|
+
);
|
|
12354
|
+
}
|
|
12355
|
+
const hostResponse = await callHostRpc(request);
|
|
12356
|
+
if (isRecord5(hostResponse) && hostResponse.error) {
|
|
12357
|
+
postToApp(hostResponse);
|
|
12358
|
+
return;
|
|
12359
|
+
}
|
|
12360
|
+
const inputText = contentBlocksToText(request.params.content);
|
|
12361
|
+
if (!inputText) {
|
|
12362
|
+
throw new Error("ui/message content did not include text");
|
|
12363
|
+
}
|
|
12364
|
+
await submit(
|
|
12365
|
+
{
|
|
12366
|
+
input: {
|
|
12367
|
+
input: inputText
|
|
12368
|
+
}
|
|
12369
|
+
},
|
|
12370
|
+
{
|
|
12371
|
+
...streamIsLoading ? { followUpMode: "queue" } : {},
|
|
12372
|
+
context: {
|
|
12373
|
+
mcpApp: {
|
|
12374
|
+
appInstanceId: data.appInstanceId,
|
|
12375
|
+
resourceUri: data.resourceUri,
|
|
12376
|
+
toolName: data.toolName,
|
|
12377
|
+
toolCallId: data.toolCallId,
|
|
12378
|
+
modelContext: modelContextRef.current
|
|
12379
|
+
}
|
|
12380
|
+
}
|
|
12381
|
+
}
|
|
12382
|
+
);
|
|
12383
|
+
postToApp(hostResponse);
|
|
12384
|
+
} catch (messageError) {
|
|
12385
|
+
postToApp(jsonRpcError(request.id, getErrorMessage(messageError)));
|
|
12386
|
+
}
|
|
12387
|
+
return;
|
|
12388
|
+
}
|
|
12389
|
+
if (request.id === void 0 && request.method.startsWith("ui/")) {
|
|
12390
|
+
return;
|
|
12391
|
+
}
|
|
12392
|
+
try {
|
|
12393
|
+
postToApp(await callHostRpc(request));
|
|
12394
|
+
} catch (rpcError) {
|
|
12395
|
+
postToApp(jsonRpcError(request.id, getErrorMessage(rpcError)));
|
|
12396
|
+
}
|
|
12397
|
+
};
|
|
12398
|
+
window.addEventListener("message", handleMessage);
|
|
12399
|
+
return () => {
|
|
12400
|
+
window.removeEventListener("message", handleMessage);
|
|
12401
|
+
};
|
|
12402
|
+
}, [
|
|
12403
|
+
callHostRpc,
|
|
12404
|
+
data.appInstanceId,
|
|
12405
|
+
data.csp,
|
|
12406
|
+
data.permissions,
|
|
12407
|
+
data.resourceUri,
|
|
12408
|
+
data.title,
|
|
12409
|
+
data.toolCallId,
|
|
12410
|
+
data.toolName,
|
|
12411
|
+
i18n2.language,
|
|
12412
|
+
postToApp,
|
|
12413
|
+
resource?.csp,
|
|
12414
|
+
resource?.permissions,
|
|
12415
|
+
resource?.toolInfo,
|
|
12416
|
+
sendInitialToolNotifications,
|
|
12417
|
+
streamIsLoading,
|
|
12418
|
+
submit
|
|
12419
|
+
]);
|
|
12420
|
+
const iframePermissions = resource?.permissions ?? data.permissions;
|
|
12421
|
+
const iframeAllow = React35.useMemo(
|
|
12422
|
+
() => buildIframeAllow(iframePermissions),
|
|
12423
|
+
[iframePermissions]
|
|
12424
|
+
);
|
|
12425
|
+
const sandbox = React35.useMemo(() => buildSandboxAttribute(), []);
|
|
12426
|
+
const prefersBorder = resource?.prefersBorder ?? data.prefersBorder ?? true;
|
|
12427
|
+
const displayTitle = resolveLocalizedText3(resource?.title ?? data.title, i18n2.language) ?? data.toolName;
|
|
12428
|
+
const displayDescription = resolveLocalizedText3(
|
|
12429
|
+
resource?.description ?? data.description,
|
|
12430
|
+
i18n2.language
|
|
12431
|
+
);
|
|
12432
|
+
const displayIcon = resource?.icon ?? data.icon;
|
|
12433
|
+
return /* @__PURE__ */ jsxs28(
|
|
12434
|
+
"div",
|
|
12435
|
+
{
|
|
12436
|
+
ref: containerRef,
|
|
12437
|
+
className: cn(
|
|
12438
|
+
"overflow-hidden rounded-lg border bg-background shadow-sm",
|
|
12439
|
+
!prefersBorder && "border-transparent shadow-none",
|
|
12440
|
+
className
|
|
12441
|
+
),
|
|
12442
|
+
children: [
|
|
12443
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex min-h-10 items-center justify-between gap-3 border-b px-3 py-2", children: [
|
|
12444
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
12445
|
+
displayIcon ? /* @__PURE__ */ jsx41(
|
|
12446
|
+
IconDefinitionRenderer,
|
|
12447
|
+
{
|
|
12448
|
+
icon: displayIcon,
|
|
12449
|
+
size: 18,
|
|
12450
|
+
className: "shrink-0",
|
|
12451
|
+
decorative: true
|
|
12452
|
+
}
|
|
12453
|
+
) : null,
|
|
12454
|
+
/* @__PURE__ */ jsxs28("div", { className: "min-w-0", children: [
|
|
12455
|
+
/* @__PURE__ */ jsx41("div", { className: "truncate text-sm font-medium", children: displayTitle }),
|
|
12456
|
+
/* @__PURE__ */ jsx41("div", { className: "truncate text-[11px] text-muted-foreground", children: displayDescription ?? data.resourceUri })
|
|
12457
|
+
] })
|
|
12458
|
+
] }),
|
|
12459
|
+
/* @__PURE__ */ jsx41(Badge, { variant: "secondary", className: "shrink-0 rounded-md", children: "MCP App" })
|
|
12460
|
+
] }),
|
|
12461
|
+
isLoading ? /* @__PURE__ */ jsxs28("div", { className: "flex h-40 items-center justify-center gap-2 text-sm text-muted-foreground", children: [
|
|
12462
|
+
/* @__PURE__ */ jsx41(Loader27, { className: "h-4 w-4 animate-spin" }),
|
|
12463
|
+
/* @__PURE__ */ jsx41("span", { children: "Loading MCP App" })
|
|
12464
|
+
] }) : error ? /* @__PURE__ */ jsxs28("div", { className: "flex h-40 items-center justify-center gap-2 px-4 text-sm text-destructive", children: [
|
|
12465
|
+
/* @__PURE__ */ jsx41(AlertCircle2, { className: "h-4 w-4 shrink-0" }),
|
|
12466
|
+
/* @__PURE__ */ jsx41("span", { className: "min-w-0 break-words", children: error })
|
|
12467
|
+
] }) : srcDoc ? /* @__PURE__ */ jsx41(
|
|
12468
|
+
"iframe",
|
|
12469
|
+
{
|
|
12470
|
+
ref: iframeRef,
|
|
12471
|
+
title: displayTitle,
|
|
12472
|
+
srcDoc,
|
|
12473
|
+
className: "block w-full bg-background",
|
|
12474
|
+
style: { height },
|
|
12475
|
+
sandbox,
|
|
12476
|
+
allow: iframeAllow,
|
|
12477
|
+
referrerPolicy: "no-referrer"
|
|
12478
|
+
}
|
|
12479
|
+
) : null
|
|
12480
|
+
]
|
|
12481
|
+
}
|
|
12482
|
+
);
|
|
12483
|
+
}
|
|
12484
|
+
|
|
12485
|
+
// src/components/thread/messages/ai.tsx
|
|
12486
|
+
import { jsx as jsx42, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
11666
12487
|
var assistantMessageStackClassName = "space-y-3 in-data-[density=compact]:space-y-2 in-data-[density=spacious]:space-y-4";
|
|
11667
12488
|
function isTextContent3(content) {
|
|
11668
12489
|
return content.type === "text";
|
|
@@ -11680,6 +12501,9 @@ function isWidgetComponent2(content) {
|
|
|
11680
12501
|
const data = content.data;
|
|
11681
12502
|
return data?.type === "Widget" && Array.isArray(data.widgets);
|
|
11682
12503
|
}
|
|
12504
|
+
function isMcpAppComponent(content) {
|
|
12505
|
+
return isMcpAppComponentData(content.data);
|
|
12506
|
+
}
|
|
11683
12507
|
function isMemoryContent(content) {
|
|
11684
12508
|
return content.type === "memory";
|
|
11685
12509
|
}
|
|
@@ -11698,11 +12522,11 @@ function ReasoningBlock({
|
|
|
11698
12522
|
}) {
|
|
11699
12523
|
const blocks = reasoning.filter((item) => item.text?.trim());
|
|
11700
12524
|
if (blocks.length === 0) return null;
|
|
11701
|
-
return /* @__PURE__ */
|
|
12525
|
+
return /* @__PURE__ */ jsx42("div", { className: "space-y-2", children: blocks.map((item, index) => /* @__PURE__ */ jsx42(
|
|
11702
12526
|
"div",
|
|
11703
12527
|
{
|
|
11704
12528
|
className: "rounded-lg border bg-muted/40 p-3 text-xs text-muted-foreground",
|
|
11705
|
-
children: /* @__PURE__ */
|
|
12529
|
+
children: /* @__PURE__ */ jsx42("p", { className: "whitespace-pre-wrap wrap-break-word leading-relaxed", children: item.text })
|
|
11706
12530
|
},
|
|
11707
12531
|
item.id ?? `reasoning-${index}`
|
|
11708
12532
|
)) });
|
|
@@ -11710,12 +12534,12 @@ function ReasoningBlock({
|
|
|
11710
12534
|
function ImageBlock({ content }) {
|
|
11711
12535
|
const imageUrl = typeof content.image_url === "string" ? content.image_url : typeof content.image_url?.url === "string" ? content.image_url.url : null;
|
|
11712
12536
|
if (!imageUrl) {
|
|
11713
|
-
return /* @__PURE__ */
|
|
11714
|
-
/* @__PURE__ */
|
|
11715
|
-
/* @__PURE__ */
|
|
12537
|
+
return /* @__PURE__ */ jsxs29(Card, { children: [
|
|
12538
|
+
/* @__PURE__ */ jsx42(CardHeader, { className: "space-y-1", children: /* @__PURE__ */ jsx42(CardTitle, { className: "text-sm", children: "Image" }) }),
|
|
12539
|
+
/* @__PURE__ */ jsx42(CardContent, { className: "text-xs text-muted-foreground", children: safeJson3(content) })
|
|
11716
12540
|
] });
|
|
11717
12541
|
}
|
|
11718
|
-
return /* @__PURE__ */
|
|
12542
|
+
return /* @__PURE__ */ jsx42("figure", { className: "overflow-hidden rounded-lg border bg-background", children: /* @__PURE__ */ jsx42(
|
|
11719
12543
|
"img",
|
|
11720
12544
|
{
|
|
11721
12545
|
src: imageUrl,
|
|
@@ -11725,12 +12549,12 @@ function ImageBlock({ content }) {
|
|
|
11725
12549
|
) });
|
|
11726
12550
|
}
|
|
11727
12551
|
function MemoryBlock({ content }) {
|
|
11728
|
-
return /* @__PURE__ */
|
|
11729
|
-
/* @__PURE__ */
|
|
11730
|
-
/* @__PURE__ */
|
|
11731
|
-
/* @__PURE__ */
|
|
12552
|
+
return /* @__PURE__ */ jsxs29(Card, { children: [
|
|
12553
|
+
/* @__PURE__ */ jsxs29(CardHeader, { className: "flex flex-row items-center justify-between gap-2", children: [
|
|
12554
|
+
/* @__PURE__ */ jsx42(CardTitle, { className: "text-sm", children: "Memory" }),
|
|
12555
|
+
/* @__PURE__ */ jsx42(Badge, { variant: "secondary", children: "Memory" })
|
|
11732
12556
|
] }),
|
|
11733
|
-
/* @__PURE__ */
|
|
12557
|
+
/* @__PURE__ */ jsx42(CardContent, { className: "text-xs text-muted-foreground", children: /* @__PURE__ */ jsx42("pre", { className: "whitespace-pre-wrap wrap-break-word", children: safeJson3(content.data ?? []) }) })
|
|
11734
12558
|
] });
|
|
11735
12559
|
}
|
|
11736
12560
|
function parseStepDate2(value) {
|
|
@@ -11764,11 +12588,11 @@ function formatStepDuration3(durationMs) {
|
|
|
11764
12588
|
}
|
|
11765
12589
|
function ComponentBlock({ content }) {
|
|
11766
12590
|
const { i18n: i18n2 } = useChatkitTranslation();
|
|
11767
|
-
const [isExpanded, setIsExpanded] =
|
|
11768
|
-
const contentRef =
|
|
11769
|
-
const shouldAutoScrollRef =
|
|
11770
|
-
const previousScrollTopRef =
|
|
11771
|
-
const [durationNow, setDurationNow] =
|
|
12591
|
+
const [isExpanded, setIsExpanded] = React36.useState(false);
|
|
12592
|
+
const contentRef = React36.useRef(null);
|
|
12593
|
+
const shouldAutoScrollRef = React36.useRef(true);
|
|
12594
|
+
const previousScrollTopRef = React36.useRef(0);
|
|
12595
|
+
const [durationNow, setDurationNow] = React36.useState(() => Date.now());
|
|
11772
12596
|
const data = getToolStepData(content);
|
|
11773
12597
|
const category = data.category ?? "Component";
|
|
11774
12598
|
const title = getToolActivityLabel(content, i18n2.language);
|
|
@@ -11782,10 +12606,10 @@ function ComponentBlock({ content }) {
|
|
|
11782
12606
|
const endedAt = parseStepDate2(data.end_date);
|
|
11783
12607
|
const durationMs = createdAt === null ? null : Math.max(0, (endedAt ?? durationNow) - createdAt);
|
|
11784
12608
|
const durationLabel = durationMs === null ? null : formatStepDuration3(durationMs);
|
|
11785
|
-
|
|
12609
|
+
React36.useEffect(() => {
|
|
11786
12610
|
if (status === "running" && output !== null) setIsExpanded(true);
|
|
11787
12611
|
}, [status, output]);
|
|
11788
|
-
|
|
12612
|
+
React36.useEffect(() => {
|
|
11789
12613
|
if (status !== "running" || createdAt === null || endedAt !== null) {
|
|
11790
12614
|
return;
|
|
11791
12615
|
}
|
|
@@ -11797,7 +12621,7 @@ function ComponentBlock({ content }) {
|
|
|
11797
12621
|
window.clearInterval(timer);
|
|
11798
12622
|
};
|
|
11799
12623
|
}, [createdAt, endedAt, status]);
|
|
11800
|
-
|
|
12624
|
+
React36.useEffect(() => {
|
|
11801
12625
|
const element = contentRef.current;
|
|
11802
12626
|
if (!element) return;
|
|
11803
12627
|
previousScrollTopRef.current = element.scrollTop;
|
|
@@ -11819,7 +12643,7 @@ function ComponentBlock({ content }) {
|
|
|
11819
12643
|
element.removeEventListener("scroll", updateAutoScrollState);
|
|
11820
12644
|
};
|
|
11821
12645
|
}, [isExpanded]);
|
|
11822
|
-
|
|
12646
|
+
React36.useEffect(() => {
|
|
11823
12647
|
if (status !== "running") {
|
|
11824
12648
|
shouldAutoScrollRef.current = true;
|
|
11825
12649
|
return;
|
|
@@ -11832,15 +12656,15 @@ function ComponentBlock({ content }) {
|
|
|
11832
12656
|
}, [isExpanded, output, status]);
|
|
11833
12657
|
const config = status ? toolStatusConfig[status] : null;
|
|
11834
12658
|
const StatusIcon = config?.icon;
|
|
11835
|
-
return /* @__PURE__ */
|
|
11836
|
-
/* @__PURE__ */
|
|
12659
|
+
return /* @__PURE__ */ jsxs29(Card, { children: [
|
|
12660
|
+
/* @__PURE__ */ jsxs29(
|
|
11837
12661
|
CardHeader,
|
|
11838
12662
|
{
|
|
11839
12663
|
className: "flex flex-row items-center justify-between gap-2 px-2 py-1 cursor-pointer",
|
|
11840
12664
|
onClick: () => setIsExpanded(!isExpanded),
|
|
11841
12665
|
children: [
|
|
11842
|
-
/* @__PURE__ */
|
|
11843
|
-
status && StatusIcon && /* @__PURE__ */
|
|
12666
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex items-center space-x-1 flex-1 min-w-0", children: [
|
|
12667
|
+
status && StatusIcon && /* @__PURE__ */ jsx42(
|
|
11844
12668
|
StatusIcon,
|
|
11845
12669
|
{
|
|
11846
12670
|
className: cn(
|
|
@@ -11850,20 +12674,20 @@ function ComponentBlock({ content }) {
|
|
|
11850
12674
|
)
|
|
11851
12675
|
}
|
|
11852
12676
|
),
|
|
11853
|
-
/* @__PURE__ */
|
|
12677
|
+
/* @__PURE__ */ jsx42(CardTitle, { className: "text-sm truncate", children: title })
|
|
11854
12678
|
] }),
|
|
11855
|
-
/* @__PURE__ */
|
|
11856
|
-
durationLabel && /* @__PURE__ */
|
|
11857
|
-
/* @__PURE__ */
|
|
11858
|
-
/* @__PURE__ */
|
|
12679
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex flex-wrap items-center gap-2 shrink-0", children: [
|
|
12680
|
+
durationLabel && /* @__PURE__ */ jsxs29("div", { className: "inline-flex items-center gap-1 text-[11px] text-muted-foreground tabular-nums", children: [
|
|
12681
|
+
/* @__PURE__ */ jsx42(Clock32, { className: "h-3 w-3" }),
|
|
12682
|
+
/* @__PURE__ */ jsx42("span", { children: durationLabel })
|
|
11859
12683
|
] }),
|
|
11860
|
-
/* @__PURE__ */
|
|
11861
|
-
/* @__PURE__ */
|
|
12684
|
+
/* @__PURE__ */ jsx42(Badge, { variant: "secondary", className: "rounded-lg px-1.5", children: category }),
|
|
12685
|
+
/* @__PURE__ */ jsx42(
|
|
11862
12686
|
"button",
|
|
11863
12687
|
{
|
|
11864
12688
|
className: "text-muted-foreground hover:text-foreground transition-colors",
|
|
11865
12689
|
"aria-label": isExpanded ? "Collapse" : "Expand",
|
|
11866
|
-
children: /* @__PURE__ */
|
|
12690
|
+
children: /* @__PURE__ */ jsx42(
|
|
11867
12691
|
ChevronDown4,
|
|
11868
12692
|
{
|
|
11869
12693
|
className: cn(
|
|
@@ -11878,53 +12702,53 @@ function ComponentBlock({ content }) {
|
|
|
11878
12702
|
]
|
|
11879
12703
|
}
|
|
11880
12704
|
),
|
|
11881
|
-
isExpanded && /* @__PURE__ */
|
|
12705
|
+
isExpanded && /* @__PURE__ */ jsxs29(
|
|
11882
12706
|
CardContent,
|
|
11883
12707
|
{
|
|
11884
12708
|
ref: contentRef,
|
|
11885
12709
|
className: "text-xs text-muted-foreground max-h-60 overflow-auto",
|
|
11886
12710
|
children: [
|
|
11887
|
-
data.input && /* @__PURE__ */
|
|
11888
|
-
error ? /* @__PURE__ */
|
|
12711
|
+
data.input && /* @__PURE__ */ jsx42("pre", { className: "whitespace-pre-wrap wrap-break-word", children: formatDisplayValue3(data.input) }),
|
|
12712
|
+
error ? /* @__PURE__ */ jsx42("pre", { className: "whitespace-pre-wrap wrap-break-word text-destructive", children: formatDisplayValue3(error) }) : hasOutput && /* @__PURE__ */ jsx42("pre", { className: "whitespace-pre-wrap wrap-break-word", children: formatDisplayValue3(fallback) })
|
|
11889
12713
|
]
|
|
11890
12714
|
}
|
|
11891
12715
|
)
|
|
11892
12716
|
] });
|
|
11893
12717
|
}
|
|
11894
12718
|
function UnknownBlock({ content }) {
|
|
11895
|
-
return /* @__PURE__ */
|
|
11896
|
-
/* @__PURE__ */
|
|
11897
|
-
/* @__PURE__ */
|
|
11898
|
-
/* @__PURE__ */
|
|
12719
|
+
return /* @__PURE__ */ jsxs29(Card, { children: [
|
|
12720
|
+
/* @__PURE__ */ jsxs29(CardHeader, { className: "flex flex-row items-center justify-between gap-2", children: [
|
|
12721
|
+
/* @__PURE__ */ jsx42(CardTitle, { className: "text-sm", children: "Assistant Content" }),
|
|
12722
|
+
/* @__PURE__ */ jsx42(Badge, { variant: "outline", children: content.type ?? "unknown" })
|
|
11899
12723
|
] }),
|
|
11900
|
-
/* @__PURE__ */
|
|
12724
|
+
/* @__PURE__ */ jsx42(CardContent, { className: "text-xs text-muted-foreground", children: /* @__PURE__ */ jsx42("pre", { className: "whitespace-pre-wrap break-words", children: safeJson3(content) }) })
|
|
11901
12725
|
] });
|
|
11902
12726
|
}
|
|
11903
12727
|
function renderContentItem(content, index, message, lookupMessages, options) {
|
|
11904
12728
|
const messageId = message.id;
|
|
11905
12729
|
const textClassName = options?.isAgentOutput ? "text-sm [&_.markdown-content_p]:!leading-6" : void 0;
|
|
11906
12730
|
if (typeof content === "string") {
|
|
11907
|
-
return /* @__PURE__ */
|
|
12731
|
+
return /* @__PURE__ */ jsx42("div", { className: textClassName, children: /* @__PURE__ */ jsx42(MarkdownText, { children: content }) }, `text-${index}`);
|
|
11908
12732
|
}
|
|
11909
12733
|
if (isThreadContextUsageRenderArtifact(content)) {
|
|
11910
12734
|
return null;
|
|
11911
12735
|
}
|
|
11912
12736
|
if (isTextContent3(content)) {
|
|
11913
|
-
return /* @__PURE__ */
|
|
12737
|
+
return /* @__PURE__ */ jsx42("div", { className: textClassName, children: /* @__PURE__ */ jsx42(MarkdownText, { children: content.text }) }, content.id ?? `text-${index}`);
|
|
11914
12738
|
}
|
|
11915
12739
|
if (isReasoningContent3(content)) {
|
|
11916
|
-
return /* @__PURE__ */
|
|
12740
|
+
return /* @__PURE__ */ jsx42("div", { children: /* @__PURE__ */ jsx42(ReasoningBlock, { reasoning: [content] }) }, content.id ?? `reasoning-${index}`);
|
|
11917
12741
|
}
|
|
11918
12742
|
if (isImageContent(content)) {
|
|
11919
|
-
return /* @__PURE__ */
|
|
12743
|
+
return /* @__PURE__ */ jsx42("div", { children: /* @__PURE__ */ jsx42(ImageBlock, { content }) }, content.id ?? `image-${index}`);
|
|
11920
12744
|
}
|
|
11921
12745
|
if (isComponentContent3(content)) {
|
|
11922
12746
|
if (isContextCompressionComponent(content)) {
|
|
11923
|
-
return /* @__PURE__ */
|
|
12747
|
+
return /* @__PURE__ */ jsx42(
|
|
11924
12748
|
"div",
|
|
11925
12749
|
{
|
|
11926
12750
|
className: "w-full",
|
|
11927
|
-
children: /* @__PURE__ */
|
|
12751
|
+
children: /* @__PURE__ */ jsx42(ContextCompressionMessage, { content })
|
|
11928
12752
|
},
|
|
11929
12753
|
content.id ?? `context-compression-${index}`
|
|
11930
12754
|
);
|
|
@@ -11934,13 +12758,16 @@ function renderContentItem(content, index, message, lookupMessages, options) {
|
|
|
11934
12758
|
lookupMessages
|
|
11935
12759
|
);
|
|
11936
12760
|
if (requestUserInputResult) {
|
|
11937
|
-
return /* @__PURE__ */
|
|
12761
|
+
return /* @__PURE__ */ jsx42("div", { children: /* @__PURE__ */ jsx42(RequestUserInputResultCard, { result: requestUserInputResult }) }, content.id ?? `request-user-input-result-${index}`);
|
|
11938
12762
|
}
|
|
11939
12763
|
if (isWidgetComponent2(content)) {
|
|
11940
|
-
return /* @__PURE__ */
|
|
12764
|
+
return /* @__PURE__ */ jsx42("div", { children: /* @__PURE__ */ jsx42(WidgetMessage, { messageId, data: content.data }) }, content.id ?? `widget-${index}`);
|
|
12765
|
+
}
|
|
12766
|
+
if (isMcpAppComponent(content)) {
|
|
12767
|
+
return /* @__PURE__ */ jsx42("div", { children: /* @__PURE__ */ jsx42(McpAppMessage, { data: content.data }) }, content.id ?? `mcp-app-${index}`);
|
|
11941
12768
|
}
|
|
11942
12769
|
if (getComponentMessagePresentation(content, getToolStepData(content)) === "grouped-step") {
|
|
11943
|
-
return /* @__PURE__ */
|
|
12770
|
+
return /* @__PURE__ */ jsx42("div", { children: /* @__PURE__ */ jsx42(
|
|
11944
12771
|
ToolComponentGroup,
|
|
11945
12772
|
{
|
|
11946
12773
|
items: [content],
|
|
@@ -11951,15 +12778,15 @@ function renderContentItem(content, index, message, lookupMessages, options) {
|
|
|
11951
12778
|
}
|
|
11952
12779
|
) }, content.id ?? `component-group-${index}`);
|
|
11953
12780
|
}
|
|
11954
|
-
return /* @__PURE__ */
|
|
12781
|
+
return /* @__PURE__ */ jsx42("div", { children: /* @__PURE__ */ jsx42(ComponentBlock, { content }) }, content.id ?? `component-${index}`);
|
|
11955
12782
|
}
|
|
11956
12783
|
if (isMemoryContent(content)) {
|
|
11957
|
-
return /* @__PURE__ */
|
|
12784
|
+
return /* @__PURE__ */ jsx42("div", { children: /* @__PURE__ */ jsx42(MemoryBlock, { content }) }, content.id ?? `memory-${index}`);
|
|
11958
12785
|
}
|
|
11959
12786
|
if (isAgentEventContent(content)) {
|
|
11960
|
-
return /* @__PURE__ */
|
|
12787
|
+
return /* @__PURE__ */ jsx42("div", { children: /* @__PURE__ */ jsx42(AgentEventRow, { content }) }, content.id ?? `agent-event-${index}`);
|
|
11961
12788
|
}
|
|
11962
|
-
return /* @__PURE__ */
|
|
12789
|
+
return /* @__PURE__ */ jsx42("div", { children: /* @__PURE__ */ jsx42(UnknownBlock, { content }) }, content.id ?? `unknown-${index}`);
|
|
11963
12790
|
}
|
|
11964
12791
|
function renderContentUnit(unit, message, lookupMessages, hasFollowingItem, options) {
|
|
11965
12792
|
if (unit.type === "item") {
|
|
@@ -11970,7 +12797,7 @@ function renderContentUnit(unit, message, lookupMessages, hasFollowingItem, opti
|
|
|
11970
12797
|
isAgentOutput: options?.isAgentOutput
|
|
11971
12798
|
});
|
|
11972
12799
|
}
|
|
11973
|
-
return /* @__PURE__ */
|
|
12800
|
+
return /* @__PURE__ */ jsx42("div", { children: /* @__PURE__ */ jsx42(
|
|
11974
12801
|
ToolComponentGroup,
|
|
11975
12802
|
{
|
|
11976
12803
|
items: unit.items,
|
|
@@ -11986,7 +12813,7 @@ function renderEntryBatch(entries, message, lookupMessages, hasFollowingItem, op
|
|
|
11986
12813
|
const renderUnits = buildToolComponentRenderUnits(
|
|
11987
12814
|
entries.map((entry) => entry.item),
|
|
11988
12815
|
{
|
|
11989
|
-
shouldGroupComponent: (item) => getRequestUserInputResultCardData(item, lookupMessages) === null
|
|
12816
|
+
shouldGroupComponent: (item) => getRequestUserInputResultCardData(item, lookupMessages) === null && !isMcpAppComponent(item)
|
|
11990
12817
|
}
|
|
11991
12818
|
);
|
|
11992
12819
|
return renderUnits.map(
|
|
@@ -12007,7 +12834,7 @@ function renderAssistantRenderUnits(units, message, lookupMessages, options, dep
|
|
|
12007
12834
|
const batch = entryBatch;
|
|
12008
12835
|
entryBatch = [];
|
|
12009
12836
|
rendered.push(
|
|
12010
|
-
/* @__PURE__ */
|
|
12837
|
+
/* @__PURE__ */ jsx42(React36.Fragment, { children: renderEntryBatch(batch, message, lookupMessages, hasFollowingItem, {
|
|
12011
12838
|
...options,
|
|
12012
12839
|
isAgentOutput: depth > 0
|
|
12013
12840
|
}) }, `entries-${batch[0]?.order ?? rendered.length}`)
|
|
@@ -12024,7 +12851,7 @@ function renderAssistantRenderUnits(units, message, lookupMessages, options, dep
|
|
|
12024
12851
|
}
|
|
12025
12852
|
flushEntries(true);
|
|
12026
12853
|
rendered.push(
|
|
12027
|
-
/* @__PURE__ */
|
|
12854
|
+
/* @__PURE__ */ jsx42(
|
|
12028
12855
|
AgentRunGroup,
|
|
12029
12856
|
{
|
|
12030
12857
|
node: unit.node,
|
|
@@ -12049,7 +12876,7 @@ function renderContent(message, lookupMessages, options) {
|
|
|
12049
12876
|
message
|
|
12050
12877
|
);
|
|
12051
12878
|
if (renderTree.hasAgentRuns) {
|
|
12052
|
-
return /* @__PURE__ */
|
|
12879
|
+
return /* @__PURE__ */ jsx42("div", { className: assistantMessageStackClassName, children: renderAssistantRenderUnits(
|
|
12053
12880
|
renderTree.units,
|
|
12054
12881
|
message,
|
|
12055
12882
|
lookupMessages,
|
|
@@ -12059,13 +12886,13 @@ function renderContent(message, lookupMessages, options) {
|
|
|
12059
12886
|
const content = message.content;
|
|
12060
12887
|
if (typeof content === "string") {
|
|
12061
12888
|
if (!content.trim()) return null;
|
|
12062
|
-
return /* @__PURE__ */
|
|
12889
|
+
return /* @__PURE__ */ jsx42(MarkdownText, { children: content });
|
|
12063
12890
|
}
|
|
12064
12891
|
if (!Array.isArray(content) || content.length === 0) return null;
|
|
12065
12892
|
const renderUnits = buildToolComponentRenderUnits(content, {
|
|
12066
|
-
shouldGroupComponent: (item) => getRequestUserInputResultCardData(item, lookupMessages) === null
|
|
12893
|
+
shouldGroupComponent: (item) => getRequestUserInputResultCardData(item, lookupMessages) === null && !isMcpAppComponent(item)
|
|
12067
12894
|
});
|
|
12068
|
-
return /* @__PURE__ */
|
|
12895
|
+
return /* @__PURE__ */ jsx42("div", { className: "space-y-3", children: renderUnits.map(
|
|
12069
12896
|
(unit, index) => renderContentUnit(
|
|
12070
12897
|
unit,
|
|
12071
12898
|
message,
|
|
@@ -12085,7 +12912,7 @@ function AssistantStreamingIndicator({
|
|
|
12085
12912
|
thinking: t("message.thinking"),
|
|
12086
12913
|
answering: t("message.answering")
|
|
12087
12914
|
};
|
|
12088
|
-
return /* @__PURE__ */
|
|
12915
|
+
return /* @__PURE__ */ jsxs29(
|
|
12089
12916
|
"div",
|
|
12090
12917
|
{
|
|
12091
12918
|
className: cn(
|
|
@@ -12093,18 +12920,18 @@ function AssistantStreamingIndicator({
|
|
|
12093
12920
|
className
|
|
12094
12921
|
),
|
|
12095
12922
|
children: [
|
|
12096
|
-
status === "loading" && /* @__PURE__ */
|
|
12097
|
-
status === "thinking" && /* @__PURE__ */
|
|
12098
|
-
/* @__PURE__ */
|
|
12099
|
-
/* @__PURE__ */
|
|
12100
|
-
/* @__PURE__ */
|
|
12923
|
+
status === "loading" && /* @__PURE__ */ jsx42(Loader28, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
12924
|
+
status === "thinking" && /* @__PURE__ */ jsxs29("div", { className: "flex items-end gap-1", "aria-hidden": "true", children: [
|
|
12925
|
+
/* @__PURE__ */ jsx42("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce [animation-delay:-0.3s]" }),
|
|
12926
|
+
/* @__PURE__ */ jsx42("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce [animation-delay:-0.15s]" }),
|
|
12927
|
+
/* @__PURE__ */ jsx42("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce" })
|
|
12101
12928
|
] }),
|
|
12102
|
-
status === "answering" && /* @__PURE__ */
|
|
12103
|
-
/* @__PURE__ */
|
|
12104
|
-
/* @__PURE__ */
|
|
12105
|
-
/* @__PURE__ */
|
|
12929
|
+
status === "answering" && /* @__PURE__ */ jsxs29("div", { className: "flex items-end gap-1", "aria-hidden": "true", children: [
|
|
12930
|
+
/* @__PURE__ */ jsx42("span", { className: "h-2 w-0.5 rounded-full bg-current animate-pulse [animation-delay:-0.25s]" }),
|
|
12931
|
+
/* @__PURE__ */ jsx42("span", { className: "h-3 w-0.5 rounded-full bg-current animate-pulse [animation-delay:-0.1s]" }),
|
|
12932
|
+
/* @__PURE__ */ jsx42("span", { className: "h-2.5 w-0.5 rounded-full bg-current animate-pulse" })
|
|
12106
12933
|
] }),
|
|
12107
|
-
/* @__PURE__ */
|
|
12934
|
+
/* @__PURE__ */ jsx42("span", { children: labelMap[status] })
|
|
12108
12935
|
]
|
|
12109
12936
|
}
|
|
12110
12937
|
);
|
|
@@ -12133,42 +12960,42 @@ function AssistantMessage({
|
|
|
12133
12960
|
organizationId,
|
|
12134
12961
|
apiUrl
|
|
12135
12962
|
});
|
|
12136
|
-
const reasoningNode = hasReasoning ? /* @__PURE__ */
|
|
12963
|
+
const reasoningNode = hasReasoning ? /* @__PURE__ */ jsx42(ReasoningBlock, { reasoning: rootReasoning ?? [] }) : null;
|
|
12137
12964
|
if (!hasContent && !hasReasoning && !resolvedStreamingStatus) return null;
|
|
12138
12965
|
const streamingClass = isStreaming ? "streaming-active" : "";
|
|
12139
12966
|
if (!hasContent && !hasReasoning && resolvedStreamingStatus) {
|
|
12140
|
-
return /* @__PURE__ */
|
|
12967
|
+
return /* @__PURE__ */ jsx42("div", { className: cn("space-y-3", streamingClass, className), children: /* @__PURE__ */ jsx42(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) });
|
|
12141
12968
|
}
|
|
12142
12969
|
if (hasContent && hasReasoning) {
|
|
12143
|
-
return /* @__PURE__ */
|
|
12144
|
-
/* @__PURE__ */
|
|
12970
|
+
return /* @__PURE__ */ jsxs29("div", { className: cn("space-y-3", streamingClass, className), children: [
|
|
12971
|
+
/* @__PURE__ */ jsxs29(
|
|
12145
12972
|
Tabs,
|
|
12146
12973
|
{
|
|
12147
12974
|
defaultValue: message.status === "reasoning" ? "reasoning" : "answer",
|
|
12148
12975
|
className: "w-full",
|
|
12149
12976
|
children: [
|
|
12150
|
-
/* @__PURE__ */
|
|
12151
|
-
/* @__PURE__ */
|
|
12152
|
-
/* @__PURE__ */
|
|
12977
|
+
/* @__PURE__ */ jsxs29(TabsList, { className: "", children: [
|
|
12978
|
+
/* @__PURE__ */ jsx42(TabsTrigger, { value: "answer", children: t("message.answer") }),
|
|
12979
|
+
/* @__PURE__ */ jsx42(TabsTrigger, { value: "reasoning", children: t("message.reasoning") })
|
|
12153
12980
|
] }),
|
|
12154
|
-
/* @__PURE__ */
|
|
12155
|
-
/* @__PURE__ */
|
|
12981
|
+
/* @__PURE__ */ jsx42(TabsContent, { value: "answer", className: "space-y-3", children: answerNode }),
|
|
12982
|
+
/* @__PURE__ */ jsx42(TabsContent, { value: "reasoning", className: "space-y-3", children: reasoningNode })
|
|
12156
12983
|
]
|
|
12157
12984
|
}
|
|
12158
12985
|
),
|
|
12159
|
-
resolvedStreamingStatus ? /* @__PURE__ */
|
|
12986
|
+
resolvedStreamingStatus ? /* @__PURE__ */ jsx42(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) : null
|
|
12160
12987
|
] });
|
|
12161
12988
|
}
|
|
12162
|
-
return /* @__PURE__ */
|
|
12989
|
+
return /* @__PURE__ */ jsxs29("div", { className: cn("space-y-3", streamingClass, className), children: [
|
|
12163
12990
|
hasReasoning ? reasoningNode : answerNode,
|
|
12164
|
-
resolvedStreamingStatus ? /* @__PURE__ */
|
|
12991
|
+
resolvedStreamingStatus ? /* @__PURE__ */ jsx42(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) : null
|
|
12165
12992
|
] });
|
|
12166
12993
|
}
|
|
12167
12994
|
|
|
12168
12995
|
// src/components/thread/MessageActions.tsx
|
|
12169
|
-
import * as
|
|
12996
|
+
import * as React37 from "react";
|
|
12170
12997
|
import { Check as Check5, Copy as Copy3, RefreshCw as RefreshCw2 } from "lucide-react";
|
|
12171
|
-
import { jsx as
|
|
12998
|
+
import { jsx as jsx43, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
12172
12999
|
function MessageActions({
|
|
12173
13000
|
content,
|
|
12174
13001
|
isAssistant = false,
|
|
@@ -12177,7 +13004,7 @@ function MessageActions({
|
|
|
12177
13004
|
className
|
|
12178
13005
|
}) {
|
|
12179
13006
|
const { t } = useChatkitTranslation();
|
|
12180
|
-
const [copied, setCopied] =
|
|
13007
|
+
const [copied, setCopied] = React37.useState(false);
|
|
12181
13008
|
const handleCopy = async () => {
|
|
12182
13009
|
try {
|
|
12183
13010
|
await navigator.clipboard.writeText(content);
|
|
@@ -12190,7 +13017,7 @@ function MessageActions({
|
|
|
12190
13017
|
if (isStreaming) {
|
|
12191
13018
|
return null;
|
|
12192
13019
|
}
|
|
12193
|
-
return /* @__PURE__ */
|
|
13020
|
+
return /* @__PURE__ */ jsxs30(
|
|
12194
13021
|
"div",
|
|
12195
13022
|
{
|
|
12196
13023
|
className: cn(
|
|
@@ -12198,7 +13025,7 @@ function MessageActions({
|
|
|
12198
13025
|
className
|
|
12199
13026
|
),
|
|
12200
13027
|
children: [
|
|
12201
|
-
/* @__PURE__ */
|
|
13028
|
+
/* @__PURE__ */ jsx43(
|
|
12202
13029
|
"button",
|
|
12203
13030
|
{
|
|
12204
13031
|
type: "button",
|
|
@@ -12208,17 +13035,17 @@ function MessageActions({
|
|
|
12208
13035
|
copied && "text-green-500"
|
|
12209
13036
|
),
|
|
12210
13037
|
title: copied ? t("messageActions.copied") : t("messageActions.copy"),
|
|
12211
|
-
children: copied ? /* @__PURE__ */
|
|
13038
|
+
children: copied ? /* @__PURE__ */ jsx43(Check5, { size: 14 }) : /* @__PURE__ */ jsx43(Copy3, { size: 14 })
|
|
12212
13039
|
}
|
|
12213
13040
|
),
|
|
12214
|
-
isAssistant && onRetry && /* @__PURE__ */
|
|
13041
|
+
isAssistant && onRetry && /* @__PURE__ */ jsx43(
|
|
12215
13042
|
"button",
|
|
12216
13043
|
{
|
|
12217
13044
|
type: "button",
|
|
12218
13045
|
onClick: onRetry,
|
|
12219
13046
|
className: "p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",
|
|
12220
13047
|
title: t("messageActions.regenerate"),
|
|
12221
|
-
children: /* @__PURE__ */
|
|
13048
|
+
children: /* @__PURE__ */ jsx43(RefreshCw2, { size: 14 })
|
|
12222
13049
|
}
|
|
12223
13050
|
)
|
|
12224
13051
|
]
|
|
@@ -12239,18 +13066,18 @@ import {
|
|
|
12239
13066
|
Sparkles as Sparkles3,
|
|
12240
13067
|
Zap
|
|
12241
13068
|
} from "lucide-react";
|
|
12242
|
-
import { jsx as
|
|
13069
|
+
import { jsx as jsx44, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
12243
13070
|
function getIconComponent2(icon) {
|
|
12244
13071
|
const iconMap = {
|
|
12245
|
-
"circle-question": /* @__PURE__ */
|
|
12246
|
-
"lightbulb": /* @__PURE__ */
|
|
12247
|
-
"sparkle": /* @__PURE__ */
|
|
12248
|
-
"write": /* @__PURE__ */
|
|
12249
|
-
"search": /* @__PURE__ */
|
|
12250
|
-
"globe": /* @__PURE__ */
|
|
12251
|
-
"book-open": /* @__PURE__ */
|
|
12252
|
-
"compass": /* @__PURE__ */
|
|
12253
|
-
"bolt": /* @__PURE__ */
|
|
13072
|
+
"circle-question": /* @__PURE__ */ jsx44(HelpCircle, { size: 20 }),
|
|
13073
|
+
"lightbulb": /* @__PURE__ */ jsx44(Lightbulb2, { size: 20 }),
|
|
13074
|
+
"sparkle": /* @__PURE__ */ jsx44(Sparkles3, { size: 20 }),
|
|
13075
|
+
"write": /* @__PURE__ */ jsx44(Pencil3, { size: 20 }),
|
|
13076
|
+
"search": /* @__PURE__ */ jsx44(Search3, { size: 20 }),
|
|
13077
|
+
"globe": /* @__PURE__ */ jsx44(Globe2, { size: 20 }),
|
|
13078
|
+
"book-open": /* @__PURE__ */ jsx44(BookOpen2, { size: 20 }),
|
|
13079
|
+
"compass": /* @__PURE__ */ jsx44(Compass, { size: 20 }),
|
|
13080
|
+
"bolt": /* @__PURE__ */ jsx44(Zap, { size: 20 })
|
|
12254
13081
|
};
|
|
12255
13082
|
return icon ? iconMap[icon] || iconMap["sparkle"] : iconMap["sparkle"];
|
|
12256
13083
|
}
|
|
@@ -12266,7 +13093,7 @@ function StartScreen({
|
|
|
12266
13093
|
const greeting = startScreen?.greeting ?? t("startScreen.greeting");
|
|
12267
13094
|
const prompts = startScreen?.prompts ?? [];
|
|
12268
13095
|
const editPromptLabel = t("startScreen.editPrompt");
|
|
12269
|
-
return /* @__PURE__ */
|
|
13096
|
+
return /* @__PURE__ */ jsxs31(
|
|
12270
13097
|
"div",
|
|
12271
13098
|
{
|
|
12272
13099
|
className: cn(
|
|
@@ -12274,8 +13101,8 @@ function StartScreen({
|
|
|
12274
13101
|
className
|
|
12275
13102
|
),
|
|
12276
13103
|
children: [
|
|
12277
|
-
/* @__PURE__ */
|
|
12278
|
-
prompts.length > 0 && /* @__PURE__ */
|
|
13104
|
+
/* @__PURE__ */ jsx44("div", { className: "mb-8 text-center", children: /* @__PURE__ */ jsx44("h2", { className: "text-2xl font-semibold text-foreground mb-2", children: greeting }) }),
|
|
13105
|
+
prompts.length > 0 && /* @__PURE__ */ jsx44("div", { className: "w-full max-w-2xl", children: /* @__PURE__ */ jsx44("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: prompts.map((item, index) => /* @__PURE__ */ jsxs31(
|
|
12279
13106
|
"div",
|
|
12280
13107
|
{
|
|
12281
13108
|
className: cn(
|
|
@@ -12284,7 +13111,7 @@ function StartScreen({
|
|
|
12284
13111
|
"focus-within:ring-2 focus-within:ring-primary/20"
|
|
12285
13112
|
),
|
|
12286
13113
|
children: [
|
|
12287
|
-
/* @__PURE__ */
|
|
13114
|
+
/* @__PURE__ */ jsxs31(
|
|
12288
13115
|
"button",
|
|
12289
13116
|
{
|
|
12290
13117
|
type: "button",
|
|
@@ -12295,12 +13122,12 @@ function StartScreen({
|
|
|
12295
13122
|
"focus:outline-none disabled:cursor-not-allowed disabled:opacity-50"
|
|
12296
13123
|
),
|
|
12297
13124
|
children: [
|
|
12298
|
-
/* @__PURE__ */
|
|
12299
|
-
/* @__PURE__ */
|
|
13125
|
+
/* @__PURE__ */ jsx44("span", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary", children: getIconComponent2(item.icon) }),
|
|
13126
|
+
/* @__PURE__ */ jsx44("span", { className: "text-sm font-medium text-foreground", children: item.label })
|
|
12300
13127
|
]
|
|
12301
13128
|
}
|
|
12302
13129
|
),
|
|
12303
|
-
/* @__PURE__ */
|
|
13130
|
+
/* @__PURE__ */ jsx44(
|
|
12304
13131
|
"button",
|
|
12305
13132
|
{
|
|
12306
13133
|
type: "button",
|
|
@@ -12313,7 +13140,7 @@ function StartScreen({
|
|
|
12313
13140
|
"rounded-r-xl transition-colors hover:bg-muted hover:text-foreground",
|
|
12314
13141
|
"focus:outline-none disabled:cursor-not-allowed disabled:opacity-50"
|
|
12315
13142
|
),
|
|
12316
|
-
children: /* @__PURE__ */
|
|
13143
|
+
children: /* @__PURE__ */ jsx44(Pencil3, { size: 16 })
|
|
12317
13144
|
}
|
|
12318
13145
|
)
|
|
12319
13146
|
]
|
|
@@ -12326,7 +13153,7 @@ function StartScreen({
|
|
|
12326
13153
|
}
|
|
12327
13154
|
|
|
12328
13155
|
// src/hooks/useThreads.ts
|
|
12329
|
-
import * as
|
|
13156
|
+
import * as React39 from "react";
|
|
12330
13157
|
var DEFAULT_LIMIT = 50;
|
|
12331
13158
|
var getThreadTitle = (threadRecord) => {
|
|
12332
13159
|
const title = threadRecord.title?.trim();
|
|
@@ -12341,7 +13168,7 @@ var toDate = (value) => {
|
|
|
12341
13168
|
if (Number.isNaN(timestamp)) return void 0;
|
|
12342
13169
|
return new Date(timestamp);
|
|
12343
13170
|
};
|
|
12344
|
-
var
|
|
13171
|
+
var getErrorMessage2 = (error) => {
|
|
12345
13172
|
if (!error) return void 0;
|
|
12346
13173
|
if (error instanceof Error) return error.message;
|
|
12347
13174
|
if (typeof error === "string") return error;
|
|
@@ -12379,16 +13206,16 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12379
13206
|
isLoading: isStreamLoading,
|
|
12380
13207
|
error: streamError
|
|
12381
13208
|
} = useStreamContext();
|
|
12382
|
-
const [threadRecords, setThreadRecords] =
|
|
12383
|
-
const [isLoading, setIsLoading] =
|
|
12384
|
-
const [error, setError] =
|
|
12385
|
-
const upsertThreadRecord =
|
|
13209
|
+
const [threadRecords, setThreadRecords] = React39.useState([]);
|
|
13210
|
+
const [isLoading, setIsLoading] = React39.useState(false);
|
|
13211
|
+
const [error, setError] = React39.useState(null);
|
|
13212
|
+
const upsertThreadRecord = React39.useCallback((threadRecord) => {
|
|
12386
13213
|
setThreadRecords((prev) => {
|
|
12387
13214
|
const next = prev.filter((item) => item.id !== threadRecord.id);
|
|
12388
13215
|
return sortThreadRecords([threadRecord, ...next]);
|
|
12389
13216
|
});
|
|
12390
13217
|
}, []);
|
|
12391
|
-
const refreshThreads =
|
|
13218
|
+
const refreshThreads = React39.useCallback(async () => {
|
|
12392
13219
|
setIsLoading(true);
|
|
12393
13220
|
setError(null);
|
|
12394
13221
|
try {
|
|
@@ -12404,7 +13231,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12404
13231
|
setIsLoading(false);
|
|
12405
13232
|
}
|
|
12406
13233
|
}, [client, limit, assistantId]);
|
|
12407
|
-
const createThread =
|
|
13234
|
+
const createThread = React39.useCallback(
|
|
12408
13235
|
async (input) => {
|
|
12409
13236
|
setError(null);
|
|
12410
13237
|
const payload = {};
|
|
@@ -12418,7 +13245,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12418
13245
|
},
|
|
12419
13246
|
[client, upsertThreadRecord]
|
|
12420
13247
|
);
|
|
12421
|
-
const updateThread =
|
|
13248
|
+
const updateThread = React39.useCallback(
|
|
12422
13249
|
async (recordId, payload) => {
|
|
12423
13250
|
setError(null);
|
|
12424
13251
|
const updated = await client.conversations.update(recordId, payload);
|
|
@@ -12427,7 +13254,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12427
13254
|
},
|
|
12428
13255
|
[client, upsertThreadRecord]
|
|
12429
13256
|
);
|
|
12430
|
-
const deleteThread =
|
|
13257
|
+
const deleteThread = React39.useCallback(
|
|
12431
13258
|
async (recordId) => {
|
|
12432
13259
|
setError(null);
|
|
12433
13260
|
await client.conversations.delete(recordId);
|
|
@@ -12435,11 +13262,11 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12435
13262
|
},
|
|
12436
13263
|
[client]
|
|
12437
13264
|
);
|
|
12438
|
-
|
|
13265
|
+
React39.useEffect(() => {
|
|
12439
13266
|
if (!isReady) return;
|
|
12440
13267
|
void refreshThreads();
|
|
12441
13268
|
}, [refreshThreads, isReady]);
|
|
12442
|
-
|
|
13269
|
+
React39.useEffect(() => {
|
|
12443
13270
|
if (!threadId || !isStreamLoading) return;
|
|
12444
13271
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
12445
13272
|
const busyStatus = "busy";
|
|
@@ -12460,8 +13287,8 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12460
13287
|
return changed ? sortThreadRecords(next) : prev;
|
|
12461
13288
|
});
|
|
12462
13289
|
}, [threadId, isStreamLoading]);
|
|
12463
|
-
|
|
12464
|
-
const message =
|
|
13290
|
+
React39.useEffect(() => {
|
|
13291
|
+
const message = getErrorMessage2(streamError)?.trim();
|
|
12465
13292
|
if (!threadId || !message) return;
|
|
12466
13293
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
12467
13294
|
const errorStatus = "error";
|
|
@@ -12482,7 +13309,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12482
13309
|
return changed ? sortThreadRecords(next) : prev;
|
|
12483
13310
|
});
|
|
12484
13311
|
}, [threadId, streamError]);
|
|
12485
|
-
|
|
13312
|
+
React39.useEffect(() => {
|
|
12486
13313
|
if (!isReady || !threadId || isStreamLoading) return;
|
|
12487
13314
|
let cancelled = false;
|
|
12488
13315
|
void client.conversations.search({ where: { threadId }, limit: 1 }).then((result) => {
|
|
@@ -12496,7 +13323,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12496
13323
|
cancelled = true;
|
|
12497
13324
|
};
|
|
12498
13325
|
}, [client, threadId, upsertThreadRecord, isReady, isStreamLoading]);
|
|
12499
|
-
const threads =
|
|
13326
|
+
const threads = React39.useMemo(
|
|
12500
13327
|
() => threadRecords.map((threadRecord) => toThreadItem(threadRecord)),
|
|
12501
13328
|
[threadRecords]
|
|
12502
13329
|
);
|
|
@@ -12513,10 +13340,10 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12513
13340
|
}
|
|
12514
13341
|
|
|
12515
13342
|
// src/components/thread/context-usage-indicator.tsx
|
|
12516
|
-
import * as
|
|
13343
|
+
import * as React40 from "react";
|
|
12517
13344
|
|
|
12518
13345
|
// src/components/ui/progress-circle.tsx
|
|
12519
|
-
import { jsx as
|
|
13346
|
+
import { jsx as jsx45, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
12520
13347
|
function clamp2(input, a, b) {
|
|
12521
13348
|
return Math.max(Math.min(input, Math.max(a, b)), Math.min(a, b));
|
|
12522
13349
|
}
|
|
@@ -12539,7 +13366,7 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
12539
13366
|
return (
|
|
12540
13367
|
// biome-ignore lint/a11y/useFocusableInteractive: false positive (progress + progressbar are not focusable interactives)
|
|
12541
13368
|
// biome-ignore lint/nursery/useAriaPropsSupportedByRole: biome rule at odds with mdn docs (presumed nursary bug with rule)
|
|
12542
|
-
/* @__PURE__ */
|
|
13369
|
+
/* @__PURE__ */ jsxs32(
|
|
12543
13370
|
"svg",
|
|
12544
13371
|
{
|
|
12545
13372
|
role: "progressbar",
|
|
@@ -12550,8 +13377,8 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
12550
13377
|
"aria-valuemax": 100,
|
|
12551
13378
|
...restSvgProps,
|
|
12552
13379
|
children: [
|
|
12553
|
-
/* @__PURE__ */
|
|
12554
|
-
/* @__PURE__ */
|
|
13380
|
+
/* @__PURE__ */ jsx45("circle", { ...commonParams, className: "stroke-current/25" }),
|
|
13381
|
+
/* @__PURE__ */ jsx45(
|
|
12555
13382
|
"circle",
|
|
12556
13383
|
{
|
|
12557
13384
|
...commonParams,
|
|
@@ -12570,7 +13397,7 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
12570
13397
|
};
|
|
12571
13398
|
|
|
12572
13399
|
// src/components/thread/context-usage-indicator.tsx
|
|
12573
|
-
import { jsx as
|
|
13400
|
+
import { jsx as jsx46, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
12574
13401
|
var kNumberFormatter = new Intl.NumberFormat("en-US", {
|
|
12575
13402
|
minimumFractionDigits: 0,
|
|
12576
13403
|
maximumFractionDigits: 1
|
|
@@ -12603,21 +13430,22 @@ function ContextUsageIndicator({
|
|
|
12603
13430
|
}) {
|
|
12604
13431
|
const { t } = useChatkitTranslation();
|
|
12605
13432
|
const stream = useStreamContext();
|
|
12606
|
-
const [maxContextSize, setMaxContextSize] =
|
|
12607
|
-
const [usedContextSize, setUsedContextSize] =
|
|
12608
|
-
const [assistantAgentKey, setAssistantAgentKey] =
|
|
12609
|
-
const latestRealtimeUsageRef =
|
|
13433
|
+
const [maxContextSize, setMaxContextSize] = React40.useState(null);
|
|
13434
|
+
const [usedContextSize, setUsedContextSize] = React40.useState(null);
|
|
13435
|
+
const [assistantAgentKey, setAssistantAgentKey] = React40.useState(null);
|
|
13436
|
+
const latestRealtimeUsageRef = React40.useRef({
|
|
12610
13437
|
threadId: null,
|
|
12611
13438
|
agentKey: null,
|
|
12612
13439
|
usedTokens: null
|
|
12613
13440
|
});
|
|
12614
|
-
const realtimeUsage =
|
|
13441
|
+
const realtimeUsage = React40.useMemo(
|
|
12615
13442
|
() => getThreadContextUsage(stream.contextUsageByAgentKey, assistantAgentKey),
|
|
12616
13443
|
[assistantAgentKey, stream.contextUsageByAgentKey]
|
|
12617
13444
|
);
|
|
12618
13445
|
const realtimeUsedContextSize = getThreadContextUsageTotalTokens(realtimeUsage);
|
|
12619
|
-
|
|
12620
|
-
|
|
13446
|
+
const hasApiConfiguration = Boolean(stream.apiUrl?.trim() && stream.apiKey?.trim());
|
|
13447
|
+
React40.useEffect(() => {
|
|
13448
|
+
if (!hasApiConfiguration || !stream.client || !stream.assistantId) {
|
|
12621
13449
|
setMaxContextSize(null);
|
|
12622
13450
|
setAssistantAgentKey(null);
|
|
12623
13451
|
return;
|
|
@@ -12635,20 +13463,20 @@ function ContextUsageIndicator({
|
|
|
12635
13463
|
return () => {
|
|
12636
13464
|
cancelled = true;
|
|
12637
13465
|
};
|
|
12638
|
-
}, [stream.client, stream.assistantId]);
|
|
12639
|
-
|
|
13466
|
+
}, [hasApiConfiguration, stream.client, stream.assistantId]);
|
|
13467
|
+
React40.useEffect(() => {
|
|
12640
13468
|
latestRealtimeUsageRef.current = {
|
|
12641
13469
|
threadId: stream.threadId ?? null,
|
|
12642
13470
|
agentKey: assistantAgentKey,
|
|
12643
13471
|
usedTokens: realtimeUsedContextSize
|
|
12644
13472
|
};
|
|
12645
13473
|
}, [assistantAgentKey, realtimeUsedContextSize, stream.threadId]);
|
|
12646
|
-
|
|
13474
|
+
React40.useEffect(() => {
|
|
12647
13475
|
if (realtimeUsedContextSize == null) return;
|
|
12648
13476
|
setUsedContextSize(realtimeUsedContextSize);
|
|
12649
13477
|
}, [realtimeUsedContextSize]);
|
|
12650
|
-
|
|
12651
|
-
if (!stream.client) {
|
|
13478
|
+
React40.useEffect(() => {
|
|
13479
|
+
if (!hasApiConfiguration || !stream.client) {
|
|
12652
13480
|
setUsedContextSize(null);
|
|
12653
13481
|
return;
|
|
12654
13482
|
}
|
|
@@ -12684,6 +13512,7 @@ function ContextUsageIndicator({
|
|
|
12684
13512
|
};
|
|
12685
13513
|
}, [
|
|
12686
13514
|
assistantAgentKey,
|
|
13515
|
+
hasApiConfiguration,
|
|
12687
13516
|
realtimeUsedContextSize,
|
|
12688
13517
|
stream.apiKey,
|
|
12689
13518
|
stream.apiUrl,
|
|
@@ -12712,8 +13541,8 @@ function ContextUsageIndicator({
|
|
|
12712
13541
|
});
|
|
12713
13542
|
const usageLabelWithSuffix = usageLabel.endsWith(":") ? usageLabel : `${usageLabel}:`;
|
|
12714
13543
|
const progressClassName = percent >= 90 ? "text-destructive" : percent >= 75 ? "text-amber-500" : "text-primary dark:text-zinc-300";
|
|
12715
|
-
return /* @__PURE__ */
|
|
12716
|
-
/* @__PURE__ */
|
|
13544
|
+
return /* @__PURE__ */ jsxs33(Tooltip, { children: [
|
|
13545
|
+
/* @__PURE__ */ jsx46(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx46(
|
|
12717
13546
|
"button",
|
|
12718
13547
|
{
|
|
12719
13548
|
type: "button",
|
|
@@ -12722,31 +13551,31 @@ function ContextUsageIndicator({
|
|
|
12722
13551
|
className
|
|
12723
13552
|
),
|
|
12724
13553
|
"aria-label": `${usageLabelWithSuffix} ${usageFullLabel}. ${usageTokensLabel}`,
|
|
12725
|
-
children: /* @__PURE__ */
|
|
13554
|
+
children: /* @__PURE__ */ jsx46(ProgressCircle, { value: percent, className: cn("size-3.5", progressClassName) })
|
|
12726
13555
|
}
|
|
12727
13556
|
) }),
|
|
12728
|
-
/* @__PURE__ */
|
|
12729
|
-
/* @__PURE__ */
|
|
12730
|
-
/* @__PURE__ */
|
|
12731
|
-
/* @__PURE__ */
|
|
13557
|
+
/* @__PURE__ */ jsxs33(TooltipContent, { side: "top", sideOffset: 6, className: "space-y-0.5 px-3 py-2 text-center", children: [
|
|
13558
|
+
/* @__PURE__ */ jsx46("div", { className: "text-primary-foreground/70", children: usageLabelWithSuffix }),
|
|
13559
|
+
/* @__PURE__ */ jsx46("div", { className: "font-medium text-primary-foreground/80", children: usageFullLabel }),
|
|
13560
|
+
/* @__PURE__ */ jsx46("div", { className: "text-sm font-semibold", children: usageTokensLabel })
|
|
12732
13561
|
] })
|
|
12733
13562
|
] });
|
|
12734
13563
|
}
|
|
12735
13564
|
|
|
12736
13565
|
// src/components/pet/PetBridge.tsx
|
|
12737
|
-
import * as
|
|
13566
|
+
import * as React41 from "react";
|
|
12738
13567
|
import { normalizePetOptions } from "@xpert-ai/chatkit-types";
|
|
12739
13568
|
function PetBridge({ pet, state }) {
|
|
12740
13569
|
const parentMessenger = useParentMessenger();
|
|
12741
13570
|
const sendEvent = parentMessenger?.sendEvent;
|
|
12742
|
-
const options =
|
|
12743
|
-
|
|
13571
|
+
const options = React41.useMemo(() => normalizePetOptions(pet), [pet]);
|
|
13572
|
+
React41.useEffect(() => {
|
|
12744
13573
|
if (!sendEvent) {
|
|
12745
13574
|
return;
|
|
12746
13575
|
}
|
|
12747
13576
|
sendEvent("pet_options_change", { pet: pet ?? null });
|
|
12748
13577
|
}, [sendEvent, pet]);
|
|
12749
|
-
|
|
13578
|
+
React41.useEffect(() => {
|
|
12750
13579
|
if (!sendEvent || !options) {
|
|
12751
13580
|
return;
|
|
12752
13581
|
}
|
|
@@ -12756,15 +13585,15 @@ function PetBridge({ pet, state }) {
|
|
|
12756
13585
|
}
|
|
12757
13586
|
|
|
12758
13587
|
// src/components/settings/SettingsSheet.tsx
|
|
12759
|
-
import * as
|
|
13588
|
+
import * as React48 from "react";
|
|
12760
13589
|
import { PawPrint, Settings } from "lucide-react";
|
|
12761
13590
|
|
|
12762
13591
|
// src/components/ui/input.tsx
|
|
12763
|
-
import * as
|
|
12764
|
-
import { jsx as
|
|
12765
|
-
var Input =
|
|
13592
|
+
import * as React42 from "react";
|
|
13593
|
+
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
13594
|
+
var Input = React42.forwardRef(
|
|
12766
13595
|
({ className, type, ...props }, ref) => {
|
|
12767
|
-
return /* @__PURE__ */
|
|
13596
|
+
return /* @__PURE__ */ jsx47(
|
|
12768
13597
|
"input",
|
|
12769
13598
|
{
|
|
12770
13599
|
ref,
|
|
@@ -12784,17 +13613,17 @@ Input.displayName = "Input";
|
|
|
12784
13613
|
import "react";
|
|
12785
13614
|
import { Select as SelectPrimitive } from "radix-ui";
|
|
12786
13615
|
import { ChevronDownIcon as ChevronDownIcon2, CheckIcon as CheckIcon4, ChevronUpIcon } from "lucide-react";
|
|
12787
|
-
import { jsx as
|
|
13616
|
+
import { jsx as jsx48, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
12788
13617
|
function Select({
|
|
12789
13618
|
...props
|
|
12790
13619
|
}) {
|
|
12791
|
-
return /* @__PURE__ */
|
|
13620
|
+
return /* @__PURE__ */ jsx48(SelectPrimitive.Root, { "data-slot": "select", ...props });
|
|
12792
13621
|
}
|
|
12793
13622
|
function SelectGroup({
|
|
12794
13623
|
className,
|
|
12795
13624
|
...props
|
|
12796
13625
|
}) {
|
|
12797
|
-
return /* @__PURE__ */
|
|
13626
|
+
return /* @__PURE__ */ jsx48(
|
|
12798
13627
|
SelectPrimitive.Group,
|
|
12799
13628
|
{
|
|
12800
13629
|
"data-slot": "select-group",
|
|
@@ -12806,7 +13635,7 @@ function SelectGroup({
|
|
|
12806
13635
|
function SelectValue({
|
|
12807
13636
|
...props
|
|
12808
13637
|
}) {
|
|
12809
|
-
return /* @__PURE__ */
|
|
13638
|
+
return /* @__PURE__ */ jsx48(SelectPrimitive.Value, { "data-slot": "select-value", ...props });
|
|
12810
13639
|
}
|
|
12811
13640
|
function SelectTrigger({
|
|
12812
13641
|
className,
|
|
@@ -12814,7 +13643,7 @@ function SelectTrigger({
|
|
|
12814
13643
|
children,
|
|
12815
13644
|
...props
|
|
12816
13645
|
}) {
|
|
12817
|
-
return /* @__PURE__ */
|
|
13646
|
+
return /* @__PURE__ */ jsxs34(
|
|
12818
13647
|
SelectPrimitive.Trigger,
|
|
12819
13648
|
{
|
|
12820
13649
|
"data-slot": "select-trigger",
|
|
@@ -12826,7 +13655,7 @@ function SelectTrigger({
|
|
|
12826
13655
|
...props,
|
|
12827
13656
|
children: [
|
|
12828
13657
|
children,
|
|
12829
|
-
/* @__PURE__ */
|
|
13658
|
+
/* @__PURE__ */ jsx48(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx48(ChevronDownIcon2, { className: "pointer-events-none size-4 text-muted-foreground" }) })
|
|
12830
13659
|
]
|
|
12831
13660
|
}
|
|
12832
13661
|
);
|
|
@@ -12838,7 +13667,7 @@ function SelectContent({
|
|
|
12838
13667
|
align = "center",
|
|
12839
13668
|
...props
|
|
12840
13669
|
}) {
|
|
12841
|
-
return /* @__PURE__ */
|
|
13670
|
+
return /* @__PURE__ */ jsx48(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs34(
|
|
12842
13671
|
SelectPrimitive.Content,
|
|
12843
13672
|
{
|
|
12844
13673
|
"data-slot": "select-content",
|
|
@@ -12848,8 +13677,8 @@ function SelectContent({
|
|
|
12848
13677
|
align,
|
|
12849
13678
|
...props,
|
|
12850
13679
|
children: [
|
|
12851
|
-
/* @__PURE__ */
|
|
12852
|
-
/* @__PURE__ */
|
|
13680
|
+
/* @__PURE__ */ jsx48(SelectScrollUpButton, {}),
|
|
13681
|
+
/* @__PURE__ */ jsx48(
|
|
12853
13682
|
SelectPrimitive.Viewport,
|
|
12854
13683
|
{
|
|
12855
13684
|
"data-position": position,
|
|
@@ -12860,7 +13689,7 @@ function SelectContent({
|
|
|
12860
13689
|
children
|
|
12861
13690
|
}
|
|
12862
13691
|
),
|
|
12863
|
-
/* @__PURE__ */
|
|
13692
|
+
/* @__PURE__ */ jsx48(SelectScrollDownButton, {})
|
|
12864
13693
|
]
|
|
12865
13694
|
}
|
|
12866
13695
|
) });
|
|
@@ -12870,7 +13699,7 @@ function SelectItem({
|
|
|
12870
13699
|
children,
|
|
12871
13700
|
...props
|
|
12872
13701
|
}) {
|
|
12873
|
-
return /* @__PURE__ */
|
|
13702
|
+
return /* @__PURE__ */ jsxs34(
|
|
12874
13703
|
SelectPrimitive.Item,
|
|
12875
13704
|
{
|
|
12876
13705
|
"data-slot": "select-item",
|
|
@@ -12880,8 +13709,8 @@ function SelectItem({
|
|
|
12880
13709
|
),
|
|
12881
13710
|
...props,
|
|
12882
13711
|
children: [
|
|
12883
|
-
/* @__PURE__ */
|
|
12884
|
-
/* @__PURE__ */
|
|
13712
|
+
/* @__PURE__ */ jsx48("span", { className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center", children: /* @__PURE__ */ jsx48(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx48(CheckIcon4, { className: "pointer-events-none" }) }) }),
|
|
13713
|
+
/* @__PURE__ */ jsx48(SelectPrimitive.ItemText, { children })
|
|
12885
13714
|
]
|
|
12886
13715
|
}
|
|
12887
13716
|
);
|
|
@@ -12890,7 +13719,7 @@ function SelectScrollUpButton({
|
|
|
12890
13719
|
className,
|
|
12891
13720
|
...props
|
|
12892
13721
|
}) {
|
|
12893
|
-
return /* @__PURE__ */
|
|
13722
|
+
return /* @__PURE__ */ jsx48(
|
|
12894
13723
|
SelectPrimitive.ScrollUpButton,
|
|
12895
13724
|
{
|
|
12896
13725
|
"data-slot": "select-scroll-up-button",
|
|
@@ -12899,7 +13728,7 @@ function SelectScrollUpButton({
|
|
|
12899
13728
|
className
|
|
12900
13729
|
),
|
|
12901
13730
|
...props,
|
|
12902
|
-
children: /* @__PURE__ */
|
|
13731
|
+
children: /* @__PURE__ */ jsx48(
|
|
12903
13732
|
ChevronUpIcon,
|
|
12904
13733
|
{}
|
|
12905
13734
|
)
|
|
@@ -12910,7 +13739,7 @@ function SelectScrollDownButton({
|
|
|
12910
13739
|
className,
|
|
12911
13740
|
...props
|
|
12912
13741
|
}) {
|
|
12913
|
-
return /* @__PURE__ */
|
|
13742
|
+
return /* @__PURE__ */ jsx48(
|
|
12914
13743
|
SelectPrimitive.ScrollDownButton,
|
|
12915
13744
|
{
|
|
12916
13745
|
"data-slot": "select-scroll-down-button",
|
|
@@ -12919,7 +13748,7 @@ function SelectScrollDownButton({
|
|
|
12919
13748
|
className
|
|
12920
13749
|
),
|
|
12921
13750
|
...props,
|
|
12922
|
-
children: /* @__PURE__ */
|
|
13751
|
+
children: /* @__PURE__ */ jsx48(
|
|
12923
13752
|
ChevronDownIcon2,
|
|
12924
13753
|
{}
|
|
12925
13754
|
)
|
|
@@ -12928,9 +13757,9 @@ function SelectScrollDownButton({
|
|
|
12928
13757
|
}
|
|
12929
13758
|
|
|
12930
13759
|
// src/components/ui/slider.tsx
|
|
12931
|
-
import * as
|
|
13760
|
+
import * as React44 from "react";
|
|
12932
13761
|
import { Slider as SliderPrimitive } from "radix-ui";
|
|
12933
|
-
import { jsx as
|
|
13762
|
+
import { jsx as jsx49, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
12934
13763
|
function Slider({
|
|
12935
13764
|
className,
|
|
12936
13765
|
defaultValue,
|
|
@@ -12939,11 +13768,11 @@ function Slider({
|
|
|
12939
13768
|
max = 100,
|
|
12940
13769
|
...props
|
|
12941
13770
|
}) {
|
|
12942
|
-
const _values =
|
|
13771
|
+
const _values = React44.useMemo(
|
|
12943
13772
|
() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
|
|
12944
13773
|
[value, defaultValue, min, max]
|
|
12945
13774
|
);
|
|
12946
|
-
return /* @__PURE__ */
|
|
13775
|
+
return /* @__PURE__ */ jsxs35(
|
|
12947
13776
|
SliderPrimitive.Root,
|
|
12948
13777
|
{
|
|
12949
13778
|
"data-slot": "slider",
|
|
@@ -12957,12 +13786,12 @@ function Slider({
|
|
|
12957
13786
|
),
|
|
12958
13787
|
...props,
|
|
12959
13788
|
children: [
|
|
12960
|
-
/* @__PURE__ */
|
|
13789
|
+
/* @__PURE__ */ jsx49(
|
|
12961
13790
|
SliderPrimitive.Track,
|
|
12962
13791
|
{
|
|
12963
13792
|
"data-slot": "slider-track",
|
|
12964
13793
|
className: "relative grow overflow-hidden rounded-full bg-muted data-horizontal:h-1 data-horizontal:w-full data-vertical:h-full data-vertical:w-1",
|
|
12965
|
-
children: /* @__PURE__ */
|
|
13794
|
+
children: /* @__PURE__ */ jsx49(
|
|
12966
13795
|
SliderPrimitive.Range,
|
|
12967
13796
|
{
|
|
12968
13797
|
"data-slot": "slider-range",
|
|
@@ -12971,7 +13800,7 @@ function Slider({
|
|
|
12971
13800
|
)
|
|
12972
13801
|
}
|
|
12973
13802
|
),
|
|
12974
|
-
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */
|
|
13803
|
+
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ jsx49(
|
|
12975
13804
|
SliderPrimitive.Thumb,
|
|
12976
13805
|
{
|
|
12977
13806
|
"data-slot": "slider-thumb",
|
|
@@ -12985,7 +13814,7 @@ function Slider({
|
|
|
12985
13814
|
}
|
|
12986
13815
|
|
|
12987
13816
|
// src/components/ui/toggle-group.tsx
|
|
12988
|
-
import * as
|
|
13817
|
+
import * as React46 from "react";
|
|
12989
13818
|
import "class-variance-authority";
|
|
12990
13819
|
import { ToggleGroup as ToggleGroupPrimitive } from "radix-ui";
|
|
12991
13820
|
|
|
@@ -12993,7 +13822,7 @@ import { ToggleGroup as ToggleGroupPrimitive } from "radix-ui";
|
|
|
12993
13822
|
import "react";
|
|
12994
13823
|
import { cva as cva2 } from "class-variance-authority";
|
|
12995
13824
|
import { Toggle as TogglePrimitive } from "radix-ui";
|
|
12996
|
-
import { jsx as
|
|
13825
|
+
import { jsx as jsx50 } from "react/jsx-runtime";
|
|
12997
13826
|
var toggleVariants = cva2(
|
|
12998
13827
|
"group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
12999
13828
|
{
|
|
@@ -13016,8 +13845,8 @@ var toggleVariants = cva2(
|
|
|
13016
13845
|
);
|
|
13017
13846
|
|
|
13018
13847
|
// src/components/ui/toggle-group.tsx
|
|
13019
|
-
import { jsx as
|
|
13020
|
-
var ToggleGroupContext =
|
|
13848
|
+
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
13849
|
+
var ToggleGroupContext = React46.createContext({
|
|
13021
13850
|
size: "default",
|
|
13022
13851
|
variant: "default",
|
|
13023
13852
|
spacing: 0,
|
|
@@ -13032,7 +13861,7 @@ function ToggleGroup({
|
|
|
13032
13861
|
children,
|
|
13033
13862
|
...props
|
|
13034
13863
|
}) {
|
|
13035
|
-
return /* @__PURE__ */
|
|
13864
|
+
return /* @__PURE__ */ jsx51(
|
|
13036
13865
|
ToggleGroupPrimitive.Root,
|
|
13037
13866
|
{
|
|
13038
13867
|
"data-slot": "toggle-group",
|
|
@@ -13046,7 +13875,7 @@ function ToggleGroup({
|
|
|
13046
13875
|
className
|
|
13047
13876
|
),
|
|
13048
13877
|
...props,
|
|
13049
|
-
children: /* @__PURE__ */
|
|
13878
|
+
children: /* @__PURE__ */ jsx51(
|
|
13050
13879
|
ToggleGroupContext.Provider,
|
|
13051
13880
|
{
|
|
13052
13881
|
value: { variant, size: size2, spacing, orientation },
|
|
@@ -13063,8 +13892,8 @@ function ToggleGroupItem({
|
|
|
13063
13892
|
size: size2 = "default",
|
|
13064
13893
|
...props
|
|
13065
13894
|
}) {
|
|
13066
|
-
const context =
|
|
13067
|
-
return /* @__PURE__ */
|
|
13895
|
+
const context = React46.useContext(ToggleGroupContext);
|
|
13896
|
+
return /* @__PURE__ */ jsx51(
|
|
13068
13897
|
ToggleGroupPrimitive.Item,
|
|
13069
13898
|
{
|
|
13070
13899
|
"data-slot": "toggle-group-item",
|
|
@@ -13304,7 +14133,7 @@ import {
|
|
|
13304
14133
|
} from "@xpert-ai/chatkit-types";
|
|
13305
14134
|
|
|
13306
14135
|
// src/components/pet/PetPreview.tsx
|
|
13307
|
-
import { jsx as
|
|
14136
|
+
import { jsx as jsx52 } from "react/jsx-runtime";
|
|
13308
14137
|
function escapeCssUrl(value) {
|
|
13309
14138
|
return value.replace(/["\\]/g, "\\$&");
|
|
13310
14139
|
}
|
|
@@ -13312,7 +14141,7 @@ function PetPreview({ src, label, className }) {
|
|
|
13312
14141
|
const scale = 0.13;
|
|
13313
14142
|
const width = petSpriteAtlas.cellWidth;
|
|
13314
14143
|
const height = petSpriteAtlas.cellHeight;
|
|
13315
|
-
return /* @__PURE__ */
|
|
14144
|
+
return /* @__PURE__ */ jsx52(
|
|
13316
14145
|
"span",
|
|
13317
14146
|
{
|
|
13318
14147
|
className: cn(
|
|
@@ -13321,7 +14150,7 @@ function PetPreview({ src, label, className }) {
|
|
|
13321
14150
|
),
|
|
13322
14151
|
"aria-hidden": "true",
|
|
13323
14152
|
title: label,
|
|
13324
|
-
children: /* @__PURE__ */
|
|
14153
|
+
children: /* @__PURE__ */ jsx52(
|
|
13325
14154
|
"span",
|
|
13326
14155
|
{
|
|
13327
14156
|
className: "absolute left-1/2 top-1/2 block",
|
|
@@ -13343,7 +14172,7 @@ function PetPreview({ src, label, className }) {
|
|
|
13343
14172
|
}
|
|
13344
14173
|
|
|
13345
14174
|
// src/components/settings/SettingsSheet.tsx
|
|
13346
|
-
import { jsx as
|
|
14175
|
+
import { jsx as jsx53, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
13347
14176
|
var CHARACTER_TYPES2 = [
|
|
13348
14177
|
"builtin",
|
|
13349
14178
|
"atlas"
|
|
@@ -13359,13 +14188,13 @@ function SettingsSheet({
|
|
|
13359
14188
|
onSave
|
|
13360
14189
|
}) {
|
|
13361
14190
|
const { t } = useChatkitTranslation();
|
|
13362
|
-
const [draft, setDraft] =
|
|
13363
|
-
|
|
14191
|
+
const [draft, setDraft] = React48.useState(settings);
|
|
14192
|
+
React48.useEffect(() => {
|
|
13364
14193
|
if (open) {
|
|
13365
14194
|
setDraft(petRequired ? { ...settings, enabled: true } : settings);
|
|
13366
14195
|
}
|
|
13367
14196
|
}, [open, petRequired, settings]);
|
|
13368
|
-
const updateDraft =
|
|
14197
|
+
const updateDraft = React48.useCallback(
|
|
13369
14198
|
(patch) => {
|
|
13370
14199
|
setDraft((previous) => ({ ...previous, ...patch }));
|
|
13371
14200
|
},
|
|
@@ -13383,23 +14212,23 @@ function SettingsSheet({
|
|
|
13383
14212
|
defaultValue: selectedBuiltinPet.label
|
|
13384
14213
|
}
|
|
13385
14214
|
);
|
|
13386
|
-
return /* @__PURE__ */
|
|
13387
|
-
/* @__PURE__ */
|
|
13388
|
-
/* @__PURE__ */
|
|
13389
|
-
/* @__PURE__ */
|
|
14215
|
+
return /* @__PURE__ */ jsx53(Sheet, { open, onOpenChange, children: /* @__PURE__ */ jsxs36(SheetContent, { side: "right", className: "w-[min(92vw,26rem)] overflow-y-auto", children: [
|
|
14216
|
+
/* @__PURE__ */ jsx53(SheetHeader, { children: /* @__PURE__ */ jsxs36("div", { className: "flex items-center gap-2", children: [
|
|
14217
|
+
/* @__PURE__ */ jsx53("span", { className: "flex h-8 w-8 items-center justify-center rounded-md bg-primary/10 text-primary", children: /* @__PURE__ */ jsx53(Settings, { size: 16 }) }),
|
|
14218
|
+
/* @__PURE__ */ jsx53(SheetTitle, { children: t("settings.title") })
|
|
13390
14219
|
] }) }),
|
|
13391
|
-
/* @__PURE__ */
|
|
13392
|
-
/* @__PURE__ */
|
|
13393
|
-
/* @__PURE__ */
|
|
13394
|
-
/* @__PURE__ */
|
|
13395
|
-
/* @__PURE__ */
|
|
14220
|
+
/* @__PURE__ */ jsxs36("form", { className: "mt-6 space-y-5", onSubmit: handleSubmit, children: [
|
|
14221
|
+
/* @__PURE__ */ jsxs36("section", { className: "space-y-5", children: [
|
|
14222
|
+
/* @__PURE__ */ jsxs36("div", { className: "flex items-center gap-2", children: [
|
|
14223
|
+
/* @__PURE__ */ jsx53("span", { className: "flex h-7 w-7 items-center justify-center rounded-md bg-muted text-muted-foreground", children: /* @__PURE__ */ jsx53(PawPrint, { size: 15 }) }),
|
|
14224
|
+
/* @__PURE__ */ jsx53("h3", { className: "text-sm font-semibold", children: t("pet.settings.title") })
|
|
13396
14225
|
] }),
|
|
13397
|
-
/* @__PURE__ */
|
|
13398
|
-
/* @__PURE__ */
|
|
13399
|
-
/* @__PURE__ */
|
|
13400
|
-
petRequired && /* @__PURE__ */
|
|
14226
|
+
/* @__PURE__ */ jsxs36("label", { className: "flex items-center justify-between gap-4 rounded-md border border-border px-3 py-2", children: [
|
|
14227
|
+
/* @__PURE__ */ jsxs36("span", { className: "min-w-0", children: [
|
|
14228
|
+
/* @__PURE__ */ jsx53("span", { className: "block text-sm font-medium", children: t("pet.settings.enabled") }),
|
|
14229
|
+
petRequired && /* @__PURE__ */ jsx53("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: t("pet.settings.requiredHint") })
|
|
13401
14230
|
] }),
|
|
13402
|
-
/* @__PURE__ */
|
|
14231
|
+
/* @__PURE__ */ jsx53(
|
|
13403
14232
|
"button",
|
|
13404
14233
|
{
|
|
13405
14234
|
type: "button",
|
|
@@ -13412,7 +14241,7 @@ function SettingsSheet({
|
|
|
13412
14241
|
draft.enabled ? "bg-primary" : "bg-muted-foreground/20",
|
|
13413
14242
|
petRequired ? "cursor-not-allowed opacity-70" : ""
|
|
13414
14243
|
].join(" "),
|
|
13415
|
-
children: /* @__PURE__ */
|
|
14244
|
+
children: /* @__PURE__ */ jsx53(
|
|
13416
14245
|
"span",
|
|
13417
14246
|
{
|
|
13418
14247
|
className: [
|
|
@@ -13425,9 +14254,9 @@ function SettingsSheet({
|
|
|
13425
14254
|
)
|
|
13426
14255
|
] })
|
|
13427
14256
|
] }),
|
|
13428
|
-
/* @__PURE__ */
|
|
13429
|
-
/* @__PURE__ */
|
|
13430
|
-
/* @__PURE__ */
|
|
14257
|
+
/* @__PURE__ */ jsxs36("div", { className: "space-y-2", children: [
|
|
14258
|
+
/* @__PURE__ */ jsx53("span", { id: "chatkit-pet-type-label", className: "text-sm font-medium", children: t("pet.settings.characterType") }),
|
|
14259
|
+
/* @__PURE__ */ jsx53(
|
|
13431
14260
|
ToggleGroup,
|
|
13432
14261
|
{
|
|
13433
14262
|
id: "chatkit-pet-type",
|
|
@@ -13442,7 +14271,7 @@ function SettingsSheet({
|
|
|
13442
14271
|
variant: "outline",
|
|
13443
14272
|
spacing: 2,
|
|
13444
14273
|
className: "!w-full",
|
|
13445
|
-
children: CHARACTER_TYPES2.map((type) => /* @__PURE__ */
|
|
14274
|
+
children: CHARACTER_TYPES2.map((type) => /* @__PURE__ */ jsx53(
|
|
13446
14275
|
ToggleGroupItem,
|
|
13447
14276
|
{
|
|
13448
14277
|
value: type,
|
|
@@ -13454,8 +14283,8 @@ function SettingsSheet({
|
|
|
13454
14283
|
}
|
|
13455
14284
|
)
|
|
13456
14285
|
] }),
|
|
13457
|
-
draft.characterType === "builtin" && /* @__PURE__ */
|
|
13458
|
-
/* @__PURE__ */
|
|
14286
|
+
draft.characterType === "builtin" && /* @__PURE__ */ jsxs36("div", { className: "space-y-2", children: [
|
|
14287
|
+
/* @__PURE__ */ jsx53(
|
|
13459
14288
|
"label",
|
|
13460
14289
|
{
|
|
13461
14290
|
htmlFor: "chatkit-pet-builtin",
|
|
@@ -13463,7 +14292,7 @@ function SettingsSheet({
|
|
|
13463
14292
|
children: t("pet.settings.builtin")
|
|
13464
14293
|
}
|
|
13465
14294
|
),
|
|
13466
|
-
/* @__PURE__ */
|
|
14295
|
+
/* @__PURE__ */ jsxs36(
|
|
13467
14296
|
Select,
|
|
13468
14297
|
{
|
|
13469
14298
|
value: selectedBuiltinPet.id,
|
|
@@ -13474,26 +14303,26 @@ function SettingsSheet({
|
|
|
13474
14303
|
}
|
|
13475
14304
|
},
|
|
13476
14305
|
children: [
|
|
13477
|
-
/* @__PURE__ */
|
|
14306
|
+
/* @__PURE__ */ jsx53(
|
|
13478
14307
|
SelectTrigger,
|
|
13479
14308
|
{
|
|
13480
14309
|
id: "chatkit-pet-builtin",
|
|
13481
14310
|
className: "min-h-12 w-full px-3 py-2",
|
|
13482
|
-
children: /* @__PURE__ */
|
|
14311
|
+
children: /* @__PURE__ */ jsx53(SelectValue, { placeholder: selectedBuiltinPetLabel })
|
|
13483
14312
|
}
|
|
13484
14313
|
),
|
|
13485
|
-
/* @__PURE__ */
|
|
14314
|
+
/* @__PURE__ */ jsx53(SelectContent, { className: "w-[var(--radix-select-trigger-width)]", children: /* @__PURE__ */ jsx53(SelectGroup, { children: INCLUDED_PET_OPTIONS.map((pet) => {
|
|
13486
14315
|
const label = t(`pet.settings.builtins.${pet.id}`, {
|
|
13487
14316
|
defaultValue: pet.label
|
|
13488
14317
|
});
|
|
13489
|
-
return /* @__PURE__ */
|
|
14318
|
+
return /* @__PURE__ */ jsx53(
|
|
13490
14319
|
SelectItem,
|
|
13491
14320
|
{
|
|
13492
14321
|
value: pet.id,
|
|
13493
14322
|
className: "min-h-10 py-1.5 pl-2 pr-8",
|
|
13494
|
-
children: /* @__PURE__ */
|
|
13495
|
-
/* @__PURE__ */
|
|
13496
|
-
/* @__PURE__ */
|
|
14323
|
+
children: /* @__PURE__ */ jsxs36("span", { className: "flex min-w-0 items-center gap-2", children: [
|
|
14324
|
+
/* @__PURE__ */ jsx53(PetPreview, { src: pet.previewSrc, label }),
|
|
14325
|
+
/* @__PURE__ */ jsx53("span", { className: "min-w-0 truncate", children: label })
|
|
13497
14326
|
] })
|
|
13498
14327
|
},
|
|
13499
14328
|
pet.id
|
|
@@ -13503,8 +14332,8 @@ function SettingsSheet({
|
|
|
13503
14332
|
}
|
|
13504
14333
|
)
|
|
13505
14334
|
] }),
|
|
13506
|
-
draft.characterType === "atlas" && /* @__PURE__ */
|
|
13507
|
-
/* @__PURE__ */
|
|
14335
|
+
draft.characterType === "atlas" && /* @__PURE__ */ jsxs36("div", { className: "space-y-2", children: [
|
|
14336
|
+
/* @__PURE__ */ jsx53(
|
|
13508
14337
|
"label",
|
|
13509
14338
|
{
|
|
13510
14339
|
className: "text-sm font-medium",
|
|
@@ -13512,7 +14341,7 @@ function SettingsSheet({
|
|
|
13512
14341
|
children: t("pet.settings.atlasUrl")
|
|
13513
14342
|
}
|
|
13514
14343
|
),
|
|
13515
|
-
/* @__PURE__ */
|
|
14344
|
+
/* @__PURE__ */ jsx53(
|
|
13516
14345
|
Input,
|
|
13517
14346
|
{
|
|
13518
14347
|
id: "chatkit-pet-atlas",
|
|
@@ -13522,15 +14351,15 @@ function SettingsSheet({
|
|
|
13522
14351
|
}
|
|
13523
14352
|
)
|
|
13524
14353
|
] }),
|
|
13525
|
-
/* @__PURE__ */
|
|
13526
|
-
/* @__PURE__ */
|
|
13527
|
-
/* @__PURE__ */
|
|
13528
|
-
/* @__PURE__ */
|
|
14354
|
+
/* @__PURE__ */ jsxs36("div", { className: "space-y-2", children: [
|
|
14355
|
+
/* @__PURE__ */ jsxs36("div", { className: "flex items-center justify-between gap-4", children: [
|
|
14356
|
+
/* @__PURE__ */ jsx53("label", { className: "text-sm font-medium", htmlFor: "chatkit-pet-scale", children: t("pet.settings.scale") }),
|
|
14357
|
+
/* @__PURE__ */ jsxs36("span", { className: "text-xs tabular-nums text-muted-foreground", children: [
|
|
13529
14358
|
draft.scale.toFixed(2),
|
|
13530
14359
|
"x"
|
|
13531
14360
|
] })
|
|
13532
14361
|
] }),
|
|
13533
|
-
/* @__PURE__ */
|
|
14362
|
+
/* @__PURE__ */ jsx53(
|
|
13534
14363
|
Slider,
|
|
13535
14364
|
{
|
|
13536
14365
|
id: "chatkit-pet-scale",
|
|
@@ -13544,8 +14373,8 @@ function SettingsSheet({
|
|
|
13544
14373
|
}
|
|
13545
14374
|
)
|
|
13546
14375
|
] }),
|
|
13547
|
-
/* @__PURE__ */
|
|
13548
|
-
/* @__PURE__ */
|
|
14376
|
+
/* @__PURE__ */ jsxs36("label", { className: "flex items-center gap-2 text-sm", children: [
|
|
14377
|
+
/* @__PURE__ */ jsx53(
|
|
13549
14378
|
"input",
|
|
13550
14379
|
{
|
|
13551
14380
|
type: "checkbox",
|
|
@@ -13556,8 +14385,8 @@ function SettingsSheet({
|
|
|
13556
14385
|
),
|
|
13557
14386
|
t("pet.settings.draggable")
|
|
13558
14387
|
] }),
|
|
13559
|
-
/* @__PURE__ */
|
|
13560
|
-
/* @__PURE__ */
|
|
14388
|
+
/* @__PURE__ */ jsxs36("label", { className: "flex items-center gap-2 text-sm", children: [
|
|
14389
|
+
/* @__PURE__ */ jsx53(
|
|
13561
14390
|
"input",
|
|
13562
14391
|
{
|
|
13563
14392
|
type: "checkbox",
|
|
@@ -13568,8 +14397,8 @@ function SettingsSheet({
|
|
|
13568
14397
|
),
|
|
13569
14398
|
t("pet.settings.persistPosition")
|
|
13570
14399
|
] }),
|
|
13571
|
-
/* @__PURE__ */
|
|
13572
|
-
/* @__PURE__ */
|
|
14400
|
+
/* @__PURE__ */ jsxs36("div", { className: "flex justify-end gap-2 pt-2", children: [
|
|
14401
|
+
/* @__PURE__ */ jsx53(
|
|
13573
14402
|
Button,
|
|
13574
14403
|
{
|
|
13575
14404
|
type: "button",
|
|
@@ -13578,7 +14407,7 @@ function SettingsSheet({
|
|
|
13578
14407
|
children: t("pet.settings.cancel")
|
|
13579
14408
|
}
|
|
13580
14409
|
),
|
|
13581
|
-
/* @__PURE__ */
|
|
14410
|
+
/* @__PURE__ */ jsx53(Button, { type: "submit", children: t("pet.settings.save") })
|
|
13582
14411
|
] })
|
|
13583
14412
|
] })
|
|
13584
14413
|
] }) });
|
|
@@ -14205,7 +15034,7 @@ function findDomPointForComposerOffset(root, offset) {
|
|
|
14205
15034
|
}
|
|
14206
15035
|
|
|
14207
15036
|
// src/components/chat.tsx
|
|
14208
|
-
import { Fragment as Fragment9, jsx as
|
|
15037
|
+
import { Fragment as Fragment9, jsx as jsx54, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
14209
15038
|
var defaultApiUrl2 = import.meta.env.VITE_XPERTAI_API_URL;
|
|
14210
15039
|
var COMPOSER_INPUT_MAX_HEIGHT = 128;
|
|
14211
15040
|
var LONG_TEXT_REFERENCE_THRESHOLD = 5e3;
|
|
@@ -14350,7 +15179,7 @@ function ReferenceChip({
|
|
|
14350
15179
|
const metaLine = getReferenceMetaLine(reference);
|
|
14351
15180
|
const isComposer = variant === "composer";
|
|
14352
15181
|
const Icon = reference.type === "quote" ? Quote : reference.type === "image" ? ImageIcon : FileText5;
|
|
14353
|
-
return /* @__PURE__ */
|
|
15182
|
+
return /* @__PURE__ */ jsxs37(
|
|
14354
15183
|
"div",
|
|
14355
15184
|
{
|
|
14356
15185
|
className: cn(
|
|
@@ -14359,7 +15188,7 @@ function ReferenceChip({
|
|
|
14359
15188
|
),
|
|
14360
15189
|
title: getReferenceTitle(reference),
|
|
14361
15190
|
children: [
|
|
14362
|
-
/* @__PURE__ */
|
|
15191
|
+
/* @__PURE__ */ jsx54(
|
|
14363
15192
|
Icon,
|
|
14364
15193
|
{
|
|
14365
15194
|
size: isComposer ? 14 : 12,
|
|
@@ -14369,8 +15198,8 @@ function ReferenceChip({
|
|
|
14369
15198
|
)
|
|
14370
15199
|
}
|
|
14371
15200
|
),
|
|
14372
|
-
/* @__PURE__ */
|
|
14373
|
-
/* @__PURE__ */
|
|
15201
|
+
/* @__PURE__ */ jsxs37("div", { className: "min-w-0 flex-1", children: [
|
|
15202
|
+
/* @__PURE__ */ jsx54(
|
|
14374
15203
|
"div",
|
|
14375
15204
|
{
|
|
14376
15205
|
className: cn(
|
|
@@ -14380,7 +15209,7 @@ function ReferenceChip({
|
|
|
14380
15209
|
children: getReferenceLabel(reference)
|
|
14381
15210
|
}
|
|
14382
15211
|
),
|
|
14383
|
-
metaLine && /* @__PURE__ */
|
|
15212
|
+
metaLine && /* @__PURE__ */ jsx54(
|
|
14384
15213
|
"div",
|
|
14385
15214
|
{
|
|
14386
15215
|
className: cn(
|
|
@@ -14391,7 +15220,7 @@ function ReferenceChip({
|
|
|
14391
15220
|
}
|
|
14392
15221
|
)
|
|
14393
15222
|
] }),
|
|
14394
|
-
onRemove && removeLabel && /* @__PURE__ */
|
|
15223
|
+
onRemove && removeLabel && /* @__PURE__ */ jsx54(
|
|
14395
15224
|
"button",
|
|
14396
15225
|
{
|
|
14397
15226
|
type: "button",
|
|
@@ -14402,7 +15231,7 @@ function ReferenceChip({
|
|
|
14402
15231
|
),
|
|
14403
15232
|
title: removeLabel,
|
|
14404
15233
|
"aria-label": removeLabel,
|
|
14405
|
-
children: /* @__PURE__ */
|
|
15234
|
+
children: /* @__PURE__ */ jsx54(X6, { size: 12 })
|
|
14406
15235
|
}
|
|
14407
15236
|
)
|
|
14408
15237
|
]
|
|
@@ -14426,26 +15255,26 @@ function Chat({
|
|
|
14426
15255
|
const { setStream } = useStreamManager();
|
|
14427
15256
|
const stream = useStreamContext();
|
|
14428
15257
|
const { theme } = useTheme();
|
|
14429
|
-
const [isHistoryLoading, setIsHistoryLoading] =
|
|
14430
|
-
const [historyError, setHistoryError] =
|
|
14431
|
-
const [assistantName, setAssistantName] =
|
|
14432
|
-
const [assistantAvatar, setAssistantAvatar] =
|
|
14433
|
-
const [threadGoal, setThreadGoal] =
|
|
14434
|
-
const [goalError, setGoalError] =
|
|
14435
|
-
const [isGoalLoading, setIsGoalLoading] =
|
|
14436
|
-
const [isGoalPanelOpen, setIsGoalPanelOpen] =
|
|
14437
|
-
const [isGoalObjectiveExpanded, setIsGoalObjectiveExpanded] =
|
|
14438
|
-
const [goalElapsedStartedAt, setGoalElapsedStartedAt] =
|
|
15258
|
+
const [isHistoryLoading, setIsHistoryLoading] = React49.useState(false);
|
|
15259
|
+
const [historyError, setHistoryError] = React49.useState(null);
|
|
15260
|
+
const [assistantName, setAssistantName] = React49.useState(null);
|
|
15261
|
+
const [assistantAvatar, setAssistantAvatar] = React49.useState(null);
|
|
15262
|
+
const [threadGoal, setThreadGoal] = React49.useState(null);
|
|
15263
|
+
const [goalError, setGoalError] = React49.useState(null);
|
|
15264
|
+
const [isGoalLoading, setIsGoalLoading] = React49.useState(false);
|
|
15265
|
+
const [isGoalPanelOpen, setIsGoalPanelOpen] = React49.useState(false);
|
|
15266
|
+
const [isGoalObjectiveExpanded, setIsGoalObjectiveExpanded] = React49.useState(false);
|
|
15267
|
+
const [goalElapsedStartedAt, setGoalElapsedStartedAt] = React49.useState(null);
|
|
14439
15268
|
const LOADING_DOTS_MIN_DURATION = 800;
|
|
14440
15269
|
const STREAMING_STATUS_REFRESH_MS = 250;
|
|
14441
|
-
const [showLoadingDots, setShowLoadingDots] =
|
|
14442
|
-
const [streamingNow, setStreamingNow] =
|
|
14443
|
-
const loadingStartTimeRef =
|
|
14444
|
-
const lastStreamOutputAtRef =
|
|
14445
|
-
|
|
15270
|
+
const [showLoadingDots, setShowLoadingDots] = React49.useState(false);
|
|
15271
|
+
const [streamingNow, setStreamingNow] = React49.useState(() => Date.now());
|
|
15272
|
+
const loadingStartTimeRef = React49.useRef(null);
|
|
15273
|
+
const lastStreamOutputAtRef = React49.useRef(null);
|
|
15274
|
+
React49.useEffect(() => {
|
|
14446
15275
|
setStream(stream);
|
|
14447
15276
|
}, [setStream, stream]);
|
|
14448
|
-
|
|
15277
|
+
React49.useEffect(() => {
|
|
14449
15278
|
if (stream.isLoading) {
|
|
14450
15279
|
if (!loadingStartTimeRef.current) {
|
|
14451
15280
|
loadingStartTimeRef.current = Date.now();
|
|
@@ -14468,7 +15297,7 @@ function Chat({
|
|
|
14468
15297
|
}
|
|
14469
15298
|
}
|
|
14470
15299
|
}, [stream.isLoading]);
|
|
14471
|
-
|
|
15300
|
+
React49.useEffect(() => {
|
|
14472
15301
|
if (!stream.isLoading) {
|
|
14473
15302
|
lastStreamOutputAtRef.current = null;
|
|
14474
15303
|
setStreamingNow(Date.now());
|
|
@@ -14478,7 +15307,7 @@ function Chat({
|
|
|
14478
15307
|
lastStreamOutputAtRef.current = now;
|
|
14479
15308
|
setStreamingNow(now);
|
|
14480
15309
|
}, [stream.messages, stream.isLoading]);
|
|
14481
|
-
|
|
15310
|
+
React49.useEffect(() => {
|
|
14482
15311
|
if (!stream.isLoading) {
|
|
14483
15312
|
return;
|
|
14484
15313
|
}
|
|
@@ -14487,7 +15316,7 @@ function Chat({
|
|
|
14487
15316
|
}, STREAMING_STATUS_REFRESH_MS);
|
|
14488
15317
|
return () => window.clearInterval(timer);
|
|
14489
15318
|
}, [stream.isLoading]);
|
|
14490
|
-
|
|
15319
|
+
React49.useEffect(() => {
|
|
14491
15320
|
if (threadGoal?.status === "active" && stream.isLoading) {
|
|
14492
15321
|
setGoalElapsedStartedAt(Date.now());
|
|
14493
15322
|
return;
|
|
@@ -14499,82 +15328,82 @@ function Chat({
|
|
|
14499
15328
|
threadGoal?.id,
|
|
14500
15329
|
threadGoal?.status
|
|
14501
15330
|
]);
|
|
14502
|
-
|
|
15331
|
+
React49.useEffect(() => {
|
|
14503
15332
|
setIsGoalObjectiveExpanded(false);
|
|
14504
15333
|
}, [threadGoal?.id]);
|
|
14505
|
-
const [composerParts, setComposerParts] =
|
|
14506
|
-
const [renderedComposerParts, setRenderedComposerParts] =
|
|
14507
|
-
const [composerDomVersion, setComposerDomVersion] =
|
|
14508
|
-
const [selectedTool, setSelectedTool] =
|
|
15334
|
+
const [composerParts, setComposerParts] = React49.useState([]);
|
|
15335
|
+
const [renderedComposerParts, setRenderedComposerParts] = React49.useState([]);
|
|
15336
|
+
const [composerDomVersion, setComposerDomVersion] = React49.useState(0);
|
|
15337
|
+
const [selectedTool, setSelectedTool] = React49.useState(
|
|
14509
15338
|
null
|
|
14510
15339
|
);
|
|
14511
|
-
const [planModeEnabled, setPlanModeEnabled] =
|
|
14512
|
-
const [petSettingsOpen, setPetSettingsOpen] =
|
|
14513
|
-
const [petLocalSettings, setPetLocalSettings] =
|
|
14514
|
-
const [runtimeCapabilities, setRuntimeCapabilities] =
|
|
14515
|
-
const [runtimeCapabilitiesReady, setRuntimeCapabilitiesReady] =
|
|
14516
|
-
const [sessionRuntimeCapabilities, setSessionRuntimeCapabilities] =
|
|
15340
|
+
const [planModeEnabled, setPlanModeEnabled] = React49.useState(false);
|
|
15341
|
+
const [petSettingsOpen, setPetSettingsOpen] = React49.useState(false);
|
|
15342
|
+
const [petLocalSettings, setPetLocalSettings] = React49.useState(() => readPetLocalSettings());
|
|
15343
|
+
const [runtimeCapabilities, setRuntimeCapabilities] = React49.useState(null);
|
|
15344
|
+
const [runtimeCapabilitiesReady, setRuntimeCapabilitiesReady] = React49.useState(false);
|
|
15345
|
+
const [sessionRuntimeCapabilities, setSessionRuntimeCapabilities] = React49.useState(
|
|
14517
15346
|
() => createEmptyRuntimeCapabilitiesSelection()
|
|
14518
15347
|
);
|
|
14519
|
-
const [runRuntimeCapabilities, setRunRuntimeCapabilities] =
|
|
15348
|
+
const [runRuntimeCapabilities, setRunRuntimeCapabilities] = React49.useState(
|
|
14520
15349
|
() => createEmptyRuntimeCapabilitiesSelection()
|
|
14521
15350
|
);
|
|
14522
|
-
const [runtimeCapabilityPalette, setRuntimeCapabilityPalette] =
|
|
14523
|
-
const [attachmentState, setAttachmentState] =
|
|
15351
|
+
const [runtimeCapabilityPalette, setRuntimeCapabilityPalette] = React49.useState(null);
|
|
15352
|
+
const [attachmentState, setAttachmentState] = React49.useState({
|
|
14524
15353
|
uploadedFiles: [],
|
|
14525
15354
|
hasUploadingFiles: false,
|
|
14526
15355
|
hasParsingFiles: false
|
|
14527
15356
|
});
|
|
14528
|
-
const [references, setReferences] =
|
|
14529
|
-
const [isUploadingReferenceImages, setIsUploadingReferenceImages] =
|
|
14530
|
-
const [quoteSelection, setQuoteSelection] =
|
|
14531
|
-
const [isAtBottom, setIsAtBottom] =
|
|
14532
|
-
const [hasUpdatesBelow, setHasUpdatesBelow] =
|
|
15357
|
+
const [references, setReferences] = React49.useState([]);
|
|
15358
|
+
const [isUploadingReferenceImages, setIsUploadingReferenceImages] = React49.useState(false);
|
|
15359
|
+
const [quoteSelection, setQuoteSelection] = React49.useState(null);
|
|
15360
|
+
const [isAtBottom, setIsAtBottom] = React49.useState(true);
|
|
15361
|
+
const [hasUpdatesBelow, setHasUpdatesBelow] = React49.useState(false);
|
|
14533
15362
|
const {
|
|
14534
15363
|
threads,
|
|
14535
15364
|
deleteThread,
|
|
14536
15365
|
refreshThreads,
|
|
14537
15366
|
isLoading: isThreadsLoading
|
|
14538
15367
|
} = useThreads();
|
|
14539
|
-
const viewportRef =
|
|
14540
|
-
const attachmentsRef =
|
|
14541
|
-
const composerInputRef =
|
|
14542
|
-
const slashPaletteRef =
|
|
14543
|
-
const slashPaletteOptionRefs =
|
|
15368
|
+
const viewportRef = React49.useRef(null);
|
|
15369
|
+
const attachmentsRef = React49.useRef(null);
|
|
15370
|
+
const composerInputRef = React49.useRef(null);
|
|
15371
|
+
const slashPaletteRef = React49.useRef(null);
|
|
15372
|
+
const slashPaletteOptionRefs = React49.useRef(
|
|
14544
15373
|
[]
|
|
14545
15374
|
);
|
|
14546
|
-
const composerPartsRef =
|
|
14547
|
-
const pendingComposerCaretOffsetRef =
|
|
14548
|
-
const shouldAutoScrollRef =
|
|
14549
|
-
const forceFollowRef =
|
|
14550
|
-
const previousMessageCountRef =
|
|
14551
|
-
const previousScrollTopRef =
|
|
14552
|
-
const isPrependingHistoryMessagesRef =
|
|
14553
|
-
const autoScrollFrameRef =
|
|
14554
|
-
const isPointerDownRef =
|
|
14555
|
-
const lastTouchYRef =
|
|
14556
|
-
const runtimeCapabilityPreferenceLoadRef =
|
|
15375
|
+
const composerPartsRef = React49.useRef([]);
|
|
15376
|
+
const pendingComposerCaretOffsetRef = React49.useRef(null);
|
|
15377
|
+
const shouldAutoScrollRef = React49.useRef(true);
|
|
15378
|
+
const forceFollowRef = React49.useRef(false);
|
|
15379
|
+
const previousMessageCountRef = React49.useRef(0);
|
|
15380
|
+
const previousScrollTopRef = React49.useRef(0);
|
|
15381
|
+
const isPrependingHistoryMessagesRef = React49.useRef(false);
|
|
15382
|
+
const autoScrollFrameRef = React49.useRef(null);
|
|
15383
|
+
const isPointerDownRef = React49.useRef(false);
|
|
15384
|
+
const lastTouchYRef = React49.useRef(null);
|
|
15385
|
+
const runtimeCapabilityPreferenceLoadRef = React49.useRef(0);
|
|
14557
15386
|
const resolvedTitle = title ?? t("chat.title");
|
|
14558
15387
|
const resolvedPlaceholder = placeholder ?? t("chat.placeholder");
|
|
14559
15388
|
const petRequired = options?.displayMode === "pet";
|
|
14560
|
-
const basePetSettings =
|
|
15389
|
+
const basePetSettings = React49.useMemo(
|
|
14561
15390
|
() => derivePetLocalSettings(options?.pet),
|
|
14562
15391
|
[options?.pet]
|
|
14563
15392
|
);
|
|
14564
|
-
const displayedPetSettings =
|
|
15393
|
+
const displayedPetSettings = React49.useMemo(
|
|
14565
15394
|
() => ({
|
|
14566
15395
|
...petLocalSettings ?? basePetSettings,
|
|
14567
15396
|
...petRequired ? { enabled: true } : {}
|
|
14568
15397
|
}),
|
|
14569
15398
|
[basePetSettings, petLocalSettings, petRequired]
|
|
14570
15399
|
);
|
|
14571
|
-
const effectivePet =
|
|
15400
|
+
const effectivePet = React49.useMemo(() => {
|
|
14572
15401
|
if (petRequired || petLocalSettings) {
|
|
14573
15402
|
return buildPetOptionsFromLocalSettings(displayedPetSettings);
|
|
14574
15403
|
}
|
|
14575
15404
|
return options?.pet ?? null;
|
|
14576
15405
|
}, [displayedPetSettings, options?.pet, petLocalSettings, petRequired]);
|
|
14577
|
-
const savePetLocalSettings =
|
|
15406
|
+
const savePetLocalSettings = React49.useCallback(
|
|
14578
15407
|
(settings) => {
|
|
14579
15408
|
const nextSettings = petRequired ? { ...settings, enabled: true } : settings;
|
|
14580
15409
|
setPetLocalSettings(nextSettings);
|
|
@@ -14582,7 +15411,7 @@ function Chat({
|
|
|
14582
15411
|
},
|
|
14583
15412
|
[petRequired]
|
|
14584
15413
|
);
|
|
14585
|
-
const handlePetCommand =
|
|
15414
|
+
const handlePetCommand = React49.useCallback(
|
|
14586
15415
|
(mode) => {
|
|
14587
15416
|
if (mode === "settings") {
|
|
14588
15417
|
setPetSettingsOpen(true);
|
|
@@ -14604,7 +15433,7 @@ function Chat({
|
|
|
14604
15433
|
[displayedPetSettings, effectivePet, petRequired, savePetLocalSettings]
|
|
14605
15434
|
);
|
|
14606
15435
|
const inputPlaceholder = selectedTool?.placeholderOverride ?? composer?.placeholder ?? resolvedPlaceholder;
|
|
14607
|
-
const messages =
|
|
15436
|
+
const messages = React49.useMemo(
|
|
14608
15437
|
() => stream.messages ?? [],
|
|
14609
15438
|
[stream.messages]
|
|
14610
15439
|
);
|
|
@@ -14613,7 +15442,7 @@ function Chat({
|
|
|
14613
15442
|
historyMessagePagination?.isLoadingMore
|
|
14614
15443
|
);
|
|
14615
15444
|
const canLoadMoreMessages = Boolean(historyMessagePagination?.hasMore);
|
|
14616
|
-
const draft =
|
|
15445
|
+
const draft = React49.useMemo(
|
|
14617
15446
|
() => getComposerPlainText(composerParts),
|
|
14618
15447
|
[composerParts]
|
|
14619
15448
|
);
|
|
@@ -14627,7 +15456,7 @@ function Chat({
|
|
|
14627
15456
|
isEmpty: isComposerInputEmpty,
|
|
14628
15457
|
isStacked: isComposerStacked
|
|
14629
15458
|
});
|
|
14630
|
-
const pendingFollowUps =
|
|
15459
|
+
const pendingFollowUps = React49.useMemo(
|
|
14631
15460
|
() => sortVisiblePendingFollowUps(stream.pendingFollowUps ?? []),
|
|
14632
15461
|
[stream.pendingFollowUps]
|
|
14633
15462
|
);
|
|
@@ -14636,11 +15465,11 @@ function Chat({
|
|
|
14636
15465
|
const hasPendingHITLRequest = Boolean(stream.pendingHITLRequest);
|
|
14637
15466
|
const hasPendingInteractiveRequest = hasPendingRequestUserInput || hasPendingHITLRequest;
|
|
14638
15467
|
const hasPendingTodos = Boolean(stream.todos?.items.length);
|
|
14639
|
-
const runtimeCapabilityOptions =
|
|
15468
|
+
const runtimeCapabilityOptions = React49.useMemo(
|
|
14640
15469
|
() => getRuntimeCapabilityOptions(runtimeCapabilities),
|
|
14641
15470
|
[runtimeCapabilities]
|
|
14642
15471
|
);
|
|
14643
|
-
const goalAdapter =
|
|
15472
|
+
const goalAdapter = React49.useMemo(
|
|
14644
15473
|
() => {
|
|
14645
15474
|
if (isGoalAdapter(options?.goal)) {
|
|
14646
15475
|
return options.goal;
|
|
@@ -14650,7 +15479,7 @@ function Chat({
|
|
|
14650
15479
|
[options?.goal, stream.client]
|
|
14651
15480
|
);
|
|
14652
15481
|
const displayedGoalElapsedSeconds = threadGoal ? (threadGoal.elapsedSeconds ?? 0) + (goalElapsedStartedAt ? Math.max(0, Math.floor((streamingNow - goalElapsedStartedAt) / 1e3)) : 0) : 0;
|
|
14653
|
-
const effectiveSessionRuntimeCapabilities =
|
|
15482
|
+
const effectiveSessionRuntimeCapabilities = React49.useMemo(
|
|
14654
15483
|
() => runtimeCapabilitiesReady && runtimeCapabilities ? mergeRuntimeCapabilitiesSelections(
|
|
14655
15484
|
runtimeCapabilities,
|
|
14656
15485
|
sessionRuntimeCapabilities
|
|
@@ -14663,7 +15492,7 @@ function Chat({
|
|
|
14663
15492
|
"goal"
|
|
14664
15493
|
);
|
|
14665
15494
|
const showGoalStatus = goalCommandAvailable && !hasCompletedGoal && (Boolean(goalError) || threadGoal?.status === "active" && stream.isLoading);
|
|
14666
|
-
const runRuntimeCapabilityOptions =
|
|
15495
|
+
const runRuntimeCapabilityOptions = React49.useMemo(
|
|
14667
15496
|
() => runtimeCapabilityOptions.filter(
|
|
14668
15497
|
(option) => isRuntimeCapabilitySelected(
|
|
14669
15498
|
runRuntimeCapabilities,
|
|
@@ -14673,11 +15502,11 @@ function Chat({
|
|
|
14673
15502
|
),
|
|
14674
15503
|
[runRuntimeCapabilities, runtimeCapabilityOptions]
|
|
14675
15504
|
);
|
|
14676
|
-
const composerRuntimeCapabilitySelectionKeys =
|
|
15505
|
+
const composerRuntimeCapabilitySelectionKeys = React49.useMemo(
|
|
14677
15506
|
() => getComposerCapabilitySelectionKeys(composerParts),
|
|
14678
15507
|
[composerParts]
|
|
14679
15508
|
);
|
|
14680
|
-
const detachedRunRuntimeCapabilityOptions =
|
|
15509
|
+
const detachedRunRuntimeCapabilityOptions = React49.useMemo(
|
|
14681
15510
|
() => runRuntimeCapabilityOptions.filter(
|
|
14682
15511
|
(option) => !composerRuntimeCapabilitySelectionKeys.has(
|
|
14683
15512
|
getRuntimeCapabilityOptionKey(option)
|
|
@@ -14685,7 +15514,7 @@ function Chat({
|
|
|
14685
15514
|
),
|
|
14686
15515
|
[composerRuntimeCapabilitySelectionKeys, runRuntimeCapabilityOptions]
|
|
14687
15516
|
);
|
|
14688
|
-
const persistSessionRuntimeCapabilities =
|
|
15517
|
+
const persistSessionRuntimeCapabilities = React49.useCallback(
|
|
14689
15518
|
async (threadId, selection) => {
|
|
14690
15519
|
if (!runtimeCapabilities || !selection) {
|
|
14691
15520
|
return;
|
|
@@ -14710,10 +15539,10 @@ function Chat({
|
|
|
14710
15539
|
},
|
|
14711
15540
|
[runtimeCapabilities, stream.client]
|
|
14712
15541
|
);
|
|
14713
|
-
const clearQuoteSelection =
|
|
15542
|
+
const clearQuoteSelection = React49.useCallback(() => {
|
|
14714
15543
|
setQuoteSelection(null);
|
|
14715
15544
|
}, []);
|
|
14716
|
-
const commitComposerParts =
|
|
15545
|
+
const commitComposerParts = React49.useCallback(
|
|
14717
15546
|
(nextParts, options2) => {
|
|
14718
15547
|
const normalized = normalizeComposerParts(nextParts);
|
|
14719
15548
|
const previous = composerPartsRef.current;
|
|
@@ -14749,7 +15578,7 @@ function Chat({
|
|
|
14749
15578
|
},
|
|
14750
15579
|
[]
|
|
14751
15580
|
);
|
|
14752
|
-
const setComposerText =
|
|
15581
|
+
const setComposerText = React49.useCallback(
|
|
14753
15582
|
(text, caretOffset = text.length) => {
|
|
14754
15583
|
commitComposerParts(createComposerTextParts(text), {
|
|
14755
15584
|
caretOffset,
|
|
@@ -14759,7 +15588,7 @@ function Chat({
|
|
|
14759
15588
|
},
|
|
14760
15589
|
[commitComposerParts]
|
|
14761
15590
|
);
|
|
14762
|
-
const focusComposerAt =
|
|
15591
|
+
const focusComposerAt = React49.useCallback((position) => {
|
|
14763
15592
|
const nextPosition = position ?? getComposerEditingLength(composerPartsRef.current);
|
|
14764
15593
|
pendingComposerCaretOffsetRef.current = nextPosition;
|
|
14765
15594
|
requestAnimationFrame(() => {
|
|
@@ -14771,7 +15600,7 @@ function Chat({
|
|
|
14771
15600
|
});
|
|
14772
15601
|
}, []);
|
|
14773
15602
|
const parentMessenger = useParentMessenger({
|
|
14774
|
-
onSetComposerValue:
|
|
15603
|
+
onSetComposerValue: React49.useCallback(
|
|
14775
15604
|
(payload) => {
|
|
14776
15605
|
if (!payload) {
|
|
14777
15606
|
return;
|
|
@@ -14794,10 +15623,10 @@ function Chat({
|
|
|
14794
15623
|
},
|
|
14795
15624
|
[composer?.tools, setComposerText]
|
|
14796
15625
|
),
|
|
14797
|
-
onFocusComposer:
|
|
15626
|
+
onFocusComposer: React49.useCallback(() => {
|
|
14798
15627
|
composerInputRef.current?.focus();
|
|
14799
15628
|
}, []),
|
|
14800
|
-
onSetPetEnabled:
|
|
15629
|
+
onSetPetEnabled: React49.useCallback(
|
|
14801
15630
|
(enabled) => {
|
|
14802
15631
|
if (petRequired) {
|
|
14803
15632
|
return;
|
|
@@ -14811,10 +15640,10 @@ function Chat({
|
|
|
14811
15640
|
)
|
|
14812
15641
|
});
|
|
14813
15642
|
const canMinimizeToPet = parentMessenger?.isParentAvailable === true && isPetEnabled(effectivePet);
|
|
14814
|
-
const handleMinimizeToPet =
|
|
15643
|
+
const handleMinimizeToPet = React49.useCallback(() => {
|
|
14815
15644
|
parentMessenger?.sendEvent("chat_minimize_change", { minimized: true });
|
|
14816
15645
|
}, [parentMessenger]);
|
|
14817
|
-
const syncQuoteSelection =
|
|
15646
|
+
const syncQuoteSelection = React49.useCallback(() => {
|
|
14818
15647
|
if (typeof window === "undefined") {
|
|
14819
15648
|
clearQuoteSelection();
|
|
14820
15649
|
return;
|
|
@@ -14859,23 +15688,23 @@ function Chat({
|
|
|
14859
15688
|
left
|
|
14860
15689
|
});
|
|
14861
15690
|
}, [clearQuoteSelection]);
|
|
14862
|
-
const cancelPendingAutoScroll =
|
|
15691
|
+
const cancelPendingAutoScroll = React49.useCallback(() => {
|
|
14863
15692
|
if (autoScrollFrameRef.current !== null) {
|
|
14864
15693
|
cancelAnimationFrame(autoScrollFrameRef.current);
|
|
14865
15694
|
autoScrollFrameRef.current = null;
|
|
14866
15695
|
}
|
|
14867
15696
|
}, []);
|
|
14868
|
-
const disableAutoFollow =
|
|
15697
|
+
const disableAutoFollow = React49.useCallback(() => {
|
|
14869
15698
|
forceFollowRef.current = false;
|
|
14870
15699
|
shouldAutoScrollRef.current = false;
|
|
14871
15700
|
cancelPendingAutoScroll();
|
|
14872
15701
|
}, [cancelPendingAutoScroll]);
|
|
14873
|
-
const enableAutoFollow =
|
|
15702
|
+
const enableAutoFollow = React49.useCallback(() => {
|
|
14874
15703
|
forceFollowRef.current = true;
|
|
14875
15704
|
shouldAutoScrollRef.current = true;
|
|
14876
15705
|
setHasUpdatesBelow(false);
|
|
14877
15706
|
}, []);
|
|
14878
|
-
const scrollToBottom =
|
|
15707
|
+
const scrollToBottom = React49.useCallback(
|
|
14879
15708
|
(smooth = false, force = false) => {
|
|
14880
15709
|
if (force) {
|
|
14881
15710
|
enableAutoFollow();
|
|
@@ -14902,7 +15731,7 @@ function Chat({
|
|
|
14902
15731
|
},
|
|
14903
15732
|
[cancelPendingAutoScroll, enableAutoFollow]
|
|
14904
15733
|
);
|
|
14905
|
-
|
|
15734
|
+
React49.useEffect(() => {
|
|
14906
15735
|
const viewport = viewportRef.current;
|
|
14907
15736
|
if (!viewport) return;
|
|
14908
15737
|
previousScrollTopRef.current = viewport.scrollTop;
|
|
@@ -14983,14 +15812,14 @@ function Chat({
|
|
|
14983
15812
|
window.removeEventListener("pointercancel", stopPointerTracking);
|
|
14984
15813
|
};
|
|
14985
15814
|
}, [cancelPendingAutoScroll, disableAutoFollow]);
|
|
14986
|
-
|
|
15815
|
+
React49.useEffect(() => {
|
|
14987
15816
|
shouldAutoScrollRef.current = true;
|
|
14988
15817
|
forceFollowRef.current = false;
|
|
14989
15818
|
previousScrollTopRef.current = 0;
|
|
14990
15819
|
setIsAtBottom(true);
|
|
14991
15820
|
setHasUpdatesBelow(false);
|
|
14992
15821
|
}, [stream.threadId]);
|
|
14993
|
-
|
|
15822
|
+
React49.useEffect(() => {
|
|
14994
15823
|
const messageCountChanged = messages.length !== previousMessageCountRef.current;
|
|
14995
15824
|
previousMessageCountRef.current = messages.length;
|
|
14996
15825
|
if (isPrependingHistoryMessagesRef.current) {
|
|
@@ -15013,7 +15842,7 @@ function Chat({
|
|
|
15013
15842
|
clientSecret: effectiveClientSecret
|
|
15014
15843
|
});
|
|
15015
15844
|
const missingConfig = Boolean(missingConfigKind);
|
|
15016
|
-
const missingConfigShortMessage =
|
|
15845
|
+
const missingConfigShortMessage = React49.useMemo(() => {
|
|
15017
15846
|
switch (missingConfigKind) {
|
|
15018
15847
|
case "apiUrl":
|
|
15019
15848
|
return t("chat.missingApiUrlShort");
|
|
@@ -15025,7 +15854,7 @@ function Chat({
|
|
|
15025
15854
|
return t("chat.missingConfigShort");
|
|
15026
15855
|
}
|
|
15027
15856
|
}, [missingConfigKind, t]);
|
|
15028
|
-
const missingConfigDetailMessage =
|
|
15857
|
+
const missingConfigDetailMessage = React49.useMemo(() => {
|
|
15029
15858
|
switch (missingConfigKind) {
|
|
15030
15859
|
case "apiUrl":
|
|
15031
15860
|
return t("chat.missingApiUrlDetail");
|
|
@@ -15042,7 +15871,7 @@ function Chat({
|
|
|
15042
15871
|
const isSubmissionBlocked = hasPendingInteractiveRequest || missingConfig || isHistoryLoading || hasUploadingFiles || isUploadingReferenceImages;
|
|
15043
15872
|
const isSendDisabled = !trimmedDraft && !hasReferences || isSubmissionBlocked;
|
|
15044
15873
|
const isPromptEditDisabled = hasPendingInteractiveRequest || missingConfig || isHistoryLoading;
|
|
15045
|
-
const resizeComposerInput =
|
|
15874
|
+
const resizeComposerInput = React49.useCallback(() => {
|
|
15046
15875
|
const input = composerInputRef.current;
|
|
15047
15876
|
if (!input) {
|
|
15048
15877
|
return;
|
|
@@ -15050,7 +15879,7 @@ function Chat({
|
|
|
15050
15879
|
input.style.maxHeight = `${COMPOSER_INPUT_MAX_HEIGHT}px`;
|
|
15051
15880
|
input.style.overflowY = input.scrollHeight > COMPOSER_INPUT_MAX_HEIGHT ? "auto" : "hidden";
|
|
15052
15881
|
}, []);
|
|
15053
|
-
|
|
15882
|
+
React49.useLayoutEffect(() => {
|
|
15054
15883
|
composerPartsRef.current = composerParts;
|
|
15055
15884
|
resizeComposerInput();
|
|
15056
15885
|
const caretOffset = pendingComposerCaretOffsetRef.current;
|
|
@@ -15062,13 +15891,13 @@ function Chat({
|
|
|
15062
15891
|
}
|
|
15063
15892
|
}
|
|
15064
15893
|
}, [composerDomVersion, composerParts, resizeComposerInput]);
|
|
15065
|
-
|
|
15894
|
+
React49.useEffect(() => {
|
|
15066
15895
|
document.addEventListener("selectionchange", syncQuoteSelection);
|
|
15067
15896
|
return () => {
|
|
15068
15897
|
document.removeEventListener("selectionchange", syncQuoteSelection);
|
|
15069
15898
|
};
|
|
15070
15899
|
}, [syncQuoteSelection]);
|
|
15071
|
-
|
|
15900
|
+
React49.useEffect(() => {
|
|
15072
15901
|
const viewport = viewportRef.current;
|
|
15073
15902
|
if (!viewport) {
|
|
15074
15903
|
return;
|
|
@@ -15085,14 +15914,14 @@ function Chat({
|
|
|
15085
15914
|
window.removeEventListener("resize", handleViewportScroll);
|
|
15086
15915
|
};
|
|
15087
15916
|
}, [clearQuoteSelection]);
|
|
15088
|
-
|
|
15917
|
+
React49.useEffect(() => {
|
|
15089
15918
|
clearQuoteSelection();
|
|
15090
15919
|
}, [messages.length, stream.threadId, clearQuoteSelection]);
|
|
15091
|
-
|
|
15920
|
+
React49.useEffect(() => {
|
|
15092
15921
|
if (missingConfig) return;
|
|
15093
15922
|
void refreshThreads();
|
|
15094
15923
|
}, [missingConfig, refreshThreads]);
|
|
15095
|
-
|
|
15924
|
+
React49.useEffect(() => {
|
|
15096
15925
|
if (missingConfig || !stream.client || !stream.assistantId) {
|
|
15097
15926
|
setAssistantName(null);
|
|
15098
15927
|
setAssistantAvatar(null);
|
|
@@ -15115,7 +15944,7 @@ function Chat({
|
|
|
15115
15944
|
cancelled = true;
|
|
15116
15945
|
};
|
|
15117
15946
|
}, [missingConfig, stream.client, stream.assistantId]);
|
|
15118
|
-
|
|
15947
|
+
React49.useEffect(() => {
|
|
15119
15948
|
if (missingConfig || !stream.client || !stream.assistantId) {
|
|
15120
15949
|
setRuntimeCapabilities(null);
|
|
15121
15950
|
setRuntimeCapabilitiesReady(false);
|
|
@@ -15162,7 +15991,7 @@ function Chat({
|
|
|
15162
15991
|
});
|
|
15163
15992
|
return () => controller.abort();
|
|
15164
15993
|
}, [missingConfig, stream.client, stream.assistantId]);
|
|
15165
|
-
|
|
15994
|
+
React49.useEffect(() => {
|
|
15166
15995
|
setRunRuntimeCapabilities(
|
|
15167
15996
|
createEmptyRuntimeCapabilitiesSelection(runtimeCapabilities)
|
|
15168
15997
|
);
|
|
@@ -15211,10 +16040,10 @@ function Chat({
|
|
|
15211
16040
|
stream.client,
|
|
15212
16041
|
stream.threadId
|
|
15213
16042
|
]);
|
|
15214
|
-
|
|
16043
|
+
React49.useEffect(() => {
|
|
15215
16044
|
setThreadGoal(stream.threadGoal);
|
|
15216
16045
|
}, [stream.threadGoal]);
|
|
15217
|
-
|
|
16046
|
+
React49.useEffect(() => {
|
|
15218
16047
|
const threadId = stream.threadId?.trim();
|
|
15219
16048
|
if (!threadId || !goalCommandAvailable) {
|
|
15220
16049
|
setThreadGoal(null);
|
|
@@ -15255,7 +16084,7 @@ function Chat({
|
|
|
15255
16084
|
return () => controller.abort();
|
|
15256
16085
|
}, [goalAdapter, goalCommandAvailable, stream.threadId]);
|
|
15257
16086
|
const uploadedFiles = attachmentState.uploadedFiles;
|
|
15258
|
-
const handleSessionRuntimeCapabilityToggle =
|
|
16087
|
+
const handleSessionRuntimeCapabilityToggle = React49.useCallback(
|
|
15259
16088
|
(type, id, selected) => {
|
|
15260
16089
|
setSessionRuntimeCapabilities((previous) => {
|
|
15261
16090
|
const nextSelection = toggleRuntimeCapabilitySelection(
|
|
@@ -15273,7 +16102,7 @@ function Chat({
|
|
|
15273
16102
|
},
|
|
15274
16103
|
[persistSessionRuntimeCapabilities, stream.threadId]
|
|
15275
16104
|
);
|
|
15276
|
-
const updateRuntimeCapabilityPalette =
|
|
16105
|
+
const updateRuntimeCapabilityPalette = React49.useCallback(
|
|
15277
16106
|
(parts, selectionStart) => {
|
|
15278
16107
|
const input = composerInputRef.current;
|
|
15279
16108
|
const editingText = getComposerEditingText(parts);
|
|
@@ -15285,7 +16114,7 @@ function Chat({
|
|
|
15285
16114
|
},
|
|
15286
16115
|
[]
|
|
15287
16116
|
);
|
|
15288
|
-
const syncComposerInputFromElement =
|
|
16117
|
+
const syncComposerInputFromElement = React49.useCallback(
|
|
15289
16118
|
(input) => {
|
|
15290
16119
|
const previousCapabilities = getComposerCapabilityPartMap(
|
|
15291
16120
|
composerPartsRef.current
|
|
@@ -15303,25 +16132,25 @@ function Chat({
|
|
|
15303
16132
|
},
|
|
15304
16133
|
[commitComposerParts, updateRuntimeCapabilityPalette]
|
|
15305
16134
|
);
|
|
15306
|
-
const handleComposerInput =
|
|
16135
|
+
const handleComposerInput = React49.useCallback(
|
|
15307
16136
|
(event) => {
|
|
15308
16137
|
syncComposerInputFromElement(event.currentTarget);
|
|
15309
16138
|
},
|
|
15310
16139
|
[syncComposerInputFromElement]
|
|
15311
16140
|
);
|
|
15312
|
-
const handleComposerCompositionEnd =
|
|
16141
|
+
const handleComposerCompositionEnd = React49.useCallback(
|
|
15313
16142
|
(event) => {
|
|
15314
16143
|
syncComposerInputFromElement(event.currentTarget);
|
|
15315
16144
|
},
|
|
15316
16145
|
[syncComposerInputFromElement]
|
|
15317
16146
|
);
|
|
15318
|
-
const handleComposerSelect =
|
|
16147
|
+
const handleComposerSelect = React49.useCallback(() => {
|
|
15319
16148
|
updateRuntimeCapabilityPalette(
|
|
15320
16149
|
composerPartsRef.current,
|
|
15321
16150
|
composerInputRef.current ? getComposerSelectionOffset(composerInputRef.current) : void 0
|
|
15322
16151
|
);
|
|
15323
16152
|
}, [updateRuntimeCapabilityPalette]);
|
|
15324
|
-
const removeRunRuntimeCapability =
|
|
16153
|
+
const removeRunRuntimeCapability = React49.useCallback(
|
|
15325
16154
|
(option) => {
|
|
15326
16155
|
setRunRuntimeCapabilities(
|
|
15327
16156
|
(previous) => toggleRuntimeCapabilitySelection(
|
|
@@ -15341,7 +16170,7 @@ function Chat({
|
|
|
15341
16170
|
},
|
|
15342
16171
|
[commitComposerParts]
|
|
15343
16172
|
);
|
|
15344
|
-
const submitDraft =
|
|
16173
|
+
const submitDraft = React49.useCallback(
|
|
15345
16174
|
(submitOptions = {}) => {
|
|
15346
16175
|
if (isSubmissionBlocked) return;
|
|
15347
16176
|
const contentToSubmit = (submitOptions.inputText ?? trimmedDraft).trim();
|
|
@@ -15464,7 +16293,7 @@ function Chat({
|
|
|
15464
16293
|
t
|
|
15465
16294
|
]
|
|
15466
16295
|
);
|
|
15467
|
-
const handleGoalCommand =
|
|
16296
|
+
const handleGoalCommand = React49.useCallback(
|
|
15468
16297
|
async ({
|
|
15469
16298
|
args,
|
|
15470
16299
|
commandSource,
|
|
@@ -15576,13 +16405,13 @@ function Chat({
|
|
|
15576
16405
|
t
|
|
15577
16406
|
]
|
|
15578
16407
|
);
|
|
15579
|
-
const handleGoalPanelOpenChange =
|
|
16408
|
+
const handleGoalPanelOpenChange = React49.useCallback(
|
|
15580
16409
|
(open) => {
|
|
15581
16410
|
setIsGoalPanelOpen(open);
|
|
15582
16411
|
},
|
|
15583
16412
|
[]
|
|
15584
16413
|
);
|
|
15585
|
-
const addRunRuntimeCapabilities =
|
|
16414
|
+
const addRunRuntimeCapabilities = React49.useCallback(
|
|
15586
16415
|
(selection) => {
|
|
15587
16416
|
setRunRuntimeCapabilities(
|
|
15588
16417
|
(previous) => runtimeCapabilities ? mergeRuntimeCapabilitiesSelections(
|
|
@@ -15594,7 +16423,7 @@ function Chat({
|
|
|
15594
16423
|
},
|
|
15595
16424
|
[runtimeCapabilities]
|
|
15596
16425
|
);
|
|
15597
|
-
const insertComposerCapabilityToken =
|
|
16426
|
+
const insertComposerCapabilityToken = React49.useCallback(
|
|
15598
16427
|
(capability, range) => {
|
|
15599
16428
|
const token = createComposerCapabilityPart(capability, createMessageId());
|
|
15600
16429
|
const currentParts = composerPartsRef.current;
|
|
@@ -15667,7 +16496,7 @@ function Chat({
|
|
|
15667
16496
|
plugin: t("composer.slashCommands.empty.loadingCapabilities"),
|
|
15668
16497
|
subAgent: t("composer.slashCommands.empty.loadingCapabilities")
|
|
15669
16498
|
};
|
|
15670
|
-
|
|
16499
|
+
React49.useEffect(() => {
|
|
15671
16500
|
if (!runtimeCapabilityPalette) {
|
|
15672
16501
|
return;
|
|
15673
16502
|
}
|
|
@@ -15686,7 +16515,7 @@ function Chat({
|
|
|
15686
16515
|
);
|
|
15687
16516
|
}
|
|
15688
16517
|
}, [slashPaletteOptions.length, runtimeCapabilityPalette]);
|
|
15689
|
-
|
|
16518
|
+
React49.useLayoutEffect(() => {
|
|
15690
16519
|
if (!runtimeCapabilityPalette) {
|
|
15691
16520
|
return;
|
|
15692
16521
|
}
|
|
@@ -15703,7 +16532,7 @@ function Chat({
|
|
|
15703
16532
|
container.scrollTop += optionRect.bottom - containerRect.bottom;
|
|
15704
16533
|
}
|
|
15705
16534
|
}, [runtimeCapabilityPalette, slashPaletteOptions.length]);
|
|
15706
|
-
const submitGoalModeDraft =
|
|
16535
|
+
const submitGoalModeDraft = React49.useCallback(() => {
|
|
15707
16536
|
const objective = getComposerPlainText(composerPartsRef.current).trim();
|
|
15708
16537
|
if (!isGoalModeOpen || !goalCommandAvailable || !objective) {
|
|
15709
16538
|
return false;
|
|
@@ -15741,7 +16570,7 @@ function Chat({
|
|
|
15741
16570
|
}
|
|
15742
16571
|
submitDraft();
|
|
15743
16572
|
};
|
|
15744
|
-
const handleEditPendingFollowUp =
|
|
16573
|
+
const handleEditPendingFollowUp = React49.useCallback(
|
|
15745
16574
|
(id) => {
|
|
15746
16575
|
const item = pendingFollowUps.find(
|
|
15747
16576
|
(entry) => entry.id === id && entry.mode === "queue"
|
|
@@ -15768,7 +16597,7 @@ function Chat({
|
|
|
15768
16597
|
},
|
|
15769
16598
|
[pendingFollowUps, setComposerText, stream]
|
|
15770
16599
|
);
|
|
15771
|
-
const handleQuoteSelection =
|
|
16600
|
+
const handleQuoteSelection = React49.useCallback(() => {
|
|
15772
16601
|
if (!quoteSelection) {
|
|
15773
16602
|
return;
|
|
15774
16603
|
}
|
|
@@ -15784,7 +16613,7 @@ function Chat({
|
|
|
15784
16613
|
const handleAttachmentClick = () => {
|
|
15785
16614
|
attachmentsRef.current?.openFilePicker();
|
|
15786
16615
|
};
|
|
15787
|
-
const uploadContextFile =
|
|
16616
|
+
const uploadContextFile = React49.useCallback(
|
|
15788
16617
|
(file) => {
|
|
15789
16618
|
const formData = new FormData();
|
|
15790
16619
|
formData.append("file", file, file.name || "upload");
|
|
@@ -15803,13 +16632,13 @@ function Chat({
|
|
|
15803
16632
|
},
|
|
15804
16633
|
[stream.assistantId, stream.client, stream.threadId]
|
|
15805
16634
|
);
|
|
15806
|
-
const getContextFileStatus =
|
|
16635
|
+
const getContextFileStatus = React49.useCallback(
|
|
15807
16636
|
(fileId) => stream.client.contexts.fetch(`/files/${fileId}/status`, {
|
|
15808
16637
|
method: "GET"
|
|
15809
16638
|
}),
|
|
15810
16639
|
[stream.client]
|
|
15811
16640
|
);
|
|
15812
|
-
const deleteContextFile =
|
|
16641
|
+
const deleteContextFile = React49.useCallback(
|
|
15813
16642
|
(storageFileId) => stream.client.contexts.deleteFile(storageFileId),
|
|
15814
16643
|
[stream.client]
|
|
15815
16644
|
);
|
|
@@ -15917,7 +16746,7 @@ function Chat({
|
|
|
15917
16746
|
}
|
|
15918
16747
|
submitDraft();
|
|
15919
16748
|
};
|
|
15920
|
-
const handleComposerPaste =
|
|
16749
|
+
const handleComposerPaste = React49.useCallback(
|
|
15921
16750
|
(event) => {
|
|
15922
16751
|
const clipboardData = event.clipboardData;
|
|
15923
16752
|
if (!clipboardData) {
|
|
@@ -16019,13 +16848,13 @@ function Chat({
|
|
|
16019
16848
|
const handleToolSelect = (tool) => {
|
|
16020
16849
|
setSelectedTool((prev) => prev?.id === tool.id ? null : tool);
|
|
16021
16850
|
};
|
|
16022
|
-
const handlePromptClick =
|
|
16851
|
+
const handlePromptClick = React49.useCallback(
|
|
16023
16852
|
(prompt) => {
|
|
16024
16853
|
submitDraft({ inputText: prompt, displayText: prompt });
|
|
16025
16854
|
},
|
|
16026
16855
|
[submitDraft]
|
|
16027
16856
|
);
|
|
16028
|
-
const handlePromptEdit =
|
|
16857
|
+
const handlePromptEdit = React49.useCallback(
|
|
16029
16858
|
(prompt) => {
|
|
16030
16859
|
if (isPromptEditDisabled) return;
|
|
16031
16860
|
setComposerText(prompt, prompt.length);
|
|
@@ -16034,7 +16863,7 @@ function Chat({
|
|
|
16034
16863
|
},
|
|
16035
16864
|
[focusComposerAt, isPromptEditDisabled, setComposerText]
|
|
16036
16865
|
);
|
|
16037
|
-
const loadConversationMessages =
|
|
16866
|
+
const loadConversationMessages = React49.useCallback(
|
|
16038
16867
|
async (recordId) => {
|
|
16039
16868
|
if (missingConfig) {
|
|
16040
16869
|
setHistoryError(missingConfigShortMessage);
|
|
@@ -16055,7 +16884,7 @@ function Chat({
|
|
|
16055
16884
|
},
|
|
16056
16885
|
[missingConfig, missingConfigShortMessage, stream, t]
|
|
16057
16886
|
);
|
|
16058
|
-
const handleLoadMoreMessages =
|
|
16887
|
+
const handleLoadMoreMessages = React49.useCallback(async () => {
|
|
16059
16888
|
if (!canLoadMoreMessages || isLoadingMoreMessages) {
|
|
16060
16889
|
return;
|
|
16061
16890
|
}
|
|
@@ -16164,15 +16993,15 @@ function Chat({
|
|
|
16164
16993
|
};
|
|
16165
16994
|
const acceptMimes = composer?.attachments?.accept ? Object.entries(composer.attachments.accept).map(([mime, exts]) => [mime, ...exts.map((e) => `.${e}`)].join(",")).join(",") : void 0;
|
|
16166
16995
|
const canUploadDroppedFiles = composer?.attachments?.enabled === true && !missingConfig && !isHistoryLoading && !hasPendingInteractiveRequest;
|
|
16167
|
-
const handleDroppedFiles =
|
|
16996
|
+
const handleDroppedFiles = React49.useCallback((files) => {
|
|
16168
16997
|
return attachmentsRef.current?.queueFiles(files) ?? false;
|
|
16169
16998
|
}, []);
|
|
16170
|
-
const currentThread =
|
|
16999
|
+
const currentThread = React49.useMemo(
|
|
16171
17000
|
() => threads.find((item) => item.id === stream.threadId),
|
|
16172
17001
|
[threads, stream.threadId]
|
|
16173
17002
|
);
|
|
16174
17003
|
const streamErrorMessage = stream.error instanceof Error ? stream.error.message : void 0;
|
|
16175
|
-
const threadErrorMessage =
|
|
17004
|
+
const threadErrorMessage = React49.useMemo(() => {
|
|
16176
17005
|
if (streamErrorMessage?.trim()) return streamErrorMessage.trim();
|
|
16177
17006
|
if (currentThread?.status !== "error") return void 0;
|
|
16178
17007
|
const message = currentThread.error?.trim();
|
|
@@ -16203,7 +17032,7 @@ function Chat({
|
|
|
16203
17032
|
fallbackTitle: t("history.threadFallback")
|
|
16204
17033
|
});
|
|
16205
17034
|
const assistantTitle = assistantName || resolvedTitle;
|
|
16206
|
-
return /* @__PURE__ */
|
|
17035
|
+
return /* @__PURE__ */ jsxs37(
|
|
16207
17036
|
UploadDroppedFiles,
|
|
16208
17037
|
{
|
|
16209
17038
|
ref: viewportRef,
|
|
@@ -16218,10 +17047,10 @@ function Chat({
|
|
|
16218
17047
|
className
|
|
16219
17048
|
),
|
|
16220
17049
|
children: [
|
|
16221
|
-
/* @__PURE__ */
|
|
16222
|
-
/* @__PURE__ */
|
|
16223
|
-
/* @__PURE__ */
|
|
16224
|
-
/* @__PURE__ */
|
|
17050
|
+
/* @__PURE__ */ jsxs37("div", { className: "flex items-center justify-between border-b p-2 sticky top-0 z-10 bg-background", children: [
|
|
17051
|
+
/* @__PURE__ */ jsxs37("div", { className: "flex items-center gap-3 overflow-hidden", children: [
|
|
17052
|
+
/* @__PURE__ */ jsxs37("div", { className: "relative shrink-0", children: [
|
|
17053
|
+
/* @__PURE__ */ jsx54(
|
|
16225
17054
|
ChatkitAvatar,
|
|
16226
17055
|
{
|
|
16227
17056
|
avatar: assistantAvatar,
|
|
@@ -16229,10 +17058,10 @@ function Chat({
|
|
|
16229
17058
|
label: assistantTitle
|
|
16230
17059
|
}
|
|
16231
17060
|
),
|
|
16232
|
-
/* @__PURE__ */
|
|
17061
|
+
/* @__PURE__ */ jsx54("span", { className: "absolute bottom-0 right-0 h-2.5 w-2.5 rounded-full border-2 border-background bg-green-500" })
|
|
16233
17062
|
] }),
|
|
16234
|
-
/* @__PURE__ */
|
|
16235
|
-
/* @__PURE__ */
|
|
17063
|
+
/* @__PURE__ */ jsxs37("div", { className: "truncate", children: [
|
|
17064
|
+
/* @__PURE__ */ jsx54(
|
|
16236
17065
|
"h2",
|
|
16237
17066
|
{
|
|
16238
17067
|
className: "text-lg font-semibold truncate",
|
|
@@ -16240,12 +17069,12 @@ function Chat({
|
|
|
16240
17069
|
children: assistantTitle
|
|
16241
17070
|
}
|
|
16242
17071
|
),
|
|
16243
|
-
/* @__PURE__ */
|
|
17072
|
+
/* @__PURE__ */ jsx54("p", { className: "text-xs text-muted-foreground", children: t("chat.statusOnline") })
|
|
16244
17073
|
] })
|
|
16245
17074
|
] }),
|
|
16246
|
-
/* @__PURE__ */
|
|
16247
|
-
canMinimizeToPet && /* @__PURE__ */
|
|
16248
|
-
/* @__PURE__ */
|
|
17075
|
+
/* @__PURE__ */ jsxs37("div", { className: "flex items-center gap-1", children: [
|
|
17076
|
+
canMinimizeToPet && /* @__PURE__ */ jsxs37(Tooltip, { children: [
|
|
17077
|
+
/* @__PURE__ */ jsx54(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx54("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ jsx54(
|
|
16249
17078
|
"button",
|
|
16250
17079
|
{
|
|
16251
17080
|
type: "button",
|
|
@@ -16256,13 +17085,13 @@ function Chat({
|
|
|
16256
17085
|
"transition-colors duration-150"
|
|
16257
17086
|
),
|
|
16258
17087
|
"aria-label": t("chat.minimizeToPet"),
|
|
16259
|
-
children: /* @__PURE__ */
|
|
17088
|
+
children: /* @__PURE__ */ jsx54(Minus, { size: 16 })
|
|
16260
17089
|
}
|
|
16261
17090
|
) }) }),
|
|
16262
|
-
/* @__PURE__ */
|
|
17091
|
+
/* @__PURE__ */ jsx54(TooltipContent, { side: "bottom", children: t("chat.minimizeToPet") })
|
|
16263
17092
|
] }),
|
|
16264
|
-
/* @__PURE__ */
|
|
16265
|
-
/* @__PURE__ */
|
|
17093
|
+
/* @__PURE__ */ jsxs37(Tooltip, { children: [
|
|
17094
|
+
/* @__PURE__ */ jsx54(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx54("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ jsx54(
|
|
16266
17095
|
"button",
|
|
16267
17096
|
{
|
|
16268
17097
|
type: "button",
|
|
@@ -16273,14 +17102,14 @@ function Chat({
|
|
|
16273
17102
|
"transition-colors duration-150"
|
|
16274
17103
|
),
|
|
16275
17104
|
"aria-label": t("settings.open"),
|
|
16276
|
-
children: /* @__PURE__ */
|
|
17105
|
+
children: /* @__PURE__ */ jsx54(Settings2, { size: 16 })
|
|
16277
17106
|
}
|
|
16278
17107
|
) }) }),
|
|
16279
|
-
/* @__PURE__ */
|
|
17108
|
+
/* @__PURE__ */ jsx54(TooltipContent, { side: "bottom", children: t("settings.open") })
|
|
16280
17109
|
] }),
|
|
16281
|
-
history?.enabled !== false && /* @__PURE__ */
|
|
16282
|
-
/* @__PURE__ */
|
|
16283
|
-
/* @__PURE__ */
|
|
17110
|
+
history?.enabled !== false && /* @__PURE__ */ jsxs37(Fragment9, { children: [
|
|
17111
|
+
/* @__PURE__ */ jsxs37(Tooltip, { children: [
|
|
17112
|
+
/* @__PURE__ */ jsx54(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx54("span", { className: "inline-flex h-8 w-8", children: /* @__PURE__ */ jsx54(
|
|
16284
17113
|
"button",
|
|
16285
17114
|
{
|
|
16286
17115
|
type: "button",
|
|
@@ -16293,12 +17122,12 @@ function Chat({
|
|
|
16293
17122
|
"disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed"
|
|
16294
17123
|
),
|
|
16295
17124
|
"aria-label": t("history.newThread"),
|
|
16296
|
-
children: /* @__PURE__ */
|
|
17125
|
+
children: /* @__PURE__ */ jsx54(Pencil4, { size: 16 })
|
|
16297
17126
|
}
|
|
16298
17127
|
) }) }),
|
|
16299
|
-
/* @__PURE__ */
|
|
17128
|
+
/* @__PURE__ */ jsx54(TooltipContent, { side: "bottom", children: t("history.newThread") })
|
|
16300
17129
|
] }),
|
|
16301
|
-
/* @__PURE__ */
|
|
17130
|
+
/* @__PURE__ */ jsx54(
|
|
16302
17131
|
HistorySidebar,
|
|
16303
17132
|
{
|
|
16304
17133
|
threads,
|
|
@@ -16313,12 +17142,12 @@ function Chat({
|
|
|
16313
17142
|
] })
|
|
16314
17143
|
] })
|
|
16315
17144
|
] }),
|
|
16316
|
-
/* @__PURE__ */
|
|
16317
|
-
errorMessage && /* @__PURE__ */
|
|
16318
|
-
historyError && /* @__PURE__ */
|
|
16319
|
-
showMissingConfig && /* @__PURE__ */
|
|
16320
|
-
isHistoryLoading && /* @__PURE__ */
|
|
16321
|
-
messages.length === 0 && !canLoadMoreMessages ? /* @__PURE__ */
|
|
17145
|
+
/* @__PURE__ */ jsxs37("div", { className: "flex-1 p-4", children: [
|
|
17146
|
+
errorMessage && /* @__PURE__ */ jsx54("div", { className: "mb-4 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive", children: errorMessage }),
|
|
17147
|
+
historyError && /* @__PURE__ */ jsx54("div", { className: "mb-4 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900", children: historyError }),
|
|
17148
|
+
showMissingConfig && /* @__PURE__ */ jsx54("div", { className: "mb-4 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900", children: missingConfigDetailMessage }),
|
|
17149
|
+
isHistoryLoading && /* @__PURE__ */ jsx54("div", { className: "mb-4 rounded-lg border border-muted px-3 py-2 text-sm text-muted-foreground", children: t("chat.loadingThread") }),
|
|
17150
|
+
messages.length === 0 && !canLoadMoreMessages ? /* @__PURE__ */ jsx54(
|
|
16322
17151
|
StartScreen,
|
|
16323
17152
|
{
|
|
16324
17153
|
startScreen,
|
|
@@ -16327,10 +17156,10 @@ function Chat({
|
|
|
16327
17156
|
promptSendDisabled: isSubmissionBlocked,
|
|
16328
17157
|
promptEditDisabled: isPromptEditDisabled
|
|
16329
17158
|
}
|
|
16330
|
-
) : /* @__PURE__ */
|
|
16331
|
-
canLoadMoreMessages && /* @__PURE__ */
|
|
16332
|
-
/* @__PURE__ */
|
|
16333
|
-
/* @__PURE__ */
|
|
17159
|
+
) : /* @__PURE__ */ jsxs37("div", { className: "space-y-4", children: [
|
|
17160
|
+
canLoadMoreMessages && /* @__PURE__ */ jsxs37("div", { className: "flex items-center gap-3 py-1", children: [
|
|
17161
|
+
/* @__PURE__ */ jsx54("div", { className: "h-px min-w-8 flex-1 bg-border" }),
|
|
17162
|
+
/* @__PURE__ */ jsx54(
|
|
16334
17163
|
Button,
|
|
16335
17164
|
{
|
|
16336
17165
|
type: "button",
|
|
@@ -16342,7 +17171,7 @@ function Chat({
|
|
|
16342
17171
|
children: isLoadingMoreMessages ? t("chat.loadingMoreMessages") : t("chat.loadMoreMessages")
|
|
16343
17172
|
}
|
|
16344
17173
|
),
|
|
16345
|
-
/* @__PURE__ */
|
|
17174
|
+
/* @__PURE__ */ jsx54("div", { className: "h-px min-w-8 flex-1 bg-border" })
|
|
16346
17175
|
] }),
|
|
16347
17176
|
messages.map((message, index) => {
|
|
16348
17177
|
const messageType = String(message.type);
|
|
@@ -16379,7 +17208,7 @@ function Chat({
|
|
|
16379
17208
|
if (!isAssistantMessage && !hasPlainRenderableContent && !hasHumanAttachments && humanRuntimeCapabilityOptions.length === 0 && humanReferences.length === 0) {
|
|
16380
17209
|
return null;
|
|
16381
17210
|
}
|
|
16382
|
-
return /* @__PURE__ */
|
|
17211
|
+
return /* @__PURE__ */ jsx54(
|
|
16383
17212
|
"div",
|
|
16384
17213
|
{
|
|
16385
17214
|
className: cn(
|
|
@@ -16387,7 +17216,7 @@ function Chat({
|
|
|
16387
17216
|
message.type === "human" ? "justify-end" : "justify-start -ml-1"
|
|
16388
17217
|
// AI messages: slightly closer to left
|
|
16389
17218
|
),
|
|
16390
|
-
children: /* @__PURE__ */
|
|
17219
|
+
children: /* @__PURE__ */ jsxs37(
|
|
16391
17220
|
"div",
|
|
16392
17221
|
{
|
|
16393
17222
|
className: cn(
|
|
@@ -16395,7 +17224,7 @@ function Chat({
|
|
|
16395
17224
|
isAssistantMessage && "min-w-0 flex-1"
|
|
16396
17225
|
),
|
|
16397
17226
|
children: [
|
|
16398
|
-
/* @__PURE__ */
|
|
17227
|
+
/* @__PURE__ */ jsx54(
|
|
16399
17228
|
"div",
|
|
16400
17229
|
{
|
|
16401
17230
|
...canQuoteMessage ? {
|
|
@@ -16407,7 +17236,7 @@ function Chat({
|
|
|
16407
17236
|
message.type === "human" ? "bg-primary text-primary-foreground px-4 py-2.5" : message.type === "system" ? "bg-muted text-muted-foreground text-xs px-4 py-2.5" : "py-1 text-chat-foreground"
|
|
16408
17237
|
// AI messages: use chat-specific foreground color
|
|
16409
17238
|
),
|
|
16410
|
-
children: isAssistantMessage ? /* @__PURE__ */
|
|
17239
|
+
children: isAssistantMessage ? /* @__PURE__ */ jsx54(
|
|
16411
17240
|
AssistantMessage,
|
|
16412
17241
|
{
|
|
16413
17242
|
message: {
|
|
@@ -16426,25 +17255,25 @@ function Chat({
|
|
|
16426
17255
|
organizationId: stream.organizationId,
|
|
16427
17256
|
apiUrl: stream.apiUrl
|
|
16428
17257
|
}
|
|
16429
|
-
) : /* @__PURE__ */
|
|
16430
|
-
message.type === "human" && humanRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */
|
|
17258
|
+
) : /* @__PURE__ */ jsxs37(Fragment9, { children: [
|
|
17259
|
+
message.type === "human" && humanRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ jsx54("div", { className: "mb-2 flex flex-wrap gap-1.5", children: humanRuntimeCapabilityOptions.map((option) => /* @__PURE__ */ jsxs37(
|
|
16431
17260
|
"span",
|
|
16432
17261
|
{
|
|
16433
17262
|
className: "inline-flex max-w-full items-center gap-1 rounded-md bg-primary-foreground/20 px-2 py-1 text-xs font-medium text-primary-foreground",
|
|
16434
17263
|
children: [
|
|
16435
|
-
/* @__PURE__ */
|
|
17264
|
+
/* @__PURE__ */ jsx54(
|
|
16436
17265
|
RuntimeCapabilityIcon,
|
|
16437
17266
|
{
|
|
16438
17267
|
option,
|
|
16439
17268
|
variant: "chip"
|
|
16440
17269
|
}
|
|
16441
17270
|
),
|
|
16442
|
-
/* @__PURE__ */
|
|
17271
|
+
/* @__PURE__ */ jsx54("span", { className: "max-w-[9rem] truncate", children: option.label })
|
|
16443
17272
|
]
|
|
16444
17273
|
},
|
|
16445
17274
|
`${option.type}:${option.id}`
|
|
16446
17275
|
)) }),
|
|
16447
|
-
message.type === "human" && humanReferences.length > 0 && /* @__PURE__ */
|
|
17276
|
+
message.type === "human" && humanReferences.length > 0 && /* @__PURE__ */ jsx54("div", { className: "mb-2 flex flex-wrap gap-1.5", children: humanReferences.map((reference) => /* @__PURE__ */ jsx54(
|
|
16448
17277
|
ReferenceChip,
|
|
16449
17278
|
{
|
|
16450
17279
|
reference,
|
|
@@ -16452,29 +17281,29 @@ function Chat({
|
|
|
16452
17281
|
},
|
|
16453
17282
|
getReferenceKey(reference)
|
|
16454
17283
|
)) }),
|
|
16455
|
-
message.type === "human" && humanAttachments.length > 0 && /* @__PURE__ */
|
|
17284
|
+
message.type === "human" && humanAttachments.length > 0 && /* @__PURE__ */ jsx54("div", { className: "flex flex-wrap gap-1.5 mb-2", children: humanAttachments.map((file, fileIndex) => /* @__PURE__ */ jsxs37(
|
|
16456
17285
|
"div",
|
|
16457
17286
|
{
|
|
16458
17287
|
className: "flex items-center gap-1.5 rounded-md bg-primary-foreground/20 px-2 py-1 text-xs",
|
|
16459
17288
|
children: [
|
|
16460
|
-
/* @__PURE__ */
|
|
16461
|
-
/* @__PURE__ */
|
|
17289
|
+
/* @__PURE__ */ jsx54(FileText5, { size: 12 }),
|
|
17290
|
+
/* @__PURE__ */ jsx54("span", { className: "max-w-[100px] truncate", children: file.originalName ?? file.id })
|
|
16462
17291
|
]
|
|
16463
17292
|
},
|
|
16464
17293
|
fileIndex
|
|
16465
17294
|
)) }),
|
|
16466
|
-
Array.isArray(message.content) ? message.content.map((part, partIndex) => /* @__PURE__ */
|
|
17295
|
+
Array.isArray(message.content) ? message.content.map((part, partIndex) => /* @__PURE__ */ jsx54(
|
|
16467
17296
|
"p",
|
|
16468
17297
|
{
|
|
16469
17298
|
className: "wrap-break-word text-sm leading-relaxed",
|
|
16470
17299
|
children: formatMessageContent(part)
|
|
16471
17300
|
},
|
|
16472
17301
|
`${part.type}-${partIndex}`
|
|
16473
|
-
)) : /* @__PURE__ */
|
|
17302
|
+
)) : /* @__PURE__ */ jsx54("span", { className: "wrap-break-word text-sm leading-relaxed", children: formatMessageContent(message.content) })
|
|
16474
17303
|
] })
|
|
16475
17304
|
}
|
|
16476
17305
|
),
|
|
16477
|
-
/* @__PURE__ */
|
|
17306
|
+
/* @__PURE__ */ jsx54(
|
|
16478
17307
|
MessageActions,
|
|
16479
17308
|
{
|
|
16480
17309
|
content: messageContent,
|
|
@@ -16512,7 +17341,7 @@ function Chat({
|
|
|
16512
17341
|
stream.isLoading,
|
|
16513
17342
|
{ now: streamingNow }
|
|
16514
17343
|
);
|
|
16515
|
-
return /* @__PURE__ */
|
|
17344
|
+
return /* @__PURE__ */ jsx54("div", { className: "flex justify-start gap-3 -ml-2", children: /* @__PURE__ */ jsx54("div", { className: "max-w-full rounded-2xl py-2.5", children: /* @__PURE__ */ jsx54(
|
|
16516
17345
|
AssistantStreamingIndicator,
|
|
16517
17346
|
{
|
|
16518
17347
|
status: fallbackStreamingStatus ?? "loading"
|
|
@@ -16521,7 +17350,7 @@ function Chat({
|
|
|
16521
17350
|
})()
|
|
16522
17351
|
] })
|
|
16523
17352
|
] }),
|
|
16524
|
-
!isAtBottom && messages.length > 0 && /* @__PURE__ */
|
|
17353
|
+
!isAtBottom && messages.length > 0 && /* @__PURE__ */ jsx54("div", { className: "sticky bottom-20 z-20 flex justify-center px-4 pointer-events-none", children: /* @__PURE__ */ jsx54(
|
|
16525
17354
|
Button,
|
|
16526
17355
|
{
|
|
16527
17356
|
type: "button",
|
|
@@ -16534,10 +17363,10 @@ function Chat({
|
|
|
16534
17363
|
onClick: () => scrollToBottom(true, true),
|
|
16535
17364
|
"aria-label": t("chat.scrollToBottom"),
|
|
16536
17365
|
title: t("chat.scrollToBottom"),
|
|
16537
|
-
children: /* @__PURE__ */
|
|
17366
|
+
children: /* @__PURE__ */ jsx54(ArrowDown2, { size: 16 })
|
|
16538
17367
|
}
|
|
16539
17368
|
) }),
|
|
16540
|
-
quoteSelection && /* @__PURE__ */
|
|
17369
|
+
quoteSelection && /* @__PURE__ */ jsx54(
|
|
16541
17370
|
"div",
|
|
16542
17371
|
{
|
|
16543
17372
|
className: "pointer-events-none fixed z-50",
|
|
@@ -16546,7 +17375,7 @@ function Chat({
|
|
|
16546
17375
|
left: `${quoteSelection.left}px`,
|
|
16547
17376
|
transform: "translateX(-50%)"
|
|
16548
17377
|
},
|
|
16549
|
-
children: /* @__PURE__ */
|
|
17378
|
+
children: /* @__PURE__ */ jsxs37(
|
|
16550
17379
|
Button,
|
|
16551
17380
|
{
|
|
16552
17381
|
type: "button",
|
|
@@ -16558,16 +17387,16 @@ function Chat({
|
|
|
16558
17387
|
"aria-label": t("composer.quoteSelection"),
|
|
16559
17388
|
title: t("composer.quoteSelection"),
|
|
16560
17389
|
children: [
|
|
16561
|
-
/* @__PURE__ */
|
|
17390
|
+
/* @__PURE__ */ jsx54(Quote, { size: 14 }),
|
|
16562
17391
|
t("composer.quoteSelection")
|
|
16563
17392
|
]
|
|
16564
17393
|
}
|
|
16565
17394
|
)
|
|
16566
17395
|
}
|
|
16567
17396
|
),
|
|
16568
|
-
/* @__PURE__ */
|
|
16569
|
-
threadErrorMessage && /* @__PURE__ */
|
|
16570
|
-
/* @__PURE__ */
|
|
17397
|
+
/* @__PURE__ */ jsxs37("div", { className: "p-2 sticky bottom-0 z-10 bg-background", children: [
|
|
17398
|
+
threadErrorMessage && /* @__PURE__ */ jsx54("div", { className: "mb-3 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive overflow-auto", children: threadErrorMessage }),
|
|
17399
|
+
/* @__PURE__ */ jsx54(
|
|
16571
17400
|
ChatAttachments,
|
|
16572
17401
|
{
|
|
16573
17402
|
ref: attachmentsRef,
|
|
@@ -16581,7 +17410,7 @@ function Chat({
|
|
|
16581
17410
|
onStateChange: setAttachmentState
|
|
16582
17411
|
}
|
|
16583
17412
|
),
|
|
16584
|
-
references.length > 0 && /* @__PURE__ */
|
|
17413
|
+
references.length > 0 && /* @__PURE__ */ jsx54("div", { className: "mb-3 flex flex-wrap gap-2", children: references.map((reference) => /* @__PURE__ */ jsx54(
|
|
16585
17414
|
ReferenceChip,
|
|
16586
17415
|
{
|
|
16587
17416
|
reference,
|
|
@@ -16595,16 +17424,16 @@ function Chat({
|
|
|
16595
17424
|
},
|
|
16596
17425
|
getReferenceKey(reference)
|
|
16597
17426
|
)) }),
|
|
16598
|
-
detachedRunRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */
|
|
16599
|
-
/* @__PURE__ */
|
|
16600
|
-
detachedRunRuntimeCapabilityOptions.map((option) => /* @__PURE__ */
|
|
17427
|
+
detachedRunRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */ jsxs37("div", { className: "mb-2 flex flex-wrap items-center gap-2", children: [
|
|
17428
|
+
/* @__PURE__ */ jsx54("span", { className: "text-xs text-muted-foreground", children: t("composer.capabilities.runOnly") }),
|
|
17429
|
+
detachedRunRuntimeCapabilityOptions.map((option) => /* @__PURE__ */ jsxs37(
|
|
16601
17430
|
"span",
|
|
16602
17431
|
{
|
|
16603
17432
|
className: "inline-flex max-w-full items-center gap-1 rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary",
|
|
16604
17433
|
children: [
|
|
16605
|
-
/* @__PURE__ */
|
|
16606
|
-
/* @__PURE__ */
|
|
16607
|
-
/* @__PURE__ */
|
|
17434
|
+
/* @__PURE__ */ jsx54(RuntimeCapabilityIcon, { option, variant: "chip" }),
|
|
17435
|
+
/* @__PURE__ */ jsx54("span", { className: "max-w-40 truncate", children: option.label }),
|
|
17436
|
+
/* @__PURE__ */ jsx54(
|
|
16608
17437
|
"button",
|
|
16609
17438
|
{
|
|
16610
17439
|
type: "button",
|
|
@@ -16612,7 +17441,7 @@ function Chat({
|
|
|
16612
17441
|
className: "rounded-full p-0.5 hover:bg-primary/15",
|
|
16613
17442
|
title: t("composer.capabilities.removeRunCapability"),
|
|
16614
17443
|
"aria-label": t("composer.capabilities.removeRunCapability"),
|
|
16615
|
-
children: /* @__PURE__ */
|
|
17444
|
+
children: /* @__PURE__ */ jsx54(X6, { size: 11 })
|
|
16616
17445
|
}
|
|
16617
17446
|
)
|
|
16618
17447
|
]
|
|
@@ -16620,7 +17449,7 @@ function Chat({
|
|
|
16620
17449
|
`${option.type}:${option.id}`
|
|
16621
17450
|
))
|
|
16622
17451
|
] }),
|
|
16623
|
-
showGoalStatus && /* @__PURE__ */
|
|
17452
|
+
showGoalStatus && /* @__PURE__ */ jsxs37(
|
|
16624
17453
|
"div",
|
|
16625
17454
|
{
|
|
16626
17455
|
className: cn(
|
|
@@ -16628,7 +17457,7 @@ function Chat({
|
|
|
16628
17457
|
isGoalObjectiveExpanded ? "items-start" : "items-center"
|
|
16629
17458
|
),
|
|
16630
17459
|
children: [
|
|
16631
|
-
/* @__PURE__ */
|
|
17460
|
+
/* @__PURE__ */ jsx54(
|
|
16632
17461
|
Target2,
|
|
16633
17462
|
{
|
|
16634
17463
|
className: cn(
|
|
@@ -16637,13 +17466,13 @@ function Chat({
|
|
|
16637
17466
|
)
|
|
16638
17467
|
}
|
|
16639
17468
|
),
|
|
16640
|
-
/* @__PURE__ */
|
|
16641
|
-
/* @__PURE__ */
|
|
16642
|
-
/* @__PURE__ */
|
|
16643
|
-
threadGoal && /* @__PURE__ */
|
|
16644
|
-
isGoalLoading && /* @__PURE__ */
|
|
17469
|
+
/* @__PURE__ */ jsxs37("div", { className: "min-w-0 flex-1", children: [
|
|
17470
|
+
/* @__PURE__ */ jsxs37("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
17471
|
+
/* @__PURE__ */ jsx54("span", { className: "font-medium", children: t("chat.goal.label") }),
|
|
17472
|
+
threadGoal && /* @__PURE__ */ jsx54("span", { className: "shrink-0 rounded-md bg-muted px-1.5 py-0.5 text-[11px] text-muted-foreground", children: t(`chat.goal.status.${threadGoal.status}`) }),
|
|
17473
|
+
isGoalLoading && /* @__PURE__ */ jsx54(Loader29, { className: "size-3 animate-spin text-muted-foreground" })
|
|
16645
17474
|
] }),
|
|
16646
|
-
/* @__PURE__ */
|
|
17475
|
+
/* @__PURE__ */ jsx54(
|
|
16647
17476
|
"div",
|
|
16648
17477
|
{
|
|
16649
17478
|
className: cn(
|
|
@@ -16653,13 +17482,13 @@ function Chat({
|
|
|
16653
17482
|
children: goalError || threadGoal?.objective
|
|
16654
17483
|
}
|
|
16655
17484
|
),
|
|
16656
|
-
threadGoal && /* @__PURE__ */
|
|
17485
|
+
threadGoal && /* @__PURE__ */ jsx54("div", { className: "mt-1 flex flex-wrap gap-x-3 gap-y-1 text-[11px] text-muted-foreground", children: /* @__PURE__ */ jsx54("span", { children: t("chat.goal.elapsed", {
|
|
16657
17486
|
elapsed: formatGoalElapsed(displayedGoalElapsedSeconds)
|
|
16658
17487
|
}) }) })
|
|
16659
17488
|
] }),
|
|
16660
|
-
threadGoal && /* @__PURE__ */
|
|
16661
|
-
/* @__PURE__ */
|
|
16662
|
-
/* @__PURE__ */
|
|
17489
|
+
threadGoal && /* @__PURE__ */ jsxs37("div", { className: "flex shrink-0 items-center gap-1", children: [
|
|
17490
|
+
/* @__PURE__ */ jsxs37(Tooltip, { children: [
|
|
17491
|
+
/* @__PURE__ */ jsx54(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx54(
|
|
16663
17492
|
Button,
|
|
16664
17493
|
{
|
|
16665
17494
|
type: "button",
|
|
@@ -16670,13 +17499,13 @@ function Chat({
|
|
|
16670
17499
|
const prefix = "/goal edit ";
|
|
16671
17500
|
setComposerText(`${prefix}${threadGoal.objective}`);
|
|
16672
17501
|
},
|
|
16673
|
-
children: /* @__PURE__ */
|
|
17502
|
+
children: /* @__PURE__ */ jsx54(Pencil4, { className: "size-3" })
|
|
16674
17503
|
}
|
|
16675
17504
|
) }),
|
|
16676
|
-
/* @__PURE__ */
|
|
17505
|
+
/* @__PURE__ */ jsx54(TooltipContent, { children: t("chat.goal.edit") })
|
|
16677
17506
|
] }),
|
|
16678
|
-
/* @__PURE__ */
|
|
16679
|
-
/* @__PURE__ */
|
|
17507
|
+
/* @__PURE__ */ jsxs37(Tooltip, { children: [
|
|
17508
|
+
/* @__PURE__ */ jsx54(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx54(
|
|
16680
17509
|
Button,
|
|
16681
17510
|
{
|
|
16682
17511
|
type: "button",
|
|
@@ -16692,13 +17521,13 @@ function Chat({
|
|
|
16692
17521
|
executionType: "insert_invocation"
|
|
16693
17522
|
}
|
|
16694
17523
|
}),
|
|
16695
|
-
children: threadGoal.status === "paused" ? /* @__PURE__ */
|
|
17524
|
+
children: threadGoal.status === "paused" ? /* @__PURE__ */ jsx54(Play, { className: "size-3" }) : /* @__PURE__ */ jsx54(Pause, { className: "size-3" })
|
|
16696
17525
|
}
|
|
16697
17526
|
) }),
|
|
16698
|
-
/* @__PURE__ */
|
|
17527
|
+
/* @__PURE__ */ jsx54(TooltipContent, { children: threadGoal.status === "paused" ? t("chat.goal.resume") : t("chat.goal.pause") })
|
|
16699
17528
|
] }),
|
|
16700
|
-
/* @__PURE__ */
|
|
16701
|
-
/* @__PURE__ */
|
|
17529
|
+
/* @__PURE__ */ jsxs37(Tooltip, { children: [
|
|
17530
|
+
/* @__PURE__ */ jsx54(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx54(
|
|
16702
17531
|
Button,
|
|
16703
17532
|
{
|
|
16704
17533
|
type: "button",
|
|
@@ -16714,13 +17543,13 @@ function Chat({
|
|
|
16714
17543
|
executionType: "insert_invocation"
|
|
16715
17544
|
}
|
|
16716
17545
|
}),
|
|
16717
|
-
children: /* @__PURE__ */
|
|
17546
|
+
children: /* @__PURE__ */ jsx54(Trash23, { className: "size-3" })
|
|
16718
17547
|
}
|
|
16719
17548
|
) }),
|
|
16720
|
-
/* @__PURE__ */
|
|
17549
|
+
/* @__PURE__ */ jsx54(TooltipContent, { children: t("chat.goal.clear") })
|
|
16721
17550
|
] }),
|
|
16722
|
-
threadGoal.objective && !goalError && /* @__PURE__ */
|
|
16723
|
-
/* @__PURE__ */
|
|
17551
|
+
threadGoal.objective && !goalError && /* @__PURE__ */ jsxs37(Tooltip, { children: [
|
|
17552
|
+
/* @__PURE__ */ jsx54(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx54(
|
|
16724
17553
|
Button,
|
|
16725
17554
|
{
|
|
16726
17555
|
type: "button",
|
|
@@ -16729,7 +17558,7 @@ function Chat({
|
|
|
16729
17558
|
"aria-expanded": isGoalObjectiveExpanded,
|
|
16730
17559
|
"aria-label": isGoalObjectiveExpanded ? t("chat.goal.collapseObjective") : t("chat.goal.expandObjective"),
|
|
16731
17560
|
onClick: () => setIsGoalObjectiveExpanded((expanded) => !expanded),
|
|
16732
|
-
children: /* @__PURE__ */
|
|
17561
|
+
children: /* @__PURE__ */ jsx54(
|
|
16733
17562
|
ChevronDown5,
|
|
16734
17563
|
{
|
|
16735
17564
|
className: cn(
|
|
@@ -16740,13 +17569,13 @@ function Chat({
|
|
|
16740
17569
|
)
|
|
16741
17570
|
}
|
|
16742
17571
|
) }),
|
|
16743
|
-
/* @__PURE__ */
|
|
17572
|
+
/* @__PURE__ */ jsx54(TooltipContent, { children: isGoalObjectiveExpanded ? t("chat.goal.collapseObjective") : t("chat.goal.expandObjective") })
|
|
16744
17573
|
] })
|
|
16745
17574
|
] })
|
|
16746
17575
|
]
|
|
16747
17576
|
}
|
|
16748
17577
|
),
|
|
16749
|
-
/* @__PURE__ */
|
|
17578
|
+
/* @__PURE__ */ jsx54(
|
|
16750
17579
|
PendingRuntimeServices,
|
|
16751
17580
|
{
|
|
16752
17581
|
state: stream.runtimeActivities.sandboxServices,
|
|
@@ -16755,7 +17584,7 @@ function Chat({
|
|
|
16755
17584
|
className: hasPendingTodos || hasPendingFollowUps ? "mb-2" : void 0
|
|
16756
17585
|
}
|
|
16757
17586
|
),
|
|
16758
|
-
/* @__PURE__ */
|
|
17587
|
+
/* @__PURE__ */ jsx54(
|
|
16759
17588
|
PendingTodos,
|
|
16760
17589
|
{
|
|
16761
17590
|
snapshot: stream.todos,
|
|
@@ -16763,7 +17592,7 @@ function Chat({
|
|
|
16763
17592
|
className: hasPendingFollowUps ? "mb-2" : void 0
|
|
16764
17593
|
}
|
|
16765
17594
|
),
|
|
16766
|
-
/* @__PURE__ */
|
|
17595
|
+
/* @__PURE__ */ jsx54(
|
|
16767
17596
|
PendingFollowUps,
|
|
16768
17597
|
{
|
|
16769
17598
|
items: pendingFollowUps,
|
|
@@ -16776,7 +17605,7 @@ function Chat({
|
|
|
16776
17605
|
attachToComposer: true
|
|
16777
17606
|
}
|
|
16778
17607
|
),
|
|
16779
|
-
/* @__PURE__ */
|
|
17608
|
+
/* @__PURE__ */ jsx54(
|
|
16780
17609
|
RequestUserInputPanel,
|
|
16781
17610
|
{
|
|
16782
17611
|
request: stream.pendingRequestUserInput,
|
|
@@ -16785,7 +17614,7 @@ function Chat({
|
|
|
16785
17614
|
attachToComposer: true
|
|
16786
17615
|
}
|
|
16787
17616
|
),
|
|
16788
|
-
/* @__PURE__ */
|
|
17617
|
+
/* @__PURE__ */ jsx54(
|
|
16789
17618
|
HITLApprovalPanel,
|
|
16790
17619
|
{
|
|
16791
17620
|
request: stream.pendingHITLRequest,
|
|
@@ -16794,7 +17623,7 @@ function Chat({
|
|
|
16794
17623
|
attachToComposer: true
|
|
16795
17624
|
}
|
|
16796
17625
|
),
|
|
16797
|
-
runtimeCapabilityPalette && /* @__PURE__ */
|
|
17626
|
+
runtimeCapabilityPalette && /* @__PURE__ */ jsx54(
|
|
16798
17627
|
SlashPalette,
|
|
16799
17628
|
{
|
|
16800
17629
|
palette: runtimeCapabilityPalette,
|
|
@@ -16808,7 +17637,7 @@ function Chat({
|
|
|
16808
17637
|
onSelect: selectSlashPaletteOption
|
|
16809
17638
|
}
|
|
16810
17639
|
),
|
|
16811
|
-
/* @__PURE__ */
|
|
17640
|
+
/* @__PURE__ */ jsx54("form", { className: "flex items-end", onSubmit: handleSubmit, children: /* @__PURE__ */ jsxs37(
|
|
16812
17641
|
"div",
|
|
16813
17642
|
{
|
|
16814
17643
|
"data-slot": "composer-input-shell",
|
|
@@ -16822,7 +17651,7 @@ function Chat({
|
|
|
16822
17651
|
composerInputRoundedClass
|
|
16823
17652
|
),
|
|
16824
17653
|
children: [
|
|
16825
|
-
/* @__PURE__ */
|
|
17654
|
+
/* @__PURE__ */ jsx54(
|
|
16826
17655
|
"div",
|
|
16827
17656
|
{
|
|
16828
17657
|
ref: composerInputRef,
|
|
@@ -16844,7 +17673,7 @@ function Chat({
|
|
|
16844
17673
|
(missingConfig || isHistoryLoading || hasPendingInteractiveRequest) && "cursor-not-allowed opacity-50"
|
|
16845
17674
|
),
|
|
16846
17675
|
children: renderedComposerParts.map(
|
|
16847
|
-
(part, index) => part.type === "text" ? /* @__PURE__ */
|
|
17676
|
+
(part, index) => part.type === "text" ? /* @__PURE__ */ jsx54(React49.Fragment, { children: part.text }, `text-${index}`) : /* @__PURE__ */ jsxs37(
|
|
16848
17677
|
"span",
|
|
16849
17678
|
{
|
|
16850
17679
|
"data-composer-capability-key": part.key,
|
|
@@ -16853,14 +17682,14 @@ function Chat({
|
|
|
16853
17682
|
contentEditable: false,
|
|
16854
17683
|
className: "mx-0.5 inline-flex max-w-[14rem] select-none items-center gap-1 text-sm font-semibold text-primary align-baseline",
|
|
16855
17684
|
children: [
|
|
16856
|
-
/* @__PURE__ */
|
|
17685
|
+
/* @__PURE__ */ jsx54(
|
|
16857
17686
|
RuntimeCapabilityIcon,
|
|
16858
17687
|
{
|
|
16859
17688
|
option: part.capability,
|
|
16860
17689
|
variant: "chip"
|
|
16861
17690
|
}
|
|
16862
17691
|
),
|
|
16863
|
-
/* @__PURE__ */
|
|
17692
|
+
/* @__PURE__ */ jsx54("span", { className: "truncate", children: part.capability.label })
|
|
16864
17693
|
]
|
|
16865
17694
|
},
|
|
16866
17695
|
part.key
|
|
@@ -16869,14 +17698,14 @@ function Chat({
|
|
|
16869
17698
|
},
|
|
16870
17699
|
composerDomVersion
|
|
16871
17700
|
),
|
|
16872
|
-
/* @__PURE__ */
|
|
17701
|
+
/* @__PURE__ */ jsxs37(
|
|
16873
17702
|
"div",
|
|
16874
17703
|
{
|
|
16875
17704
|
"data-slot": "composer-action-bar",
|
|
16876
17705
|
className: "pointer-events-none absolute inset-x-1.5 bottom-1 flex min-h-10 items-center justify-between gap-2",
|
|
16877
17706
|
children: [
|
|
16878
|
-
/* @__PURE__ */
|
|
16879
|
-
/* @__PURE__ */
|
|
17707
|
+
/* @__PURE__ */ jsxs37("div", { className: "pointer-events-none flex min-w-0 flex-1 items-center gap-1.5", children: [
|
|
17708
|
+
/* @__PURE__ */ jsx54("div", { className: "pointer-events-auto flex shrink-0 items-center gap-1.5", children: /* @__PURE__ */ jsx54(
|
|
16880
17709
|
ComposerMenu,
|
|
16881
17710
|
{
|
|
16882
17711
|
composer,
|
|
@@ -16894,20 +17723,20 @@ function Chat({
|
|
|
16894
17723
|
disabled: missingConfig || isHistoryLoading || hasPendingInteractiveRequest
|
|
16895
17724
|
}
|
|
16896
17725
|
) }),
|
|
16897
|
-
selectedTool && /* @__PURE__ */
|
|
16898
|
-
/* @__PURE__ */
|
|
16899
|
-
/* @__PURE__ */
|
|
17726
|
+
selectedTool && /* @__PURE__ */ jsxs37("span", { className: "pointer-events-auto inline-flex h-8 min-w-0 max-w-[14rem] shrink items-center gap-1.5 rounded-full bg-primary/10 px-2 text-xs font-medium text-primary transition-all duration-200", children: [
|
|
17727
|
+
/* @__PURE__ */ jsx54("span", { className: "truncate", children: selectedTool.shortLabel ?? selectedTool.label }),
|
|
17728
|
+
/* @__PURE__ */ jsx54(
|
|
16900
17729
|
"button",
|
|
16901
17730
|
{
|
|
16902
17731
|
type: "button",
|
|
16903
17732
|
onClick: () => setSelectedTool(null),
|
|
16904
17733
|
className: "shrink-0 rounded-full p-0.5 text-primary/70 hover:bg-primary/10 hover:text-primary",
|
|
16905
|
-
children: /* @__PURE__ */
|
|
17734
|
+
children: /* @__PURE__ */ jsx54(X6, { size: 12 })
|
|
16906
17735
|
}
|
|
16907
17736
|
)
|
|
16908
17737
|
] })
|
|
16909
17738
|
] }),
|
|
16910
|
-
/* @__PURE__ */
|
|
17739
|
+
/* @__PURE__ */ jsx54("div", { className: "pointer-events-auto shrink-0", children: /* @__PURE__ */ jsx54(
|
|
16911
17740
|
SendButton,
|
|
16912
17741
|
{
|
|
16913
17742
|
disabled: isSendDisabled,
|
|
@@ -16930,7 +17759,7 @@ function Chat({
|
|
|
16930
17759
|
]
|
|
16931
17760
|
}
|
|
16932
17761
|
) }),
|
|
16933
|
-
disclaimer?.text && /* @__PURE__ */
|
|
17762
|
+
disclaimer?.text && /* @__PURE__ */ jsx54(
|
|
16934
17763
|
"p",
|
|
16935
17764
|
{
|
|
16936
17765
|
className: cn(
|
|
@@ -16940,12 +17769,12 @@ function Chat({
|
|
|
16940
17769
|
children: disclaimer.text
|
|
16941
17770
|
}
|
|
16942
17771
|
),
|
|
16943
|
-
/* @__PURE__ */
|
|
16944
|
-
/* @__PURE__ */
|
|
16945
|
-
/* @__PURE__ */
|
|
17772
|
+
/* @__PURE__ */ jsxs37("div", { className: "mt-2 flex items-center justify-center gap-2 text-xs text-muted-foreground", children: [
|
|
17773
|
+
/* @__PURE__ */ jsx54("span", { children: t("chat.poweredBy") }),
|
|
17774
|
+
/* @__PURE__ */ jsx54(ContextUsageIndicator, { className: "absolute right-4" })
|
|
16946
17775
|
] })
|
|
16947
17776
|
] }),
|
|
16948
|
-
/* @__PURE__ */
|
|
17777
|
+
/* @__PURE__ */ jsx54(
|
|
16949
17778
|
SettingsSheet,
|
|
16950
17779
|
{
|
|
16951
17780
|
open: petSettingsOpen,
|
|
@@ -16955,17 +17784,17 @@ function Chat({
|
|
|
16955
17784
|
onSave: savePetLocalSettings
|
|
16956
17785
|
}
|
|
16957
17786
|
),
|
|
16958
|
-
/* @__PURE__ */
|
|
17787
|
+
/* @__PURE__ */ jsx54(PetBridge, { pet: effectivePet, state: petAutoState })
|
|
16959
17788
|
]
|
|
16960
17789
|
}
|
|
16961
17790
|
);
|
|
16962
17791
|
}
|
|
16963
17792
|
|
|
16964
17793
|
// src/components/ui/separator.tsx
|
|
16965
|
-
import * as
|
|
16966
|
-
import { jsx as
|
|
16967
|
-
var Separator =
|
|
16968
|
-
({ className, orientation = "horizontal", ...props }, ref) => /* @__PURE__ */
|
|
17794
|
+
import * as React50 from "react";
|
|
17795
|
+
import { jsx as jsx55 } from "react/jsx-runtime";
|
|
17796
|
+
var Separator = React50.forwardRef(
|
|
17797
|
+
({ className, orientation = "horizontal", ...props }, ref) => /* @__PURE__ */ jsx55(
|
|
16969
17798
|
"div",
|
|
16970
17799
|
{
|
|
16971
17800
|
ref,
|