@xpert-ai/chatkit-ui 0.3.20 → 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-dO9u_ouJ.js → _baseUniq-DgIHlkQm.js} +1 -1
- package/dist/app/assets/{abap-0mUJM--r.js → abap-lB8VLppN.js} +1 -1
- package/dist/app/assets/{abnf-DKGxGp8Z.js → abnf-CMm-FA7V.js} +1 -1
- package/dist/app/assets/{actionscript-DtO_0ylO.js → actionscript-C44LZKx4.js} +1 -1
- package/dist/app/assets/{ada-DCuTzTIT.js → ada-BL4d2yHl.js} +1 -1
- package/dist/app/assets/{agda-CqhS82in.js → agda-DUeBOfao.js} +1 -1
- package/dist/app/assets/{al-DGtNqkyL.js → al-r379MYUc.js} +1 -1
- package/dist/app/assets/{antlr4-BGE2dxa_.js → antlr4-BhepIW3H.js} +1 -1
- package/dist/app/assets/{apacheconf-Dd1EMcOJ.js → apacheconf-ZblTvauv.js} +1 -1
- package/dist/app/assets/{apex-Dp2zfXlN.js → apex-DXCjRfej.js} +1 -1
- package/dist/app/assets/{apl-Cxj8FQdm.js → apl-0mvw9LXG.js} +1 -1
- package/dist/app/assets/{applescript-D1uoFy80.js → applescript-s8Oxmrfz.js} +1 -1
- package/dist/app/assets/{aql-DGOYHZfO.js → aql-BMN4x1O3.js} +1 -1
- package/dist/app/assets/{arc-CSSgPkN1.js → arc-xNYJT0Sf.js} +1 -1
- package/dist/app/assets/{architectureDiagram-Q4EWVU46-BN7Ayh3h.js → architectureDiagram-Q4EWVU46-B3lvRgUo.js} +1 -1
- package/dist/app/assets/{arduino-BorrL9gm.js → arduino-daTjF253.js} +1 -1
- package/dist/app/assets/{arff-DxHxsjkc.js → arff-DxxxOwyy.js} +1 -1
- package/dist/app/assets/{asciidoc-CxU0US1U.js → asciidoc-B0aClqCc.js} +1 -1
- package/dist/app/assets/{asm6502-Dyy6pjI8.js → asm6502-BsfejLyD.js} +1 -1
- package/dist/app/assets/{asmatmel-Dr8p_P1f.js → asmatmel-BQPOdk6m.js} +1 -1
- package/dist/app/assets/{aspnet-B4z81enL.js → aspnet-CI7Ah4u1.js} +1 -1
- package/dist/app/assets/{autohotkey-BGyfWN1i.js → autohotkey-IQAyKsEZ.js} +1 -1
- package/dist/app/assets/{autoit-Xligx8s2.js → autoit-Cc50euDJ.js} +1 -1
- package/dist/app/assets/{avisynth-CUaqko0w.js → avisynth-D_3k61Mh.js} +1 -1
- package/dist/app/assets/{avro-idl-CrBvsyQE.js → avro-idl-Dakyv0EK.js} +1 -1
- package/dist/app/assets/{bash-CpEeAKNU.js → bash-CK4ls-uk.js} +1 -1
- package/dist/app/assets/{basic-DyvwR5ul.js → basic-sAy-3U_-.js} +1 -1
- package/dist/app/assets/{batch-CAnM992n.js → batch-BULEa0VP.js} +1 -1
- package/dist/app/assets/{bbcode-Bds1cYRC.js → bbcode-mxGKgZDu.js} +1 -1
- package/dist/app/assets/{bicep-Ch2CQn9H.js → bicep-DxUd9L5w.js} +1 -1
- package/dist/app/assets/{birb-D9ZtmdxE.js → birb-CT9d0Hfg.js} +1 -1
- package/dist/app/assets/{bison-CS7U9ElI.js → bison-CJWctWOI.js} +1 -1
- package/dist/app/assets/{blockDiagram-DXYQGD6D-WguPOWUb.js → blockDiagram-DXYQGD6D-D-AjcpQ4.js} +1 -1
- package/dist/app/assets/{bnf-DGZM-tVS.js → bnf-BfiH5qUl.js} +1 -1
- package/dist/app/assets/{brainfuck-DyAfQENG.js → brainfuck-BXCfmtpc.js} +1 -1
- package/dist/app/assets/{brightscript-C1LlTbYI.js → brightscript-B8Se3L7d.js} +1 -1
- package/dist/app/assets/{bro-DBtyBs7j.js → bro-BYNaGskD.js} +1 -1
- package/dist/app/assets/{bsl-CIws9jBl.js → bsl-rAkCQZce.js} +1 -1
- package/dist/app/assets/{c-CFDrZLe4.js → c-BLwhDOSO.js} +1 -1
- package/dist/app/assets/{c4Diagram-AHTNJAMY-RtYhntJz.js → c4Diagram-AHTNJAMY-CqDIUKeo.js} +1 -1
- package/dist/app/assets/{cfscript-CtivxrTV.js → cfscript-BEVtIJMz.js} +1 -1
- package/dist/app/assets/{chaiscript-CZzVXweq.js → chaiscript-DcH2srx5.js} +1 -1
- package/dist/app/assets/channel-CI-ehimI.js +1 -0
- package/dist/app/assets/{chunk-4BX2VUAB-CXkxcnLB.js → chunk-4BX2VUAB-m_kyuUbe.js} +1 -1
- package/dist/app/assets/{chunk-4TB4RGXK-DiI3vXpV.js → chunk-4TB4RGXK-BjqYS6Yy.js} +1 -1
- package/dist/app/assets/{chunk-55IACEB6-BbmFk-DA.js → chunk-55IACEB6-oWAL2kJR.js} +1 -1
- package/dist/app/assets/{chunk-EDXVE4YY-MjXpiNnM.js → chunk-EDXVE4YY-BR40heM4.js} +1 -1
- package/dist/app/assets/{chunk-FMBD7UC4-DYgOt2vm.js → chunk-FMBD7UC4-Bv7-5Ls-.js} +1 -1
- package/dist/app/assets/{chunk-OYMX7WX6-kKZSMF0R.js → chunk-OYMX7WX6-CIKeB20i.js} +1 -1
- package/dist/app/assets/{chunk-QZHKN3VN-CiXg8Cbu.js → chunk-QZHKN3VN-CBk_nqgS.js} +1 -1
- package/dist/app/assets/{chunk-YZCP3GAM-pPNMK4mQ.js → chunk-YZCP3GAM-DbrAyIeM.js} +1 -1
- package/dist/app/assets/{cil-DoAmknqy.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-DwlmdH1o.js → clike-DWwvlcID.js} +1 -1
- package/dist/app/assets/{clojure-CFznyY-8.js → clojure-m5aYwMVY.js} +1 -1
- package/dist/app/assets/clone-70-rkKhs.js +1 -0
- package/dist/app/assets/{cmake-CcUYbAkX.js → cmake-D1AphalP.js} +1 -1
- package/dist/app/assets/{cobol-DRgBRGN9.js → cobol-DfRj-gRZ.js} +1 -1
- package/dist/app/assets/{coffeescript-Bo7rHazJ.js → coffeescript-DBVw6hft.js} +1 -1
- package/dist/app/assets/{concurnas-B4Cy2ldU.js → concurnas-p-HBsubn.js} +1 -1
- package/dist/app/assets/{coq-CMgtMpjq.js → coq-DpEsabSd.js} +1 -1
- package/dist/app/assets/{core-BYh6RTIo.js → core-Bu1sMhBI.js} +1 -1
- package/dist/app/assets/{cose-bilkent-S5V4N54A-C46_8K97.js → cose-bilkent-S5V4N54A-Bu1oc34k.js} +1 -1
- package/dist/app/assets/{cpp-ggzE8h3n.js → cpp-DWOjniRs.js} +1 -1
- package/dist/app/assets/{crystal-JYb0cXRo.js → crystal-CQJ7kmd6.js} +1 -1
- package/dist/app/assets/{csharp-Dfy28CKx.js → csharp-D7MPpOcK.js} +1 -1
- package/dist/app/assets/{cshtml-D9iKfsWo.js → cshtml-DKqAFWTy.js} +1 -1
- package/dist/app/assets/{csp-Cv5xhFMf.js → csp-CdccqHH0.js} +1 -1
- package/dist/app/assets/{css-BlnX_aMm.js → css-CF8Mhm8t.js} +1 -1
- package/dist/app/assets/{css-extras-EAMuHsg4.js → css-extras-BzYoJo_2.js} +1 -1
- package/dist/app/assets/{csv-ETLeI9yB.js → csv-BkNUxNGN.js} +1 -1
- package/dist/app/assets/{cypher-CbiYD0C6.js → cypher-B6Ago4_f.js} +1 -1
- package/dist/app/assets/{d-BLr7DSZ_.js → d-0OD8he-p.js} +1 -1
- package/dist/app/assets/{dagre-KV5264BT-DVX0nAWn.js → dagre-KV5264BT-CtnwN-Dh.js} +1 -1
- package/dist/app/assets/{dart-BUsQiEKs.js → dart-CRBezsEJ.js} +1 -1
- package/dist/app/assets/{dataweave-BYiDcYrB.js → dataweave-C5NSsb9T.js} +1 -1
- package/dist/app/assets/{dax-iosgVacE.js → dax-DA_08-S-.js} +1 -1
- package/dist/app/assets/{dhall-DIQ8EFrC.js → dhall-B5eyKfIX.js} +1 -1
- package/dist/app/assets/{diagram-5BDNPKRD-CbKYwcnw.js → diagram-5BDNPKRD-BWMmYkfv.js} +1 -1
- package/dist/app/assets/{diagram-G4DWMVQ6-4-JjCu5t.js → diagram-G4DWMVQ6-BZqIfTTc.js} +1 -1
- package/dist/app/assets/{diagram-MMDJMWI5-BzKnlGDI.js → diagram-MMDJMWI5--lVSAtvL.js} +1 -1
- package/dist/app/assets/{diagram-TYMM5635-DuwasHtC.js → diagram-TYMM5635-CAdX-pMH.js} +1 -1
- package/dist/app/assets/{diff-DHBSHNgP.js → diff-BcQ3lgLg.js} +1 -1
- package/dist/app/assets/{django-CfRtrcZO.js → django-C_tw_AYj.js} +1 -1
- package/dist/app/assets/{dns-zone-file-BIlXUWGI.js → dns-zone-file-CyqP1EvD.js} +1 -1
- package/dist/app/assets/{docker-DRXwbY0w.js → docker-wz3Lj9Db.js} +1 -1
- package/dist/app/assets/{dot-CqKYiXSR.js → dot-B-DDY2H8.js} +1 -1
- package/dist/app/assets/{ebnf-eSA59aZE.js → ebnf-X2ewhLUy.js} +1 -1
- package/dist/app/assets/{editorconfig-DArWTZiN.js → editorconfig-qcUVBPkT.js} +1 -1
- package/dist/app/assets/{eiffel-BMDMvmAa.js → eiffel-BAqW7pbE.js} +1 -1
- package/dist/app/assets/{ejs-D82JChud.js → ejs-61WKLTYk.js} +1 -1
- package/dist/app/assets/{elixir-C9Jq5FWr.js → elixir-EzFqXZk2.js} +1 -1
- package/dist/app/assets/{elm-VfWYgR_0.js → elm-DmnpDBDa.js} +1 -1
- package/dist/app/assets/{erDiagram-SMLLAGMA-Di9Kvn6n.js → erDiagram-SMLLAGMA-D-t806Qt.js} +1 -1
- package/dist/app/assets/{erb-CEuJHL9b.js → erb-CcQKm2oQ.js} +1 -1
- package/dist/app/assets/{erlang-zlZ7-qY9.js → erlang-DW-WXopd.js} +1 -1
- package/dist/app/assets/{etlua-C1g7aW5E.js → etlua-BJxhJpxy.js} +1 -1
- package/dist/app/assets/{excel-formula-CAYwHvAw.js → excel-formula-7oXshpg3.js} +1 -1
- package/dist/app/assets/{factor-DN7MW_2U.js → factor-BC8WW8Od.js} +1 -1
- package/dist/app/assets/{false-09xZ6VlZ.js → false-C6lXY4VC.js} +1 -1
- package/dist/app/assets/{firestore-security-rules-zq1uGQbY.js → firestore-security-rules-B4dcnH7G.js} +1 -1
- package/dist/app/assets/{flow-CK25t_lW.js → flow-CFpX3faq.js} +1 -1
- package/dist/app/assets/{flowDiagram-DWJPFMVM-BCmFDjmk.js → flowDiagram-DWJPFMVM-BjTXVIWo.js} +1 -1
- package/dist/app/assets/{fortran-CZFYKfOS.js → fortran-RwIGxqZ9.js} +1 -1
- package/dist/app/assets/{fsharp-BbarO2cP.js → fsharp-C5S6wt_8.js} +1 -1
- package/dist/app/assets/{ftl-Ca9Ss-f6.js → ftl-DXTedmzK.js} +1 -1
- package/dist/app/assets/{ganttDiagram-T4ZO3ILL-b_SWQw-B.js → ganttDiagram-T4ZO3ILL-DPqZs20S.js} +1 -1
- package/dist/app/assets/{gap-BDUwxdTV.js → gap-C0KFM8Sn.js} +1 -1
- package/dist/app/assets/{gcode-FzmJqrxN.js → gcode-Ck54RmDV.js} +1 -1
- package/dist/app/assets/{gdscript-X7m3fyWi.js → gdscript-DX_Bezt8.js} +1 -1
- package/dist/app/assets/{gedcom-BIzK9DAz.js → gedcom-54x_GC3_.js} +1 -1
- package/dist/app/assets/{gherkin-BzV1WJ3C.js → gherkin-DpY70MhW.js} +1 -1
- package/dist/app/assets/{git-CWX33q2q.js → git-Bg40h27U.js} +1 -1
- package/dist/app/assets/{gitGraphDiagram-UUTBAWPF-ByifHh7n.js → gitGraphDiagram-UUTBAWPF-CMuB9NDh.js} +1 -1
- package/dist/app/assets/{glsl-DfrDIiov.js → glsl-BcqYx_6I.js} +1 -1
- package/dist/app/assets/{gml-DAbaYzvk.js → gml-DJePf9E6.js} +1 -1
- package/dist/app/assets/{gn-Bl3zMQJx.js → gn-hOkcYKt5.js} +1 -1
- package/dist/app/assets/{go-oQ0wGTRg.js → go-CBdX4RKq.js} +1 -1
- package/dist/app/assets/{go-module-BEwJOHqW.js → go-module-8CqpJAjn.js} +1 -1
- package/dist/app/assets/{graph-RZk9H4ri.js → graph-DiXdxCpd.js} +1 -1
- package/dist/app/assets/{graphql-Cgq8uWTM.js → graphql-DzkHa_Lt.js} +1 -1
- package/dist/app/assets/{groovy-C0gTg-aZ.js → groovy-CuKAytl9.js} +1 -1
- package/dist/app/assets/{haml-Bzk6EfVk.js → haml-BHlOO4D-.js} +1 -1
- package/dist/app/assets/{handlebars-ChszlW4e.js → handlebars-DgTuPlRj.js} +1 -1
- package/dist/app/assets/{haskell-1kh-_Mkx.js → haskell-BYOS6zzQ.js} +1 -1
- package/dist/app/assets/{haxe-Btd4WdA3.js → haxe-QCi0Miq5.js} +1 -1
- package/dist/app/assets/{hcl-Cqh76IbY.js → hcl-DCUWHECM.js} +1 -1
- package/dist/app/assets/{hlsl-ChvI2E6p.js → hlsl-Bp2hwiJd.js} +1 -1
- package/dist/app/assets/{hoon-B9IgXQj0.js → hoon-BzW-9-xp.js} +1 -1
- package/dist/app/assets/{hpkp-DTGGzNzf.js → hpkp-BWPv-cBm.js} +1 -1
- package/dist/app/assets/{hsts-2EGrct05.js → hsts-CJiK6uQM.js} +1 -1
- package/dist/app/assets/{http-1KqK1qH8.js → http-DQlaEk07.js} +1 -1
- package/dist/app/assets/{ichigojam-gVysk7Nt.js → ichigojam-K2-54W_i.js} +1 -1
- package/dist/app/assets/{icon-CarlP8Nz.js → icon-DtDq4nwU.js} +1 -1
- package/dist/app/assets/{icu-message-format-D7lgOAji.js → icu-message-format-CzUzfEvD.js} +1 -1
- package/dist/app/assets/{idris-CJJs2Fpr.js → idris-CZStDvUu.js} +1 -1
- package/dist/app/assets/{iecst-C5LUC-nz.js → iecst-BJn6mRZC.js} +1 -1
- package/dist/app/assets/{ignore-1e8QpoH9.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-DXx3uupu.js → infoDiagram-42DDH7IO-BVqN5Cf-.js} +1 -1
- package/dist/app/assets/{inform7-DeZriFCi.js → inform7-C64PxE5P.js} +1 -1
- package/dist/app/assets/{ini-BhOLfejd.js → ini-D6uyClxM.js} +1 -1
- package/dist/app/assets/{io-9zPt8gSg.js → io-BEddoOXw.js} +1 -1
- package/dist/app/assets/{ishikawaDiagram-UXIWVN3A-R4damDdy.js → ishikawaDiagram-UXIWVN3A-DMCnYQDL.js} +1 -1
- package/dist/app/assets/{j-7GReLLGn.js → j-BZjnLaoD.js} +1 -1
- package/dist/app/assets/{java-lSyPzlvl.js → java-C16BQXmJ.js} +1 -1
- package/dist/app/assets/{javadoc-Vsvu72YU.js → javadoc-Bp_K_1w9.js} +1 -1
- package/dist/app/assets/{javadoclike-Bt2IQS3j.js → javadoclike-CCL57XT3.js} +1 -1
- package/dist/app/assets/{javascript-Bsf_qcep.js → javascript-UKmanPpI.js} +1 -1
- package/dist/app/assets/{javastacktrace-C6eP2Aus.js → javastacktrace-Bt6MmvHK.js} +1 -1
- package/dist/app/assets/{jexl-DUrnRUQQ.js → jexl-BSIE3NAS.js} +1 -1
- package/dist/app/assets/{jolie-CDUYu14B.js → jolie-DwAozljt.js} +1 -1
- package/dist/app/assets/{journeyDiagram-VCZTEJTY-Bv9hwBpp.js → journeyDiagram-VCZTEJTY-hfkm8x7F.js} +1 -1
- package/dist/app/assets/{jq-DJJOyxBz.js → jq-B6HQblEc.js} +1 -1
- package/dist/app/assets/{js-extras-C88FKFNA.js → js-extras-C4kJ0q_P.js} +1 -1
- package/dist/app/assets/{js-templates-sBJ73gs2.js → js-templates-BF0RGSgj.js} +1 -1
- package/dist/app/assets/{jsdoc-CjYZRLbN.js → jsdoc-BaH_CjIP.js} +1 -1
- package/dist/app/assets/{json-DVP15SY5.js → json-JpTWEtLR.js} +1 -1
- package/dist/app/assets/{json5-Bjn67lk5.js → json5-DJHj-rXR.js} +1 -1
- package/dist/app/assets/{jsonp-DHGagYL7.js → jsonp-DpjTc_na.js} +1 -1
- package/dist/app/assets/{jsstacktrace-BOuYaiIh.js → jsstacktrace-DnLa9vhb.js} +1 -1
- package/dist/app/assets/{jsx-Dmo6JTYK.js → jsx-BRHrY2BL.js} +1 -1
- package/dist/app/assets/{julia-_w8lzZbt.js → julia-9zZ-iwP_.js} +1 -1
- package/dist/app/assets/{kanban-definition-6JOO6SKY-Cb_7yCx_.js → kanban-definition-6JOO6SKY-DE3YihJJ.js} +1 -1
- package/dist/app/assets/{keepalived-4LhOS9un.js → keepalived-Uu89aoXa.js} +1 -1
- package/dist/app/assets/{keyman-CUSnTu69.js → keyman-DFGcwqDK.js} +1 -1
- package/dist/app/assets/{kotlin-Bj06xeFi.js → kotlin-LTPAm-Va.js} +1 -1
- package/dist/app/assets/{kumir-DEv-obaC.js → kumir-BcPP82e-.js} +1 -1
- package/dist/app/assets/{kusto-TgM2Lwnw.js → kusto-CxK7uEBf.js} +1 -1
- package/dist/app/assets/{latex-k1SkdLd8.js → latex-CJOru6Xl.js} +1 -1
- package/dist/app/assets/{latte-Cw3lTIBr.js → latte-yocJ797x.js} +1 -1
- package/dist/app/assets/{layout-BXbEHoki.js → layout-CXEXCcrp.js} +1 -1
- package/dist/app/assets/{less-B6n9jGED.js → less-BmacGfdt.js} +1 -1
- package/dist/app/assets/{lilypond-DikIigko.js → lilypond-XADZqv26.js} +1 -1
- package/dist/app/assets/{linear-CUHq8GYQ.js → linear-BoHhQExU.js} +1 -1
- package/dist/app/assets/{liquid-B05mXBd-.js → liquid-DrXu3I4o.js} +1 -1
- package/dist/app/assets/{lisp-BNA9GUrJ.js → lisp-D7GBOEAq.js} +1 -1
- package/dist/app/assets/{livescript-DDl5Qm6x.js → livescript-CYEGDtxo.js} +1 -1
- package/dist/app/assets/{llvm-CcfX96cD.js → llvm-Cg59OFV5.js} +1 -1
- package/dist/app/assets/{log-Dz8L9EqF.js → log-Dgz6RJ76.js} +1 -1
- package/dist/app/assets/{lolcode-BELXPVX3.js → lolcode-BiaQuLMI.js} +1 -1
- package/dist/app/assets/{lua-B78FPW4A.js → lua-A_5_hnzN.js} +1 -1
- package/dist/app/assets/{magma-xNHzxoFq.js → magma-vL3dHSsW.js} +1 -1
- package/dist/app/assets/{makefile-5NEtuhzy.js → makefile-C1iS0HiM.js} +1 -1
- package/dist/app/assets/{markdown-B9k9uhzd.js → markdown-B2oYsnLL.js} +1 -1
- package/dist/app/assets/{markup-BZ34BXR_.js → markup-DfTA_BVw.js} +1 -1
- package/dist/app/assets/{markup-templating-BUyWAFJR.js → markup-templating-Cuy4LPLx.js} +1 -1
- package/dist/app/assets/{matlab-XKcpa9B8.js → matlab-D6BnQC4u.js} +1 -1
- package/dist/app/assets/{maxscript-D4JiPJuC.js → maxscript-C6TABA1u.js} +1 -1
- package/dist/app/assets/{mel-CyK7Q1TM.js → mel-4rfx7Bfv.js} +1 -1
- package/dist/app/assets/{mermaid-Tm2sV_0O.js → mermaid-C9zerIka.js} +1 -1
- package/dist/app/assets/{min-BGC2d4iH.js → min-CYeWfD_S.js} +1 -1
- package/dist/app/assets/{mindmap-definition-QFDTVHPH-C1IURfNU.js → mindmap-definition-QFDTVHPH-DEJyZ1TS.js} +1 -1
- package/dist/app/assets/{mizar-yGz-_EIV.js → mizar-DRgDOhTN.js} +1 -1
- package/dist/app/assets/{mongodb-DAN68-YI.js → mongodb-Bz5t1Kri.js} +1 -1
- package/dist/app/assets/{monkey-Cb6rRr17.js → monkey-DmpKIE8A.js} +1 -1
- package/dist/app/assets/{moonscript-D0FzuIC0.js → moonscript-Detay_Aq.js} +1 -1
- package/dist/app/assets/{n1ql-VtzttBJz.js → n1ql-BmgXbS-M.js} +1 -1
- package/dist/app/assets/{n4js-DdrCzTNg.js → n4js-DmTPdCqi.js} +1 -1
- package/dist/app/assets/{nand2tetris-hdl-CiuFr3Z6.js → nand2tetris-hdl-DXraXq65.js} +1 -1
- package/dist/app/assets/{naniscript-CZmsm3Qe.js → naniscript-B261gwHF.js} +1 -1
- package/dist/app/assets/{nasm-Cz1JvPh7.js → nasm-DjgP63mx.js} +1 -1
- package/dist/app/assets/{neon-CVb_1MMJ.js → neon-BkyLss_j.js} +1 -1
- package/dist/app/assets/{nevod-CgOKEeZN.js → nevod-D3AIDy_-.js} +1 -1
- package/dist/app/assets/{nginx-CMgTpa3W.js → nginx-x6qaHbn6.js} +1 -1
- package/dist/app/assets/{nim-4vicXzfG.js → nim-DEkLs6r2.js} +1 -1
- package/dist/app/assets/{nix-cWZZM13i.js → nix-DKfH6GYJ.js} +1 -1
- package/dist/app/assets/{nsis-IRFq8enS.js → nsis-DdaElZTp.js} +1 -1
- package/dist/app/assets/{objectivec-DCJ0g-mt.js → objectivec-D-GvlelH.js} +1 -1
- package/dist/app/assets/{ocaml-Bq1gHzib.js → ocaml-Bh8mdwPO.js} +1 -1
- package/dist/app/assets/{opencl-D9_IlJyv.js → opencl-DqbqQpJ8.js} +1 -1
- package/dist/app/assets/{openqasm-BX53feNx.js → openqasm-BzHZ1geL.js} +1 -1
- package/dist/app/assets/{oz-BvB8VT8D.js → oz-CAffbl5h.js} +1 -1
- package/dist/app/assets/{parigp-Dbn0ydWU.js → parigp-CKqiqq8G.js} +1 -1
- package/dist/app/assets/{parser-BILFvSNt.js → parser-Cg00t7Mb.js} +1 -1
- package/dist/app/assets/{pascal-C_2x3UBR.js → pascal--toS4iGX.js} +1 -1
- package/dist/app/assets/{pascaligo-C-uFinpv.js → pascaligo-DkkGDPuY.js} +1 -1
- package/dist/app/assets/{pcaxis-CQ2eXcFv.js → pcaxis-YW2drt9P.js} +1 -1
- package/dist/app/assets/{peoplecode-C6SRpjR3.js → peoplecode-DcSxF5p-.js} +1 -1
- package/dist/app/assets/{perl-DWfpmx5P.js → perl-YKp_XolM.js} +1 -1
- package/dist/app/assets/{php-D-7-JbKw.js → php-IihSyd58.js} +1 -1
- package/dist/app/assets/{php-extras-ByoNTDno.js → php-extras-CiYXDTjg.js} +1 -1
- package/dist/app/assets/{phpdoc-De_A0ai1.js → phpdoc-CTwGmVuh.js} +1 -1
- package/dist/app/assets/{pieDiagram-DEJITSTG-uJYQjeIi.js → pieDiagram-DEJITSTG-CYgrtYQD.js} +1 -1
- package/dist/app/assets/{plsql-BJES8Peg.js → plsql-BLbbnpCf.js} +1 -1
- package/dist/app/assets/{powerquery-BuZUrom0.js → powerquery-CW3t8EHf.js} +1 -1
- package/dist/app/assets/{powershell-Ch3rXXK5.js → powershell-Dy-20mWQ.js} +1 -1
- package/dist/app/assets/{processing-ZfE7oiNf.js → processing-DfOUJsGU.js} +1 -1
- package/dist/app/assets/{prolog-BMqE2LJL.js → prolog-Bt7umQZ_.js} +1 -1
- package/dist/app/assets/{promql-BtvdQ5KU.js → promql-BsbEgNrg.js} +1 -1
- package/dist/app/assets/{properties-DyupgQuS.js → properties-0VtNy_J8.js} +1 -1
- package/dist/app/assets/{protobuf-C_n_QYlc.js → protobuf-CnepKVtX.js} +1 -1
- package/dist/app/assets/{psl-VG_i5NJ0.js → psl-OGz4CFKI.js} +1 -1
- package/dist/app/assets/{pug-wG-KUzbN.js → pug-BUMiCGsa.js} +1 -1
- package/dist/app/assets/{puppet-Cygb5ibB.js → puppet-BpwvYCrA.js} +1 -1
- package/dist/app/assets/{pure-f9Y66cTQ.js → pure-u9lIjKsQ.js} +1 -1
- package/dist/app/assets/{purebasic-DE2tn6ax.js → purebasic-BsE8kKSG.js} +1 -1
- package/dist/app/assets/{purescript-DBfL-1W4.js → purescript-D4DGIRwN.js} +1 -1
- package/dist/app/assets/{q-C4FrUHun.js → q-Dd4Y9jTu.js} +1 -1
- package/dist/app/assets/{qml-lg8bHtYT.js → qml-IZqRvexj.js} +1 -1
- package/dist/app/assets/{qore-Dm_t34lE.js → qore-CVgOeY5j.js} +1 -1
- package/dist/app/assets/{qsharp-CdP2k5Ge.js → qsharp-C1ibrSjI.js} +1 -1
- package/dist/app/assets/{quadrantDiagram-34T5L4WZ-C_oB5-WY.js → quadrantDiagram-34T5L4WZ-Hy_efLgq.js} +1 -1
- package/dist/app/assets/{r-d1eAOwoy.js → r-CO3iHGES.js} +1 -1
- package/dist/app/assets/{racket-D-wzkPsR.js → racket-CDsoIwWb.js} +1 -1
- package/dist/app/assets/{reason-Dd4fsFdV.js → reason-BXp7TkTV.js} +1 -1
- package/dist/app/assets/{regex-CYNIq2D2.js → regex-C8d4nMD-.js} +1 -1
- package/dist/app/assets/{rego-Dnu4gFWt.js → rego-CnCdTWPv.js} +1 -1
- package/dist/app/assets/{renpy-CR1Z5gVo.js → renpy-BCpztAT2.js} +1 -1
- package/dist/app/assets/{requirementDiagram-MS252O5E-BDjIBMP9.js → requirementDiagram-MS252O5E-BI0Kue_K.js} +1 -1
- package/dist/app/assets/{rest-eklLtD63.js → rest-DRU6Mo0N.js} +1 -1
- package/dist/app/assets/{rip-MOqQRQUS.js → rip-DGcSsuJR.js} +1 -1
- package/dist/app/assets/{roboconf-DdgXe0cH.js → roboconf-D84u_D2h.js} +1 -1
- package/dist/app/assets/{robotframework-5umczlju.js → robotframework-B55NHCrN.js} +1 -1
- package/dist/app/assets/{ruby-DXk_ALBc.js → ruby-byKCK-dY.js} +1 -1
- package/dist/app/assets/{rust-doHVhnFl.js → rust-DafX95DJ.js} +1 -1
- package/dist/app/assets/{sankeyDiagram-XADWPNL6-DdzGMZhR.js → sankeyDiagram-XADWPNL6-D6MJ50Pq.js} +1 -1
- package/dist/app/assets/{sas-BobJk3Hp.js → sas-DTVLhrey.js} +1 -1
- package/dist/app/assets/{sass-6se6msf0.js → sass-rDhfj9yl.js} +1 -1
- package/dist/app/assets/{scala-BfMmg2GN.js → scala-BrKTyUsE.js} +1 -1
- package/dist/app/assets/{scheme-DPZwWy4g.js → scheme-B_eu29xA.js} +1 -1
- package/dist/app/assets/{scss-nscMYHq7.js → scss-kgRahDzu.js} +1 -1
- package/dist/app/assets/{sequenceDiagram-FGHM5R23-DloNcfwf.js → sequenceDiagram-FGHM5R23-BtFJlKLA.js} +1 -1
- package/dist/app/assets/{shell-session-CXhfVmEP.js → shell-session-CF0mJgux.js} +1 -1
- package/dist/app/assets/{smali-DovRTy6y.js → smali-cYYyD8tY.js} +1 -1
- package/dist/app/assets/{smalltalk-DvYEu6hN.js → smalltalk-C0P2MRK9.js} +1 -1
- package/dist/app/assets/{smarty-bepA2LFV.js → smarty-bSAEKlze.js} +1 -1
- package/dist/app/assets/{sml-CHAt1iCr.js → sml-CVkWiohq.js} +1 -1
- package/dist/app/assets/{solidity-AzC8UVTD.js → solidity-DBmi5l50.js} +1 -1
- package/dist/app/assets/{solution-file-CuIcDmO5.js → solution-file-CnTT-bB0.js} +1 -1
- package/dist/app/assets/{soy-BqhfLUlA.js → soy-D6Pv-4-M.js} +1 -1
- package/dist/app/assets/{sparql-BxMY2jr9.js → sparql-C_FSzEBv.js} +1 -1
- package/dist/app/assets/{splunk-spl-DPMmo4nN.js → splunk-spl-BY7Iqglg.js} +1 -1
- package/dist/app/assets/{sqf-D-9uf3KY.js → sqf-CPktPAhH.js} +1 -1
- package/dist/app/assets/{sql-B8R0FHwG.js → sql-o4K_-hAR.js} +1 -1
- package/dist/app/assets/{squirrel-Bza7MU1Z.js → squirrel-C7nc0I9a.js} +1 -1
- package/dist/app/assets/{stan-BcarQztx.js → stan-BaHsDAPv.js} +1 -1
- package/dist/app/assets/{stateDiagram-FHFEXIEX-Cdho2yx_.js → stateDiagram-FHFEXIEX-Jt84X8Km.js} +1 -1
- package/dist/app/assets/stateDiagram-v2-QKLJ7IA2-2fuYX60f.js +1 -0
- package/dist/app/assets/{stylus-BdwnU_Je.js → stylus-LrKOfqx1.js} +1 -1
- package/dist/app/assets/{swift-GardvYRU.js → swift-Du5HvL9Z.js} +1 -1
- package/dist/app/assets/{systemd-BoEN0I28.js → systemd-B9G8EDGS.js} +1 -1
- package/dist/app/assets/{t4-cs-DUsOTeNI.js → t4-cs-Cx16HVWP.js} +1 -1
- package/dist/app/assets/{t4-templating-D2600IbH.js → t4-templating-8EFI9hGP.js} +1 -1
- package/dist/app/assets/{t4-vb-D1Q0eOQa.js → t4-vb-DY4dRQ0Y.js} +1 -1
- package/dist/app/assets/{tap-Bx92xV60.js → tap-CnPjcybx.js} +1 -1
- package/dist/app/assets/{tcl-BXRtWK0m.js → tcl-CyN53FjG.js} +1 -1
- package/dist/app/assets/{textile-5TDjaphc.js → textile-CcaFbMIR.js} +1 -1
- package/dist/app/assets/{timeline-definition-GMOUNBTQ-BDqwqFsf.js → timeline-definition-GMOUNBTQ-BIX9PrwR.js} +1 -1
- package/dist/app/assets/{toml-2OJRuBjR.js → toml-Dsv-Gf-x.js} +1 -1
- package/dist/app/assets/{tremor-AXCzTiPp.js → tremor-CFgQf23a.js} +1 -1
- package/dist/app/assets/{tt2-CVHTmv1T.js → tt2-C35x8-ln.js} +1 -1
- package/dist/app/assets/{turtle-CEbdA-5Y.js → turtle-mi4wNaqz.js} +1 -1
- package/dist/app/assets/{twig-CyJqSctJ.js → twig--0LWYrgK.js} +1 -1
- package/dist/app/assets/{typescript-BgZtngSj.js → typescript-TITb6K2H.js} +1 -1
- package/dist/app/assets/{typoscript-DHfRoJFl.js → typoscript-D9-RVwIo.js} +1 -1
- package/dist/app/assets/{unrealscript-D0jLY_Tm.js → unrealscript-CEl7HM5o.js} +1 -1
- package/dist/app/assets/{uorazor-B-UCiHn2.js → uorazor-D_Rffmzi.js} +1 -1
- package/dist/app/assets/{uri-BVY3aqDB.js → uri-BrG_tFHQ.js} +1 -1
- package/dist/app/assets/{v-BQL7Jc1c.js → v-CSrNrMZT.js} +1 -1
- package/dist/app/assets/{vala-BAK1DdPV.js → vala-lXeoxFEf.js} +1 -1
- package/dist/app/assets/{vbnet-DcCYNaHo.js → vbnet-CDvW0IYg.js} +1 -1
- package/dist/app/assets/{velocity-XnhHLUFX.js → velocity-CsuMf7zZ.js} +1 -1
- package/dist/app/assets/{vennDiagram-DHZGUBPP-CX64m0DJ.js → vennDiagram-DHZGUBPP-Bd1_DGNK.js} +1 -1
- package/dist/app/assets/{verilog-Dzt9jIMc.js → verilog-Ba1kXwcH.js} +1 -1
- package/dist/app/assets/{vhdl-DDBB3YGF.js → vhdl-DC7iDUsg.js} +1 -1
- package/dist/app/assets/{vim-DECEaMbi.js → vim-m5sIDmbL.js} +1 -1
- package/dist/app/assets/{visual-basic-DneMYd1t.js → visual-basic-CZAxZhXd.js} +1 -1
- package/dist/app/assets/{wardley-RL74JXVD-D5xiqeaK.js → wardley-RL74JXVD-Bi7eSfh4.js} +1 -1
- package/dist/app/assets/{wardleyDiagram-NUSXRM2D-LbamXo90.js → wardleyDiagram-NUSXRM2D-C5W1iA0y.js} +1 -1
- package/dist/app/assets/{warpscript-8iin9jnq.js → warpscript-YqE12jpR.js} +1 -1
- package/dist/app/assets/{wasm-B0juytjb.js → wasm-Cqk0NwrL.js} +1 -1
- package/dist/app/assets/{web-idl-BjnZSr8j.js → web-idl-BBz8nwvE.js} +1 -1
- package/dist/app/assets/{wiki-BDydxMmb.js → wiki-DTaDNr2a.js} +1 -1
- package/dist/app/assets/{wolfram-CxjIcLma.js → wolfram-D_dyKsVO.js} +1 -1
- package/dist/app/assets/{wren-DBqoey6C.js → wren-VhlSRnur.js} +1 -1
- package/dist/app/assets/{xeora-DHnKIwPt.js → xeora-C3d3uHWl.js} +1 -1
- package/dist/app/assets/{xml-doc-DHuvjsXL.js → xml-doc-Dn8dXLkg.js} +1 -1
- package/dist/app/assets/{xojo-BWvXjR5v.js → xojo-D7cO_F-x.js} +1 -1
- package/dist/app/assets/{xquery-Bfh3oq_u.js → xquery-C1brqcan.js} +1 -1
- package/dist/app/assets/{xychartDiagram-5P7HB3ND-ZoHhPQCM.js → xychartDiagram-5P7HB3ND-CPn62Rvn.js} +1 -1
- package/dist/app/assets/{yaml-BwzzB-wQ.js → yaml-CucHvpnq.js} +1 -1
- package/dist/app/assets/{yang--lhggci0.js → yang-BwF0d5Qn.js} +1 -1
- package/dist/app/assets/{zig-B-HUmzlq.js → zig-Bi_ZcakP.js} +1 -1
- package/dist/app/index.html +2 -2
- package/dist/index.cjs +1437 -587
- package/dist/index.js +1417 -565
- package/package.json +3 -3
- package/dist/app/assets/channel-D2P4ANqW.js +0 -1
- package/dist/app/assets/classDiagram-6PBFFD2Q-BMjJP3qv.js +0 -1
- package/dist/app/assets/classDiagram-v2-HSJHXN6E-BMjJP3qv.js +0 -1
- package/dist/app/assets/clone-DoQzxKYE.js +0 -1
- package/dist/app/assets/index-DKNbfCqG.js +0 -754
- package/dist/app/assets/index-DpEwCIj4.css +0 -1
- package/dist/app/assets/stateDiagram-v2-QKLJ7IA2-DesWGtpp.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,
|
|
@@ -1515,7 +1515,8 @@ var en_US_default = {
|
|
|
1515
1515
|
regenerate: "Regenerate response"
|
|
1516
1516
|
},
|
|
1517
1517
|
startScreen: {
|
|
1518
|
-
greeting: "What can I help with today?"
|
|
1518
|
+
greeting: "What can I help with today?",
|
|
1519
|
+
editPrompt: "Edit prompt"
|
|
1519
1520
|
},
|
|
1520
1521
|
composer: {
|
|
1521
1522
|
openMenu: "Open menu",
|
|
@@ -1904,7 +1905,8 @@ var zh_CN_default = {
|
|
|
1904
1905
|
regenerate: "\u91CD\u65B0\u751F\u6210\u56DE\u590D"
|
|
1905
1906
|
},
|
|
1906
1907
|
startScreen: {
|
|
1907
|
-
greeting: "\u4ECA\u5929\u6211\u80FD\u5E2E\u4F60\u4EC0\u4E48\uFF1F"
|
|
1908
|
+
greeting: "\u4ECA\u5929\u6211\u80FD\u5E2E\u4F60\u4EC0\u4E48\uFF1F",
|
|
1909
|
+
editPrompt: "\u7F16\u8F91\u5E38\u7528\u95EE\u9898"
|
|
1908
1910
|
},
|
|
1909
1911
|
composer: {
|
|
1910
1912
|
openMenu: "\u6253\u5F00\u83DC\u5355",
|
|
@@ -7736,8 +7738,8 @@ function useSlashCommands({
|
|
|
7736
7738
|
}
|
|
7737
7739
|
|
|
7738
7740
|
// src/components/thread/messages/ai.tsx
|
|
7739
|
-
import * as
|
|
7740
|
-
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";
|
|
7741
7743
|
|
|
7742
7744
|
// src/lib/agent-run-render-tree.ts
|
|
7743
7745
|
function isTextContent(content) {
|
|
@@ -11659,8 +11661,829 @@ function hasLegacySurface(surface) {
|
|
|
11659
11661
|
return !!surface?.componentTree;
|
|
11660
11662
|
}
|
|
11661
11663
|
|
|
11662
|
-
// 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";
|
|
11663
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";
|
|
11664
12487
|
var assistantMessageStackClassName = "space-y-3 in-data-[density=compact]:space-y-2 in-data-[density=spacious]:space-y-4";
|
|
11665
12488
|
function isTextContent3(content) {
|
|
11666
12489
|
return content.type === "text";
|
|
@@ -11678,6 +12501,9 @@ function isWidgetComponent2(content) {
|
|
|
11678
12501
|
const data = content.data;
|
|
11679
12502
|
return data?.type === "Widget" && Array.isArray(data.widgets);
|
|
11680
12503
|
}
|
|
12504
|
+
function isMcpAppComponent(content) {
|
|
12505
|
+
return isMcpAppComponentData(content.data);
|
|
12506
|
+
}
|
|
11681
12507
|
function isMemoryContent(content) {
|
|
11682
12508
|
return content.type === "memory";
|
|
11683
12509
|
}
|
|
@@ -11696,11 +12522,11 @@ function ReasoningBlock({
|
|
|
11696
12522
|
}) {
|
|
11697
12523
|
const blocks = reasoning.filter((item) => item.text?.trim());
|
|
11698
12524
|
if (blocks.length === 0) return null;
|
|
11699
|
-
return /* @__PURE__ */
|
|
12525
|
+
return /* @__PURE__ */ jsx42("div", { className: "space-y-2", children: blocks.map((item, index) => /* @__PURE__ */ jsx42(
|
|
11700
12526
|
"div",
|
|
11701
12527
|
{
|
|
11702
12528
|
className: "rounded-lg border bg-muted/40 p-3 text-xs text-muted-foreground",
|
|
11703
|
-
children: /* @__PURE__ */
|
|
12529
|
+
children: /* @__PURE__ */ jsx42("p", { className: "whitespace-pre-wrap wrap-break-word leading-relaxed", children: item.text })
|
|
11704
12530
|
},
|
|
11705
12531
|
item.id ?? `reasoning-${index}`
|
|
11706
12532
|
)) });
|
|
@@ -11708,12 +12534,12 @@ function ReasoningBlock({
|
|
|
11708
12534
|
function ImageBlock({ content }) {
|
|
11709
12535
|
const imageUrl = typeof content.image_url === "string" ? content.image_url : typeof content.image_url?.url === "string" ? content.image_url.url : null;
|
|
11710
12536
|
if (!imageUrl) {
|
|
11711
|
-
return /* @__PURE__ */
|
|
11712
|
-
/* @__PURE__ */
|
|
11713
|
-
/* @__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) })
|
|
11714
12540
|
] });
|
|
11715
12541
|
}
|
|
11716
|
-
return /* @__PURE__ */
|
|
12542
|
+
return /* @__PURE__ */ jsx42("figure", { className: "overflow-hidden rounded-lg border bg-background", children: /* @__PURE__ */ jsx42(
|
|
11717
12543
|
"img",
|
|
11718
12544
|
{
|
|
11719
12545
|
src: imageUrl,
|
|
@@ -11723,12 +12549,12 @@ function ImageBlock({ content }) {
|
|
|
11723
12549
|
) });
|
|
11724
12550
|
}
|
|
11725
12551
|
function MemoryBlock({ content }) {
|
|
11726
|
-
return /* @__PURE__ */
|
|
11727
|
-
/* @__PURE__ */
|
|
11728
|
-
/* @__PURE__ */
|
|
11729
|
-
/* @__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" })
|
|
11730
12556
|
] }),
|
|
11731
|
-
/* @__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 ?? []) }) })
|
|
11732
12558
|
] });
|
|
11733
12559
|
}
|
|
11734
12560
|
function parseStepDate2(value) {
|
|
@@ -11762,11 +12588,11 @@ function formatStepDuration3(durationMs) {
|
|
|
11762
12588
|
}
|
|
11763
12589
|
function ComponentBlock({ content }) {
|
|
11764
12590
|
const { i18n: i18n2 } = useChatkitTranslation();
|
|
11765
|
-
const [isExpanded, setIsExpanded] =
|
|
11766
|
-
const contentRef =
|
|
11767
|
-
const shouldAutoScrollRef =
|
|
11768
|
-
const previousScrollTopRef =
|
|
11769
|
-
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());
|
|
11770
12596
|
const data = getToolStepData(content);
|
|
11771
12597
|
const category = data.category ?? "Component";
|
|
11772
12598
|
const title = getToolActivityLabel(content, i18n2.language);
|
|
@@ -11780,10 +12606,10 @@ function ComponentBlock({ content }) {
|
|
|
11780
12606
|
const endedAt = parseStepDate2(data.end_date);
|
|
11781
12607
|
const durationMs = createdAt === null ? null : Math.max(0, (endedAt ?? durationNow) - createdAt);
|
|
11782
12608
|
const durationLabel = durationMs === null ? null : formatStepDuration3(durationMs);
|
|
11783
|
-
|
|
12609
|
+
React36.useEffect(() => {
|
|
11784
12610
|
if (status === "running" && output !== null) setIsExpanded(true);
|
|
11785
12611
|
}, [status, output]);
|
|
11786
|
-
|
|
12612
|
+
React36.useEffect(() => {
|
|
11787
12613
|
if (status !== "running" || createdAt === null || endedAt !== null) {
|
|
11788
12614
|
return;
|
|
11789
12615
|
}
|
|
@@ -11795,7 +12621,7 @@ function ComponentBlock({ content }) {
|
|
|
11795
12621
|
window.clearInterval(timer);
|
|
11796
12622
|
};
|
|
11797
12623
|
}, [createdAt, endedAt, status]);
|
|
11798
|
-
|
|
12624
|
+
React36.useEffect(() => {
|
|
11799
12625
|
const element = contentRef.current;
|
|
11800
12626
|
if (!element) return;
|
|
11801
12627
|
previousScrollTopRef.current = element.scrollTop;
|
|
@@ -11817,7 +12643,7 @@ function ComponentBlock({ content }) {
|
|
|
11817
12643
|
element.removeEventListener("scroll", updateAutoScrollState);
|
|
11818
12644
|
};
|
|
11819
12645
|
}, [isExpanded]);
|
|
11820
|
-
|
|
12646
|
+
React36.useEffect(() => {
|
|
11821
12647
|
if (status !== "running") {
|
|
11822
12648
|
shouldAutoScrollRef.current = true;
|
|
11823
12649
|
return;
|
|
@@ -11830,15 +12656,15 @@ function ComponentBlock({ content }) {
|
|
|
11830
12656
|
}, [isExpanded, output, status]);
|
|
11831
12657
|
const config = status ? toolStatusConfig[status] : null;
|
|
11832
12658
|
const StatusIcon = config?.icon;
|
|
11833
|
-
return /* @__PURE__ */
|
|
11834
|
-
/* @__PURE__ */
|
|
12659
|
+
return /* @__PURE__ */ jsxs29(Card, { children: [
|
|
12660
|
+
/* @__PURE__ */ jsxs29(
|
|
11835
12661
|
CardHeader,
|
|
11836
12662
|
{
|
|
11837
12663
|
className: "flex flex-row items-center justify-between gap-2 px-2 py-1 cursor-pointer",
|
|
11838
12664
|
onClick: () => setIsExpanded(!isExpanded),
|
|
11839
12665
|
children: [
|
|
11840
|
-
/* @__PURE__ */
|
|
11841
|
-
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(
|
|
11842
12668
|
StatusIcon,
|
|
11843
12669
|
{
|
|
11844
12670
|
className: cn(
|
|
@@ -11848,20 +12674,20 @@ function ComponentBlock({ content }) {
|
|
|
11848
12674
|
)
|
|
11849
12675
|
}
|
|
11850
12676
|
),
|
|
11851
|
-
/* @__PURE__ */
|
|
12677
|
+
/* @__PURE__ */ jsx42(CardTitle, { className: "text-sm truncate", children: title })
|
|
11852
12678
|
] }),
|
|
11853
|
-
/* @__PURE__ */
|
|
11854
|
-
durationLabel && /* @__PURE__ */
|
|
11855
|
-
/* @__PURE__ */
|
|
11856
|
-
/* @__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 })
|
|
11857
12683
|
] }),
|
|
11858
|
-
/* @__PURE__ */
|
|
11859
|
-
/* @__PURE__ */
|
|
12684
|
+
/* @__PURE__ */ jsx42(Badge, { variant: "secondary", className: "rounded-lg px-1.5", children: category }),
|
|
12685
|
+
/* @__PURE__ */ jsx42(
|
|
11860
12686
|
"button",
|
|
11861
12687
|
{
|
|
11862
12688
|
className: "text-muted-foreground hover:text-foreground transition-colors",
|
|
11863
12689
|
"aria-label": isExpanded ? "Collapse" : "Expand",
|
|
11864
|
-
children: /* @__PURE__ */
|
|
12690
|
+
children: /* @__PURE__ */ jsx42(
|
|
11865
12691
|
ChevronDown4,
|
|
11866
12692
|
{
|
|
11867
12693
|
className: cn(
|
|
@@ -11876,53 +12702,53 @@ function ComponentBlock({ content }) {
|
|
|
11876
12702
|
]
|
|
11877
12703
|
}
|
|
11878
12704
|
),
|
|
11879
|
-
isExpanded && /* @__PURE__ */
|
|
12705
|
+
isExpanded && /* @__PURE__ */ jsxs29(
|
|
11880
12706
|
CardContent,
|
|
11881
12707
|
{
|
|
11882
12708
|
ref: contentRef,
|
|
11883
12709
|
className: "text-xs text-muted-foreground max-h-60 overflow-auto",
|
|
11884
12710
|
children: [
|
|
11885
|
-
data.input && /* @__PURE__ */
|
|
11886
|
-
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) })
|
|
11887
12713
|
]
|
|
11888
12714
|
}
|
|
11889
12715
|
)
|
|
11890
12716
|
] });
|
|
11891
12717
|
}
|
|
11892
12718
|
function UnknownBlock({ content }) {
|
|
11893
|
-
return /* @__PURE__ */
|
|
11894
|
-
/* @__PURE__ */
|
|
11895
|
-
/* @__PURE__ */
|
|
11896
|
-
/* @__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" })
|
|
11897
12723
|
] }),
|
|
11898
|
-
/* @__PURE__ */
|
|
12724
|
+
/* @__PURE__ */ jsx42(CardContent, { className: "text-xs text-muted-foreground", children: /* @__PURE__ */ jsx42("pre", { className: "whitespace-pre-wrap break-words", children: safeJson3(content) }) })
|
|
11899
12725
|
] });
|
|
11900
12726
|
}
|
|
11901
12727
|
function renderContentItem(content, index, message, lookupMessages, options) {
|
|
11902
12728
|
const messageId = message.id;
|
|
11903
12729
|
const textClassName = options?.isAgentOutput ? "text-sm [&_.markdown-content_p]:!leading-6" : void 0;
|
|
11904
12730
|
if (typeof content === "string") {
|
|
11905
|
-
return /* @__PURE__ */
|
|
12731
|
+
return /* @__PURE__ */ jsx42("div", { className: textClassName, children: /* @__PURE__ */ jsx42(MarkdownText, { children: content }) }, `text-${index}`);
|
|
11906
12732
|
}
|
|
11907
12733
|
if (isThreadContextUsageRenderArtifact(content)) {
|
|
11908
12734
|
return null;
|
|
11909
12735
|
}
|
|
11910
12736
|
if (isTextContent3(content)) {
|
|
11911
|
-
return /* @__PURE__ */
|
|
12737
|
+
return /* @__PURE__ */ jsx42("div", { className: textClassName, children: /* @__PURE__ */ jsx42(MarkdownText, { children: content.text }) }, content.id ?? `text-${index}`);
|
|
11912
12738
|
}
|
|
11913
12739
|
if (isReasoningContent3(content)) {
|
|
11914
|
-
return /* @__PURE__ */
|
|
12740
|
+
return /* @__PURE__ */ jsx42("div", { children: /* @__PURE__ */ jsx42(ReasoningBlock, { reasoning: [content] }) }, content.id ?? `reasoning-${index}`);
|
|
11915
12741
|
}
|
|
11916
12742
|
if (isImageContent(content)) {
|
|
11917
|
-
return /* @__PURE__ */
|
|
12743
|
+
return /* @__PURE__ */ jsx42("div", { children: /* @__PURE__ */ jsx42(ImageBlock, { content }) }, content.id ?? `image-${index}`);
|
|
11918
12744
|
}
|
|
11919
12745
|
if (isComponentContent3(content)) {
|
|
11920
12746
|
if (isContextCompressionComponent(content)) {
|
|
11921
|
-
return /* @__PURE__ */
|
|
12747
|
+
return /* @__PURE__ */ jsx42(
|
|
11922
12748
|
"div",
|
|
11923
12749
|
{
|
|
11924
12750
|
className: "w-full",
|
|
11925
|
-
children: /* @__PURE__ */
|
|
12751
|
+
children: /* @__PURE__ */ jsx42(ContextCompressionMessage, { content })
|
|
11926
12752
|
},
|
|
11927
12753
|
content.id ?? `context-compression-${index}`
|
|
11928
12754
|
);
|
|
@@ -11932,13 +12758,16 @@ function renderContentItem(content, index, message, lookupMessages, options) {
|
|
|
11932
12758
|
lookupMessages
|
|
11933
12759
|
);
|
|
11934
12760
|
if (requestUserInputResult) {
|
|
11935
|
-
return /* @__PURE__ */
|
|
12761
|
+
return /* @__PURE__ */ jsx42("div", { children: /* @__PURE__ */ jsx42(RequestUserInputResultCard, { result: requestUserInputResult }) }, content.id ?? `request-user-input-result-${index}`);
|
|
11936
12762
|
}
|
|
11937
12763
|
if (isWidgetComponent2(content)) {
|
|
11938
|
-
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}`);
|
|
11939
12768
|
}
|
|
11940
12769
|
if (getComponentMessagePresentation(content, getToolStepData(content)) === "grouped-step") {
|
|
11941
|
-
return /* @__PURE__ */
|
|
12770
|
+
return /* @__PURE__ */ jsx42("div", { children: /* @__PURE__ */ jsx42(
|
|
11942
12771
|
ToolComponentGroup,
|
|
11943
12772
|
{
|
|
11944
12773
|
items: [content],
|
|
@@ -11949,15 +12778,15 @@ function renderContentItem(content, index, message, lookupMessages, options) {
|
|
|
11949
12778
|
}
|
|
11950
12779
|
) }, content.id ?? `component-group-${index}`);
|
|
11951
12780
|
}
|
|
11952
|
-
return /* @__PURE__ */
|
|
12781
|
+
return /* @__PURE__ */ jsx42("div", { children: /* @__PURE__ */ jsx42(ComponentBlock, { content }) }, content.id ?? `component-${index}`);
|
|
11953
12782
|
}
|
|
11954
12783
|
if (isMemoryContent(content)) {
|
|
11955
|
-
return /* @__PURE__ */
|
|
12784
|
+
return /* @__PURE__ */ jsx42("div", { children: /* @__PURE__ */ jsx42(MemoryBlock, { content }) }, content.id ?? `memory-${index}`);
|
|
11956
12785
|
}
|
|
11957
12786
|
if (isAgentEventContent(content)) {
|
|
11958
|
-
return /* @__PURE__ */
|
|
12787
|
+
return /* @__PURE__ */ jsx42("div", { children: /* @__PURE__ */ jsx42(AgentEventRow, { content }) }, content.id ?? `agent-event-${index}`);
|
|
11959
12788
|
}
|
|
11960
|
-
return /* @__PURE__ */
|
|
12789
|
+
return /* @__PURE__ */ jsx42("div", { children: /* @__PURE__ */ jsx42(UnknownBlock, { content }) }, content.id ?? `unknown-${index}`);
|
|
11961
12790
|
}
|
|
11962
12791
|
function renderContentUnit(unit, message, lookupMessages, hasFollowingItem, options) {
|
|
11963
12792
|
if (unit.type === "item") {
|
|
@@ -11968,7 +12797,7 @@ function renderContentUnit(unit, message, lookupMessages, hasFollowingItem, opti
|
|
|
11968
12797
|
isAgentOutput: options?.isAgentOutput
|
|
11969
12798
|
});
|
|
11970
12799
|
}
|
|
11971
|
-
return /* @__PURE__ */
|
|
12800
|
+
return /* @__PURE__ */ jsx42("div", { children: /* @__PURE__ */ jsx42(
|
|
11972
12801
|
ToolComponentGroup,
|
|
11973
12802
|
{
|
|
11974
12803
|
items: unit.items,
|
|
@@ -11984,7 +12813,7 @@ function renderEntryBatch(entries, message, lookupMessages, hasFollowingItem, op
|
|
|
11984
12813
|
const renderUnits = buildToolComponentRenderUnits(
|
|
11985
12814
|
entries.map((entry) => entry.item),
|
|
11986
12815
|
{
|
|
11987
|
-
shouldGroupComponent: (item) => getRequestUserInputResultCardData(item, lookupMessages) === null
|
|
12816
|
+
shouldGroupComponent: (item) => getRequestUserInputResultCardData(item, lookupMessages) === null && !isMcpAppComponent(item)
|
|
11988
12817
|
}
|
|
11989
12818
|
);
|
|
11990
12819
|
return renderUnits.map(
|
|
@@ -12005,7 +12834,7 @@ function renderAssistantRenderUnits(units, message, lookupMessages, options, dep
|
|
|
12005
12834
|
const batch = entryBatch;
|
|
12006
12835
|
entryBatch = [];
|
|
12007
12836
|
rendered.push(
|
|
12008
|
-
/* @__PURE__ */
|
|
12837
|
+
/* @__PURE__ */ jsx42(React36.Fragment, { children: renderEntryBatch(batch, message, lookupMessages, hasFollowingItem, {
|
|
12009
12838
|
...options,
|
|
12010
12839
|
isAgentOutput: depth > 0
|
|
12011
12840
|
}) }, `entries-${batch[0]?.order ?? rendered.length}`)
|
|
@@ -12022,7 +12851,7 @@ function renderAssistantRenderUnits(units, message, lookupMessages, options, dep
|
|
|
12022
12851
|
}
|
|
12023
12852
|
flushEntries(true);
|
|
12024
12853
|
rendered.push(
|
|
12025
|
-
/* @__PURE__ */
|
|
12854
|
+
/* @__PURE__ */ jsx42(
|
|
12026
12855
|
AgentRunGroup,
|
|
12027
12856
|
{
|
|
12028
12857
|
node: unit.node,
|
|
@@ -12047,7 +12876,7 @@ function renderContent(message, lookupMessages, options) {
|
|
|
12047
12876
|
message
|
|
12048
12877
|
);
|
|
12049
12878
|
if (renderTree.hasAgentRuns) {
|
|
12050
|
-
return /* @__PURE__ */
|
|
12879
|
+
return /* @__PURE__ */ jsx42("div", { className: assistantMessageStackClassName, children: renderAssistantRenderUnits(
|
|
12051
12880
|
renderTree.units,
|
|
12052
12881
|
message,
|
|
12053
12882
|
lookupMessages,
|
|
@@ -12057,13 +12886,13 @@ function renderContent(message, lookupMessages, options) {
|
|
|
12057
12886
|
const content = message.content;
|
|
12058
12887
|
if (typeof content === "string") {
|
|
12059
12888
|
if (!content.trim()) return null;
|
|
12060
|
-
return /* @__PURE__ */
|
|
12889
|
+
return /* @__PURE__ */ jsx42(MarkdownText, { children: content });
|
|
12061
12890
|
}
|
|
12062
12891
|
if (!Array.isArray(content) || content.length === 0) return null;
|
|
12063
12892
|
const renderUnits = buildToolComponentRenderUnits(content, {
|
|
12064
|
-
shouldGroupComponent: (item) => getRequestUserInputResultCardData(item, lookupMessages) === null
|
|
12893
|
+
shouldGroupComponent: (item) => getRequestUserInputResultCardData(item, lookupMessages) === null && !isMcpAppComponent(item)
|
|
12065
12894
|
});
|
|
12066
|
-
return /* @__PURE__ */
|
|
12895
|
+
return /* @__PURE__ */ jsx42("div", { className: "space-y-3", children: renderUnits.map(
|
|
12067
12896
|
(unit, index) => renderContentUnit(
|
|
12068
12897
|
unit,
|
|
12069
12898
|
message,
|
|
@@ -12083,7 +12912,7 @@ function AssistantStreamingIndicator({
|
|
|
12083
12912
|
thinking: t("message.thinking"),
|
|
12084
12913
|
answering: t("message.answering")
|
|
12085
12914
|
};
|
|
12086
|
-
return /* @__PURE__ */
|
|
12915
|
+
return /* @__PURE__ */ jsxs29(
|
|
12087
12916
|
"div",
|
|
12088
12917
|
{
|
|
12089
12918
|
className: cn(
|
|
@@ -12091,18 +12920,18 @@ function AssistantStreamingIndicator({
|
|
|
12091
12920
|
className
|
|
12092
12921
|
),
|
|
12093
12922
|
children: [
|
|
12094
|
-
status === "loading" && /* @__PURE__ */
|
|
12095
|
-
status === "thinking" && /* @__PURE__ */
|
|
12096
|
-
/* @__PURE__ */
|
|
12097
|
-
/* @__PURE__ */
|
|
12098
|
-
/* @__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" })
|
|
12099
12928
|
] }),
|
|
12100
|
-
status === "answering" && /* @__PURE__ */
|
|
12101
|
-
/* @__PURE__ */
|
|
12102
|
-
/* @__PURE__ */
|
|
12103
|
-
/* @__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" })
|
|
12104
12933
|
] }),
|
|
12105
|
-
/* @__PURE__ */
|
|
12934
|
+
/* @__PURE__ */ jsx42("span", { children: labelMap[status] })
|
|
12106
12935
|
]
|
|
12107
12936
|
}
|
|
12108
12937
|
);
|
|
@@ -12131,42 +12960,42 @@ function AssistantMessage({
|
|
|
12131
12960
|
organizationId,
|
|
12132
12961
|
apiUrl
|
|
12133
12962
|
});
|
|
12134
|
-
const reasoningNode = hasReasoning ? /* @__PURE__ */
|
|
12963
|
+
const reasoningNode = hasReasoning ? /* @__PURE__ */ jsx42(ReasoningBlock, { reasoning: rootReasoning ?? [] }) : null;
|
|
12135
12964
|
if (!hasContent && !hasReasoning && !resolvedStreamingStatus) return null;
|
|
12136
12965
|
const streamingClass = isStreaming ? "streaming-active" : "";
|
|
12137
12966
|
if (!hasContent && !hasReasoning && resolvedStreamingStatus) {
|
|
12138
|
-
return /* @__PURE__ */
|
|
12967
|
+
return /* @__PURE__ */ jsx42("div", { className: cn("space-y-3", streamingClass, className), children: /* @__PURE__ */ jsx42(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) });
|
|
12139
12968
|
}
|
|
12140
12969
|
if (hasContent && hasReasoning) {
|
|
12141
|
-
return /* @__PURE__ */
|
|
12142
|
-
/* @__PURE__ */
|
|
12970
|
+
return /* @__PURE__ */ jsxs29("div", { className: cn("space-y-3", streamingClass, className), children: [
|
|
12971
|
+
/* @__PURE__ */ jsxs29(
|
|
12143
12972
|
Tabs,
|
|
12144
12973
|
{
|
|
12145
12974
|
defaultValue: message.status === "reasoning" ? "reasoning" : "answer",
|
|
12146
12975
|
className: "w-full",
|
|
12147
12976
|
children: [
|
|
12148
|
-
/* @__PURE__ */
|
|
12149
|
-
/* @__PURE__ */
|
|
12150
|
-
/* @__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") })
|
|
12151
12980
|
] }),
|
|
12152
|
-
/* @__PURE__ */
|
|
12153
|
-
/* @__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 })
|
|
12154
12983
|
]
|
|
12155
12984
|
}
|
|
12156
12985
|
),
|
|
12157
|
-
resolvedStreamingStatus ? /* @__PURE__ */
|
|
12986
|
+
resolvedStreamingStatus ? /* @__PURE__ */ jsx42(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) : null
|
|
12158
12987
|
] });
|
|
12159
12988
|
}
|
|
12160
|
-
return /* @__PURE__ */
|
|
12989
|
+
return /* @__PURE__ */ jsxs29("div", { className: cn("space-y-3", streamingClass, className), children: [
|
|
12161
12990
|
hasReasoning ? reasoningNode : answerNode,
|
|
12162
|
-
resolvedStreamingStatus ? /* @__PURE__ */
|
|
12991
|
+
resolvedStreamingStatus ? /* @__PURE__ */ jsx42(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) : null
|
|
12163
12992
|
] });
|
|
12164
12993
|
}
|
|
12165
12994
|
|
|
12166
12995
|
// src/components/thread/MessageActions.tsx
|
|
12167
|
-
import * as
|
|
12996
|
+
import * as React37 from "react";
|
|
12168
12997
|
import { Check as Check5, Copy as Copy3, RefreshCw as RefreshCw2 } from "lucide-react";
|
|
12169
|
-
import { jsx as
|
|
12998
|
+
import { jsx as jsx43, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
12170
12999
|
function MessageActions({
|
|
12171
13000
|
content,
|
|
12172
13001
|
isAssistant = false,
|
|
@@ -12175,7 +13004,7 @@ function MessageActions({
|
|
|
12175
13004
|
className
|
|
12176
13005
|
}) {
|
|
12177
13006
|
const { t } = useChatkitTranslation();
|
|
12178
|
-
const [copied, setCopied] =
|
|
13007
|
+
const [copied, setCopied] = React37.useState(false);
|
|
12179
13008
|
const handleCopy = async () => {
|
|
12180
13009
|
try {
|
|
12181
13010
|
await navigator.clipboard.writeText(content);
|
|
@@ -12188,7 +13017,7 @@ function MessageActions({
|
|
|
12188
13017
|
if (isStreaming) {
|
|
12189
13018
|
return null;
|
|
12190
13019
|
}
|
|
12191
|
-
return /* @__PURE__ */
|
|
13020
|
+
return /* @__PURE__ */ jsxs30(
|
|
12192
13021
|
"div",
|
|
12193
13022
|
{
|
|
12194
13023
|
className: cn(
|
|
@@ -12196,7 +13025,7 @@ function MessageActions({
|
|
|
12196
13025
|
className
|
|
12197
13026
|
),
|
|
12198
13027
|
children: [
|
|
12199
|
-
/* @__PURE__ */
|
|
13028
|
+
/* @__PURE__ */ jsx43(
|
|
12200
13029
|
"button",
|
|
12201
13030
|
{
|
|
12202
13031
|
type: "button",
|
|
@@ -12206,17 +13035,17 @@ function MessageActions({
|
|
|
12206
13035
|
copied && "text-green-500"
|
|
12207
13036
|
),
|
|
12208
13037
|
title: copied ? t("messageActions.copied") : t("messageActions.copy"),
|
|
12209
|
-
children: copied ? /* @__PURE__ */
|
|
13038
|
+
children: copied ? /* @__PURE__ */ jsx43(Check5, { size: 14 }) : /* @__PURE__ */ jsx43(Copy3, { size: 14 })
|
|
12210
13039
|
}
|
|
12211
13040
|
),
|
|
12212
|
-
isAssistant && onRetry && /* @__PURE__ */
|
|
13041
|
+
isAssistant && onRetry && /* @__PURE__ */ jsx43(
|
|
12213
13042
|
"button",
|
|
12214
13043
|
{
|
|
12215
13044
|
type: "button",
|
|
12216
13045
|
onClick: onRetry,
|
|
12217
13046
|
className: "p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",
|
|
12218
13047
|
title: t("messageActions.regenerate"),
|
|
12219
|
-
children: /* @__PURE__ */
|
|
13048
|
+
children: /* @__PURE__ */ jsx43(RefreshCw2, { size: 14 })
|
|
12220
13049
|
}
|
|
12221
13050
|
)
|
|
12222
13051
|
]
|
|
@@ -12237,49 +13066,94 @@ import {
|
|
|
12237
13066
|
Sparkles as Sparkles3,
|
|
12238
13067
|
Zap
|
|
12239
13068
|
} from "lucide-react";
|
|
12240
|
-
import { jsx as
|
|
13069
|
+
import { jsx as jsx44, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
12241
13070
|
function getIconComponent2(icon) {
|
|
12242
13071
|
const iconMap = {
|
|
12243
|
-
"circle-question": /* @__PURE__ */
|
|
12244
|
-
"lightbulb": /* @__PURE__ */
|
|
12245
|
-
"sparkle": /* @__PURE__ */
|
|
12246
|
-
"write": /* @__PURE__ */
|
|
12247
|
-
"search": /* @__PURE__ */
|
|
12248
|
-
"globe": /* @__PURE__ */
|
|
12249
|
-
"book-open": /* @__PURE__ */
|
|
12250
|
-
"compass": /* @__PURE__ */
|
|
12251
|
-
"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 })
|
|
12252
13081
|
};
|
|
12253
13082
|
return icon ? iconMap[icon] || iconMap["sparkle"] : iconMap["sparkle"];
|
|
12254
13083
|
}
|
|
12255
|
-
function StartScreen({
|
|
13084
|
+
function StartScreen({
|
|
13085
|
+
startScreen,
|
|
13086
|
+
onPromptClick,
|
|
13087
|
+
onPromptEdit,
|
|
13088
|
+
promptSendDisabled = false,
|
|
13089
|
+
promptEditDisabled = false,
|
|
13090
|
+
className
|
|
13091
|
+
}) {
|
|
12256
13092
|
const { t } = useChatkitTranslation();
|
|
12257
13093
|
const greeting = startScreen?.greeting ?? t("startScreen.greeting");
|
|
12258
13094
|
const prompts = startScreen?.prompts ?? [];
|
|
12259
|
-
|
|
12260
|
-
|
|
12261
|
-
|
|
12262
|
-
|
|
12263
|
-
|
|
12264
|
-
|
|
12265
|
-
|
|
12266
|
-
|
|
12267
|
-
|
|
12268
|
-
|
|
12269
|
-
|
|
12270
|
-
|
|
12271
|
-
|
|
12272
|
-
|
|
12273
|
-
|
|
12274
|
-
|
|
12275
|
-
|
|
12276
|
-
|
|
12277
|
-
|
|
12278
|
-
|
|
13095
|
+
const editPromptLabel = t("startScreen.editPrompt");
|
|
13096
|
+
return /* @__PURE__ */ jsxs31(
|
|
13097
|
+
"div",
|
|
13098
|
+
{
|
|
13099
|
+
className: cn(
|
|
13100
|
+
"flex flex-col items-center justify-center py-12 px-4",
|
|
13101
|
+
className
|
|
13102
|
+
),
|
|
13103
|
+
children: [
|
|
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(
|
|
13106
|
+
"div",
|
|
13107
|
+
{
|
|
13108
|
+
className: cn(
|
|
13109
|
+
"flex items-stretch rounded-xl border bg-card text-left",
|
|
13110
|
+
"transition-colors hover:border-primary/20 hover:bg-muted/50",
|
|
13111
|
+
"focus-within:ring-2 focus-within:ring-primary/20"
|
|
13112
|
+
),
|
|
13113
|
+
children: [
|
|
13114
|
+
/* @__PURE__ */ jsxs31(
|
|
13115
|
+
"button",
|
|
13116
|
+
{
|
|
13117
|
+
type: "button",
|
|
13118
|
+
disabled: promptSendDisabled,
|
|
13119
|
+
onClick: () => onPromptClick?.(item.prompt),
|
|
13120
|
+
className: cn(
|
|
13121
|
+
"flex min-w-0 flex-1 items-center gap-3 p-4 text-left",
|
|
13122
|
+
"focus:outline-none disabled:cursor-not-allowed disabled:opacity-50"
|
|
13123
|
+
),
|
|
13124
|
+
children: [
|
|
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 })
|
|
13127
|
+
]
|
|
13128
|
+
}
|
|
13129
|
+
),
|
|
13130
|
+
/* @__PURE__ */ jsx44(
|
|
13131
|
+
"button",
|
|
13132
|
+
{
|
|
13133
|
+
type: "button",
|
|
13134
|
+
disabled: promptEditDisabled,
|
|
13135
|
+
onClick: () => onPromptEdit?.(item.prompt),
|
|
13136
|
+
"aria-label": editPromptLabel,
|
|
13137
|
+
title: editPromptLabel,
|
|
13138
|
+
className: cn(
|
|
13139
|
+
"flex w-12 shrink-0 items-center justify-center border-l text-muted-foreground",
|
|
13140
|
+
"rounded-r-xl transition-colors hover:bg-muted hover:text-foreground",
|
|
13141
|
+
"focus:outline-none disabled:cursor-not-allowed disabled:opacity-50"
|
|
13142
|
+
),
|
|
13143
|
+
children: /* @__PURE__ */ jsx44(Pencil3, { size: 16 })
|
|
13144
|
+
}
|
|
13145
|
+
)
|
|
13146
|
+
]
|
|
13147
|
+
},
|
|
13148
|
+
`prompt-${index}`
|
|
13149
|
+
)) }) })
|
|
13150
|
+
]
|
|
13151
|
+
}
|
|
13152
|
+
);
|
|
12279
13153
|
}
|
|
12280
13154
|
|
|
12281
13155
|
// src/hooks/useThreads.ts
|
|
12282
|
-
import * as
|
|
13156
|
+
import * as React39 from "react";
|
|
12283
13157
|
var DEFAULT_LIMIT = 50;
|
|
12284
13158
|
var getThreadTitle = (threadRecord) => {
|
|
12285
13159
|
const title = threadRecord.title?.trim();
|
|
@@ -12294,7 +13168,7 @@ var toDate = (value) => {
|
|
|
12294
13168
|
if (Number.isNaN(timestamp)) return void 0;
|
|
12295
13169
|
return new Date(timestamp);
|
|
12296
13170
|
};
|
|
12297
|
-
var
|
|
13171
|
+
var getErrorMessage2 = (error) => {
|
|
12298
13172
|
if (!error) return void 0;
|
|
12299
13173
|
if (error instanceof Error) return error.message;
|
|
12300
13174
|
if (typeof error === "string") return error;
|
|
@@ -12332,16 +13206,16 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12332
13206
|
isLoading: isStreamLoading,
|
|
12333
13207
|
error: streamError
|
|
12334
13208
|
} = useStreamContext();
|
|
12335
|
-
const [threadRecords, setThreadRecords] =
|
|
12336
|
-
const [isLoading, setIsLoading] =
|
|
12337
|
-
const [error, setError] =
|
|
12338
|
-
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) => {
|
|
12339
13213
|
setThreadRecords((prev) => {
|
|
12340
13214
|
const next = prev.filter((item) => item.id !== threadRecord.id);
|
|
12341
13215
|
return sortThreadRecords([threadRecord, ...next]);
|
|
12342
13216
|
});
|
|
12343
13217
|
}, []);
|
|
12344
|
-
const refreshThreads =
|
|
13218
|
+
const refreshThreads = React39.useCallback(async () => {
|
|
12345
13219
|
setIsLoading(true);
|
|
12346
13220
|
setError(null);
|
|
12347
13221
|
try {
|
|
@@ -12357,7 +13231,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12357
13231
|
setIsLoading(false);
|
|
12358
13232
|
}
|
|
12359
13233
|
}, [client, limit, assistantId]);
|
|
12360
|
-
const createThread =
|
|
13234
|
+
const createThread = React39.useCallback(
|
|
12361
13235
|
async (input) => {
|
|
12362
13236
|
setError(null);
|
|
12363
13237
|
const payload = {};
|
|
@@ -12371,7 +13245,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12371
13245
|
},
|
|
12372
13246
|
[client, upsertThreadRecord]
|
|
12373
13247
|
);
|
|
12374
|
-
const updateThread =
|
|
13248
|
+
const updateThread = React39.useCallback(
|
|
12375
13249
|
async (recordId, payload) => {
|
|
12376
13250
|
setError(null);
|
|
12377
13251
|
const updated = await client.conversations.update(recordId, payload);
|
|
@@ -12380,7 +13254,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12380
13254
|
},
|
|
12381
13255
|
[client, upsertThreadRecord]
|
|
12382
13256
|
);
|
|
12383
|
-
const deleteThread =
|
|
13257
|
+
const deleteThread = React39.useCallback(
|
|
12384
13258
|
async (recordId) => {
|
|
12385
13259
|
setError(null);
|
|
12386
13260
|
await client.conversations.delete(recordId);
|
|
@@ -12388,11 +13262,11 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12388
13262
|
},
|
|
12389
13263
|
[client]
|
|
12390
13264
|
);
|
|
12391
|
-
|
|
13265
|
+
React39.useEffect(() => {
|
|
12392
13266
|
if (!isReady) return;
|
|
12393
13267
|
void refreshThreads();
|
|
12394
13268
|
}, [refreshThreads, isReady]);
|
|
12395
|
-
|
|
13269
|
+
React39.useEffect(() => {
|
|
12396
13270
|
if (!threadId || !isStreamLoading) return;
|
|
12397
13271
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
12398
13272
|
const busyStatus = "busy";
|
|
@@ -12413,8 +13287,8 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12413
13287
|
return changed ? sortThreadRecords(next) : prev;
|
|
12414
13288
|
});
|
|
12415
13289
|
}, [threadId, isStreamLoading]);
|
|
12416
|
-
|
|
12417
|
-
const message =
|
|
13290
|
+
React39.useEffect(() => {
|
|
13291
|
+
const message = getErrorMessage2(streamError)?.trim();
|
|
12418
13292
|
if (!threadId || !message) return;
|
|
12419
13293
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
12420
13294
|
const errorStatus = "error";
|
|
@@ -12435,7 +13309,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12435
13309
|
return changed ? sortThreadRecords(next) : prev;
|
|
12436
13310
|
});
|
|
12437
13311
|
}, [threadId, streamError]);
|
|
12438
|
-
|
|
13312
|
+
React39.useEffect(() => {
|
|
12439
13313
|
if (!isReady || !threadId || isStreamLoading) return;
|
|
12440
13314
|
let cancelled = false;
|
|
12441
13315
|
void client.conversations.search({ where: { threadId }, limit: 1 }).then((result) => {
|
|
@@ -12449,7 +13323,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12449
13323
|
cancelled = true;
|
|
12450
13324
|
};
|
|
12451
13325
|
}, [client, threadId, upsertThreadRecord, isReady, isStreamLoading]);
|
|
12452
|
-
const threads =
|
|
13326
|
+
const threads = React39.useMemo(
|
|
12453
13327
|
() => threadRecords.map((threadRecord) => toThreadItem(threadRecord)),
|
|
12454
13328
|
[threadRecords]
|
|
12455
13329
|
);
|
|
@@ -12466,10 +13340,10 @@ function useThreads(limit = DEFAULT_LIMIT) {
|
|
|
12466
13340
|
}
|
|
12467
13341
|
|
|
12468
13342
|
// src/components/thread/context-usage-indicator.tsx
|
|
12469
|
-
import * as
|
|
13343
|
+
import * as React40 from "react";
|
|
12470
13344
|
|
|
12471
13345
|
// src/components/ui/progress-circle.tsx
|
|
12472
|
-
import { jsx as
|
|
13346
|
+
import { jsx as jsx45, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
12473
13347
|
function clamp2(input, a, b) {
|
|
12474
13348
|
return Math.max(Math.min(input, Math.max(a, b)), Math.min(a, b));
|
|
12475
13349
|
}
|
|
@@ -12492,7 +13366,7 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
12492
13366
|
return (
|
|
12493
13367
|
// biome-ignore lint/a11y/useFocusableInteractive: false positive (progress + progressbar are not focusable interactives)
|
|
12494
13368
|
// biome-ignore lint/nursery/useAriaPropsSupportedByRole: biome rule at odds with mdn docs (presumed nursary bug with rule)
|
|
12495
|
-
/* @__PURE__ */
|
|
13369
|
+
/* @__PURE__ */ jsxs32(
|
|
12496
13370
|
"svg",
|
|
12497
13371
|
{
|
|
12498
13372
|
role: "progressbar",
|
|
@@ -12503,8 +13377,8 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
12503
13377
|
"aria-valuemax": 100,
|
|
12504
13378
|
...restSvgProps,
|
|
12505
13379
|
children: [
|
|
12506
|
-
/* @__PURE__ */
|
|
12507
|
-
/* @__PURE__ */
|
|
13380
|
+
/* @__PURE__ */ jsx45("circle", { ...commonParams, className: "stroke-current/25" }),
|
|
13381
|
+
/* @__PURE__ */ jsx45(
|
|
12508
13382
|
"circle",
|
|
12509
13383
|
{
|
|
12510
13384
|
...commonParams,
|
|
@@ -12523,7 +13397,7 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
|
|
|
12523
13397
|
};
|
|
12524
13398
|
|
|
12525
13399
|
// src/components/thread/context-usage-indicator.tsx
|
|
12526
|
-
import { jsx as
|
|
13400
|
+
import { jsx as jsx46, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
12527
13401
|
var kNumberFormatter = new Intl.NumberFormat("en-US", {
|
|
12528
13402
|
minimumFractionDigits: 0,
|
|
12529
13403
|
maximumFractionDigits: 1
|
|
@@ -12556,21 +13430,22 @@ function ContextUsageIndicator({
|
|
|
12556
13430
|
}) {
|
|
12557
13431
|
const { t } = useChatkitTranslation();
|
|
12558
13432
|
const stream = useStreamContext();
|
|
12559
|
-
const [maxContextSize, setMaxContextSize] =
|
|
12560
|
-
const [usedContextSize, setUsedContextSize] =
|
|
12561
|
-
const [assistantAgentKey, setAssistantAgentKey] =
|
|
12562
|
-
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({
|
|
12563
13437
|
threadId: null,
|
|
12564
13438
|
agentKey: null,
|
|
12565
13439
|
usedTokens: null
|
|
12566
13440
|
});
|
|
12567
|
-
const realtimeUsage =
|
|
13441
|
+
const realtimeUsage = React40.useMemo(
|
|
12568
13442
|
() => getThreadContextUsage(stream.contextUsageByAgentKey, assistantAgentKey),
|
|
12569
13443
|
[assistantAgentKey, stream.contextUsageByAgentKey]
|
|
12570
13444
|
);
|
|
12571
13445
|
const realtimeUsedContextSize = getThreadContextUsageTotalTokens(realtimeUsage);
|
|
12572
|
-
|
|
12573
|
-
|
|
13446
|
+
const hasApiConfiguration = Boolean(stream.apiUrl?.trim() && stream.apiKey?.trim());
|
|
13447
|
+
React40.useEffect(() => {
|
|
13448
|
+
if (!hasApiConfiguration || !stream.client || !stream.assistantId) {
|
|
12574
13449
|
setMaxContextSize(null);
|
|
12575
13450
|
setAssistantAgentKey(null);
|
|
12576
13451
|
return;
|
|
@@ -12588,20 +13463,20 @@ function ContextUsageIndicator({
|
|
|
12588
13463
|
return () => {
|
|
12589
13464
|
cancelled = true;
|
|
12590
13465
|
};
|
|
12591
|
-
}, [stream.client, stream.assistantId]);
|
|
12592
|
-
|
|
13466
|
+
}, [hasApiConfiguration, stream.client, stream.assistantId]);
|
|
13467
|
+
React40.useEffect(() => {
|
|
12593
13468
|
latestRealtimeUsageRef.current = {
|
|
12594
13469
|
threadId: stream.threadId ?? null,
|
|
12595
13470
|
agentKey: assistantAgentKey,
|
|
12596
13471
|
usedTokens: realtimeUsedContextSize
|
|
12597
13472
|
};
|
|
12598
13473
|
}, [assistantAgentKey, realtimeUsedContextSize, stream.threadId]);
|
|
12599
|
-
|
|
13474
|
+
React40.useEffect(() => {
|
|
12600
13475
|
if (realtimeUsedContextSize == null) return;
|
|
12601
13476
|
setUsedContextSize(realtimeUsedContextSize);
|
|
12602
13477
|
}, [realtimeUsedContextSize]);
|
|
12603
|
-
|
|
12604
|
-
if (!stream.client) {
|
|
13478
|
+
React40.useEffect(() => {
|
|
13479
|
+
if (!hasApiConfiguration || !stream.client) {
|
|
12605
13480
|
setUsedContextSize(null);
|
|
12606
13481
|
return;
|
|
12607
13482
|
}
|
|
@@ -12637,6 +13512,7 @@ function ContextUsageIndicator({
|
|
|
12637
13512
|
};
|
|
12638
13513
|
}, [
|
|
12639
13514
|
assistantAgentKey,
|
|
13515
|
+
hasApiConfiguration,
|
|
12640
13516
|
realtimeUsedContextSize,
|
|
12641
13517
|
stream.apiKey,
|
|
12642
13518
|
stream.apiUrl,
|
|
@@ -12665,8 +13541,8 @@ function ContextUsageIndicator({
|
|
|
12665
13541
|
});
|
|
12666
13542
|
const usageLabelWithSuffix = usageLabel.endsWith(":") ? usageLabel : `${usageLabel}:`;
|
|
12667
13543
|
const progressClassName = percent >= 90 ? "text-destructive" : percent >= 75 ? "text-amber-500" : "text-primary dark:text-zinc-300";
|
|
12668
|
-
return /* @__PURE__ */
|
|
12669
|
-
/* @__PURE__ */
|
|
13544
|
+
return /* @__PURE__ */ jsxs33(Tooltip, { children: [
|
|
13545
|
+
/* @__PURE__ */ jsx46(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx46(
|
|
12670
13546
|
"button",
|
|
12671
13547
|
{
|
|
12672
13548
|
type: "button",
|
|
@@ -12675,31 +13551,31 @@ function ContextUsageIndicator({
|
|
|
12675
13551
|
className
|
|
12676
13552
|
),
|
|
12677
13553
|
"aria-label": `${usageLabelWithSuffix} ${usageFullLabel}. ${usageTokensLabel}`,
|
|
12678
|
-
children: /* @__PURE__ */
|
|
13554
|
+
children: /* @__PURE__ */ jsx46(ProgressCircle, { value: percent, className: cn("size-3.5", progressClassName) })
|
|
12679
13555
|
}
|
|
12680
13556
|
) }),
|
|
12681
|
-
/* @__PURE__ */
|
|
12682
|
-
/* @__PURE__ */
|
|
12683
|
-
/* @__PURE__ */
|
|
12684
|
-
/* @__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 })
|
|
12685
13561
|
] })
|
|
12686
13562
|
] });
|
|
12687
13563
|
}
|
|
12688
13564
|
|
|
12689
13565
|
// src/components/pet/PetBridge.tsx
|
|
12690
|
-
import * as
|
|
13566
|
+
import * as React41 from "react";
|
|
12691
13567
|
import { normalizePetOptions } from "@xpert-ai/chatkit-types";
|
|
12692
13568
|
function PetBridge({ pet, state }) {
|
|
12693
13569
|
const parentMessenger = useParentMessenger();
|
|
12694
13570
|
const sendEvent = parentMessenger?.sendEvent;
|
|
12695
|
-
const options =
|
|
12696
|
-
|
|
13571
|
+
const options = React41.useMemo(() => normalizePetOptions(pet), [pet]);
|
|
13572
|
+
React41.useEffect(() => {
|
|
12697
13573
|
if (!sendEvent) {
|
|
12698
13574
|
return;
|
|
12699
13575
|
}
|
|
12700
13576
|
sendEvent("pet_options_change", { pet: pet ?? null });
|
|
12701
13577
|
}, [sendEvent, pet]);
|
|
12702
|
-
|
|
13578
|
+
React41.useEffect(() => {
|
|
12703
13579
|
if (!sendEvent || !options) {
|
|
12704
13580
|
return;
|
|
12705
13581
|
}
|
|
@@ -12709,15 +13585,15 @@ function PetBridge({ pet, state }) {
|
|
|
12709
13585
|
}
|
|
12710
13586
|
|
|
12711
13587
|
// src/components/settings/SettingsSheet.tsx
|
|
12712
|
-
import * as
|
|
13588
|
+
import * as React48 from "react";
|
|
12713
13589
|
import { PawPrint, Settings } from "lucide-react";
|
|
12714
13590
|
|
|
12715
13591
|
// src/components/ui/input.tsx
|
|
12716
|
-
import * as
|
|
12717
|
-
import { jsx as
|
|
12718
|
-
var Input =
|
|
13592
|
+
import * as React42 from "react";
|
|
13593
|
+
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
13594
|
+
var Input = React42.forwardRef(
|
|
12719
13595
|
({ className, type, ...props }, ref) => {
|
|
12720
|
-
return /* @__PURE__ */
|
|
13596
|
+
return /* @__PURE__ */ jsx47(
|
|
12721
13597
|
"input",
|
|
12722
13598
|
{
|
|
12723
13599
|
ref,
|
|
@@ -12737,17 +13613,17 @@ Input.displayName = "Input";
|
|
|
12737
13613
|
import "react";
|
|
12738
13614
|
import { Select as SelectPrimitive } from "radix-ui";
|
|
12739
13615
|
import { ChevronDownIcon as ChevronDownIcon2, CheckIcon as CheckIcon4, ChevronUpIcon } from "lucide-react";
|
|
12740
|
-
import { jsx as
|
|
13616
|
+
import { jsx as jsx48, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
12741
13617
|
function Select({
|
|
12742
13618
|
...props
|
|
12743
13619
|
}) {
|
|
12744
|
-
return /* @__PURE__ */
|
|
13620
|
+
return /* @__PURE__ */ jsx48(SelectPrimitive.Root, { "data-slot": "select", ...props });
|
|
12745
13621
|
}
|
|
12746
13622
|
function SelectGroup({
|
|
12747
13623
|
className,
|
|
12748
13624
|
...props
|
|
12749
13625
|
}) {
|
|
12750
|
-
return /* @__PURE__ */
|
|
13626
|
+
return /* @__PURE__ */ jsx48(
|
|
12751
13627
|
SelectPrimitive.Group,
|
|
12752
13628
|
{
|
|
12753
13629
|
"data-slot": "select-group",
|
|
@@ -12759,7 +13635,7 @@ function SelectGroup({
|
|
|
12759
13635
|
function SelectValue({
|
|
12760
13636
|
...props
|
|
12761
13637
|
}) {
|
|
12762
|
-
return /* @__PURE__ */
|
|
13638
|
+
return /* @__PURE__ */ jsx48(SelectPrimitive.Value, { "data-slot": "select-value", ...props });
|
|
12763
13639
|
}
|
|
12764
13640
|
function SelectTrigger({
|
|
12765
13641
|
className,
|
|
@@ -12767,7 +13643,7 @@ function SelectTrigger({
|
|
|
12767
13643
|
children,
|
|
12768
13644
|
...props
|
|
12769
13645
|
}) {
|
|
12770
|
-
return /* @__PURE__ */
|
|
13646
|
+
return /* @__PURE__ */ jsxs34(
|
|
12771
13647
|
SelectPrimitive.Trigger,
|
|
12772
13648
|
{
|
|
12773
13649
|
"data-slot": "select-trigger",
|
|
@@ -12779,7 +13655,7 @@ function SelectTrigger({
|
|
|
12779
13655
|
...props,
|
|
12780
13656
|
children: [
|
|
12781
13657
|
children,
|
|
12782
|
-
/* @__PURE__ */
|
|
13658
|
+
/* @__PURE__ */ jsx48(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx48(ChevronDownIcon2, { className: "pointer-events-none size-4 text-muted-foreground" }) })
|
|
12783
13659
|
]
|
|
12784
13660
|
}
|
|
12785
13661
|
);
|
|
@@ -12791,7 +13667,7 @@ function SelectContent({
|
|
|
12791
13667
|
align = "center",
|
|
12792
13668
|
...props
|
|
12793
13669
|
}) {
|
|
12794
|
-
return /* @__PURE__ */
|
|
13670
|
+
return /* @__PURE__ */ jsx48(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs34(
|
|
12795
13671
|
SelectPrimitive.Content,
|
|
12796
13672
|
{
|
|
12797
13673
|
"data-slot": "select-content",
|
|
@@ -12801,8 +13677,8 @@ function SelectContent({
|
|
|
12801
13677
|
align,
|
|
12802
13678
|
...props,
|
|
12803
13679
|
children: [
|
|
12804
|
-
/* @__PURE__ */
|
|
12805
|
-
/* @__PURE__ */
|
|
13680
|
+
/* @__PURE__ */ jsx48(SelectScrollUpButton, {}),
|
|
13681
|
+
/* @__PURE__ */ jsx48(
|
|
12806
13682
|
SelectPrimitive.Viewport,
|
|
12807
13683
|
{
|
|
12808
13684
|
"data-position": position,
|
|
@@ -12813,7 +13689,7 @@ function SelectContent({
|
|
|
12813
13689
|
children
|
|
12814
13690
|
}
|
|
12815
13691
|
),
|
|
12816
|
-
/* @__PURE__ */
|
|
13692
|
+
/* @__PURE__ */ jsx48(SelectScrollDownButton, {})
|
|
12817
13693
|
]
|
|
12818
13694
|
}
|
|
12819
13695
|
) });
|
|
@@ -12823,7 +13699,7 @@ function SelectItem({
|
|
|
12823
13699
|
children,
|
|
12824
13700
|
...props
|
|
12825
13701
|
}) {
|
|
12826
|
-
return /* @__PURE__ */
|
|
13702
|
+
return /* @__PURE__ */ jsxs34(
|
|
12827
13703
|
SelectPrimitive.Item,
|
|
12828
13704
|
{
|
|
12829
13705
|
"data-slot": "select-item",
|
|
@@ -12833,8 +13709,8 @@ function SelectItem({
|
|
|
12833
13709
|
),
|
|
12834
13710
|
...props,
|
|
12835
13711
|
children: [
|
|
12836
|
-
/* @__PURE__ */
|
|
12837
|
-
/* @__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 })
|
|
12838
13714
|
]
|
|
12839
13715
|
}
|
|
12840
13716
|
);
|
|
@@ -12843,7 +13719,7 @@ function SelectScrollUpButton({
|
|
|
12843
13719
|
className,
|
|
12844
13720
|
...props
|
|
12845
13721
|
}) {
|
|
12846
|
-
return /* @__PURE__ */
|
|
13722
|
+
return /* @__PURE__ */ jsx48(
|
|
12847
13723
|
SelectPrimitive.ScrollUpButton,
|
|
12848
13724
|
{
|
|
12849
13725
|
"data-slot": "select-scroll-up-button",
|
|
@@ -12852,7 +13728,7 @@ function SelectScrollUpButton({
|
|
|
12852
13728
|
className
|
|
12853
13729
|
),
|
|
12854
13730
|
...props,
|
|
12855
|
-
children: /* @__PURE__ */
|
|
13731
|
+
children: /* @__PURE__ */ jsx48(
|
|
12856
13732
|
ChevronUpIcon,
|
|
12857
13733
|
{}
|
|
12858
13734
|
)
|
|
@@ -12863,7 +13739,7 @@ function SelectScrollDownButton({
|
|
|
12863
13739
|
className,
|
|
12864
13740
|
...props
|
|
12865
13741
|
}) {
|
|
12866
|
-
return /* @__PURE__ */
|
|
13742
|
+
return /* @__PURE__ */ jsx48(
|
|
12867
13743
|
SelectPrimitive.ScrollDownButton,
|
|
12868
13744
|
{
|
|
12869
13745
|
"data-slot": "select-scroll-down-button",
|
|
@@ -12872,7 +13748,7 @@ function SelectScrollDownButton({
|
|
|
12872
13748
|
className
|
|
12873
13749
|
),
|
|
12874
13750
|
...props,
|
|
12875
|
-
children: /* @__PURE__ */
|
|
13751
|
+
children: /* @__PURE__ */ jsx48(
|
|
12876
13752
|
ChevronDownIcon2,
|
|
12877
13753
|
{}
|
|
12878
13754
|
)
|
|
@@ -12881,9 +13757,9 @@ function SelectScrollDownButton({
|
|
|
12881
13757
|
}
|
|
12882
13758
|
|
|
12883
13759
|
// src/components/ui/slider.tsx
|
|
12884
|
-
import * as
|
|
13760
|
+
import * as React44 from "react";
|
|
12885
13761
|
import { Slider as SliderPrimitive } from "radix-ui";
|
|
12886
|
-
import { jsx as
|
|
13762
|
+
import { jsx as jsx49, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
12887
13763
|
function Slider({
|
|
12888
13764
|
className,
|
|
12889
13765
|
defaultValue,
|
|
@@ -12892,11 +13768,11 @@ function Slider({
|
|
|
12892
13768
|
max = 100,
|
|
12893
13769
|
...props
|
|
12894
13770
|
}) {
|
|
12895
|
-
const _values =
|
|
13771
|
+
const _values = React44.useMemo(
|
|
12896
13772
|
() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
|
|
12897
13773
|
[value, defaultValue, min, max]
|
|
12898
13774
|
);
|
|
12899
|
-
return /* @__PURE__ */
|
|
13775
|
+
return /* @__PURE__ */ jsxs35(
|
|
12900
13776
|
SliderPrimitive.Root,
|
|
12901
13777
|
{
|
|
12902
13778
|
"data-slot": "slider",
|
|
@@ -12910,12 +13786,12 @@ function Slider({
|
|
|
12910
13786
|
),
|
|
12911
13787
|
...props,
|
|
12912
13788
|
children: [
|
|
12913
|
-
/* @__PURE__ */
|
|
13789
|
+
/* @__PURE__ */ jsx49(
|
|
12914
13790
|
SliderPrimitive.Track,
|
|
12915
13791
|
{
|
|
12916
13792
|
"data-slot": "slider-track",
|
|
12917
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",
|
|
12918
|
-
children: /* @__PURE__ */
|
|
13794
|
+
children: /* @__PURE__ */ jsx49(
|
|
12919
13795
|
SliderPrimitive.Range,
|
|
12920
13796
|
{
|
|
12921
13797
|
"data-slot": "slider-range",
|
|
@@ -12924,7 +13800,7 @@ function Slider({
|
|
|
12924
13800
|
)
|
|
12925
13801
|
}
|
|
12926
13802
|
),
|
|
12927
|
-
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */
|
|
13803
|
+
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ jsx49(
|
|
12928
13804
|
SliderPrimitive.Thumb,
|
|
12929
13805
|
{
|
|
12930
13806
|
"data-slot": "slider-thumb",
|
|
@@ -12938,7 +13814,7 @@ function Slider({
|
|
|
12938
13814
|
}
|
|
12939
13815
|
|
|
12940
13816
|
// src/components/ui/toggle-group.tsx
|
|
12941
|
-
import * as
|
|
13817
|
+
import * as React46 from "react";
|
|
12942
13818
|
import "class-variance-authority";
|
|
12943
13819
|
import { ToggleGroup as ToggleGroupPrimitive } from "radix-ui";
|
|
12944
13820
|
|
|
@@ -12946,7 +13822,7 @@ import { ToggleGroup as ToggleGroupPrimitive } from "radix-ui";
|
|
|
12946
13822
|
import "react";
|
|
12947
13823
|
import { cva as cva2 } from "class-variance-authority";
|
|
12948
13824
|
import { Toggle as TogglePrimitive } from "radix-ui";
|
|
12949
|
-
import { jsx as
|
|
13825
|
+
import { jsx as jsx50 } from "react/jsx-runtime";
|
|
12950
13826
|
var toggleVariants = cva2(
|
|
12951
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",
|
|
12952
13828
|
{
|
|
@@ -12969,8 +13845,8 @@ var toggleVariants = cva2(
|
|
|
12969
13845
|
);
|
|
12970
13846
|
|
|
12971
13847
|
// src/components/ui/toggle-group.tsx
|
|
12972
|
-
import { jsx as
|
|
12973
|
-
var ToggleGroupContext =
|
|
13848
|
+
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
13849
|
+
var ToggleGroupContext = React46.createContext({
|
|
12974
13850
|
size: "default",
|
|
12975
13851
|
variant: "default",
|
|
12976
13852
|
spacing: 0,
|
|
@@ -12985,7 +13861,7 @@ function ToggleGroup({
|
|
|
12985
13861
|
children,
|
|
12986
13862
|
...props
|
|
12987
13863
|
}) {
|
|
12988
|
-
return /* @__PURE__ */
|
|
13864
|
+
return /* @__PURE__ */ jsx51(
|
|
12989
13865
|
ToggleGroupPrimitive.Root,
|
|
12990
13866
|
{
|
|
12991
13867
|
"data-slot": "toggle-group",
|
|
@@ -12999,7 +13875,7 @@ function ToggleGroup({
|
|
|
12999
13875
|
className
|
|
13000
13876
|
),
|
|
13001
13877
|
...props,
|
|
13002
|
-
children: /* @__PURE__ */
|
|
13878
|
+
children: /* @__PURE__ */ jsx51(
|
|
13003
13879
|
ToggleGroupContext.Provider,
|
|
13004
13880
|
{
|
|
13005
13881
|
value: { variant, size: size2, spacing, orientation },
|
|
@@ -13016,8 +13892,8 @@ function ToggleGroupItem({
|
|
|
13016
13892
|
size: size2 = "default",
|
|
13017
13893
|
...props
|
|
13018
13894
|
}) {
|
|
13019
|
-
const context =
|
|
13020
|
-
return /* @__PURE__ */
|
|
13895
|
+
const context = React46.useContext(ToggleGroupContext);
|
|
13896
|
+
return /* @__PURE__ */ jsx51(
|
|
13021
13897
|
ToggleGroupPrimitive.Item,
|
|
13022
13898
|
{
|
|
13023
13899
|
"data-slot": "toggle-group-item",
|
|
@@ -13257,7 +14133,7 @@ import {
|
|
|
13257
14133
|
} from "@xpert-ai/chatkit-types";
|
|
13258
14134
|
|
|
13259
14135
|
// src/components/pet/PetPreview.tsx
|
|
13260
|
-
import { jsx as
|
|
14136
|
+
import { jsx as jsx52 } from "react/jsx-runtime";
|
|
13261
14137
|
function escapeCssUrl(value) {
|
|
13262
14138
|
return value.replace(/["\\]/g, "\\$&");
|
|
13263
14139
|
}
|
|
@@ -13265,7 +14141,7 @@ function PetPreview({ src, label, className }) {
|
|
|
13265
14141
|
const scale = 0.13;
|
|
13266
14142
|
const width = petSpriteAtlas.cellWidth;
|
|
13267
14143
|
const height = petSpriteAtlas.cellHeight;
|
|
13268
|
-
return /* @__PURE__ */
|
|
14144
|
+
return /* @__PURE__ */ jsx52(
|
|
13269
14145
|
"span",
|
|
13270
14146
|
{
|
|
13271
14147
|
className: cn(
|
|
@@ -13274,7 +14150,7 @@ function PetPreview({ src, label, className }) {
|
|
|
13274
14150
|
),
|
|
13275
14151
|
"aria-hidden": "true",
|
|
13276
14152
|
title: label,
|
|
13277
|
-
children: /* @__PURE__ */
|
|
14153
|
+
children: /* @__PURE__ */ jsx52(
|
|
13278
14154
|
"span",
|
|
13279
14155
|
{
|
|
13280
14156
|
className: "absolute left-1/2 top-1/2 block",
|
|
@@ -13296,7 +14172,7 @@ function PetPreview({ src, label, className }) {
|
|
|
13296
14172
|
}
|
|
13297
14173
|
|
|
13298
14174
|
// src/components/settings/SettingsSheet.tsx
|
|
13299
|
-
import { jsx as
|
|
14175
|
+
import { jsx as jsx53, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
13300
14176
|
var CHARACTER_TYPES2 = [
|
|
13301
14177
|
"builtin",
|
|
13302
14178
|
"atlas"
|
|
@@ -13312,13 +14188,13 @@ function SettingsSheet({
|
|
|
13312
14188
|
onSave
|
|
13313
14189
|
}) {
|
|
13314
14190
|
const { t } = useChatkitTranslation();
|
|
13315
|
-
const [draft, setDraft] =
|
|
13316
|
-
|
|
14191
|
+
const [draft, setDraft] = React48.useState(settings);
|
|
14192
|
+
React48.useEffect(() => {
|
|
13317
14193
|
if (open) {
|
|
13318
14194
|
setDraft(petRequired ? { ...settings, enabled: true } : settings);
|
|
13319
14195
|
}
|
|
13320
14196
|
}, [open, petRequired, settings]);
|
|
13321
|
-
const updateDraft =
|
|
14197
|
+
const updateDraft = React48.useCallback(
|
|
13322
14198
|
(patch) => {
|
|
13323
14199
|
setDraft((previous) => ({ ...previous, ...patch }));
|
|
13324
14200
|
},
|
|
@@ -13336,23 +14212,23 @@ function SettingsSheet({
|
|
|
13336
14212
|
defaultValue: selectedBuiltinPet.label
|
|
13337
14213
|
}
|
|
13338
14214
|
);
|
|
13339
|
-
return /* @__PURE__ */
|
|
13340
|
-
/* @__PURE__ */
|
|
13341
|
-
/* @__PURE__ */
|
|
13342
|
-
/* @__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") })
|
|
13343
14219
|
] }) }),
|
|
13344
|
-
/* @__PURE__ */
|
|
13345
|
-
/* @__PURE__ */
|
|
13346
|
-
/* @__PURE__ */
|
|
13347
|
-
/* @__PURE__ */
|
|
13348
|
-
/* @__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") })
|
|
13349
14225
|
] }),
|
|
13350
|
-
/* @__PURE__ */
|
|
13351
|
-
/* @__PURE__ */
|
|
13352
|
-
/* @__PURE__ */
|
|
13353
|
-
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") })
|
|
13354
14230
|
] }),
|
|
13355
|
-
/* @__PURE__ */
|
|
14231
|
+
/* @__PURE__ */ jsx53(
|
|
13356
14232
|
"button",
|
|
13357
14233
|
{
|
|
13358
14234
|
type: "button",
|
|
@@ -13365,7 +14241,7 @@ function SettingsSheet({
|
|
|
13365
14241
|
draft.enabled ? "bg-primary" : "bg-muted-foreground/20",
|
|
13366
14242
|
petRequired ? "cursor-not-allowed opacity-70" : ""
|
|
13367
14243
|
].join(" "),
|
|
13368
|
-
children: /* @__PURE__ */
|
|
14244
|
+
children: /* @__PURE__ */ jsx53(
|
|
13369
14245
|
"span",
|
|
13370
14246
|
{
|
|
13371
14247
|
className: [
|
|
@@ -13378,9 +14254,9 @@ function SettingsSheet({
|
|
|
13378
14254
|
)
|
|
13379
14255
|
] })
|
|
13380
14256
|
] }),
|
|
13381
|
-
/* @__PURE__ */
|
|
13382
|
-
/* @__PURE__ */
|
|
13383
|
-
/* @__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(
|
|
13384
14260
|
ToggleGroup,
|
|
13385
14261
|
{
|
|
13386
14262
|
id: "chatkit-pet-type",
|
|
@@ -13395,7 +14271,7 @@ function SettingsSheet({
|
|
|
13395
14271
|
variant: "outline",
|
|
13396
14272
|
spacing: 2,
|
|
13397
14273
|
className: "!w-full",
|
|
13398
|
-
children: CHARACTER_TYPES2.map((type) => /* @__PURE__ */
|
|
14274
|
+
children: CHARACTER_TYPES2.map((type) => /* @__PURE__ */ jsx53(
|
|
13399
14275
|
ToggleGroupItem,
|
|
13400
14276
|
{
|
|
13401
14277
|
value: type,
|
|
@@ -13407,8 +14283,8 @@ function SettingsSheet({
|
|
|
13407
14283
|
}
|
|
13408
14284
|
)
|
|
13409
14285
|
] }),
|
|
13410
|
-
draft.characterType === "builtin" && /* @__PURE__ */
|
|
13411
|
-
/* @__PURE__ */
|
|
14286
|
+
draft.characterType === "builtin" && /* @__PURE__ */ jsxs36("div", { className: "space-y-2", children: [
|
|
14287
|
+
/* @__PURE__ */ jsx53(
|
|
13412
14288
|
"label",
|
|
13413
14289
|
{
|
|
13414
14290
|
htmlFor: "chatkit-pet-builtin",
|
|
@@ -13416,7 +14292,7 @@ function SettingsSheet({
|
|
|
13416
14292
|
children: t("pet.settings.builtin")
|
|
13417
14293
|
}
|
|
13418
14294
|
),
|
|
13419
|
-
/* @__PURE__ */
|
|
14295
|
+
/* @__PURE__ */ jsxs36(
|
|
13420
14296
|
Select,
|
|
13421
14297
|
{
|
|
13422
14298
|
value: selectedBuiltinPet.id,
|
|
@@ -13427,26 +14303,26 @@ function SettingsSheet({
|
|
|
13427
14303
|
}
|
|
13428
14304
|
},
|
|
13429
14305
|
children: [
|
|
13430
|
-
/* @__PURE__ */
|
|
14306
|
+
/* @__PURE__ */ jsx53(
|
|
13431
14307
|
SelectTrigger,
|
|
13432
14308
|
{
|
|
13433
14309
|
id: "chatkit-pet-builtin",
|
|
13434
14310
|
className: "min-h-12 w-full px-3 py-2",
|
|
13435
|
-
children: /* @__PURE__ */
|
|
14311
|
+
children: /* @__PURE__ */ jsx53(SelectValue, { placeholder: selectedBuiltinPetLabel })
|
|
13436
14312
|
}
|
|
13437
14313
|
),
|
|
13438
|
-
/* @__PURE__ */
|
|
14314
|
+
/* @__PURE__ */ jsx53(SelectContent, { className: "w-[var(--radix-select-trigger-width)]", children: /* @__PURE__ */ jsx53(SelectGroup, { children: INCLUDED_PET_OPTIONS.map((pet) => {
|
|
13439
14315
|
const label = t(`pet.settings.builtins.${pet.id}`, {
|
|
13440
14316
|
defaultValue: pet.label
|
|
13441
14317
|
});
|
|
13442
|
-
return /* @__PURE__ */
|
|
14318
|
+
return /* @__PURE__ */ jsx53(
|
|
13443
14319
|
SelectItem,
|
|
13444
14320
|
{
|
|
13445
14321
|
value: pet.id,
|
|
13446
14322
|
className: "min-h-10 py-1.5 pl-2 pr-8",
|
|
13447
|
-
children: /* @__PURE__ */
|
|
13448
|
-
/* @__PURE__ */
|
|
13449
|
-
/* @__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 })
|
|
13450
14326
|
] })
|
|
13451
14327
|
},
|
|
13452
14328
|
pet.id
|
|
@@ -13456,8 +14332,8 @@ function SettingsSheet({
|
|
|
13456
14332
|
}
|
|
13457
14333
|
)
|
|
13458
14334
|
] }),
|
|
13459
|
-
draft.characterType === "atlas" && /* @__PURE__ */
|
|
13460
|
-
/* @__PURE__ */
|
|
14335
|
+
draft.characterType === "atlas" && /* @__PURE__ */ jsxs36("div", { className: "space-y-2", children: [
|
|
14336
|
+
/* @__PURE__ */ jsx53(
|
|
13461
14337
|
"label",
|
|
13462
14338
|
{
|
|
13463
14339
|
className: "text-sm font-medium",
|
|
@@ -13465,7 +14341,7 @@ function SettingsSheet({
|
|
|
13465
14341
|
children: t("pet.settings.atlasUrl")
|
|
13466
14342
|
}
|
|
13467
14343
|
),
|
|
13468
|
-
/* @__PURE__ */
|
|
14344
|
+
/* @__PURE__ */ jsx53(
|
|
13469
14345
|
Input,
|
|
13470
14346
|
{
|
|
13471
14347
|
id: "chatkit-pet-atlas",
|
|
@@ -13475,15 +14351,15 @@ function SettingsSheet({
|
|
|
13475
14351
|
}
|
|
13476
14352
|
)
|
|
13477
14353
|
] }),
|
|
13478
|
-
/* @__PURE__ */
|
|
13479
|
-
/* @__PURE__ */
|
|
13480
|
-
/* @__PURE__ */
|
|
13481
|
-
/* @__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: [
|
|
13482
14358
|
draft.scale.toFixed(2),
|
|
13483
14359
|
"x"
|
|
13484
14360
|
] })
|
|
13485
14361
|
] }),
|
|
13486
|
-
/* @__PURE__ */
|
|
14362
|
+
/* @__PURE__ */ jsx53(
|
|
13487
14363
|
Slider,
|
|
13488
14364
|
{
|
|
13489
14365
|
id: "chatkit-pet-scale",
|
|
@@ -13497,8 +14373,8 @@ function SettingsSheet({
|
|
|
13497
14373
|
}
|
|
13498
14374
|
)
|
|
13499
14375
|
] }),
|
|
13500
|
-
/* @__PURE__ */
|
|
13501
|
-
/* @__PURE__ */
|
|
14376
|
+
/* @__PURE__ */ jsxs36("label", { className: "flex items-center gap-2 text-sm", children: [
|
|
14377
|
+
/* @__PURE__ */ jsx53(
|
|
13502
14378
|
"input",
|
|
13503
14379
|
{
|
|
13504
14380
|
type: "checkbox",
|
|
@@ -13509,8 +14385,8 @@ function SettingsSheet({
|
|
|
13509
14385
|
),
|
|
13510
14386
|
t("pet.settings.draggable")
|
|
13511
14387
|
] }),
|
|
13512
|
-
/* @__PURE__ */
|
|
13513
|
-
/* @__PURE__ */
|
|
14388
|
+
/* @__PURE__ */ jsxs36("label", { className: "flex items-center gap-2 text-sm", children: [
|
|
14389
|
+
/* @__PURE__ */ jsx53(
|
|
13514
14390
|
"input",
|
|
13515
14391
|
{
|
|
13516
14392
|
type: "checkbox",
|
|
@@ -13521,8 +14397,8 @@ function SettingsSheet({
|
|
|
13521
14397
|
),
|
|
13522
14398
|
t("pet.settings.persistPosition")
|
|
13523
14399
|
] }),
|
|
13524
|
-
/* @__PURE__ */
|
|
13525
|
-
/* @__PURE__ */
|
|
14400
|
+
/* @__PURE__ */ jsxs36("div", { className: "flex justify-end gap-2 pt-2", children: [
|
|
14401
|
+
/* @__PURE__ */ jsx53(
|
|
13526
14402
|
Button,
|
|
13527
14403
|
{
|
|
13528
14404
|
type: "button",
|
|
@@ -13531,7 +14407,7 @@ function SettingsSheet({
|
|
|
13531
14407
|
children: t("pet.settings.cancel")
|
|
13532
14408
|
}
|
|
13533
14409
|
),
|
|
13534
|
-
/* @__PURE__ */
|
|
14410
|
+
/* @__PURE__ */ jsx53(Button, { type: "submit", children: t("pet.settings.save") })
|
|
13535
14411
|
] })
|
|
13536
14412
|
] })
|
|
13537
14413
|
] }) });
|
|
@@ -14158,7 +15034,7 @@ function findDomPointForComposerOffset(root, offset) {
|
|
|
14158
15034
|
}
|
|
14159
15035
|
|
|
14160
15036
|
// src/components/chat.tsx
|
|
14161
|
-
import { Fragment as Fragment9, jsx as
|
|
15037
|
+
import { Fragment as Fragment9, jsx as jsx54, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
14162
15038
|
var defaultApiUrl2 = import.meta.env.VITE_XPERTAI_API_URL;
|
|
14163
15039
|
var COMPOSER_INPUT_MAX_HEIGHT = 128;
|
|
14164
15040
|
var LONG_TEXT_REFERENCE_THRESHOLD = 5e3;
|
|
@@ -14303,7 +15179,7 @@ function ReferenceChip({
|
|
|
14303
15179
|
const metaLine = getReferenceMetaLine(reference);
|
|
14304
15180
|
const isComposer = variant === "composer";
|
|
14305
15181
|
const Icon = reference.type === "quote" ? Quote : reference.type === "image" ? ImageIcon : FileText5;
|
|
14306
|
-
return /* @__PURE__ */
|
|
15182
|
+
return /* @__PURE__ */ jsxs37(
|
|
14307
15183
|
"div",
|
|
14308
15184
|
{
|
|
14309
15185
|
className: cn(
|
|
@@ -14312,7 +15188,7 @@ function ReferenceChip({
|
|
|
14312
15188
|
),
|
|
14313
15189
|
title: getReferenceTitle(reference),
|
|
14314
15190
|
children: [
|
|
14315
|
-
/* @__PURE__ */
|
|
15191
|
+
/* @__PURE__ */ jsx54(
|
|
14316
15192
|
Icon,
|
|
14317
15193
|
{
|
|
14318
15194
|
size: isComposer ? 14 : 12,
|
|
@@ -14322,8 +15198,8 @@ function ReferenceChip({
|
|
|
14322
15198
|
)
|
|
14323
15199
|
}
|
|
14324
15200
|
),
|
|
14325
|
-
/* @__PURE__ */
|
|
14326
|
-
/* @__PURE__ */
|
|
15201
|
+
/* @__PURE__ */ jsxs37("div", { className: "min-w-0 flex-1", children: [
|
|
15202
|
+
/* @__PURE__ */ jsx54(
|
|
14327
15203
|
"div",
|
|
14328
15204
|
{
|
|
14329
15205
|
className: cn(
|
|
@@ -14333,7 +15209,7 @@ function ReferenceChip({
|
|
|
14333
15209
|
children: getReferenceLabel(reference)
|
|
14334
15210
|
}
|
|
14335
15211
|
),
|
|
14336
|
-
metaLine && /* @__PURE__ */
|
|
15212
|
+
metaLine && /* @__PURE__ */ jsx54(
|
|
14337
15213
|
"div",
|
|
14338
15214
|
{
|
|
14339
15215
|
className: cn(
|
|
@@ -14344,7 +15220,7 @@ function ReferenceChip({
|
|
|
14344
15220
|
}
|
|
14345
15221
|
)
|
|
14346
15222
|
] }),
|
|
14347
|
-
onRemove && removeLabel && /* @__PURE__ */
|
|
15223
|
+
onRemove && removeLabel && /* @__PURE__ */ jsx54(
|
|
14348
15224
|
"button",
|
|
14349
15225
|
{
|
|
14350
15226
|
type: "button",
|
|
@@ -14355,7 +15231,7 @@ function ReferenceChip({
|
|
|
14355
15231
|
),
|
|
14356
15232
|
title: removeLabel,
|
|
14357
15233
|
"aria-label": removeLabel,
|
|
14358
|
-
children: /* @__PURE__ */
|
|
15234
|
+
children: /* @__PURE__ */ jsx54(X6, { size: 12 })
|
|
14359
15235
|
}
|
|
14360
15236
|
)
|
|
14361
15237
|
]
|
|
@@ -14379,26 +15255,26 @@ function Chat({
|
|
|
14379
15255
|
const { setStream } = useStreamManager();
|
|
14380
15256
|
const stream = useStreamContext();
|
|
14381
15257
|
const { theme } = useTheme();
|
|
14382
|
-
const [isHistoryLoading, setIsHistoryLoading] =
|
|
14383
|
-
const [historyError, setHistoryError] =
|
|
14384
|
-
const [assistantName, setAssistantName] =
|
|
14385
|
-
const [assistantAvatar, setAssistantAvatar] =
|
|
14386
|
-
const [threadGoal, setThreadGoal] =
|
|
14387
|
-
const [goalError, setGoalError] =
|
|
14388
|
-
const [isGoalLoading, setIsGoalLoading] =
|
|
14389
|
-
const [isGoalPanelOpen, setIsGoalPanelOpen] =
|
|
14390
|
-
const [isGoalObjectiveExpanded, setIsGoalObjectiveExpanded] =
|
|
14391
|
-
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);
|
|
14392
15268
|
const LOADING_DOTS_MIN_DURATION = 800;
|
|
14393
15269
|
const STREAMING_STATUS_REFRESH_MS = 250;
|
|
14394
|
-
const [showLoadingDots, setShowLoadingDots] =
|
|
14395
|
-
const [streamingNow, setStreamingNow] =
|
|
14396
|
-
const loadingStartTimeRef =
|
|
14397
|
-
const lastStreamOutputAtRef =
|
|
14398
|
-
|
|
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(() => {
|
|
14399
15275
|
setStream(stream);
|
|
14400
15276
|
}, [setStream, stream]);
|
|
14401
|
-
|
|
15277
|
+
React49.useEffect(() => {
|
|
14402
15278
|
if (stream.isLoading) {
|
|
14403
15279
|
if (!loadingStartTimeRef.current) {
|
|
14404
15280
|
loadingStartTimeRef.current = Date.now();
|
|
@@ -14421,7 +15297,7 @@ function Chat({
|
|
|
14421
15297
|
}
|
|
14422
15298
|
}
|
|
14423
15299
|
}, [stream.isLoading]);
|
|
14424
|
-
|
|
15300
|
+
React49.useEffect(() => {
|
|
14425
15301
|
if (!stream.isLoading) {
|
|
14426
15302
|
lastStreamOutputAtRef.current = null;
|
|
14427
15303
|
setStreamingNow(Date.now());
|
|
@@ -14431,7 +15307,7 @@ function Chat({
|
|
|
14431
15307
|
lastStreamOutputAtRef.current = now;
|
|
14432
15308
|
setStreamingNow(now);
|
|
14433
15309
|
}, [stream.messages, stream.isLoading]);
|
|
14434
|
-
|
|
15310
|
+
React49.useEffect(() => {
|
|
14435
15311
|
if (!stream.isLoading) {
|
|
14436
15312
|
return;
|
|
14437
15313
|
}
|
|
@@ -14440,7 +15316,7 @@ function Chat({
|
|
|
14440
15316
|
}, STREAMING_STATUS_REFRESH_MS);
|
|
14441
15317
|
return () => window.clearInterval(timer);
|
|
14442
15318
|
}, [stream.isLoading]);
|
|
14443
|
-
|
|
15319
|
+
React49.useEffect(() => {
|
|
14444
15320
|
if (threadGoal?.status === "active" && stream.isLoading) {
|
|
14445
15321
|
setGoalElapsedStartedAt(Date.now());
|
|
14446
15322
|
return;
|
|
@@ -14452,82 +15328,82 @@ function Chat({
|
|
|
14452
15328
|
threadGoal?.id,
|
|
14453
15329
|
threadGoal?.status
|
|
14454
15330
|
]);
|
|
14455
|
-
|
|
15331
|
+
React49.useEffect(() => {
|
|
14456
15332
|
setIsGoalObjectiveExpanded(false);
|
|
14457
15333
|
}, [threadGoal?.id]);
|
|
14458
|
-
const [composerParts, setComposerParts] =
|
|
14459
|
-
const [renderedComposerParts, setRenderedComposerParts] =
|
|
14460
|
-
const [composerDomVersion, setComposerDomVersion] =
|
|
14461
|
-
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(
|
|
14462
15338
|
null
|
|
14463
15339
|
);
|
|
14464
|
-
const [planModeEnabled, setPlanModeEnabled] =
|
|
14465
|
-
const [petSettingsOpen, setPetSettingsOpen] =
|
|
14466
|
-
const [petLocalSettings, setPetLocalSettings] =
|
|
14467
|
-
const [runtimeCapabilities, setRuntimeCapabilities] =
|
|
14468
|
-
const [runtimeCapabilitiesReady, setRuntimeCapabilitiesReady] =
|
|
14469
|
-
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(
|
|
14470
15346
|
() => createEmptyRuntimeCapabilitiesSelection()
|
|
14471
15347
|
);
|
|
14472
|
-
const [runRuntimeCapabilities, setRunRuntimeCapabilities] =
|
|
15348
|
+
const [runRuntimeCapabilities, setRunRuntimeCapabilities] = React49.useState(
|
|
14473
15349
|
() => createEmptyRuntimeCapabilitiesSelection()
|
|
14474
15350
|
);
|
|
14475
|
-
const [runtimeCapabilityPalette, setRuntimeCapabilityPalette] =
|
|
14476
|
-
const [attachmentState, setAttachmentState] =
|
|
15351
|
+
const [runtimeCapabilityPalette, setRuntimeCapabilityPalette] = React49.useState(null);
|
|
15352
|
+
const [attachmentState, setAttachmentState] = React49.useState({
|
|
14477
15353
|
uploadedFiles: [],
|
|
14478
15354
|
hasUploadingFiles: false,
|
|
14479
15355
|
hasParsingFiles: false
|
|
14480
15356
|
});
|
|
14481
|
-
const [references, setReferences] =
|
|
14482
|
-
const [isUploadingReferenceImages, setIsUploadingReferenceImages] =
|
|
14483
|
-
const [quoteSelection, setQuoteSelection] =
|
|
14484
|
-
const [isAtBottom, setIsAtBottom] =
|
|
14485
|
-
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);
|
|
14486
15362
|
const {
|
|
14487
15363
|
threads,
|
|
14488
15364
|
deleteThread,
|
|
14489
15365
|
refreshThreads,
|
|
14490
15366
|
isLoading: isThreadsLoading
|
|
14491
15367
|
} = useThreads();
|
|
14492
|
-
const viewportRef =
|
|
14493
|
-
const attachmentsRef =
|
|
14494
|
-
const composerInputRef =
|
|
14495
|
-
const slashPaletteRef =
|
|
14496
|
-
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(
|
|
14497
15373
|
[]
|
|
14498
15374
|
);
|
|
14499
|
-
const composerPartsRef =
|
|
14500
|
-
const pendingComposerCaretOffsetRef =
|
|
14501
|
-
const shouldAutoScrollRef =
|
|
14502
|
-
const forceFollowRef =
|
|
14503
|
-
const previousMessageCountRef =
|
|
14504
|
-
const previousScrollTopRef =
|
|
14505
|
-
const isPrependingHistoryMessagesRef =
|
|
14506
|
-
const autoScrollFrameRef =
|
|
14507
|
-
const isPointerDownRef =
|
|
14508
|
-
const lastTouchYRef =
|
|
14509
|
-
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);
|
|
14510
15386
|
const resolvedTitle = title ?? t("chat.title");
|
|
14511
15387
|
const resolvedPlaceholder = placeholder ?? t("chat.placeholder");
|
|
14512
15388
|
const petRequired = options?.displayMode === "pet";
|
|
14513
|
-
const basePetSettings =
|
|
15389
|
+
const basePetSettings = React49.useMemo(
|
|
14514
15390
|
() => derivePetLocalSettings(options?.pet),
|
|
14515
15391
|
[options?.pet]
|
|
14516
15392
|
);
|
|
14517
|
-
const displayedPetSettings =
|
|
15393
|
+
const displayedPetSettings = React49.useMemo(
|
|
14518
15394
|
() => ({
|
|
14519
15395
|
...petLocalSettings ?? basePetSettings,
|
|
14520
15396
|
...petRequired ? { enabled: true } : {}
|
|
14521
15397
|
}),
|
|
14522
15398
|
[basePetSettings, petLocalSettings, petRequired]
|
|
14523
15399
|
);
|
|
14524
|
-
const effectivePet =
|
|
15400
|
+
const effectivePet = React49.useMemo(() => {
|
|
14525
15401
|
if (petRequired || petLocalSettings) {
|
|
14526
15402
|
return buildPetOptionsFromLocalSettings(displayedPetSettings);
|
|
14527
15403
|
}
|
|
14528
15404
|
return options?.pet ?? null;
|
|
14529
15405
|
}, [displayedPetSettings, options?.pet, petLocalSettings, petRequired]);
|
|
14530
|
-
const savePetLocalSettings =
|
|
15406
|
+
const savePetLocalSettings = React49.useCallback(
|
|
14531
15407
|
(settings) => {
|
|
14532
15408
|
const nextSettings = petRequired ? { ...settings, enabled: true } : settings;
|
|
14533
15409
|
setPetLocalSettings(nextSettings);
|
|
@@ -14535,7 +15411,7 @@ function Chat({
|
|
|
14535
15411
|
},
|
|
14536
15412
|
[petRequired]
|
|
14537
15413
|
);
|
|
14538
|
-
const handlePetCommand =
|
|
15414
|
+
const handlePetCommand = React49.useCallback(
|
|
14539
15415
|
(mode) => {
|
|
14540
15416
|
if (mode === "settings") {
|
|
14541
15417
|
setPetSettingsOpen(true);
|
|
@@ -14557,7 +15433,7 @@ function Chat({
|
|
|
14557
15433
|
[displayedPetSettings, effectivePet, petRequired, savePetLocalSettings]
|
|
14558
15434
|
);
|
|
14559
15435
|
const inputPlaceholder = selectedTool?.placeholderOverride ?? composer?.placeholder ?? resolvedPlaceholder;
|
|
14560
|
-
const messages =
|
|
15436
|
+
const messages = React49.useMemo(
|
|
14561
15437
|
() => stream.messages ?? [],
|
|
14562
15438
|
[stream.messages]
|
|
14563
15439
|
);
|
|
@@ -14566,7 +15442,7 @@ function Chat({
|
|
|
14566
15442
|
historyMessagePagination?.isLoadingMore
|
|
14567
15443
|
);
|
|
14568
15444
|
const canLoadMoreMessages = Boolean(historyMessagePagination?.hasMore);
|
|
14569
|
-
const draft =
|
|
15445
|
+
const draft = React49.useMemo(
|
|
14570
15446
|
() => getComposerPlainText(composerParts),
|
|
14571
15447
|
[composerParts]
|
|
14572
15448
|
);
|
|
@@ -14580,7 +15456,7 @@ function Chat({
|
|
|
14580
15456
|
isEmpty: isComposerInputEmpty,
|
|
14581
15457
|
isStacked: isComposerStacked
|
|
14582
15458
|
});
|
|
14583
|
-
const pendingFollowUps =
|
|
15459
|
+
const pendingFollowUps = React49.useMemo(
|
|
14584
15460
|
() => sortVisiblePendingFollowUps(stream.pendingFollowUps ?? []),
|
|
14585
15461
|
[stream.pendingFollowUps]
|
|
14586
15462
|
);
|
|
@@ -14589,11 +15465,11 @@ function Chat({
|
|
|
14589
15465
|
const hasPendingHITLRequest = Boolean(stream.pendingHITLRequest);
|
|
14590
15466
|
const hasPendingInteractiveRequest = hasPendingRequestUserInput || hasPendingHITLRequest;
|
|
14591
15467
|
const hasPendingTodos = Boolean(stream.todos?.items.length);
|
|
14592
|
-
const runtimeCapabilityOptions =
|
|
15468
|
+
const runtimeCapabilityOptions = React49.useMemo(
|
|
14593
15469
|
() => getRuntimeCapabilityOptions(runtimeCapabilities),
|
|
14594
15470
|
[runtimeCapabilities]
|
|
14595
15471
|
);
|
|
14596
|
-
const goalAdapter =
|
|
15472
|
+
const goalAdapter = React49.useMemo(
|
|
14597
15473
|
() => {
|
|
14598
15474
|
if (isGoalAdapter(options?.goal)) {
|
|
14599
15475
|
return options.goal;
|
|
@@ -14603,7 +15479,7 @@ function Chat({
|
|
|
14603
15479
|
[options?.goal, stream.client]
|
|
14604
15480
|
);
|
|
14605
15481
|
const displayedGoalElapsedSeconds = threadGoal ? (threadGoal.elapsedSeconds ?? 0) + (goalElapsedStartedAt ? Math.max(0, Math.floor((streamingNow - goalElapsedStartedAt) / 1e3)) : 0) : 0;
|
|
14606
|
-
const effectiveSessionRuntimeCapabilities =
|
|
15482
|
+
const effectiveSessionRuntimeCapabilities = React49.useMemo(
|
|
14607
15483
|
() => runtimeCapabilitiesReady && runtimeCapabilities ? mergeRuntimeCapabilitiesSelections(
|
|
14608
15484
|
runtimeCapabilities,
|
|
14609
15485
|
sessionRuntimeCapabilities
|
|
@@ -14616,7 +15492,7 @@ function Chat({
|
|
|
14616
15492
|
"goal"
|
|
14617
15493
|
);
|
|
14618
15494
|
const showGoalStatus = goalCommandAvailable && !hasCompletedGoal && (Boolean(goalError) || threadGoal?.status === "active" && stream.isLoading);
|
|
14619
|
-
const runRuntimeCapabilityOptions =
|
|
15495
|
+
const runRuntimeCapabilityOptions = React49.useMemo(
|
|
14620
15496
|
() => runtimeCapabilityOptions.filter(
|
|
14621
15497
|
(option) => isRuntimeCapabilitySelected(
|
|
14622
15498
|
runRuntimeCapabilities,
|
|
@@ -14626,11 +15502,11 @@ function Chat({
|
|
|
14626
15502
|
),
|
|
14627
15503
|
[runRuntimeCapabilities, runtimeCapabilityOptions]
|
|
14628
15504
|
);
|
|
14629
|
-
const composerRuntimeCapabilitySelectionKeys =
|
|
15505
|
+
const composerRuntimeCapabilitySelectionKeys = React49.useMemo(
|
|
14630
15506
|
() => getComposerCapabilitySelectionKeys(composerParts),
|
|
14631
15507
|
[composerParts]
|
|
14632
15508
|
);
|
|
14633
|
-
const detachedRunRuntimeCapabilityOptions =
|
|
15509
|
+
const detachedRunRuntimeCapabilityOptions = React49.useMemo(
|
|
14634
15510
|
() => runRuntimeCapabilityOptions.filter(
|
|
14635
15511
|
(option) => !composerRuntimeCapabilitySelectionKeys.has(
|
|
14636
15512
|
getRuntimeCapabilityOptionKey(option)
|
|
@@ -14638,7 +15514,7 @@ function Chat({
|
|
|
14638
15514
|
),
|
|
14639
15515
|
[composerRuntimeCapabilitySelectionKeys, runRuntimeCapabilityOptions]
|
|
14640
15516
|
);
|
|
14641
|
-
const persistSessionRuntimeCapabilities =
|
|
15517
|
+
const persistSessionRuntimeCapabilities = React49.useCallback(
|
|
14642
15518
|
async (threadId, selection) => {
|
|
14643
15519
|
if (!runtimeCapabilities || !selection) {
|
|
14644
15520
|
return;
|
|
@@ -14663,10 +15539,10 @@ function Chat({
|
|
|
14663
15539
|
},
|
|
14664
15540
|
[runtimeCapabilities, stream.client]
|
|
14665
15541
|
);
|
|
14666
|
-
const clearQuoteSelection =
|
|
15542
|
+
const clearQuoteSelection = React49.useCallback(() => {
|
|
14667
15543
|
setQuoteSelection(null);
|
|
14668
15544
|
}, []);
|
|
14669
|
-
const commitComposerParts =
|
|
15545
|
+
const commitComposerParts = React49.useCallback(
|
|
14670
15546
|
(nextParts, options2) => {
|
|
14671
15547
|
const normalized = normalizeComposerParts(nextParts);
|
|
14672
15548
|
const previous = composerPartsRef.current;
|
|
@@ -14702,7 +15578,7 @@ function Chat({
|
|
|
14702
15578
|
},
|
|
14703
15579
|
[]
|
|
14704
15580
|
);
|
|
14705
|
-
const setComposerText =
|
|
15581
|
+
const setComposerText = React49.useCallback(
|
|
14706
15582
|
(text, caretOffset = text.length) => {
|
|
14707
15583
|
commitComposerParts(createComposerTextParts(text), {
|
|
14708
15584
|
caretOffset,
|
|
@@ -14712,7 +15588,7 @@ function Chat({
|
|
|
14712
15588
|
},
|
|
14713
15589
|
[commitComposerParts]
|
|
14714
15590
|
);
|
|
14715
|
-
const focusComposerAt =
|
|
15591
|
+
const focusComposerAt = React49.useCallback((position) => {
|
|
14716
15592
|
const nextPosition = position ?? getComposerEditingLength(composerPartsRef.current);
|
|
14717
15593
|
pendingComposerCaretOffsetRef.current = nextPosition;
|
|
14718
15594
|
requestAnimationFrame(() => {
|
|
@@ -14724,7 +15600,7 @@ function Chat({
|
|
|
14724
15600
|
});
|
|
14725
15601
|
}, []);
|
|
14726
15602
|
const parentMessenger = useParentMessenger({
|
|
14727
|
-
onSetComposerValue:
|
|
15603
|
+
onSetComposerValue: React49.useCallback(
|
|
14728
15604
|
(payload) => {
|
|
14729
15605
|
if (!payload) {
|
|
14730
15606
|
return;
|
|
@@ -14747,10 +15623,10 @@ function Chat({
|
|
|
14747
15623
|
},
|
|
14748
15624
|
[composer?.tools, setComposerText]
|
|
14749
15625
|
),
|
|
14750
|
-
onFocusComposer:
|
|
15626
|
+
onFocusComposer: React49.useCallback(() => {
|
|
14751
15627
|
composerInputRef.current?.focus();
|
|
14752
15628
|
}, []),
|
|
14753
|
-
onSetPetEnabled:
|
|
15629
|
+
onSetPetEnabled: React49.useCallback(
|
|
14754
15630
|
(enabled) => {
|
|
14755
15631
|
if (petRequired) {
|
|
14756
15632
|
return;
|
|
@@ -14764,10 +15640,10 @@ function Chat({
|
|
|
14764
15640
|
)
|
|
14765
15641
|
});
|
|
14766
15642
|
const canMinimizeToPet = parentMessenger?.isParentAvailable === true && isPetEnabled(effectivePet);
|
|
14767
|
-
const handleMinimizeToPet =
|
|
15643
|
+
const handleMinimizeToPet = React49.useCallback(() => {
|
|
14768
15644
|
parentMessenger?.sendEvent("chat_minimize_change", { minimized: true });
|
|
14769
15645
|
}, [parentMessenger]);
|
|
14770
|
-
const syncQuoteSelection =
|
|
15646
|
+
const syncQuoteSelection = React49.useCallback(() => {
|
|
14771
15647
|
if (typeof window === "undefined") {
|
|
14772
15648
|
clearQuoteSelection();
|
|
14773
15649
|
return;
|
|
@@ -14812,23 +15688,23 @@ function Chat({
|
|
|
14812
15688
|
left
|
|
14813
15689
|
});
|
|
14814
15690
|
}, [clearQuoteSelection]);
|
|
14815
|
-
const cancelPendingAutoScroll =
|
|
15691
|
+
const cancelPendingAutoScroll = React49.useCallback(() => {
|
|
14816
15692
|
if (autoScrollFrameRef.current !== null) {
|
|
14817
15693
|
cancelAnimationFrame(autoScrollFrameRef.current);
|
|
14818
15694
|
autoScrollFrameRef.current = null;
|
|
14819
15695
|
}
|
|
14820
15696
|
}, []);
|
|
14821
|
-
const disableAutoFollow =
|
|
15697
|
+
const disableAutoFollow = React49.useCallback(() => {
|
|
14822
15698
|
forceFollowRef.current = false;
|
|
14823
15699
|
shouldAutoScrollRef.current = false;
|
|
14824
15700
|
cancelPendingAutoScroll();
|
|
14825
15701
|
}, [cancelPendingAutoScroll]);
|
|
14826
|
-
const enableAutoFollow =
|
|
15702
|
+
const enableAutoFollow = React49.useCallback(() => {
|
|
14827
15703
|
forceFollowRef.current = true;
|
|
14828
15704
|
shouldAutoScrollRef.current = true;
|
|
14829
15705
|
setHasUpdatesBelow(false);
|
|
14830
15706
|
}, []);
|
|
14831
|
-
const scrollToBottom =
|
|
15707
|
+
const scrollToBottom = React49.useCallback(
|
|
14832
15708
|
(smooth = false, force = false) => {
|
|
14833
15709
|
if (force) {
|
|
14834
15710
|
enableAutoFollow();
|
|
@@ -14855,7 +15731,7 @@ function Chat({
|
|
|
14855
15731
|
},
|
|
14856
15732
|
[cancelPendingAutoScroll, enableAutoFollow]
|
|
14857
15733
|
);
|
|
14858
|
-
|
|
15734
|
+
React49.useEffect(() => {
|
|
14859
15735
|
const viewport = viewportRef.current;
|
|
14860
15736
|
if (!viewport) return;
|
|
14861
15737
|
previousScrollTopRef.current = viewport.scrollTop;
|
|
@@ -14936,14 +15812,14 @@ function Chat({
|
|
|
14936
15812
|
window.removeEventListener("pointercancel", stopPointerTracking);
|
|
14937
15813
|
};
|
|
14938
15814
|
}, [cancelPendingAutoScroll, disableAutoFollow]);
|
|
14939
|
-
|
|
15815
|
+
React49.useEffect(() => {
|
|
14940
15816
|
shouldAutoScrollRef.current = true;
|
|
14941
15817
|
forceFollowRef.current = false;
|
|
14942
15818
|
previousScrollTopRef.current = 0;
|
|
14943
15819
|
setIsAtBottom(true);
|
|
14944
15820
|
setHasUpdatesBelow(false);
|
|
14945
15821
|
}, [stream.threadId]);
|
|
14946
|
-
|
|
15822
|
+
React49.useEffect(() => {
|
|
14947
15823
|
const messageCountChanged = messages.length !== previousMessageCountRef.current;
|
|
14948
15824
|
previousMessageCountRef.current = messages.length;
|
|
14949
15825
|
if (isPrependingHistoryMessagesRef.current) {
|
|
@@ -14966,7 +15842,7 @@ function Chat({
|
|
|
14966
15842
|
clientSecret: effectiveClientSecret
|
|
14967
15843
|
});
|
|
14968
15844
|
const missingConfig = Boolean(missingConfigKind);
|
|
14969
|
-
const missingConfigShortMessage =
|
|
15845
|
+
const missingConfigShortMessage = React49.useMemo(() => {
|
|
14970
15846
|
switch (missingConfigKind) {
|
|
14971
15847
|
case "apiUrl":
|
|
14972
15848
|
return t("chat.missingApiUrlShort");
|
|
@@ -14978,7 +15854,7 @@ function Chat({
|
|
|
14978
15854
|
return t("chat.missingConfigShort");
|
|
14979
15855
|
}
|
|
14980
15856
|
}, [missingConfigKind, t]);
|
|
14981
|
-
const missingConfigDetailMessage =
|
|
15857
|
+
const missingConfigDetailMessage = React49.useMemo(() => {
|
|
14982
15858
|
switch (missingConfigKind) {
|
|
14983
15859
|
case "apiUrl":
|
|
14984
15860
|
return t("chat.missingApiUrlDetail");
|
|
@@ -14992,8 +15868,10 @@ function Chat({
|
|
|
14992
15868
|
}, [missingConfigKind, t]);
|
|
14993
15869
|
const showMissingConfig = !isClientSecretInitializing && missingConfig;
|
|
14994
15870
|
const hasUploadingFiles = attachmentState.hasUploadingFiles;
|
|
14995
|
-
const
|
|
14996
|
-
const
|
|
15871
|
+
const isSubmissionBlocked = hasPendingInteractiveRequest || missingConfig || isHistoryLoading || hasUploadingFiles || isUploadingReferenceImages;
|
|
15872
|
+
const isSendDisabled = !trimmedDraft && !hasReferences || isSubmissionBlocked;
|
|
15873
|
+
const isPromptEditDisabled = hasPendingInteractiveRequest || missingConfig || isHistoryLoading;
|
|
15874
|
+
const resizeComposerInput = React49.useCallback(() => {
|
|
14997
15875
|
const input = composerInputRef.current;
|
|
14998
15876
|
if (!input) {
|
|
14999
15877
|
return;
|
|
@@ -15001,7 +15879,7 @@ function Chat({
|
|
|
15001
15879
|
input.style.maxHeight = `${COMPOSER_INPUT_MAX_HEIGHT}px`;
|
|
15002
15880
|
input.style.overflowY = input.scrollHeight > COMPOSER_INPUT_MAX_HEIGHT ? "auto" : "hidden";
|
|
15003
15881
|
}, []);
|
|
15004
|
-
|
|
15882
|
+
React49.useLayoutEffect(() => {
|
|
15005
15883
|
composerPartsRef.current = composerParts;
|
|
15006
15884
|
resizeComposerInput();
|
|
15007
15885
|
const caretOffset = pendingComposerCaretOffsetRef.current;
|
|
@@ -15013,13 +15891,13 @@ function Chat({
|
|
|
15013
15891
|
}
|
|
15014
15892
|
}
|
|
15015
15893
|
}, [composerDomVersion, composerParts, resizeComposerInput]);
|
|
15016
|
-
|
|
15894
|
+
React49.useEffect(() => {
|
|
15017
15895
|
document.addEventListener("selectionchange", syncQuoteSelection);
|
|
15018
15896
|
return () => {
|
|
15019
15897
|
document.removeEventListener("selectionchange", syncQuoteSelection);
|
|
15020
15898
|
};
|
|
15021
15899
|
}, [syncQuoteSelection]);
|
|
15022
|
-
|
|
15900
|
+
React49.useEffect(() => {
|
|
15023
15901
|
const viewport = viewportRef.current;
|
|
15024
15902
|
if (!viewport) {
|
|
15025
15903
|
return;
|
|
@@ -15036,14 +15914,14 @@ function Chat({
|
|
|
15036
15914
|
window.removeEventListener("resize", handleViewportScroll);
|
|
15037
15915
|
};
|
|
15038
15916
|
}, [clearQuoteSelection]);
|
|
15039
|
-
|
|
15917
|
+
React49.useEffect(() => {
|
|
15040
15918
|
clearQuoteSelection();
|
|
15041
15919
|
}, [messages.length, stream.threadId, clearQuoteSelection]);
|
|
15042
|
-
|
|
15920
|
+
React49.useEffect(() => {
|
|
15043
15921
|
if (missingConfig) return;
|
|
15044
15922
|
void refreshThreads();
|
|
15045
15923
|
}, [missingConfig, refreshThreads]);
|
|
15046
|
-
|
|
15924
|
+
React49.useEffect(() => {
|
|
15047
15925
|
if (missingConfig || !stream.client || !stream.assistantId) {
|
|
15048
15926
|
setAssistantName(null);
|
|
15049
15927
|
setAssistantAvatar(null);
|
|
@@ -15066,7 +15944,7 @@ function Chat({
|
|
|
15066
15944
|
cancelled = true;
|
|
15067
15945
|
};
|
|
15068
15946
|
}, [missingConfig, stream.client, stream.assistantId]);
|
|
15069
|
-
|
|
15947
|
+
React49.useEffect(() => {
|
|
15070
15948
|
if (missingConfig || !stream.client || !stream.assistantId) {
|
|
15071
15949
|
setRuntimeCapabilities(null);
|
|
15072
15950
|
setRuntimeCapabilitiesReady(false);
|
|
@@ -15113,7 +15991,7 @@ function Chat({
|
|
|
15113
15991
|
});
|
|
15114
15992
|
return () => controller.abort();
|
|
15115
15993
|
}, [missingConfig, stream.client, stream.assistantId]);
|
|
15116
|
-
|
|
15994
|
+
React49.useEffect(() => {
|
|
15117
15995
|
setRunRuntimeCapabilities(
|
|
15118
15996
|
createEmptyRuntimeCapabilitiesSelection(runtimeCapabilities)
|
|
15119
15997
|
);
|
|
@@ -15162,10 +16040,10 @@ function Chat({
|
|
|
15162
16040
|
stream.client,
|
|
15163
16041
|
stream.threadId
|
|
15164
16042
|
]);
|
|
15165
|
-
|
|
16043
|
+
React49.useEffect(() => {
|
|
15166
16044
|
setThreadGoal(stream.threadGoal);
|
|
15167
16045
|
}, [stream.threadGoal]);
|
|
15168
|
-
|
|
16046
|
+
React49.useEffect(() => {
|
|
15169
16047
|
const threadId = stream.threadId?.trim();
|
|
15170
16048
|
if (!threadId || !goalCommandAvailable) {
|
|
15171
16049
|
setThreadGoal(null);
|
|
@@ -15206,7 +16084,7 @@ function Chat({
|
|
|
15206
16084
|
return () => controller.abort();
|
|
15207
16085
|
}, [goalAdapter, goalCommandAvailable, stream.threadId]);
|
|
15208
16086
|
const uploadedFiles = attachmentState.uploadedFiles;
|
|
15209
|
-
const handleSessionRuntimeCapabilityToggle =
|
|
16087
|
+
const handleSessionRuntimeCapabilityToggle = React49.useCallback(
|
|
15210
16088
|
(type, id, selected) => {
|
|
15211
16089
|
setSessionRuntimeCapabilities((previous) => {
|
|
15212
16090
|
const nextSelection = toggleRuntimeCapabilitySelection(
|
|
@@ -15224,7 +16102,7 @@ function Chat({
|
|
|
15224
16102
|
},
|
|
15225
16103
|
[persistSessionRuntimeCapabilities, stream.threadId]
|
|
15226
16104
|
);
|
|
15227
|
-
const updateRuntimeCapabilityPalette =
|
|
16105
|
+
const updateRuntimeCapabilityPalette = React49.useCallback(
|
|
15228
16106
|
(parts, selectionStart) => {
|
|
15229
16107
|
const input = composerInputRef.current;
|
|
15230
16108
|
const editingText = getComposerEditingText(parts);
|
|
@@ -15236,7 +16114,7 @@ function Chat({
|
|
|
15236
16114
|
},
|
|
15237
16115
|
[]
|
|
15238
16116
|
);
|
|
15239
|
-
const syncComposerInputFromElement =
|
|
16117
|
+
const syncComposerInputFromElement = React49.useCallback(
|
|
15240
16118
|
(input) => {
|
|
15241
16119
|
const previousCapabilities = getComposerCapabilityPartMap(
|
|
15242
16120
|
composerPartsRef.current
|
|
@@ -15254,25 +16132,25 @@ function Chat({
|
|
|
15254
16132
|
},
|
|
15255
16133
|
[commitComposerParts, updateRuntimeCapabilityPalette]
|
|
15256
16134
|
);
|
|
15257
|
-
const handleComposerInput =
|
|
16135
|
+
const handleComposerInput = React49.useCallback(
|
|
15258
16136
|
(event) => {
|
|
15259
16137
|
syncComposerInputFromElement(event.currentTarget);
|
|
15260
16138
|
},
|
|
15261
16139
|
[syncComposerInputFromElement]
|
|
15262
16140
|
);
|
|
15263
|
-
const handleComposerCompositionEnd =
|
|
16141
|
+
const handleComposerCompositionEnd = React49.useCallback(
|
|
15264
16142
|
(event) => {
|
|
15265
16143
|
syncComposerInputFromElement(event.currentTarget);
|
|
15266
16144
|
},
|
|
15267
16145
|
[syncComposerInputFromElement]
|
|
15268
16146
|
);
|
|
15269
|
-
const handleComposerSelect =
|
|
16147
|
+
const handleComposerSelect = React49.useCallback(() => {
|
|
15270
16148
|
updateRuntimeCapabilityPalette(
|
|
15271
16149
|
composerPartsRef.current,
|
|
15272
16150
|
composerInputRef.current ? getComposerSelectionOffset(composerInputRef.current) : void 0
|
|
15273
16151
|
);
|
|
15274
16152
|
}, [updateRuntimeCapabilityPalette]);
|
|
15275
|
-
const removeRunRuntimeCapability =
|
|
16153
|
+
const removeRunRuntimeCapability = React49.useCallback(
|
|
15276
16154
|
(option) => {
|
|
15277
16155
|
setRunRuntimeCapabilities(
|
|
15278
16156
|
(previous) => toggleRuntimeCapabilitySelection(
|
|
@@ -15292,9 +16170,9 @@ function Chat({
|
|
|
15292
16170
|
},
|
|
15293
16171
|
[commitComposerParts]
|
|
15294
16172
|
);
|
|
15295
|
-
const submitDraft =
|
|
16173
|
+
const submitDraft = React49.useCallback(
|
|
15296
16174
|
(submitOptions = {}) => {
|
|
15297
|
-
if (
|
|
16175
|
+
if (isSubmissionBlocked) return;
|
|
15298
16176
|
const contentToSubmit = (submitOptions.inputText ?? trimmedDraft).trim();
|
|
15299
16177
|
const filesToSend = uploadedFiles.length > 0 ? [...uploadedFiles] : void 0;
|
|
15300
16178
|
const referencesToSend = references.length > 0 ? [...references] : void 0;
|
|
@@ -15397,7 +16275,7 @@ function Chat({
|
|
|
15397
16275
|
},
|
|
15398
16276
|
[
|
|
15399
16277
|
effectiveSessionRuntimeCapabilities,
|
|
15400
|
-
|
|
16278
|
+
isSubmissionBlocked,
|
|
15401
16279
|
options?.request,
|
|
15402
16280
|
persistSessionRuntimeCapabilities,
|
|
15403
16281
|
references,
|
|
@@ -15415,7 +16293,7 @@ function Chat({
|
|
|
15415
16293
|
t
|
|
15416
16294
|
]
|
|
15417
16295
|
);
|
|
15418
|
-
const handleGoalCommand =
|
|
16296
|
+
const handleGoalCommand = React49.useCallback(
|
|
15419
16297
|
async ({
|
|
15420
16298
|
args,
|
|
15421
16299
|
commandSource,
|
|
@@ -15527,13 +16405,13 @@ function Chat({
|
|
|
15527
16405
|
t
|
|
15528
16406
|
]
|
|
15529
16407
|
);
|
|
15530
|
-
const handleGoalPanelOpenChange =
|
|
16408
|
+
const handleGoalPanelOpenChange = React49.useCallback(
|
|
15531
16409
|
(open) => {
|
|
15532
16410
|
setIsGoalPanelOpen(open);
|
|
15533
16411
|
},
|
|
15534
16412
|
[]
|
|
15535
16413
|
);
|
|
15536
|
-
const addRunRuntimeCapabilities =
|
|
16414
|
+
const addRunRuntimeCapabilities = React49.useCallback(
|
|
15537
16415
|
(selection) => {
|
|
15538
16416
|
setRunRuntimeCapabilities(
|
|
15539
16417
|
(previous) => runtimeCapabilities ? mergeRuntimeCapabilitiesSelections(
|
|
@@ -15545,7 +16423,7 @@ function Chat({
|
|
|
15545
16423
|
},
|
|
15546
16424
|
[runtimeCapabilities]
|
|
15547
16425
|
);
|
|
15548
|
-
const insertComposerCapabilityToken =
|
|
16426
|
+
const insertComposerCapabilityToken = React49.useCallback(
|
|
15549
16427
|
(capability, range) => {
|
|
15550
16428
|
const token = createComposerCapabilityPart(capability, createMessageId());
|
|
15551
16429
|
const currentParts = composerPartsRef.current;
|
|
@@ -15618,7 +16496,7 @@ function Chat({
|
|
|
15618
16496
|
plugin: t("composer.slashCommands.empty.loadingCapabilities"),
|
|
15619
16497
|
subAgent: t("composer.slashCommands.empty.loadingCapabilities")
|
|
15620
16498
|
};
|
|
15621
|
-
|
|
16499
|
+
React49.useEffect(() => {
|
|
15622
16500
|
if (!runtimeCapabilityPalette) {
|
|
15623
16501
|
return;
|
|
15624
16502
|
}
|
|
@@ -15637,7 +16515,7 @@ function Chat({
|
|
|
15637
16515
|
);
|
|
15638
16516
|
}
|
|
15639
16517
|
}, [slashPaletteOptions.length, runtimeCapabilityPalette]);
|
|
15640
|
-
|
|
16518
|
+
React49.useLayoutEffect(() => {
|
|
15641
16519
|
if (!runtimeCapabilityPalette) {
|
|
15642
16520
|
return;
|
|
15643
16521
|
}
|
|
@@ -15654,7 +16532,7 @@ function Chat({
|
|
|
15654
16532
|
container.scrollTop += optionRect.bottom - containerRect.bottom;
|
|
15655
16533
|
}
|
|
15656
16534
|
}, [runtimeCapabilityPalette, slashPaletteOptions.length]);
|
|
15657
|
-
const submitGoalModeDraft =
|
|
16535
|
+
const submitGoalModeDraft = React49.useCallback(() => {
|
|
15658
16536
|
const objective = getComposerPlainText(composerPartsRef.current).trim();
|
|
15659
16537
|
if (!isGoalModeOpen || !goalCommandAvailable || !objective) {
|
|
15660
16538
|
return false;
|
|
@@ -15692,7 +16570,7 @@ function Chat({
|
|
|
15692
16570
|
}
|
|
15693
16571
|
submitDraft();
|
|
15694
16572
|
};
|
|
15695
|
-
const handleEditPendingFollowUp =
|
|
16573
|
+
const handleEditPendingFollowUp = React49.useCallback(
|
|
15696
16574
|
(id) => {
|
|
15697
16575
|
const item = pendingFollowUps.find(
|
|
15698
16576
|
(entry) => entry.id === id && entry.mode === "queue"
|
|
@@ -15719,7 +16597,7 @@ function Chat({
|
|
|
15719
16597
|
},
|
|
15720
16598
|
[pendingFollowUps, setComposerText, stream]
|
|
15721
16599
|
);
|
|
15722
|
-
const handleQuoteSelection =
|
|
16600
|
+
const handleQuoteSelection = React49.useCallback(() => {
|
|
15723
16601
|
if (!quoteSelection) {
|
|
15724
16602
|
return;
|
|
15725
16603
|
}
|
|
@@ -15735,7 +16613,7 @@ function Chat({
|
|
|
15735
16613
|
const handleAttachmentClick = () => {
|
|
15736
16614
|
attachmentsRef.current?.openFilePicker();
|
|
15737
16615
|
};
|
|
15738
|
-
const uploadContextFile =
|
|
16616
|
+
const uploadContextFile = React49.useCallback(
|
|
15739
16617
|
(file) => {
|
|
15740
16618
|
const formData = new FormData();
|
|
15741
16619
|
formData.append("file", file, file.name || "upload");
|
|
@@ -15754,13 +16632,13 @@ function Chat({
|
|
|
15754
16632
|
},
|
|
15755
16633
|
[stream.assistantId, stream.client, stream.threadId]
|
|
15756
16634
|
);
|
|
15757
|
-
const getContextFileStatus =
|
|
16635
|
+
const getContextFileStatus = React49.useCallback(
|
|
15758
16636
|
(fileId) => stream.client.contexts.fetch(`/files/${fileId}/status`, {
|
|
15759
16637
|
method: "GET"
|
|
15760
16638
|
}),
|
|
15761
16639
|
[stream.client]
|
|
15762
16640
|
);
|
|
15763
|
-
const deleteContextFile =
|
|
16641
|
+
const deleteContextFile = React49.useCallback(
|
|
15764
16642
|
(storageFileId) => stream.client.contexts.deleteFile(storageFileId),
|
|
15765
16643
|
[stream.client]
|
|
15766
16644
|
);
|
|
@@ -15868,7 +16746,7 @@ function Chat({
|
|
|
15868
16746
|
}
|
|
15869
16747
|
submitDraft();
|
|
15870
16748
|
};
|
|
15871
|
-
const handleComposerPaste =
|
|
16749
|
+
const handleComposerPaste = React49.useCallback(
|
|
15872
16750
|
(event) => {
|
|
15873
16751
|
const clipboardData = event.clipboardData;
|
|
15874
16752
|
if (!clipboardData) {
|
|
@@ -15970,51 +16848,22 @@ function Chat({
|
|
|
15970
16848
|
const handleToolSelect = (tool) => {
|
|
15971
16849
|
setSelectedTool((prev) => prev?.id === tool.id ? null : tool);
|
|
15972
16850
|
};
|
|
15973
|
-
const handlePromptClick = (
|
|
15974
|
-
|
|
15975
|
-
|
|
15976
|
-
|
|
15977
|
-
|
|
15978
|
-
|
|
15979
|
-
|
|
15980
|
-
|
|
15981
|
-
|
|
15982
|
-
|
|
15983
|
-
|
|
15984
|
-
|
|
15985
|
-
}
|
|
15986
|
-
|
|
15987
|
-
|
|
15988
|
-
|
|
15989
|
-
});
|
|
15990
|
-
const sessionRuntimeCapabilitiesForPersistence = effectiveSessionRuntimeCapabilities;
|
|
15991
|
-
const shouldPersistSessionRuntimeCapabilities = !!sessionRuntimeCapabilitiesForPersistence && !stream.threadId && !nextFollowUpMode;
|
|
15992
|
-
stream.submit(
|
|
15993
|
-
{
|
|
15994
|
-
input: inputPayload,
|
|
15995
|
-
...requestOptions.state ? { state: requestOptions.state } : {}
|
|
15996
|
-
},
|
|
15997
|
-
{
|
|
15998
|
-
...nextFollowUpMode ? { followUpMode: nextFollowUpMode } : {},
|
|
15999
|
-
...requestOptions.context ? { context: requestOptions.context } : {},
|
|
16000
|
-
...requestOptions.config ? { config: requestOptions.config } : {},
|
|
16001
|
-
...shouldPersistSessionRuntimeCapabilities ? {
|
|
16002
|
-
onThreadResolved: (threadId) => persistSessionRuntimeCapabilities(
|
|
16003
|
-
threadId,
|
|
16004
|
-
sessionRuntimeCapabilitiesForPersistence
|
|
16005
|
-
)
|
|
16006
|
-
} : {},
|
|
16007
|
-
...!nextFollowUpMode ? {
|
|
16008
|
-
optimisticValues: (prev) => {
|
|
16009
|
-
const prevMessages = prev?.messages ?? [];
|
|
16010
|
-
return { ...prev, messages: [...prevMessages, newMessage] };
|
|
16011
|
-
}
|
|
16012
|
-
} : {}
|
|
16013
|
-
}
|
|
16014
|
-
);
|
|
16015
|
-
scrollToBottom(true, true);
|
|
16016
|
-
};
|
|
16017
|
-
const loadConversationMessages = React48.useCallback(
|
|
16851
|
+
const handlePromptClick = React49.useCallback(
|
|
16852
|
+
(prompt) => {
|
|
16853
|
+
submitDraft({ inputText: prompt, displayText: prompt });
|
|
16854
|
+
},
|
|
16855
|
+
[submitDraft]
|
|
16856
|
+
);
|
|
16857
|
+
const handlePromptEdit = React49.useCallback(
|
|
16858
|
+
(prompt) => {
|
|
16859
|
+
if (isPromptEditDisabled) return;
|
|
16860
|
+
setComposerText(prompt, prompt.length);
|
|
16861
|
+
setRuntimeCapabilityPalette(null);
|
|
16862
|
+
focusComposerAt(prompt.length);
|
|
16863
|
+
},
|
|
16864
|
+
[focusComposerAt, isPromptEditDisabled, setComposerText]
|
|
16865
|
+
);
|
|
16866
|
+
const loadConversationMessages = React49.useCallback(
|
|
16018
16867
|
async (recordId) => {
|
|
16019
16868
|
if (missingConfig) {
|
|
16020
16869
|
setHistoryError(missingConfigShortMessage);
|
|
@@ -16035,7 +16884,7 @@ function Chat({
|
|
|
16035
16884
|
},
|
|
16036
16885
|
[missingConfig, missingConfigShortMessage, stream, t]
|
|
16037
16886
|
);
|
|
16038
|
-
const handleLoadMoreMessages =
|
|
16887
|
+
const handleLoadMoreMessages = React49.useCallback(async () => {
|
|
16039
16888
|
if (!canLoadMoreMessages || isLoadingMoreMessages) {
|
|
16040
16889
|
return;
|
|
16041
16890
|
}
|
|
@@ -16144,15 +16993,15 @@ function Chat({
|
|
|
16144
16993
|
};
|
|
16145
16994
|
const acceptMimes = composer?.attachments?.accept ? Object.entries(composer.attachments.accept).map(([mime, exts]) => [mime, ...exts.map((e) => `.${e}`)].join(",")).join(",") : void 0;
|
|
16146
16995
|
const canUploadDroppedFiles = composer?.attachments?.enabled === true && !missingConfig && !isHistoryLoading && !hasPendingInteractiveRequest;
|
|
16147
|
-
const handleDroppedFiles =
|
|
16996
|
+
const handleDroppedFiles = React49.useCallback((files) => {
|
|
16148
16997
|
return attachmentsRef.current?.queueFiles(files) ?? false;
|
|
16149
16998
|
}, []);
|
|
16150
|
-
const currentThread =
|
|
16999
|
+
const currentThread = React49.useMemo(
|
|
16151
17000
|
() => threads.find((item) => item.id === stream.threadId),
|
|
16152
17001
|
[threads, stream.threadId]
|
|
16153
17002
|
);
|
|
16154
17003
|
const streamErrorMessage = stream.error instanceof Error ? stream.error.message : void 0;
|
|
16155
|
-
const threadErrorMessage =
|
|
17004
|
+
const threadErrorMessage = React49.useMemo(() => {
|
|
16156
17005
|
if (streamErrorMessage?.trim()) return streamErrorMessage.trim();
|
|
16157
17006
|
if (currentThread?.status !== "error") return void 0;
|
|
16158
17007
|
const message = currentThread.error?.trim();
|
|
@@ -16183,7 +17032,7 @@ function Chat({
|
|
|
16183
17032
|
fallbackTitle: t("history.threadFallback")
|
|
16184
17033
|
});
|
|
16185
17034
|
const assistantTitle = assistantName || resolvedTitle;
|
|
16186
|
-
return /* @__PURE__ */
|
|
17035
|
+
return /* @__PURE__ */ jsxs37(
|
|
16187
17036
|
UploadDroppedFiles,
|
|
16188
17037
|
{
|
|
16189
17038
|
ref: viewportRef,
|
|
@@ -16198,10 +17047,10 @@ function Chat({
|
|
|
16198
17047
|
className
|
|
16199
17048
|
),
|
|
16200
17049
|
children: [
|
|
16201
|
-
/* @__PURE__ */
|
|
16202
|
-
/* @__PURE__ */
|
|
16203
|
-
/* @__PURE__ */
|
|
16204
|
-
/* @__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(
|
|
16205
17054
|
ChatkitAvatar,
|
|
16206
17055
|
{
|
|
16207
17056
|
avatar: assistantAvatar,
|
|
@@ -16209,10 +17058,10 @@ function Chat({
|
|
|
16209
17058
|
label: assistantTitle
|
|
16210
17059
|
}
|
|
16211
17060
|
),
|
|
16212
|
-
/* @__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" })
|
|
16213
17062
|
] }),
|
|
16214
|
-
/* @__PURE__ */
|
|
16215
|
-
/* @__PURE__ */
|
|
17063
|
+
/* @__PURE__ */ jsxs37("div", { className: "truncate", children: [
|
|
17064
|
+
/* @__PURE__ */ jsx54(
|
|
16216
17065
|
"h2",
|
|
16217
17066
|
{
|
|
16218
17067
|
className: "text-lg font-semibold truncate",
|
|
@@ -16220,12 +17069,12 @@ function Chat({
|
|
|
16220
17069
|
children: assistantTitle
|
|
16221
17070
|
}
|
|
16222
17071
|
),
|
|
16223
|
-
/* @__PURE__ */
|
|
17072
|
+
/* @__PURE__ */ jsx54("p", { className: "text-xs text-muted-foreground", children: t("chat.statusOnline") })
|
|
16224
17073
|
] })
|
|
16225
17074
|
] }),
|
|
16226
|
-
/* @__PURE__ */
|
|
16227
|
-
canMinimizeToPet && /* @__PURE__ */
|
|
16228
|
-
/* @__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(
|
|
16229
17078
|
"button",
|
|
16230
17079
|
{
|
|
16231
17080
|
type: "button",
|
|
@@ -16236,13 +17085,13 @@ function Chat({
|
|
|
16236
17085
|
"transition-colors duration-150"
|
|
16237
17086
|
),
|
|
16238
17087
|
"aria-label": t("chat.minimizeToPet"),
|
|
16239
|
-
children: /* @__PURE__ */
|
|
17088
|
+
children: /* @__PURE__ */ jsx54(Minus, { size: 16 })
|
|
16240
17089
|
}
|
|
16241
17090
|
) }) }),
|
|
16242
|
-
/* @__PURE__ */
|
|
17091
|
+
/* @__PURE__ */ jsx54(TooltipContent, { side: "bottom", children: t("chat.minimizeToPet") })
|
|
16243
17092
|
] }),
|
|
16244
|
-
/* @__PURE__ */
|
|
16245
|
-
/* @__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(
|
|
16246
17095
|
"button",
|
|
16247
17096
|
{
|
|
16248
17097
|
type: "button",
|
|
@@ -16253,14 +17102,14 @@ function Chat({
|
|
|
16253
17102
|
"transition-colors duration-150"
|
|
16254
17103
|
),
|
|
16255
17104
|
"aria-label": t("settings.open"),
|
|
16256
|
-
children: /* @__PURE__ */
|
|
17105
|
+
children: /* @__PURE__ */ jsx54(Settings2, { size: 16 })
|
|
16257
17106
|
}
|
|
16258
17107
|
) }) }),
|
|
16259
|
-
/* @__PURE__ */
|
|
17108
|
+
/* @__PURE__ */ jsx54(TooltipContent, { side: "bottom", children: t("settings.open") })
|
|
16260
17109
|
] }),
|
|
16261
|
-
history?.enabled !== false && /* @__PURE__ */
|
|
16262
|
-
/* @__PURE__ */
|
|
16263
|
-
/* @__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(
|
|
16264
17113
|
"button",
|
|
16265
17114
|
{
|
|
16266
17115
|
type: "button",
|
|
@@ -16273,12 +17122,12 @@ function Chat({
|
|
|
16273
17122
|
"disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed"
|
|
16274
17123
|
),
|
|
16275
17124
|
"aria-label": t("history.newThread"),
|
|
16276
|
-
children: /* @__PURE__ */
|
|
17125
|
+
children: /* @__PURE__ */ jsx54(Pencil4, { size: 16 })
|
|
16277
17126
|
}
|
|
16278
17127
|
) }) }),
|
|
16279
|
-
/* @__PURE__ */
|
|
17128
|
+
/* @__PURE__ */ jsx54(TooltipContent, { side: "bottom", children: t("history.newThread") })
|
|
16280
17129
|
] }),
|
|
16281
|
-
/* @__PURE__ */
|
|
17130
|
+
/* @__PURE__ */ jsx54(
|
|
16282
17131
|
HistorySidebar,
|
|
16283
17132
|
{
|
|
16284
17133
|
threads,
|
|
@@ -16293,21 +17142,24 @@ function Chat({
|
|
|
16293
17142
|
] })
|
|
16294
17143
|
] })
|
|
16295
17144
|
] }),
|
|
16296
|
-
/* @__PURE__ */
|
|
16297
|
-
errorMessage && /* @__PURE__ */
|
|
16298
|
-
historyError && /* @__PURE__ */
|
|
16299
|
-
showMissingConfig && /* @__PURE__ */
|
|
16300
|
-
isHistoryLoading && /* @__PURE__ */
|
|
16301
|
-
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(
|
|
16302
17151
|
StartScreen,
|
|
16303
17152
|
{
|
|
16304
17153
|
startScreen,
|
|
16305
|
-
onPromptClick: handlePromptClick
|
|
17154
|
+
onPromptClick: handlePromptClick,
|
|
17155
|
+
onPromptEdit: handlePromptEdit,
|
|
17156
|
+
promptSendDisabled: isSubmissionBlocked,
|
|
17157
|
+
promptEditDisabled: isPromptEditDisabled
|
|
16306
17158
|
}
|
|
16307
|
-
) : /* @__PURE__ */
|
|
16308
|
-
canLoadMoreMessages && /* @__PURE__ */
|
|
16309
|
-
/* @__PURE__ */
|
|
16310
|
-
/* @__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(
|
|
16311
17163
|
Button,
|
|
16312
17164
|
{
|
|
16313
17165
|
type: "button",
|
|
@@ -16319,7 +17171,7 @@ function Chat({
|
|
|
16319
17171
|
children: isLoadingMoreMessages ? t("chat.loadingMoreMessages") : t("chat.loadMoreMessages")
|
|
16320
17172
|
}
|
|
16321
17173
|
),
|
|
16322
|
-
/* @__PURE__ */
|
|
17174
|
+
/* @__PURE__ */ jsx54("div", { className: "h-px min-w-8 flex-1 bg-border" })
|
|
16323
17175
|
] }),
|
|
16324
17176
|
messages.map((message, index) => {
|
|
16325
17177
|
const messageType = String(message.type);
|
|
@@ -16356,7 +17208,7 @@ function Chat({
|
|
|
16356
17208
|
if (!isAssistantMessage && !hasPlainRenderableContent && !hasHumanAttachments && humanRuntimeCapabilityOptions.length === 0 && humanReferences.length === 0) {
|
|
16357
17209
|
return null;
|
|
16358
17210
|
}
|
|
16359
|
-
return /* @__PURE__ */
|
|
17211
|
+
return /* @__PURE__ */ jsx54(
|
|
16360
17212
|
"div",
|
|
16361
17213
|
{
|
|
16362
17214
|
className: cn(
|
|
@@ -16364,7 +17216,7 @@ function Chat({
|
|
|
16364
17216
|
message.type === "human" ? "justify-end" : "justify-start -ml-1"
|
|
16365
17217
|
// AI messages: slightly closer to left
|
|
16366
17218
|
),
|
|
16367
|
-
children: /* @__PURE__ */
|
|
17219
|
+
children: /* @__PURE__ */ jsxs37(
|
|
16368
17220
|
"div",
|
|
16369
17221
|
{
|
|
16370
17222
|
className: cn(
|
|
@@ -16372,7 +17224,7 @@ function Chat({
|
|
|
16372
17224
|
isAssistantMessage && "min-w-0 flex-1"
|
|
16373
17225
|
),
|
|
16374
17226
|
children: [
|
|
16375
|
-
/* @__PURE__ */
|
|
17227
|
+
/* @__PURE__ */ jsx54(
|
|
16376
17228
|
"div",
|
|
16377
17229
|
{
|
|
16378
17230
|
...canQuoteMessage ? {
|
|
@@ -16384,7 +17236,7 @@ function Chat({
|
|
|
16384
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"
|
|
16385
17237
|
// AI messages: use chat-specific foreground color
|
|
16386
17238
|
),
|
|
16387
|
-
children: isAssistantMessage ? /* @__PURE__ */
|
|
17239
|
+
children: isAssistantMessage ? /* @__PURE__ */ jsx54(
|
|
16388
17240
|
AssistantMessage,
|
|
16389
17241
|
{
|
|
16390
17242
|
message: {
|
|
@@ -16403,25 +17255,25 @@ function Chat({
|
|
|
16403
17255
|
organizationId: stream.organizationId,
|
|
16404
17256
|
apiUrl: stream.apiUrl
|
|
16405
17257
|
}
|
|
16406
|
-
) : /* @__PURE__ */
|
|
16407
|
-
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(
|
|
16408
17260
|
"span",
|
|
16409
17261
|
{
|
|
16410
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",
|
|
16411
17263
|
children: [
|
|
16412
|
-
/* @__PURE__ */
|
|
17264
|
+
/* @__PURE__ */ jsx54(
|
|
16413
17265
|
RuntimeCapabilityIcon,
|
|
16414
17266
|
{
|
|
16415
17267
|
option,
|
|
16416
17268
|
variant: "chip"
|
|
16417
17269
|
}
|
|
16418
17270
|
),
|
|
16419
|
-
/* @__PURE__ */
|
|
17271
|
+
/* @__PURE__ */ jsx54("span", { className: "max-w-[9rem] truncate", children: option.label })
|
|
16420
17272
|
]
|
|
16421
17273
|
},
|
|
16422
17274
|
`${option.type}:${option.id}`
|
|
16423
17275
|
)) }),
|
|
16424
|
-
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(
|
|
16425
17277
|
ReferenceChip,
|
|
16426
17278
|
{
|
|
16427
17279
|
reference,
|
|
@@ -16429,29 +17281,29 @@ function Chat({
|
|
|
16429
17281
|
},
|
|
16430
17282
|
getReferenceKey(reference)
|
|
16431
17283
|
)) }),
|
|
16432
|
-
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(
|
|
16433
17285
|
"div",
|
|
16434
17286
|
{
|
|
16435
17287
|
className: "flex items-center gap-1.5 rounded-md bg-primary-foreground/20 px-2 py-1 text-xs",
|
|
16436
17288
|
children: [
|
|
16437
|
-
/* @__PURE__ */
|
|
16438
|
-
/* @__PURE__ */
|
|
17289
|
+
/* @__PURE__ */ jsx54(FileText5, { size: 12 }),
|
|
17290
|
+
/* @__PURE__ */ jsx54("span", { className: "max-w-[100px] truncate", children: file.originalName ?? file.id })
|
|
16439
17291
|
]
|
|
16440
17292
|
},
|
|
16441
17293
|
fileIndex
|
|
16442
17294
|
)) }),
|
|
16443
|
-
Array.isArray(message.content) ? message.content.map((part, partIndex) => /* @__PURE__ */
|
|
17295
|
+
Array.isArray(message.content) ? message.content.map((part, partIndex) => /* @__PURE__ */ jsx54(
|
|
16444
17296
|
"p",
|
|
16445
17297
|
{
|
|
16446
17298
|
className: "wrap-break-word text-sm leading-relaxed",
|
|
16447
17299
|
children: formatMessageContent(part)
|
|
16448
17300
|
},
|
|
16449
17301
|
`${part.type}-${partIndex}`
|
|
16450
|
-
)) : /* @__PURE__ */
|
|
17302
|
+
)) : /* @__PURE__ */ jsx54("span", { className: "wrap-break-word text-sm leading-relaxed", children: formatMessageContent(message.content) })
|
|
16451
17303
|
] })
|
|
16452
17304
|
}
|
|
16453
17305
|
),
|
|
16454
|
-
/* @__PURE__ */
|
|
17306
|
+
/* @__PURE__ */ jsx54(
|
|
16455
17307
|
MessageActions,
|
|
16456
17308
|
{
|
|
16457
17309
|
content: messageContent,
|
|
@@ -16489,7 +17341,7 @@ function Chat({
|
|
|
16489
17341
|
stream.isLoading,
|
|
16490
17342
|
{ now: streamingNow }
|
|
16491
17343
|
);
|
|
16492
|
-
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(
|
|
16493
17345
|
AssistantStreamingIndicator,
|
|
16494
17346
|
{
|
|
16495
17347
|
status: fallbackStreamingStatus ?? "loading"
|
|
@@ -16498,7 +17350,7 @@ function Chat({
|
|
|
16498
17350
|
})()
|
|
16499
17351
|
] })
|
|
16500
17352
|
] }),
|
|
16501
|
-
!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(
|
|
16502
17354
|
Button,
|
|
16503
17355
|
{
|
|
16504
17356
|
type: "button",
|
|
@@ -16511,10 +17363,10 @@ function Chat({
|
|
|
16511
17363
|
onClick: () => scrollToBottom(true, true),
|
|
16512
17364
|
"aria-label": t("chat.scrollToBottom"),
|
|
16513
17365
|
title: t("chat.scrollToBottom"),
|
|
16514
|
-
children: /* @__PURE__ */
|
|
17366
|
+
children: /* @__PURE__ */ jsx54(ArrowDown2, { size: 16 })
|
|
16515
17367
|
}
|
|
16516
17368
|
) }),
|
|
16517
|
-
quoteSelection && /* @__PURE__ */
|
|
17369
|
+
quoteSelection && /* @__PURE__ */ jsx54(
|
|
16518
17370
|
"div",
|
|
16519
17371
|
{
|
|
16520
17372
|
className: "pointer-events-none fixed z-50",
|
|
@@ -16523,7 +17375,7 @@ function Chat({
|
|
|
16523
17375
|
left: `${quoteSelection.left}px`,
|
|
16524
17376
|
transform: "translateX(-50%)"
|
|
16525
17377
|
},
|
|
16526
|
-
children: /* @__PURE__ */
|
|
17378
|
+
children: /* @__PURE__ */ jsxs37(
|
|
16527
17379
|
Button,
|
|
16528
17380
|
{
|
|
16529
17381
|
type: "button",
|
|
@@ -16535,16 +17387,16 @@ function Chat({
|
|
|
16535
17387
|
"aria-label": t("composer.quoteSelection"),
|
|
16536
17388
|
title: t("composer.quoteSelection"),
|
|
16537
17389
|
children: [
|
|
16538
|
-
/* @__PURE__ */
|
|
17390
|
+
/* @__PURE__ */ jsx54(Quote, { size: 14 }),
|
|
16539
17391
|
t("composer.quoteSelection")
|
|
16540
17392
|
]
|
|
16541
17393
|
}
|
|
16542
17394
|
)
|
|
16543
17395
|
}
|
|
16544
17396
|
),
|
|
16545
|
-
/* @__PURE__ */
|
|
16546
|
-
threadErrorMessage && /* @__PURE__ */
|
|
16547
|
-
/* @__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(
|
|
16548
17400
|
ChatAttachments,
|
|
16549
17401
|
{
|
|
16550
17402
|
ref: attachmentsRef,
|
|
@@ -16558,7 +17410,7 @@ function Chat({
|
|
|
16558
17410
|
onStateChange: setAttachmentState
|
|
16559
17411
|
}
|
|
16560
17412
|
),
|
|
16561
|
-
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(
|
|
16562
17414
|
ReferenceChip,
|
|
16563
17415
|
{
|
|
16564
17416
|
reference,
|
|
@@ -16572,16 +17424,16 @@ function Chat({
|
|
|
16572
17424
|
},
|
|
16573
17425
|
getReferenceKey(reference)
|
|
16574
17426
|
)) }),
|
|
16575
|
-
detachedRunRuntimeCapabilityOptions.length > 0 && /* @__PURE__ */
|
|
16576
|
-
/* @__PURE__ */
|
|
16577
|
-
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(
|
|
16578
17430
|
"span",
|
|
16579
17431
|
{
|
|
16580
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",
|
|
16581
17433
|
children: [
|
|
16582
|
-
/* @__PURE__ */
|
|
16583
|
-
/* @__PURE__ */
|
|
16584
|
-
/* @__PURE__ */
|
|
17434
|
+
/* @__PURE__ */ jsx54(RuntimeCapabilityIcon, { option, variant: "chip" }),
|
|
17435
|
+
/* @__PURE__ */ jsx54("span", { className: "max-w-40 truncate", children: option.label }),
|
|
17436
|
+
/* @__PURE__ */ jsx54(
|
|
16585
17437
|
"button",
|
|
16586
17438
|
{
|
|
16587
17439
|
type: "button",
|
|
@@ -16589,7 +17441,7 @@ function Chat({
|
|
|
16589
17441
|
className: "rounded-full p-0.5 hover:bg-primary/15",
|
|
16590
17442
|
title: t("composer.capabilities.removeRunCapability"),
|
|
16591
17443
|
"aria-label": t("composer.capabilities.removeRunCapability"),
|
|
16592
|
-
children: /* @__PURE__ */
|
|
17444
|
+
children: /* @__PURE__ */ jsx54(X6, { size: 11 })
|
|
16593
17445
|
}
|
|
16594
17446
|
)
|
|
16595
17447
|
]
|
|
@@ -16597,7 +17449,7 @@ function Chat({
|
|
|
16597
17449
|
`${option.type}:${option.id}`
|
|
16598
17450
|
))
|
|
16599
17451
|
] }),
|
|
16600
|
-
showGoalStatus && /* @__PURE__ */
|
|
17452
|
+
showGoalStatus && /* @__PURE__ */ jsxs37(
|
|
16601
17453
|
"div",
|
|
16602
17454
|
{
|
|
16603
17455
|
className: cn(
|
|
@@ -16605,7 +17457,7 @@ function Chat({
|
|
|
16605
17457
|
isGoalObjectiveExpanded ? "items-start" : "items-center"
|
|
16606
17458
|
),
|
|
16607
17459
|
children: [
|
|
16608
|
-
/* @__PURE__ */
|
|
17460
|
+
/* @__PURE__ */ jsx54(
|
|
16609
17461
|
Target2,
|
|
16610
17462
|
{
|
|
16611
17463
|
className: cn(
|
|
@@ -16614,13 +17466,13 @@ function Chat({
|
|
|
16614
17466
|
)
|
|
16615
17467
|
}
|
|
16616
17468
|
),
|
|
16617
|
-
/* @__PURE__ */
|
|
16618
|
-
/* @__PURE__ */
|
|
16619
|
-
/* @__PURE__ */
|
|
16620
|
-
threadGoal && /* @__PURE__ */
|
|
16621
|
-
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" })
|
|
16622
17474
|
] }),
|
|
16623
|
-
/* @__PURE__ */
|
|
17475
|
+
/* @__PURE__ */ jsx54(
|
|
16624
17476
|
"div",
|
|
16625
17477
|
{
|
|
16626
17478
|
className: cn(
|
|
@@ -16630,13 +17482,13 @@ function Chat({
|
|
|
16630
17482
|
children: goalError || threadGoal?.objective
|
|
16631
17483
|
}
|
|
16632
17484
|
),
|
|
16633
|
-
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", {
|
|
16634
17486
|
elapsed: formatGoalElapsed(displayedGoalElapsedSeconds)
|
|
16635
17487
|
}) }) })
|
|
16636
17488
|
] }),
|
|
16637
|
-
threadGoal && /* @__PURE__ */
|
|
16638
|
-
/* @__PURE__ */
|
|
16639
|
-
/* @__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(
|
|
16640
17492
|
Button,
|
|
16641
17493
|
{
|
|
16642
17494
|
type: "button",
|
|
@@ -16647,13 +17499,13 @@ function Chat({
|
|
|
16647
17499
|
const prefix = "/goal edit ";
|
|
16648
17500
|
setComposerText(`${prefix}${threadGoal.objective}`);
|
|
16649
17501
|
},
|
|
16650
|
-
children: /* @__PURE__ */
|
|
17502
|
+
children: /* @__PURE__ */ jsx54(Pencil4, { className: "size-3" })
|
|
16651
17503
|
}
|
|
16652
17504
|
) }),
|
|
16653
|
-
/* @__PURE__ */
|
|
17505
|
+
/* @__PURE__ */ jsx54(TooltipContent, { children: t("chat.goal.edit") })
|
|
16654
17506
|
] }),
|
|
16655
|
-
/* @__PURE__ */
|
|
16656
|
-
/* @__PURE__ */
|
|
17507
|
+
/* @__PURE__ */ jsxs37(Tooltip, { children: [
|
|
17508
|
+
/* @__PURE__ */ jsx54(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx54(
|
|
16657
17509
|
Button,
|
|
16658
17510
|
{
|
|
16659
17511
|
type: "button",
|
|
@@ -16669,13 +17521,13 @@ function Chat({
|
|
|
16669
17521
|
executionType: "insert_invocation"
|
|
16670
17522
|
}
|
|
16671
17523
|
}),
|
|
16672
|
-
children: threadGoal.status === "paused" ? /* @__PURE__ */
|
|
17524
|
+
children: threadGoal.status === "paused" ? /* @__PURE__ */ jsx54(Play, { className: "size-3" }) : /* @__PURE__ */ jsx54(Pause, { className: "size-3" })
|
|
16673
17525
|
}
|
|
16674
17526
|
) }),
|
|
16675
|
-
/* @__PURE__ */
|
|
17527
|
+
/* @__PURE__ */ jsx54(TooltipContent, { children: threadGoal.status === "paused" ? t("chat.goal.resume") : t("chat.goal.pause") })
|
|
16676
17528
|
] }),
|
|
16677
|
-
/* @__PURE__ */
|
|
16678
|
-
/* @__PURE__ */
|
|
17529
|
+
/* @__PURE__ */ jsxs37(Tooltip, { children: [
|
|
17530
|
+
/* @__PURE__ */ jsx54(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx54(
|
|
16679
17531
|
Button,
|
|
16680
17532
|
{
|
|
16681
17533
|
type: "button",
|
|
@@ -16691,13 +17543,13 @@ function Chat({
|
|
|
16691
17543
|
executionType: "insert_invocation"
|
|
16692
17544
|
}
|
|
16693
17545
|
}),
|
|
16694
|
-
children: /* @__PURE__ */
|
|
17546
|
+
children: /* @__PURE__ */ jsx54(Trash23, { className: "size-3" })
|
|
16695
17547
|
}
|
|
16696
17548
|
) }),
|
|
16697
|
-
/* @__PURE__ */
|
|
17549
|
+
/* @__PURE__ */ jsx54(TooltipContent, { children: t("chat.goal.clear") })
|
|
16698
17550
|
] }),
|
|
16699
|
-
threadGoal.objective && !goalError && /* @__PURE__ */
|
|
16700
|
-
/* @__PURE__ */
|
|
17551
|
+
threadGoal.objective && !goalError && /* @__PURE__ */ jsxs37(Tooltip, { children: [
|
|
17552
|
+
/* @__PURE__ */ jsx54(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx54(
|
|
16701
17553
|
Button,
|
|
16702
17554
|
{
|
|
16703
17555
|
type: "button",
|
|
@@ -16706,7 +17558,7 @@ function Chat({
|
|
|
16706
17558
|
"aria-expanded": isGoalObjectiveExpanded,
|
|
16707
17559
|
"aria-label": isGoalObjectiveExpanded ? t("chat.goal.collapseObjective") : t("chat.goal.expandObjective"),
|
|
16708
17560
|
onClick: () => setIsGoalObjectiveExpanded((expanded) => !expanded),
|
|
16709
|
-
children: /* @__PURE__ */
|
|
17561
|
+
children: /* @__PURE__ */ jsx54(
|
|
16710
17562
|
ChevronDown5,
|
|
16711
17563
|
{
|
|
16712
17564
|
className: cn(
|
|
@@ -16717,13 +17569,13 @@ function Chat({
|
|
|
16717
17569
|
)
|
|
16718
17570
|
}
|
|
16719
17571
|
) }),
|
|
16720
|
-
/* @__PURE__ */
|
|
17572
|
+
/* @__PURE__ */ jsx54(TooltipContent, { children: isGoalObjectiveExpanded ? t("chat.goal.collapseObjective") : t("chat.goal.expandObjective") })
|
|
16721
17573
|
] })
|
|
16722
17574
|
] })
|
|
16723
17575
|
]
|
|
16724
17576
|
}
|
|
16725
17577
|
),
|
|
16726
|
-
/* @__PURE__ */
|
|
17578
|
+
/* @__PURE__ */ jsx54(
|
|
16727
17579
|
PendingRuntimeServices,
|
|
16728
17580
|
{
|
|
16729
17581
|
state: stream.runtimeActivities.sandboxServices,
|
|
@@ -16732,7 +17584,7 @@ function Chat({
|
|
|
16732
17584
|
className: hasPendingTodos || hasPendingFollowUps ? "mb-2" : void 0
|
|
16733
17585
|
}
|
|
16734
17586
|
),
|
|
16735
|
-
/* @__PURE__ */
|
|
17587
|
+
/* @__PURE__ */ jsx54(
|
|
16736
17588
|
PendingTodos,
|
|
16737
17589
|
{
|
|
16738
17590
|
snapshot: stream.todos,
|
|
@@ -16740,7 +17592,7 @@ function Chat({
|
|
|
16740
17592
|
className: hasPendingFollowUps ? "mb-2" : void 0
|
|
16741
17593
|
}
|
|
16742
17594
|
),
|
|
16743
|
-
/* @__PURE__ */
|
|
17595
|
+
/* @__PURE__ */ jsx54(
|
|
16744
17596
|
PendingFollowUps,
|
|
16745
17597
|
{
|
|
16746
17598
|
items: pendingFollowUps,
|
|
@@ -16753,7 +17605,7 @@ function Chat({
|
|
|
16753
17605
|
attachToComposer: true
|
|
16754
17606
|
}
|
|
16755
17607
|
),
|
|
16756
|
-
/* @__PURE__ */
|
|
17608
|
+
/* @__PURE__ */ jsx54(
|
|
16757
17609
|
RequestUserInputPanel,
|
|
16758
17610
|
{
|
|
16759
17611
|
request: stream.pendingRequestUserInput,
|
|
@@ -16762,7 +17614,7 @@ function Chat({
|
|
|
16762
17614
|
attachToComposer: true
|
|
16763
17615
|
}
|
|
16764
17616
|
),
|
|
16765
|
-
/* @__PURE__ */
|
|
17617
|
+
/* @__PURE__ */ jsx54(
|
|
16766
17618
|
HITLApprovalPanel,
|
|
16767
17619
|
{
|
|
16768
17620
|
request: stream.pendingHITLRequest,
|
|
@@ -16771,7 +17623,7 @@ function Chat({
|
|
|
16771
17623
|
attachToComposer: true
|
|
16772
17624
|
}
|
|
16773
17625
|
),
|
|
16774
|
-
runtimeCapabilityPalette && /* @__PURE__ */
|
|
17626
|
+
runtimeCapabilityPalette && /* @__PURE__ */ jsx54(
|
|
16775
17627
|
SlashPalette,
|
|
16776
17628
|
{
|
|
16777
17629
|
palette: runtimeCapabilityPalette,
|
|
@@ -16785,7 +17637,7 @@ function Chat({
|
|
|
16785
17637
|
onSelect: selectSlashPaletteOption
|
|
16786
17638
|
}
|
|
16787
17639
|
),
|
|
16788
|
-
/* @__PURE__ */
|
|
17640
|
+
/* @__PURE__ */ jsx54("form", { className: "flex items-end", onSubmit: handleSubmit, children: /* @__PURE__ */ jsxs37(
|
|
16789
17641
|
"div",
|
|
16790
17642
|
{
|
|
16791
17643
|
"data-slot": "composer-input-shell",
|
|
@@ -16799,7 +17651,7 @@ function Chat({
|
|
|
16799
17651
|
composerInputRoundedClass
|
|
16800
17652
|
),
|
|
16801
17653
|
children: [
|
|
16802
|
-
/* @__PURE__ */
|
|
17654
|
+
/* @__PURE__ */ jsx54(
|
|
16803
17655
|
"div",
|
|
16804
17656
|
{
|
|
16805
17657
|
ref: composerInputRef,
|
|
@@ -16821,7 +17673,7 @@ function Chat({
|
|
|
16821
17673
|
(missingConfig || isHistoryLoading || hasPendingInteractiveRequest) && "cursor-not-allowed opacity-50"
|
|
16822
17674
|
),
|
|
16823
17675
|
children: renderedComposerParts.map(
|
|
16824
|
-
(part, index) => part.type === "text" ? /* @__PURE__ */
|
|
17676
|
+
(part, index) => part.type === "text" ? /* @__PURE__ */ jsx54(React49.Fragment, { children: part.text }, `text-${index}`) : /* @__PURE__ */ jsxs37(
|
|
16825
17677
|
"span",
|
|
16826
17678
|
{
|
|
16827
17679
|
"data-composer-capability-key": part.key,
|
|
@@ -16830,14 +17682,14 @@ function Chat({
|
|
|
16830
17682
|
contentEditable: false,
|
|
16831
17683
|
className: "mx-0.5 inline-flex max-w-[14rem] select-none items-center gap-1 text-sm font-semibold text-primary align-baseline",
|
|
16832
17684
|
children: [
|
|
16833
|
-
/* @__PURE__ */
|
|
17685
|
+
/* @__PURE__ */ jsx54(
|
|
16834
17686
|
RuntimeCapabilityIcon,
|
|
16835
17687
|
{
|
|
16836
17688
|
option: part.capability,
|
|
16837
17689
|
variant: "chip"
|
|
16838
17690
|
}
|
|
16839
17691
|
),
|
|
16840
|
-
/* @__PURE__ */
|
|
17692
|
+
/* @__PURE__ */ jsx54("span", { className: "truncate", children: part.capability.label })
|
|
16841
17693
|
]
|
|
16842
17694
|
},
|
|
16843
17695
|
part.key
|
|
@@ -16846,14 +17698,14 @@ function Chat({
|
|
|
16846
17698
|
},
|
|
16847
17699
|
composerDomVersion
|
|
16848
17700
|
),
|
|
16849
|
-
/* @__PURE__ */
|
|
17701
|
+
/* @__PURE__ */ jsxs37(
|
|
16850
17702
|
"div",
|
|
16851
17703
|
{
|
|
16852
17704
|
"data-slot": "composer-action-bar",
|
|
16853
17705
|
className: "pointer-events-none absolute inset-x-1.5 bottom-1 flex min-h-10 items-center justify-between gap-2",
|
|
16854
17706
|
children: [
|
|
16855
|
-
/* @__PURE__ */
|
|
16856
|
-
/* @__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(
|
|
16857
17709
|
ComposerMenu,
|
|
16858
17710
|
{
|
|
16859
17711
|
composer,
|
|
@@ -16871,20 +17723,20 @@ function Chat({
|
|
|
16871
17723
|
disabled: missingConfig || isHistoryLoading || hasPendingInteractiveRequest
|
|
16872
17724
|
}
|
|
16873
17725
|
) }),
|
|
16874
|
-
selectedTool && /* @__PURE__ */
|
|
16875
|
-
/* @__PURE__ */
|
|
16876
|
-
/* @__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(
|
|
16877
17729
|
"button",
|
|
16878
17730
|
{
|
|
16879
17731
|
type: "button",
|
|
16880
17732
|
onClick: () => setSelectedTool(null),
|
|
16881
17733
|
className: "shrink-0 rounded-full p-0.5 text-primary/70 hover:bg-primary/10 hover:text-primary",
|
|
16882
|
-
children: /* @__PURE__ */
|
|
17734
|
+
children: /* @__PURE__ */ jsx54(X6, { size: 12 })
|
|
16883
17735
|
}
|
|
16884
17736
|
)
|
|
16885
17737
|
] })
|
|
16886
17738
|
] }),
|
|
16887
|
-
/* @__PURE__ */
|
|
17739
|
+
/* @__PURE__ */ jsx54("div", { className: "pointer-events-auto shrink-0", children: /* @__PURE__ */ jsx54(
|
|
16888
17740
|
SendButton,
|
|
16889
17741
|
{
|
|
16890
17742
|
disabled: isSendDisabled,
|
|
@@ -16907,7 +17759,7 @@ function Chat({
|
|
|
16907
17759
|
]
|
|
16908
17760
|
}
|
|
16909
17761
|
) }),
|
|
16910
|
-
disclaimer?.text && /* @__PURE__ */
|
|
17762
|
+
disclaimer?.text && /* @__PURE__ */ jsx54(
|
|
16911
17763
|
"p",
|
|
16912
17764
|
{
|
|
16913
17765
|
className: cn(
|
|
@@ -16917,12 +17769,12 @@ function Chat({
|
|
|
16917
17769
|
children: disclaimer.text
|
|
16918
17770
|
}
|
|
16919
17771
|
),
|
|
16920
|
-
/* @__PURE__ */
|
|
16921
|
-
/* @__PURE__ */
|
|
16922
|
-
/* @__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" })
|
|
16923
17775
|
] })
|
|
16924
17776
|
] }),
|
|
16925
|
-
/* @__PURE__ */
|
|
17777
|
+
/* @__PURE__ */ jsx54(
|
|
16926
17778
|
SettingsSheet,
|
|
16927
17779
|
{
|
|
16928
17780
|
open: petSettingsOpen,
|
|
@@ -16932,17 +17784,17 @@ function Chat({
|
|
|
16932
17784
|
onSave: savePetLocalSettings
|
|
16933
17785
|
}
|
|
16934
17786
|
),
|
|
16935
|
-
/* @__PURE__ */
|
|
17787
|
+
/* @__PURE__ */ jsx54(PetBridge, { pet: effectivePet, state: petAutoState })
|
|
16936
17788
|
]
|
|
16937
17789
|
}
|
|
16938
17790
|
);
|
|
16939
17791
|
}
|
|
16940
17792
|
|
|
16941
17793
|
// src/components/ui/separator.tsx
|
|
16942
|
-
import * as
|
|
16943
|
-
import { jsx as
|
|
16944
|
-
var Separator =
|
|
16945
|
-
({ 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(
|
|
16946
17798
|
"div",
|
|
16947
17799
|
{
|
|
16948
17800
|
ref,
|